mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Remove unnecessary view casts
findViewById is now defined using generics, which allows the types to be inferred. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=166355555
This commit is contained in:
parent
6e03dcdfa1
commit
6907ffb285
6 changed files with 18 additions and 18 deletions
|
|
@ -49,12 +49,12 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
setContentView(R.layout.main_activity);
|
setContentView(R.layout.main_activity);
|
||||||
|
|
||||||
simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
|
simpleExoPlayerView = findViewById(R.id.player_view);
|
||||||
simpleExoPlayerView.requestFocus();
|
simpleExoPlayerView.requestFocus();
|
||||||
|
|
||||||
castControlView = (PlaybackControlView) findViewById(R.id.cast_control_view);
|
castControlView = findViewById(R.id.cast_control_view);
|
||||||
|
|
||||||
ListView sampleList = (ListView) findViewById(R.id.sample_list);
|
ListView sampleList = findViewById(R.id.sample_list);
|
||||||
sampleList.setAdapter(new SampleListAdapter());
|
sampleList.setAdapter(new SampleListAdapter());
|
||||||
sampleList.setOnItemClickListener(new SampleClickListener());
|
sampleList.setOnItemClickListener(new SampleClickListener());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,12 +148,12 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi
|
||||||
setContentView(R.layout.player_activity);
|
setContentView(R.layout.player_activity);
|
||||||
View rootView = findViewById(R.id.root);
|
View rootView = findViewById(R.id.root);
|
||||||
rootView.setOnClickListener(this);
|
rootView.setOnClickListener(this);
|
||||||
debugRootView = (LinearLayout) findViewById(R.id.controls_root);
|
debugRootView = findViewById(R.id.controls_root);
|
||||||
debugTextView = (TextView) findViewById(R.id.debug_text_view);
|
debugTextView = findViewById(R.id.debug_text_view);
|
||||||
retryButton = (Button) findViewById(R.id.retry_button);
|
retryButton = findViewById(R.id.retry_button);
|
||||||
retryButton.setOnClickListener(this);
|
retryButton.setOnClickListener(this);
|
||||||
|
|
||||||
simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
|
simpleExoPlayerView = findViewById(R.id.player_view);
|
||||||
simpleExoPlayerView.setControllerVisibilityListener(this);
|
simpleExoPlayerView.setControllerVisibilityListener(this);
|
||||||
simpleExoPlayerView.requestFocus();
|
simpleExoPlayerView.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public class SampleChooserActivity extends Activity {
|
||||||
Toast.makeText(getApplicationContext(), R.string.sample_list_load_error, Toast.LENGTH_LONG)
|
Toast.makeText(getApplicationContext(), R.string.sample_list_load_error, Toast.LENGTH_LONG)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
ExpandableListView sampleList = (ExpandableListView) findViewById(R.id.sample_list);
|
ExpandableListView sampleList = findViewById(R.id.sample_list);
|
||||||
sampleList.setAdapter(new SampleAdapter(this, groups));
|
sampleList.setAdapter(new SampleAdapter(this, groups));
|
||||||
sampleList.setOnChildClickListener(new OnChildClickListener() {
|
sampleList.setOnChildClickListener(new OnChildClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -374,9 +374,9 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
LayoutInflater.from(context).inflate(controllerLayoutId, this);
|
LayoutInflater.from(context).inflate(controllerLayoutId, this);
|
||||||
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
||||||
|
|
||||||
durationView = (TextView) findViewById(R.id.exo_duration);
|
durationView = findViewById(R.id.exo_duration);
|
||||||
positionView = (TextView) findViewById(R.id.exo_position);
|
positionView = findViewById(R.id.exo_position);
|
||||||
timeBar = (TimeBar) findViewById(R.id.exo_progress);
|
timeBar = findViewById(R.id.exo_progress);
|
||||||
if (timeBar != null) {
|
if (timeBar != null) {
|
||||||
timeBar.setListener(componentListener);
|
timeBar.setListener(componentListener);
|
||||||
}
|
}
|
||||||
|
|
@ -404,7 +404,7 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
if (fastForwardButton != null) {
|
if (fastForwardButton != null) {
|
||||||
fastForwardButton.setOnClickListener(componentListener);
|
fastForwardButton.setOnClickListener(componentListener);
|
||||||
}
|
}
|
||||||
repeatToggleButton = (ImageView) findViewById(R.id.exo_repeat_toggle);
|
repeatToggleButton = findViewById(R.id.exo_repeat_toggle);
|
||||||
if (repeatToggleButton != null) {
|
if (repeatToggleButton != null) {
|
||||||
repeatToggleButton.setOnClickListener(componentListener);
|
repeatToggleButton.setOnClickListener(componentListener);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
|
||||||
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
|
||||||
|
|
||||||
// Content frame.
|
// Content frame.
|
||||||
contentFrame = (AspectRatioFrameLayout) findViewById(R.id.exo_content_frame);
|
contentFrame = findViewById(R.id.exo_content_frame);
|
||||||
if (contentFrame != null) {
|
if (contentFrame != null) {
|
||||||
setResizeModeRaw(contentFrame, resizeMode);
|
setResizeModeRaw(contentFrame, resizeMode);
|
||||||
}
|
}
|
||||||
|
|
@ -307,24 +307,24 @@ public final class SimpleExoPlayerView extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overlay frame layout.
|
// Overlay frame layout.
|
||||||
overlayFrameLayout = (FrameLayout) findViewById(R.id.exo_overlay);
|
overlayFrameLayout = findViewById(R.id.exo_overlay);
|
||||||
|
|
||||||
// Artwork view.
|
// Artwork view.
|
||||||
artworkView = (ImageView) findViewById(R.id.exo_artwork);
|
artworkView = findViewById(R.id.exo_artwork);
|
||||||
this.useArtwork = useArtwork && artworkView != null;
|
this.useArtwork = useArtwork && artworkView != null;
|
||||||
if (defaultArtworkId != 0) {
|
if (defaultArtworkId != 0) {
|
||||||
defaultArtwork = BitmapFactory.decodeResource(context.getResources(), defaultArtworkId);
|
defaultArtwork = BitmapFactory.decodeResource(context.getResources(), defaultArtworkId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subtitle view.
|
// Subtitle view.
|
||||||
subtitleView = (SubtitleView) findViewById(R.id.exo_subtitles);
|
subtitleView = findViewById(R.id.exo_subtitles);
|
||||||
if (subtitleView != null) {
|
if (subtitleView != null) {
|
||||||
subtitleView.setUserDefaultStyle();
|
subtitleView.setUserDefaultStyle();
|
||||||
subtitleView.setUserDefaultTextSize();
|
subtitleView.setUserDefaultTextSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Playback control view.
|
// Playback control view.
|
||||||
PlaybackControlView customController = (PlaybackControlView) findViewById(R.id.exo_controller);
|
PlaybackControlView customController = findViewById(R.id.exo_controller);
|
||||||
View controllerPlaceholder = findViewById(R.id.exo_controller_placeholder);
|
View controllerPlaceholder = findViewById(R.id.exo_controller_placeholder);
|
||||||
if (customController != null) {
|
if (customController != null) {
|
||||||
this.controller = customController;
|
this.controller = customController;
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
setContentView(getResources().getIdentifier("host_activity", "layout", getPackageName()));
|
setContentView(getResources().getIdentifier("host_activity", "layout", getPackageName()));
|
||||||
surfaceView = (SurfaceView) findViewById(
|
surfaceView = findViewById(
|
||||||
getResources().getIdentifier("surface_view", "id", getPackageName()));
|
getResources().getIdentifier("surface_view", "id", getPackageName()));
|
||||||
surfaceView.getHolder().addCallback(this);
|
surfaceView.getHolder().addCallback(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue