1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Fix regression: Unable to find explicit activity class

See https://github.com/TeamNewPipe/NewPipe/issues/3114#issuecomment-589940878 for info on this crash.
This reverts ef90493c27 partly.
This commit is contained in:
TobiGr 2020-02-22 20:43:38 +01:00
parent 5b98d41637
commit 0bc769b971
3 changed files with 22 additions and 11 deletions

View File

@ -55,7 +55,13 @@ public final class BackgroundPlayerActivity extends ServicePlayerActivity {
return true;
}
return switchTo(PopupVideoPlayer.class);
this.player.setRecovery();
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
getApplicationContext().startService(
getSwitchIntent(PopupVideoPlayer.class)
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying())
);
return true;
}
return false;
}

View File

@ -48,7 +48,13 @@ public final class PopupVideoPlayerActivity extends ServicePlayerActivity {
@Override
public boolean onPlayerOptionSelected(MenuItem item) {
if (item.getItemId() == R.id.action_switch_background) {
return switchTo(BackgroundPlayer.class);
this.player.setRecovery();
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
getApplicationContext().startService(
getSwitchIntent(BackgroundPlayer.class)
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying())
);
return true;
}
return false;
}

View File

@ -166,7 +166,13 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
return true;
case R.id.action_switch_main:
return switchTo(MainVideoPlayer.class);
this.player.setRecovery();
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
getApplicationContext().startActivity(
getSwitchIntent(MainVideoPlayer.class)
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying())
);
return true;
}
return onPlayerOptionSelected(item) || super.onOptionsItemSelected(item);
}
@ -190,14 +196,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
false,
false
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying());
}
protected boolean switchTo(final Class clazz) {
this.player.setRecovery();
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
getApplicationContext().startActivity(getSwitchIntent(clazz));
return true;
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying());
}
////////////////////////////////////////////////////////////////////////////