Skip to content
Permalink
Browse files

front: Long-click gallery item to jump straight to game activity.

  • Loading branch information
littleguy77 committed Jun 7, 2015
1 parent 75a023d commit 18991b0c6a80eedb2cbc236e3de23a363bde9720
@@ -527,6 +527,12 @@ public void onGalleryItemClick( GalleryItem item )
mDrawerLayout.openDrawer( GravityCompat.START );
}

public boolean onGalleryItemLongClick( GalleryItem item )
{
launchGameActivity( item.romFile.getAbsolutePath(), item.md5, false );
return true;
}

@Override
public boolean onKeyDown( int keyCode, KeyEvent event )
{
@@ -34,6 +34,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -119,7 +120,8 @@ public int compare( GalleryItem item1, GalleryItem item2 )
}
}

public static class ViewHolder extends RecyclerView.ViewHolder implements OnClickListener
public static class ViewHolder extends RecyclerView.ViewHolder implements OnClickListener,
OnLongClickListener
{
public GalleryItem item;
private Context mContext;
@@ -129,6 +131,7 @@ public ViewHolder( Context context, View view )
super( view );
mContext = context;
view.setOnClickListener( this );
view.setOnLongClickListener( this );
}

@Override
@@ -146,6 +149,17 @@ public void onClick( View view )
activity.onGalleryItemClick( item );
}
}

@Override
public boolean onLongClick( View view )
{
if( mContext instanceof GalleryActivity )
{
GalleryActivity activity = (GalleryActivity) mContext;
return activity.onGalleryItemLongClick( item );
}
return false;
}
}

public static class Adapter extends RecyclerView.Adapter<ViewHolder>

0 comments on commit 18991b0

Please sign in to comment.
You can’t perform that action at this time.