Variable cannot be final

This commit is contained in:
Martin Fietz 2018-01-14 18:42:26 +01:00
parent b38d016ec3
commit e56e3868da
1 changed files with 9 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.WindowCompat;
import android.support.v7.app.ActionBar;
import android.util.Log;
import android.util.Pair;
import android.view.MotionEvent;
@ -353,20 +354,23 @@ public class VideoplayerActivity extends MediaplayerActivity {
private static final int DELAY = 2500;
private final WeakReference<VideoplayerActivity> activity;
private WeakReference<VideoplayerActivity> activity;
public VideoControlsHider(VideoplayerActivity activity) {
VideoControlsHider(VideoplayerActivity activity) {
this.activity = new WeakReference<>(activity);
}
private final Runnable hideVideoControls = () -> {
VideoplayerActivity vpa = activity.get();
VideoplayerActivity vpa = activity != null ? activity.get() : null;
if(vpa == null) {
return;
}
if (vpa.videoControlsShowing) {
Log.d(TAG, "Hiding video controls");
vpa.getSupportActionBar().hide();
ActionBar actionBar = vpa.getSupportActionBar();
if(actionBar != null) {
actionBar.hide();
}
vpa.hideVideoControls();
vpa.videoControlsShowing = false;
}
@ -376,7 +380,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
this.postDelayed(hideVideoControls, DELAY);
}
public void stop() {
void stop() {
this.removeCallbacks(hideVideoControls);
}