mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Make back button pause player instead of quitting app
PiperOrigin-RevId: 700282443
This commit is contained in:
parent
f257e5511f
commit
e357629400
@ -191,6 +191,18 @@ public final class CompositionPreviewActivity extends AppCompatActivity {
|
|||||||
exportStopwatch.reset();
|
exportStopwatch.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("MissingSuperCall")
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (compositionPlayer != null) {
|
||||||
|
compositionPlayer.pause();
|
||||||
|
}
|
||||||
|
if (exportStopwatch.isRunning()) {
|
||||||
|
cancelExport();
|
||||||
|
exportStopwatch.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Composition prepareComposition() {
|
private Composition prepareComposition() {
|
||||||
String[] presetUris = getResources().getStringArray(/* id= */ R.array.preset_uris);
|
String[] presetUris = getResources().getStringArray(/* id= */ R.array.preset_uris);
|
||||||
int[] presetDurationsUs = getResources().getIntArray(/* id= */ R.array.preset_durations);
|
int[] presetDurationsUs = getResources().getIntArray(/* id= */ R.array.preset_durations);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user