[Android] Detect TSP, and hide tips for non touch devices

Geoffrey Métais git at videolan.org
Wed Nov 5 10:40:54 CET 2014


vlc-ports/android | branch: tv | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct 22 14:43:08 2014 +0200| [fccd51b2bf12534f97be78a295e39034941455f9] | committer: Geoffrey Métais

Detect TSP, and hide tips for non touch devices

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java           |    3 ++-
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java      |    2 +-
 vlc-android/src/org/videolan/vlc/util/AndroidDevices.java        |    6 ++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 69935c0..e333e8d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -42,6 +42,7 @@ import org.videolan.vlc.gui.video.VideoGridFragment;
 import org.videolan.vlc.gui.video.VideoListAdapter;
 import org.videolan.vlc.interfaces.IRefreshable;
 import org.videolan.vlc.interfaces.ISortable;
+import org.videolan.vlc.util.AndroidDevices;
 import org.videolan.vlc.util.Util;
 import org.videolan.vlc.util.VLCInstance;
 import org.videolan.vlc.util.WeakHandler;
@@ -1020,7 +1021,7 @@ public class MainActivity extends ActionBarActivity {
      * @param settingKey the setting key to check if the view must be displayed or not.
      */
     public void showTipViewIfNeeded(final int layoutId, final String settingKey) {
-        if (!mSettings.getBoolean(settingKey, false)) {
+        if (!mSettings.getBoolean(settingKey, false) && AndroidDevices.hasTsp()) {
             removeTipViewIfDisplayed();
             View v = LayoutInflater.from(this).inflate(layoutId, null);
             mRootContainer.addView(v,
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 686f6d8..f6e442a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -448,7 +448,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
                     : getScreenOrientation());
             // Tips
             mOverlayTips = findViewById(R.id.player_overlay_tips);
-            if(mSettings.getBoolean(PREF_TIPS_SHOWN, false) || getIntent().getBooleanExtra("tvDevice", false))
+            if(!AndroidDevices.hasTsp() || mSettings.getBoolean(PREF_TIPS_SHOWN, false))
                 mOverlayTips.setVisibility(View.GONE);
             else {
                 mOverlayTips.bringToFront();
diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index 88b7073..dbb7555 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -45,6 +45,7 @@ public class AndroidDevices {
     public final static String TAG = "VLC/Util/AndroidDevices";
 
     final static boolean hasNavBar;
+    final static boolean hasTsp;
 
     static {
         HashSet<String> devicesWithoutNavBar = new HashSet<String>();
@@ -54,6 +55,7 @@ public class AndroidDevices {
         devicesWithoutNavBar.add("HTC One XL");
         hasNavBar = LibVlcUtil.isJellyBeanMR1OrLater() || (LibVlcUtil.isICSOrLater()
                 && !devicesWithoutNavBar.contains(android.os.Build.MODEL));
+        hasTsp = VLCApplication.getAppContext().getPackageManager().hasSystemFeature("android.hardware.touchscreen");
     }
 
     public static boolean hasExternalStorage() {
@@ -81,6 +83,10 @@ public class AndroidDevices {
         }
     }
 
+    public static boolean hasTsp(){
+        return hasTsp;
+    }
+
     public static String[] getStorageDirectories() {
         String[] dirs = null;
         BufferedReader bufReader = null;



More information about the Android mailing list