[Android] Add a 'Home' button in subtitles picker

Geoffrey Métais git at videolan.org
Mon Jun 26 17:44:49 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jun 26 17:44:22 2017 +0200| [a3a49f1c32f6f63328f4487f44fbc7e848c8fb06] | committer: Geoffrey Métais

Add a 'Home' button in subtitles picker

> https://code.videolan.org/videolan/vlc-android/commit/a3a49f1c32f6f63328f4487f44fbc7e848c8fb06
---

 vlc-android/res/layout/file_picker_activity.xml           | 15 ++++++++++++---
 .../org/videolan/vlc/gui/browser/FilePickerActivity.java  |  6 ++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/layout/file_picker_activity.xml b/vlc-android/res/layout/file_picker_activity.xml
index 33deb98db..ca9549db5 100644
--- a/vlc-android/res/layout/file_picker_activity.xml
+++ b/vlc-android/res/layout/file_picker_activity.xml
@@ -1,12 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:orientation="vertical" android:layout_width="@dimen/file_picker_width"
     android:layout_height="@dimen/file_picker_height">
-
+    <ImageView
+        android:id="@+id/button_home"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:layout_gravity="center_horizontal"
+        android:contentDescription="@string/directories"
+        android:onClick="onHomeClick"
+        tools:targetApi="11"
+        style="?android:attr/borderlessButtonStyle"
+        android:src="@drawable/icon"/>
     <FrameLayout
         android:id="@+id/fragment_placeholder"
         android:layout_width="match_parent"
         android:layout_height="match_parent"/>
-
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.java b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.java
index a766bdfd4..02c42b34d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.java
@@ -26,6 +26,7 @@ package org.videolan.vlc.gui.browser;
 import android.os.Bundle;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v7.app.AppCompatActivity;
+import android.view.View;
 
 import org.videolan.vlc.R;
 
@@ -49,4 +50,9 @@ public class FilePickerActivity extends AppCompatActivity {
             ((FilePickerFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder)).browseUp();
         }
     }
+
+    public void onHomeClick(View v) {
+        ((FilePickerFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder)).browseRoot();
+        setTitle(R.string.directories);
+    }
 }



More information about the Android mailing list