[Android] Use a close icon for the activity when browsing files

Nicolas Pomepuy git at videolan.org
Tue Nov 3 15:47:10 CET 2020


vlc-android | branch: 3.3.x | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Oct 26 15:54:58 2020 +0100| [8814f95e8c35d71fcf8f8bc190048cbbb0c1afc7] | committer: Nicolas Pomepuy

Use a close icon for the activity when browsing files

Fixes #1519

(cherry picked from commit fce53ead6803576780144a267160b4ee3aa1f182)

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

 application/resources/src/main/res/drawable/ic_close_up.xml      | 9 +++++++++
 .../src/org/videolan/vlc/gui/browser/FileBrowserFragment.kt      | 7 +++++++
 .../src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.kt   | 3 +++
 3 files changed, 19 insertions(+)

diff --git a/application/resources/src/main/res/drawable/ic_close_up.xml b/application/resources/src/main/res/drawable/ic_close_up.xml
new file mode 100644
index 000000000..dfe2f6ac4
--- /dev/null
+++ b/application/resources/src/main/res/drawable/ic_close_up.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+            android:fillColor="?attr/colorControlNormal"
+            android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
+</vector>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.kt
index 587619b7f..8f1f64cca 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.kt
@@ -28,6 +28,7 @@ import android.os.Bundle
 import android.view.Menu
 import android.view.MenuInflater
 import android.view.View
+import androidx.appcompat.app.AppCompatActivity
 import androidx.core.net.toUri
 import androidx.fragment.app.Fragment
 import androidx.lifecycle.lifecycleScope
@@ -42,6 +43,7 @@ import org.videolan.resources.CTX_FAV_ADD
 import org.videolan.tools.removeFileProtocole
 import org.videolan.vlc.ExternalMonitor
 import org.videolan.vlc.R
+import org.videolan.vlc.gui.SecondaryActivity
 import org.videolan.vlc.gui.helpers.MedialibraryUtils
 import org.videolan.vlc.gui.helpers.hf.OtgAccess
 import org.videolan.vlc.gui.helpers.hf.requestOtgRoot
@@ -62,6 +64,11 @@ open class FileBrowserFragment : BaseBrowserFragment() {
         return FileBrowserFragment()
     }
 
+    override fun onActivityCreated(savedInstanceState: Bundle?) {
+        super.onActivityCreated(savedInstanceState)
+        (requireActivity() as? SecondaryActivity)?.supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_close_up)
+    }
+
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
         super.onViewCreated(view, savedInstanceState)
         setupBrowser()
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.kt
index 131ce1dec..4c1481e40 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.kt
@@ -27,6 +27,7 @@ import android.os.Bundle
 import android.view.Menu
 import android.view.MenuInflater
 import android.view.View
+import androidx.appcompat.app.AppCompatActivity
 import androidx.core.net.toUri
 import androidx.lifecycle.lifecycleScope
 import com.google.android.material.snackbar.Snackbar
@@ -38,6 +39,7 @@ import org.videolan.medialibrary.interfaces.media.MediaWrapper
 import org.videolan.resources.CTX_FAV_ADD
 import org.videolan.tools.NetworkMonitor
 import org.videolan.vlc.R
+import org.videolan.vlc.gui.SecondaryActivity
 import org.videolan.vlc.gui.view.EmptyLoadingState
 import org.videolan.vlc.util.DialogDelegate
 import org.videolan.vlc.util.IDialogManager
@@ -61,6 +63,7 @@ class NetworkBrowserFragment : BaseBrowserFragment(), IDialogManager {
         super.onCreate(bundle)
         dialogsDelegate.observeDialogs(this, this)
         networkMonitor = NetworkMonitor.getInstance(requireContext())
+        (requireActivity() as? SecondaryActivity)?.supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_close_up)
     }
 
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {



More information about the Android mailing list