fixing duplicate controlelrs

This commit is contained in:
dhk2 2020-06-30 14:56:01 -07:00
parent f942e27536
commit 03a196c491
2 changed files with 14 additions and 2 deletions

View File

@ -61,7 +61,7 @@ import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
public class VideoPlayActivity extends AppCompatActivity {
private static final String TAG = "VideoPlayActivity";
private static boolean floatMode = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -112,6 +112,12 @@ public class VideoPlayActivity extends AppCompatActivity {
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
assert videoPlayerFragment != null;
Boolean killFloat=intent.getBooleanExtra("killFloat",false);
Log.e(TAG,killFloat.toString()+" "+floatMode);
if (killFloat && floatMode){
finish();
return;
}
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
Log.v(TAG, "new intent click: " + videoUuid +" is trying to replace: "+videoPlayerFragment.getVideoUuid());
assert videoPlayerFragment != null;
@ -355,8 +361,10 @@ public class VideoPlayActivity extends AppCompatActivity {
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
if (isInPictureInPictureMode) {
Log.v(TAG,"switched to pip ");
floatMode=true;
} else {
Log.v(TAG,"switched to normal");
floatMode=false;
}
}
}

View File

@ -239,6 +239,7 @@ public class VideoPlayerService extends Service {
// don't show skip buttons in notification
playerNotificationManager.setUseNavigationActions(false);
playerNotificationManager.setUseStopAction(true);
playerNotificationManager.setNotificationListener(
new PlayerNotificationManager.NotificationListener() {
@ -250,7 +251,10 @@ public class VideoPlayerService extends Service {
@Override
public void onNotificationCancelled(int notificationId) {
Log.v(TAG, "onNotificationCancelled...");
Intent killFloatingWindow = new Intent(getApplicationContext(),VideoPlayActivity.class);
killFloatingWindow.putExtra("killFloat",true);
killFloatingWindow.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(killFloatingWindow);
// TODO: only kill the notification if we no longer have a bound activity
stopForeground(true);
}