[Android] Extract TV UI check to prevent race condition
Geoffrey Métais
git at videolan.org
Thu Aug 25 14:48:53 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 25 13:59:36 2016 +0200| [0484d7b0100bd6998011ec366386e23ff3305bde] | committer: Geoffrey Métais
Extract TV UI check to prevent race condition
> https://code.videolan.org/videolan/vlc-android/commit/0484d7b0100bd6998011ec366386e23ff3305bde
---
vlc-android/src/org/videolan/vlc/StartActivity.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index 99f9d2b..f6ab079 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -29,6 +29,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
+import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
@@ -63,12 +64,17 @@ public class StartActivity extends Activity {
else
MediaUtils.openMediaNoUi(intent.getData());
} else if (intent != null && TextUtils.equals(intent.getAction(), AudioPlayerContainerActivity.ACTION_SHOW_PLAYER)) {
- startActivity(new Intent(this, VLCApplication.showTvUi() ? AudioPlayerActivity.class : MainActivity.class));
+ startActivity(new Intent(this, showTvUi() ? AudioPlayerActivity.class : MainActivity.class));
} else
- startActivity(new Intent(this, VLCApplication.showTvUi() ? MainTvActivity.class : MainActivity.class));
+ startActivity(new Intent(this, showTvUi() ? MainTvActivity.class : MainActivity.class));
finish();
}
+ private boolean showTvUi() {
+ return AndroidUtil.isJellyBeanMR1OrLater() && (AndroidDevices.isAndroidTv() || !AndroidDevices.hasTsp() ||
+ PreferenceManager.getDefaultSharedPreferences(this).getBoolean("tv_ui", false));
+ }
+
private Uri getUri(Intent intent) {
Uri mUri = null, data = intent.getData();
if (data != null && TextUtils.equals(data.getScheme(), "content")) {
More information about the Android
mailing list