Skip to content
Snippets Groups Projects
Commit f0926eee authored by Chegou Junior KEITA's avatar Chegou Junior KEITA Committed by Geoffrey Métais
Browse files

Focus on item in main video screen


Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
parent fda3c813
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.text.Html;
import android.text.TextUtils;
import android.util.DisplayMetrics;
......@@ -55,6 +56,9 @@ import java.util.concurrent.atomic.AtomicInteger;
public class UiTools {
public static final int ITEM_FOCUS_ON = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.orange800);
public static final int ITEM_FOCUS_OFF = ContextCompat.getColor(VLCApplication.getAppContext(), R.color.transparent);
private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1);
private static final Handler sHandler = new Handler(Looper.getMainLooper());
......
......@@ -37,6 +37,7 @@ import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.gui.SecondaryActivity;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.media.MediaGroup;
import org.videolan.vlc.media.MediaWrapper;
import org.videolan.vlc.util.Strings;
......@@ -294,7 +295,7 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
return super.getItemViewType(position);
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener {
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnFocusChangeListener {
boolean listmode;
public ViewDataBinding binding;
......@@ -304,6 +305,7 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
this.listmode = listMode;
binding.setVariable(BR.holder, this);
itemView.setOnLongClickListener(this);
itemView.setOnFocusChangeListener(this);
}
public void onClick(View v){
......@@ -330,5 +332,13 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
mFragment.mGridView.openContextMenu(getLayoutPosition());
return true;
}
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus)
itemView.setBackgroundColor(UiTools.ITEM_FOCUS_ON);
else
itemView.setBackgroundColor(UiTools.ITEM_FOCUS_OFF);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment