mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Simplify non-main demo apps to not care about multi-window
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=173528055
This commit is contained in:
parent
3602a9a7e4
commit
cf38900d20
1 changed files with 3 additions and 35 deletions
|
|
@ -30,7 +30,6 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
|
|||
import com.google.android.exoplayer2.ext.cast.CastPlayer;
|
||||
import com.google.android.exoplayer2.ui.PlaybackControlView;
|
||||
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory;
|
||||
|
||||
/**
|
||||
|
|
@ -69,36 +68,17 @@ public class MainActivity extends AppCompatActivity {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (Util.SDK_INT > 23) {
|
||||
setupPlayerManager();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if ((Util.SDK_INT <= 23)) {
|
||||
setupPlayerManager();
|
||||
}
|
||||
playerManager = new PlayerManager(simpleExoPlayerView, castControlView, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (Util.SDK_INT <= 23) {
|
||||
releasePlayerManager();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (Util.SDK_INT > 23) {
|
||||
releasePlayerManager();
|
||||
}
|
||||
playerManager.release();
|
||||
playerManager = null;
|
||||
}
|
||||
|
||||
// Activity input.
|
||||
|
|
@ -109,18 +89,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
return super.dispatchKeyEvent(event) || playerManager.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
// Internal methods.
|
||||
|
||||
private void setupPlayerManager() {
|
||||
playerManager = new PlayerManager(simpleExoPlayerView, castControlView,
|
||||
getApplicationContext());
|
||||
}
|
||||
|
||||
private void releasePlayerManager() {
|
||||
playerManager.release();
|
||||
playerManager = null;
|
||||
}
|
||||
|
||||
// User controls.
|
||||
|
||||
private final class SampleListAdapter extends ArrayAdapter<CastDemoUtil.Sample> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue