Merge branch 'dev' into 1907renamePlaylist
This commit is contained in:
commit
b5ea61a079
|
@ -55,10 +55,7 @@ public final class BackgroundPlayerActivity extends ServicePlayerActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.player.setRecovery();
|
return switchTo(PopupVideoPlayer.class);
|
||||||
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
|
|
||||||
getApplicationContext().startService(getSwitchIntent(PopupVideoPlayer.class));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,8 @@ public abstract class BasePlayer implements
|
||||||
@NonNull
|
@NonNull
|
||||||
public static final String RESUME_PLAYBACK = "resume_playback";
|
public static final String RESUME_PLAYBACK = "resume_playback";
|
||||||
@NonNull
|
@NonNull
|
||||||
|
public static final String START_PAUSED = "start_paused";
|
||||||
|
@NonNull
|
||||||
public static final String SELECT_ON_APPEND = "select_on_append";
|
public static final String SELECT_ON_APPEND = "select_on_append";
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -304,7 +306,7 @@ public abstract class BasePlayer implements
|
||||||
}
|
}
|
||||||
// Good to go...
|
// Good to go...
|
||||||
initPlayback(queue, repeatMode, playbackSpeed, playbackPitch, playbackSkipSilence,
|
initPlayback(queue, repeatMode, playbackSpeed, playbackPitch, playbackSkipSilence,
|
||||||
/*playOnInit=*/true);
|
/*playOnInit=*/!intent.getBooleanExtra(START_PAUSED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initPlayback(@NonNull final PlayQueue queue,
|
protected void initPlayback(@NonNull final PlayQueue queue,
|
||||||
|
@ -944,10 +946,10 @@ public abstract class BasePlayer implements
|
||||||
public void onPlayPause() {
|
public void onPlayPause() {
|
||||||
if (DEBUG) Log.d(TAG, "onPlayPause() called");
|
if (DEBUG) Log.d(TAG, "onPlayPause() called");
|
||||||
|
|
||||||
if (!isPlaying()) {
|
if (isPlaying()) {
|
||||||
onPlay();
|
|
||||||
} else {
|
|
||||||
onPause();
|
onPause();
|
||||||
|
} else {
|
||||||
|
onPlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -614,7 +614,8 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
this.getPlaybackPitch(),
|
this.getPlaybackPitch(),
|
||||||
this.getPlaybackSkipSilence(),
|
this.getPlaybackSkipSilence(),
|
||||||
this.getPlaybackQuality(),
|
this.getPlaybackQuality(),
|
||||||
false
|
false,
|
||||||
|
!isPlaying()
|
||||||
);
|
);
|
||||||
context.startService(intent);
|
context.startService(intent);
|
||||||
|
|
||||||
|
@ -637,7 +638,8 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
this.getPlaybackPitch(),
|
this.getPlaybackPitch(),
|
||||||
this.getPlaybackSkipSilence(),
|
this.getPlaybackSkipSilence(),
|
||||||
this.getPlaybackQuality(),
|
this.getPlaybackQuality(),
|
||||||
false
|
false,
|
||||||
|
!isPlaying()
|
||||||
);
|
);
|
||||||
context.startService(intent);
|
context.startService(intent);
|
||||||
|
|
||||||
|
|
|
@ -567,7 +567,8 @@ public final class PopupVideoPlayer extends Service {
|
||||||
this.getPlaybackPitch(),
|
this.getPlaybackPitch(),
|
||||||
this.getPlaybackSkipSilence(),
|
this.getPlaybackSkipSilence(),
|
||||||
this.getPlaybackQuality(),
|
this.getPlaybackQuality(),
|
||||||
false
|
false,
|
||||||
|
!isPlaying()
|
||||||
);
|
);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
|
|
|
@ -48,10 +48,7 @@ public final class PopupVideoPlayerActivity extends ServicePlayerActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPlayerOptionSelected(MenuItem item) {
|
public boolean onPlayerOptionSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.action_switch_background) {
|
if (item.getItemId() == R.id.action_switch_background) {
|
||||||
this.player.setRecovery();
|
return switchTo(BackgroundPlayer.class);
|
||||||
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
|
|
||||||
getApplicationContext().startService(getSwitchIntent(BackgroundPlayer.class));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,10 +161,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
|
startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_switch_main:
|
case R.id.action_switch_main:
|
||||||
this.player.setRecovery();
|
return switchTo(MainVideoPlayer.class);
|
||||||
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
|
|
||||||
getApplicationContext().startActivity(getSwitchIntent(MainVideoPlayer.class));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return onPlayerOptionSelected(item) || super.onOptionsItemSelected(item);
|
return onPlayerOptionSelected(item) || super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
@ -185,8 +182,17 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
this.player.getPlaybackPitch(),
|
this.player.getPlaybackPitch(),
|
||||||
this.player.getPlaybackSkipSilence(),
|
this.player.getPlaybackSkipSilence(),
|
||||||
null,
|
null,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
).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;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -109,12 +109,14 @@ public class NavigationHelper {
|
||||||
final float playbackPitch,
|
final float playbackPitch,
|
||||||
final boolean playbackSkipSilence,
|
final boolean playbackSkipSilence,
|
||||||
@Nullable final String playbackQuality,
|
@Nullable final String playbackQuality,
|
||||||
final boolean resumePlayback) {
|
final boolean resumePlayback,
|
||||||
|
final boolean startPaused) {
|
||||||
return getPlayerIntent(context, targetClazz, playQueue, playbackQuality, resumePlayback)
|
return getPlayerIntent(context, targetClazz, playQueue, playbackQuality, resumePlayback)
|
||||||
.putExtra(BasePlayer.REPEAT_MODE, repeatMode)
|
.putExtra(BasePlayer.REPEAT_MODE, repeatMode)
|
||||||
.putExtra(BasePlayer.PLAYBACK_SPEED, playbackSpeed)
|
.putExtra(BasePlayer.PLAYBACK_SPEED, playbackSpeed)
|
||||||
.putExtra(BasePlayer.PLAYBACK_PITCH, playbackPitch)
|
.putExtra(BasePlayer.PLAYBACK_PITCH, playbackPitch)
|
||||||
.putExtra(BasePlayer.PLAYBACK_SKIP_SILENCE, playbackSkipSilence);
|
.putExtra(BasePlayer.PLAYBACK_SKIP_SILENCE, playbackSkipSilence)
|
||||||
|
.putExtra(BasePlayer.START_PAUSED, startPaused);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playOnMainPlayer(final Context context, final PlayQueue queue, final boolean resumePlayback) {
|
public static void playOnMainPlayer(final Context context, final PlayQueue queue, final boolean resumePlayback) {
|
||||||
|
|
Loading…
Reference in New Issue