[Android] TV: Fix directories selection
Geoffrey Métais
git at videolan.org
Mon May 30 18:09:49 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 30 18:09:21 2016 +0200| [988f897da7c0ebece1c461f521d6e3b833b64b59] | committer: Geoffrey Métais
TV: Fix directories selection
> https://code.videolan.org/videolan/vlc-android/commit/988f897da7c0ebece1c461f521d6e3b833b64b59
---
vlc-android/res/layout/directory_view_item.xml | 3 ++-
.../org/videolan/vlc/gui/browser/BaseBrowserAdapter.java | 7 +++++++
.../videolan/vlc/gui/browser/StorageBrowserFragment.java | 14 +++++++++++++-
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/vlc-android/res/layout/directory_view_item.xml b/vlc-android/res/layout/directory_view_item.xml
index c71db83..0f92df6 100644
--- a/vlc-android/res/layout/directory_view_item.xml
+++ b/vlc-android/res/layout/directory_view_item.xml
@@ -38,7 +38,7 @@
android:orientation="horizontal"
android:focusable="true"
android:clickable="@{holder != null}"
- android:longClickable="@{hasContextMenu}"
+ android:longClickable="@{hasContextMenu || storage != null}"
android:onClick="@{holder.onClick}"
android:background="@drawable/background_item">
@@ -49,6 +49,7 @@
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:visibility="@{type == 2 ? View.VISIBLE : View.GONE}"
+ android:focusable="false"
android:enabled="@{checkEnabled}"
android:checked="@{checked}"
android:onClick="@{holder.onCheckBoxClick}"/>
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index c7dad55..0a6c8e8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -140,6 +140,13 @@ public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
binding.setHolder(this);
v.findViewById(R.id.layout_item).setTag(R.id.layout_item, this);
v.setTag(binding);
+ v.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ binding.browserCheckbox.toggle();
+ return true;
+ }
+ });
}
public void setContextMenuListener() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
index f45e5ae..ef770fc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
@@ -36,8 +36,9 @@ import android.view.View;
import android.view.ViewGroup;
import org.videolan.libvlc.Media;
-import org.videolan.vlc.media.MediaWrapper;
import org.videolan.vlc.R;
+import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.media.MediaWrapper;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.CustomDirectories;
@@ -83,6 +84,17 @@ public class StorageBrowserFragment extends FileBrowserFragment {
}
@Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ if (VLCApplication.showTvUi()) {
+ if (mRoot)
+ mFAB.requestFocus();
+ else
+ mRecyclerView.requestFocus();
+ }
+ }
+
+ @Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(KEY_IN_MEDIALIB, mScannedDirectory);
More information about the Android
mailing list