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
@ -30,7 +30,6 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
|
|||||||
import com.google.android.exoplayer2.ext.cast.CastPlayer;
|
import com.google.android.exoplayer2.ext.cast.CastPlayer;
|
||||||
import com.google.android.exoplayer2.ui.PlaybackControlView;
|
import com.google.android.exoplayer2.ui.PlaybackControlView;
|
||||||
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
|
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
|
||||||
import com.google.android.gms.cast.framework.CastButtonFactory;
|
import com.google.android.gms.cast.framework.CastButtonFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,36 +68,17 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
if (Util.SDK_INT > 23) {
|
|
||||||
setupPlayerManager();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if ((Util.SDK_INT <= 23)) {
|
playerManager = new PlayerManager(simpleExoPlayerView, castControlView, this);
|
||||||
setupPlayerManager();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (Util.SDK_INT <= 23) {
|
playerManager.release();
|
||||||
releasePlayerManager();
|
playerManager = null;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
if (Util.SDK_INT > 23) {
|
|
||||||
releasePlayerManager();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activity input.
|
// Activity input.
|
||||||
@ -109,18 +89,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return super.dispatchKeyEvent(event) || playerManager.dispatchKeyEvent(event);
|
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.
|
// User controls.
|
||||||
|
|
||||||
private final class SampleListAdapter extends ArrayAdapter<CastDemoUtil.Sample> {
|
private final class SampleListAdapter extends ArrayAdapter<CastDemoUtil.Sample> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user