[Android] Make snackbar hint permanent on TV

Geoffrey Métais git at videolan.org
Thu Aug 31 14:08:40 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 31 13:51:28 2017 +0200| [b4b4becdae7f6eba6ccd08d1bb42f563743d0ec6] | committer: Geoffrey Métais

Make snackbar hint permanent on TV

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

 .../src/org/videolan/vlc/gui/SecondaryActivity.java        |  2 --
 .../videolan/vlc/gui/browser/StorageBrowserFragment.java   | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
index 6cc8b3856..7f326881a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
@@ -85,8 +85,6 @@ public class SecondaryActivity extends ContentActivity {
             getSupportFragmentManager().beginTransaction()
             .add(R.id.fragment_placeholder, mFragment)
             .commit();
-            if (VLCApplication.showTvUi() && STORAGE_BROWSER.equals(fragmentId))
-                Snackbar.make(getWindow().getDecorView(), R.string.tv_settings_hint, Snackbar.LENGTH_LONG).show();
         }
     }
 
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 03fbd5fd1..19817dbb0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
@@ -26,6 +26,8 @@ package org.videolan.vlc.gui.browser;
 import android.databinding.DataBindingUtil;
 import android.net.Uri;
 import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.design.widget.Snackbar;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v4.util.SimpleArrayMap;
@@ -56,6 +58,7 @@ public class StorageBrowserFragment extends FileBrowserFragment implements Entry
 
     boolean mScannedDirectory = false;
     SimpleArrayMap<String, CheckBox> mProcessingFolders = new SimpleArrayMap<>();
+    private Snackbar mSnack;
 
     public boolean isSortEnabled() {
         return false;
@@ -79,6 +82,13 @@ public class StorageBrowserFragment extends FileBrowserFragment implements Entry
     }
 
     @Override
+    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        if (mRoot && VLCApplication.showTvUi())
+            mSnack = Snackbar.make(view, R.string.tv_settings_hint, Snackbar.LENGTH_INDEFINITE);
+    }
+
+    @Override
     public void onStart() {
         super.onStart();
         if (mRoot && mFabPlay != null) {
@@ -87,6 +97,8 @@ public class StorageBrowserFragment extends FileBrowserFragment implements Entry
             setFabPlayVisibility(true);
         }
         VLCApplication.getMLInstance().addEntryPointsEventsCb(this);
+        if (mSnack != null)
+            mSnack.show();
     }
 
     @Override
@@ -97,6 +109,8 @@ public class StorageBrowserFragment extends FileBrowserFragment implements Entry
             mFabPlay.setOnClickListener(null);
         }
         VLCApplication.getMLInstance().removeEntryPointsEventsCb(this);
+        if (mSnack != null)
+            mSnack.dismiss();
     }
 
     @Override



More information about the Android mailing list