[Android] Hide sleep setting on non TSP devices

Geoffrey Métais git at videolan.org
Fri Jan 23 17:10:41 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 23 12:37:07 2015 +0100| [5bc5d0ab7409b064549ed4367a2b797bb38f28e5] | committer: Geoffrey Métais

Hide sleep setting on non TSP devices

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=5bc5d0ab7409b064549ed4367a2b797bb38f28e5
---

 vlc-android/res/layout/fragment_advanced_options.xml      |    1 +
 .../src/org/videolan/vlc/gui/video/AdvOptionsDialog.java  |   13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/vlc-android/res/layout/fragment_advanced_options.xml b/vlc-android/res/layout/fragment_advanced_options.xml
index ca4477b..406d42c 100644
--- a/vlc-android/res/layout/fragment_advanced_options.xml
+++ b/vlc-android/res/layout/fragment_advanced_options.xml
@@ -113,6 +113,7 @@
     <!-- Sleep Timer -->
 
     <LinearLayout
+        android:id="@+id/sleep_timer_container"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="10dp"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/video/AdvOptionsDialog.java
index d7122aa..7771fc9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/AdvOptionsDialog.java
@@ -44,6 +44,7 @@ import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.PickTimeFragment;
 import org.videolan.vlc.gui.TimePickerDialogFragment;
+import org.videolan.vlc.util.AndroidDevices;
 import org.videolan.vlc.util.Strings;
 
 import java.util.Calendar;
@@ -104,10 +105,14 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
         mSleepTime = (TextView) root.findViewById(R.id.sleep_timer_value);
         mSleepCancel = (TextView) root.findViewById(R.id.sleep_timer_cancel);
 
-        mSleepIcon.setOnClickListener(this);
-        mSleepTitle.setOnClickListener(this);
-        mSleepTime.setOnClickListener(this);
-        mSleepCancel.setOnClickListener(this);
+        if (AndroidDevices.hasTsp()) {
+            mSleepIcon.setOnClickListener(this);
+            mSleepTitle.setOnClickListener(this);
+            mSleepTime.setOnClickListener(this);
+            mSleepCancel.setOnClickListener(this);
+        } else {
+            root.findViewById(R.id.sleep_timer_container).setVisibility(View.GONE);
+        }
 
         mJumpIcon = (ImageView) root.findViewById(R.id.jump_icon);
         mJumpTitle = (TextView) root.findViewById(R.id.jump_title);



More information about the Android mailing list