[Android] Remove 'tv' boolean

Geoffrey Métais git at videolan.org
Thu Jan 21 15:10:25 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 21 10:10:21 2016 +0100| [525dff475ac485b1216d1cf814e49b0cd265947c] | committer: Geoffrey Métais

Remove 'tv' boolean

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

 vlc-android/build.gradle                                       |  3 ---
 .../src/org/videolan/vlc/RemoteControlClientReceiver.java      |  4 +++-
 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java |  5 +++--
 vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java |  3 ++-
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java    | 10 +++++-----
 5 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 74040be..ba3163d 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -83,19 +83,16 @@ android {
         vanilla {
             dimension "target"
             versionCode = 0
-            buildConfigField "boolean", "tv", "false"
         }
         tv {
             minSdkVersion 17
             dimension "target"
             versionCode = 1
-            buildConfigField "boolean", "tv", "true"
         }
         chrome {
             minSdkVersion 19
             dimension "target"
             versionCode = 2
-            buildConfigField "boolean", "tv", "false"
         }
         ARMv5 {
             dimension "abi"
diff --git a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
index 5fb8e93..6b67709 100644
--- a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
+++ b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
@@ -25,6 +25,8 @@ import android.content.Intent;
 import android.os.SystemClock;
 import android.view.KeyEvent;
 
+import org.videolan.vlc.util.AndroidDevices;
+
 /**
  * Small class to receive events passed out by the remote controls (wired, bluetooth, lock screen, ...)
  */
@@ -68,7 +70,7 @@ public class RemoteControlClientReceiver extends BroadcastReceiver {
                                 mHeadsetDownTime = time;
                             break;
                         case KeyEvent.ACTION_UP:
-                            if (!BuildConfig.tv) { //no backward/forward on TV
+                            if (!AndroidDevices.hasTsp()) { //no backward/forward on TV
                                 if (time - mHeadsetDownTime >= 1000) { // long click
                                     i = new Intent(PlaybackService.ACTION_REMOTE_BACKWARD);
                                     time = 0;
diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index f3f38f2..86bdc1e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -47,6 +47,7 @@ import com.android.widget.SlidingPaneLayout;
 import org.videolan.vlc.BuildConfig;
 import org.videolan.vlc.PlaybackService;
 import org.videolan.vlc.R;
+import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.audio.AudioPlayer;
 import org.videolan.vlc.gui.browser.MediaBrowserFragment;
 import org.videolan.vlc.gui.helpers.UiTools;
@@ -147,7 +148,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
 
     private void applyTheme() {
         boolean enableBlackTheme = mSettings.getBoolean("enable_black_theme", false);
-        if (BuildConfig.tv || enableBlackTheme) {
+        if (VLCApplication.showTvUi() || enableBlackTheme) {
             setTheme(R.style.Theme_VLC_Black);
         }
     }
@@ -181,7 +182,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
     public void showTipViewIfNeeded(final int layoutId, final String settingKey) {
         if (BuildConfig.DEBUG)
             return;
-        if (!mSettings.getBoolean(settingKey, false) && !BuildConfig.tv) {
+        if (!mSettings.getBoolean(settingKey, false) && !VLCApplication.showTvUi()) {
             removeTipViewIfDisplayed();
             View v = LayoutInflater.from(this).inflate(layoutId, null);
             ViewGroup root = (ViewGroup) findViewById(R.id.pane).getParent();
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java b/vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java
index c6cfb14..5d7b31b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java
@@ -37,6 +37,7 @@ import android.widget.Toast;
 import org.videolan.libvlc.util.HWDecoderUtil;
 import org.videolan.vlc.BuildConfig;
 import org.videolan.vlc.R;
+import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.helpers.AudioUtil;
 import org.videolan.vlc.gui.helpers.BitmapCache;
 import org.videolan.vlc.gui.helpers.UiTools;
@@ -162,7 +163,7 @@ public class Advanced extends BasePreferenceFragment implements SharedPreference
                 BitmapCache.getInstance().clear();
                 AudioUtil.clearCacheFolders();
                 getActivity().setResult(PreferencesActivity.RESULT_RESCAN);
-                if (BuildConfig.tv)
+                if (VLCApplication.showTvUi())
                     Toast.makeText(getActivity(), R.string.media_db_cleared, Toast.LENGTH_SHORT).show();
                 else
                     UiTools.snacker(getView(), R.string.media_db_cleared);
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 63155b7..e56b12a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -480,7 +480,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                     : getScreenOrientation());
             // Tips
             mOverlayTips = findViewById(R.id.player_overlay_tips);
-            if(BuildConfig.DEBUG || BuildConfig.tv || mSettings.getBoolean(PREF_TIPS_SHOWN, false))
+            if(BuildConfig.DEBUG || VLCApplication.showTvUi() || mSettings.getBoolean(PREF_TIPS_SHOWN, false))
                 mOverlayTips.setVisibility(View.GONE);
             else {
                 mOverlayTips.bringToFront();
@@ -569,7 +569,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         /* Stop the earliest possible to avoid vout error */
         if (isFinishing())
             stopPlayback();
-        else if (BuildConfig.tv && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !requestVisibleBehind(true))
+        else if (AndroidDevices.isAndroidTv() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !requestVisibleBehind(true))
             stopPlayback();
     }
 
@@ -1013,12 +1013,12 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
         if (System.currentTimeMillis() - mLastMove > JOYSTICK_INPUT_DELAY){
             if (Math.abs(x) > 0.3){
-                if (BuildConfig.tv) {
+                if (VLCApplication.showTvUi()) {
                     navigateDvdMenu(x > 0.0f ? KeyEvent.KEYCODE_DPAD_RIGHT : KeyEvent.KEYCODE_DPAD_LEFT);
                 } else
                     seekDelta(x > 0.0f ? 10000 : -10000);
             } else if (Math.abs(y) > 0.3){
-                if (BuildConfig.tv)
+                if (VLCApplication.showTvUi())
                     navigateDvdMenu(x > 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN);
                 else {
                     if (mIsFirstBrightnessGesture)
@@ -1046,7 +1046,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             togglePlaylist();
         } else if (mDelay != DelayState.OFF){
             endDelaySetting();
-        } else if (BuildConfig.tv && mShowing && !mIsLocked) {
+        } else if (VLCApplication.showTvUi() && mShowing && !mIsLocked) {
             hideOverlay(true);
         } else {
             exitOK();



More information about the Android mailing list