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

Jean-Baptiste Kempf jb at videolan.org
Wed Oct 22 14:55:22 CEST 2014


LGTM.

On 22 Oct, Geoffrey Métais wrote :
> ---
>  vlc-android/src/org/videolan/vlc/gui/MainActivity.java              | 3 ++-
>  vlc-android/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 c8df820..8c8e222 100644
> --- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
> +++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
> @@ -447,7 +447,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;
> -- 
> 1.9.1
> 
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the Android mailing list