[Android] Fix crash on few 4.0/4.1 devices.
Thomas Guillem
git at videolan.org
Fri Oct 17 10:39:10 CEST 2014
vlc-ports/android | branch: master | Thomas Guillem <tom at gllm.fr> | Fri Oct 17 10:28:38 2014 +0200| [ddc398fc2787d9a6ae317f46b12fc6db124449ef] | committer: Jean-Baptiste Kempf
Fix crash on few 4.0/4.1 devices.
Never trust android.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ddc398fc2787d9a6ae317f46b12fc6db124449ef
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
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..61c1493 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -320,6 +320,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
}
});
mTitle = (TextView) view.findViewById(R.id.player_overlay_title);
+ mOverlayHeader = mSysTime = mBattery = null;
} else {
mOverlayHeader = findViewById(R.id.player_overlay_header);
/* header */
@@ -676,7 +677,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
{
String action = intent.getAction();
if (action.equalsIgnoreCase(Intent.ACTION_BATTERY_CHANGED)) {
- if (mOverlayUseStatusBar)
+ if (mBattery == null)
return;
int batteryLevel = intent.getIntExtra("level", 0);
if (batteryLevel >= 50)
@@ -1811,7 +1812,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
if (!mIsLocked) {
if (mOverlayUseStatusBar)
setActionBarVisibility(true);
- else
+ else if (mOverlayHeader != null)
mOverlayHeader.setVisibility(View.VISIBLE);
mOverlayOption.setVisibility(View.VISIBLE);
mPlayPause.setVisibility(View.VISIBLE);
@@ -1839,7 +1840,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
Log.i(TAG, "remove View!");
if (mOverlayTips != null) mOverlayTips.setVisibility(View.INVISIBLE);
if (!fromUser && !mIsLocked) {
- if (!mOverlayUseStatusBar)
+ if (mOverlayHeader != null)
mOverlayHeader.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
mOverlayOption.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
mOverlayProgress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
@@ -1852,7 +1853,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
}
if (mOverlayUseStatusBar)
setActionBarVisibility(false);
- else
+ else if (mOverlayHeader != null)
mOverlayHeader.setVisibility(View.INVISIBLE);
mOverlayOption.setVisibility(View.INVISIBLE);
mOverlayProgress.setVisibility(View.INVISIBLE);
@@ -1931,7 +1932,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
mForward.setVisibility(isSeekable ? View.VISIBLE : View.GONE);
mSeekbar.setMax(length);
mSeekbar.setProgress(time);
- if (!mOverlayUseStatusBar)
+ if (mSysTime != null)
mSysTime.setText(DateFormat.getTimeFormat(this).format(new Date(System.currentTimeMillis())));
if (time >= 0) mTime.setText(Strings.millisToString(time));
if (length >= 0) mLength.setText(mDisplayRemainingTime && length > 0
More information about the Android
mailing list