diff --git a/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/FullScreenManager.java b/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/FullScreenManager.java index 3676d95..99654c5 100644 --- a/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/FullScreenManager.java +++ b/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/FullScreenManager.java @@ -6,7 +6,6 @@ import android.app.Dialog; import android.view.View; import android.view.ViewGroup; -import android.widget.FrameLayout; import android.widget.ImageView; import com.google.android.exoplayer2.ui.PlaybackControlView; import com.google.android.exoplayer2.ui.PlayerView; @@ -19,7 +18,7 @@ final class FullScreenManager { private PlayerView localPlayerView; private Dialog mFullScreenDialog; private ImageView mFullScreenIcon; - private FrameLayout mFullScreenButton; + private ViewGroup mFullScreenButton; // static factory @@ -82,7 +81,7 @@ public void onBackPressed() { } private void openFullscreenDialog() { - ((ViewGroup) localPlayerView.getParent()).removeView(localPlayerView); + ((ViewGroup) localPlayerView.getParent()).removeView(localPlayerView); // FrameLayout mFullScreenDialog.addContentView(localPlayerView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mFullScreenIcon.setImageDrawable(ContextCompat.getDrawable(videoActivity, R.drawable.ic_fullscreen_close)); isFullScreen = true; @@ -90,17 +89,18 @@ private void openFullscreenDialog() { } private void closeFullscreenDialog() { - ((ViewGroup) localPlayerView.getParent()).removeView(localPlayerView); - ((FrameLayout) videoActivity.findViewById(R.id.main_media_frame)).addView(localPlayerView); + ((ViewGroup) localPlayerView.getParent()).removeView(localPlayerView); // Dialog + ((ViewGroup) videoActivity.findViewById(R.id.main_media_frame)).addView(localPlayerView); // FrameLayout isFullScreen = false; mFullScreenDialog.dismiss(); mFullScreenIcon.setImageDrawable(ContextCompat.getDrawable(videoActivity, R.drawable.ic_fullscreen_open)); } private void initFullscreenButton() { - PlaybackControlView controlView = localPlayerView.findViewById(R.id.exo_controller); - mFullScreenIcon = controlView.findViewById(R.id.exo_fullscreen_icon); - mFullScreenButton = controlView.findViewById(R.id.exo_fullscreen_button); + PlaybackControlView controlView; + controlView = (PlaybackControlView) localPlayerView.findViewById(R.id.exo_controller); + mFullScreenIcon = (ImageView) controlView.findViewById(R.id.exo_fullscreen_icon); + mFullScreenButton = (ViewGroup) controlView.findViewById(R.id.exo_fullscreen_button); // FrameLayout mFullScreenButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/PlayerManager.java b/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/PlayerManager.java index cb74b1c..00075ca 100644 --- a/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/PlayerManager.java +++ b/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/PlayerManager.java @@ -7,6 +7,7 @@ import androidx.annotation.Nullable; import android.view.KeyEvent; import android.view.View; +import android.view.ViewGroup; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.DefaultRenderersFactory; @@ -452,11 +453,11 @@ private void setCurrentPlayer(Player currentPlayer) { // View management. if (currentPlayer == exoPlayer) { fullScreenManager.enable(); - localPlayerView.setVisibility(View.VISIBLE); + ((ViewGroup) localPlayerView.getParent()).setVisibility(View.VISIBLE); // FrameLayout castControlView.hide(); } else /* currentPlayer == castPlayer */ { fullScreenManager.disable(); - localPlayerView.setVisibility(View.GONE); + ((ViewGroup) localPlayerView.getParent()).setVisibility(View.GONE); // FrameLayout castControlView.show(); } diff --git a/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/VideoActivity.java b/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/VideoActivity.java index 0d3425c..4ad5723 100644 --- a/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/VideoActivity.java +++ b/WebCast/src/main/java/com/github/warren_bank/webcast/exoplayer2/VideoActivity.java @@ -65,7 +65,7 @@ public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.video_activity); - Toolbar toolbar = findViewById(R.id.toolbar); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(""); toolbar.setNavigationIcon(R.drawable.ic_arrow_back); @@ -76,12 +76,12 @@ public void onClick(View v) { } }); - localPlayerView = findViewById(R.id.local_player_view); + localPlayerView = (PlayerView) findViewById(R.id.local_player_view); localPlayerView.requestFocus(); - castControlView = findViewById(R.id.cast_control_view); + castControlView = (PlayerControlView) findViewById(R.id.cast_control_view); - mediaQueueList = findViewById(R.id.sample_list); + mediaQueueList = (RecyclerView) findViewById(R.id.sample_list); ItemTouchHelper helper = new ItemTouchHelper(new RecyclerViewCallback()); helper.attachToRecyclerView(mediaQueueList); mediaQueueList.setLayoutManager(new LinearLayoutManager(this)); diff --git a/constants.gradle b/constants.gradle index 39e0699..79b7880 100644 --- a/constants.gradle +++ b/constants.gradle @@ -1,6 +1,6 @@ project.ext { - releaseVersionCode = 004070016 - releaseVersion = '004.07.00-16API' + releaseVersionCode = 004070116 + releaseVersion = '004.07.01-16API' minSdkVersion = 16 targetSdkVersion = 28 compileSdkVersion = 28