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

Geoffrey Métais git at videolan.org
Thu Oct 23 10:48:46 CEST 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct 22 14:43:08 2014 +0200| [1804eec18c9408af15c07a1fcfb17315bf85f146] | 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=1804eec18c9408af15c07a1fcfb17315bf85f146
---

 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 af8cad4..c8d830d 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 382898e..d80b92d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -451,7 +451,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
                     : getScreenOrientation());
             // Tips
             mOverlayTips = findViewById(R.id.player_overlay_tips);
-            if(mSettings.getBoolean(PREF_TIPS_SHOWN, 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