From e5b65a5aecdeb0d6a5c4eb7cbfd06c29eb7ac75b Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Thu, 21 Sep 2023 23:15:34 -0400 Subject: Start changing video control UI. --- .../activities/ViewVideoActivity.java | 28 ++++++++++-------- .../adapters/HistoryPostRecyclerViewAdapter.java | 33 +++++++++++----------- .../adapters/PostDetailRecyclerViewAdapter.java | 14 ++++----- .../adapters/PostRecyclerViewAdapter.java | 32 ++++++++++----------- 4 files changed, 55 insertions(+), 52 deletions(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java index 59cb5fd4..5072d96c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -29,7 +29,6 @@ import android.view.MenuItem; import android.view.OrientationEventListener; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; @@ -70,6 +69,7 @@ import com.google.android.exoplayer2.upstream.cache.SimpleCache; import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.video.VideoSize; import com.google.android.material.bottomappbar.BottomAppBar; +import com.google.android.material.button.MaterialButton; import com.google.android.material.snackbar.Snackbar; import com.google.common.collect.ImmutableList; import com.otaliastudios.zoom.ZoomEngine; @@ -130,7 +130,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe public static final String EXTRA_VIDEO_DOWNLOAD_URL = "EVDU"; public static final String EXTRA_SUBREDDIT = "ES"; public static final String EXTRA_ID = "EI"; - public static final String EXTRA_POST_TITLE = "EPT"; + public static final String EXTRA_POST = "EP"; public static final String EXTRA_PROGRESS_SECONDS = "EPS"; public static final String EXTRA_VIDEO_TYPE = "EVT"; public static final String EXTRA_GFYCAT_ID = "EGI"; @@ -161,9 +161,9 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe @BindView(R.id.progress_bar_view_video_activity) ProgressBar progressBar; @BindView(R.id.mute_exo_playback_control_view) - ImageButton muteButton; + MaterialButton muteButton; @BindView(R.id.hd_exo_playback_control_view) - ImageButton hdButton; + MaterialButton hdButton; @BindView(R.id.bottom_navigation_exo_playback_control_view) BottomAppBar bottomAppBar; @BindView(R.id.title_text_view_exo_playback_control_view) @@ -405,8 +405,12 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe } } - String postTitle = intent.getStringExtra(EXTRA_POST_TITLE); - setSmallTitle(postTitle); + Post post = intent.getParcelableExtra(EXTRA_POST); + if (post != null) { + //setSmallTitle(post.getTitle()); + setTitle(" "); + titleTextView.setText(post.getTitle()); + } trackSelector = new DefaultTrackSelector(this); if (videoType == VIDEO_TYPE_NORMAL && isDataSavingMode && dataSavingModeDefaultResolution > 0) { @@ -630,17 +634,17 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe isMute = savedInstanceState.getBoolean(IS_MUTE_STATE); if (isMute) { player.setVolume(0f); - muteButton.setImageResource(R.drawable.ic_mute_24dp); + muteButton.setIconResource(R.drawable.ic_mute_24dp); } else { player.setVolume(1f); - muteButton.setImageResource(R.drawable.ic_unmute_24dp); + muteButton.setIconResource(R.drawable.ic_unmute_24dp); } } else if (muteVideo) { isMute = true; player.setVolume(0f); - muteButton.setImageResource(R.drawable.ic_mute_24dp); + muteButton.setIconResource(R.drawable.ic_mute_24dp); } else { - muteButton.setImageResource(R.drawable.ic_unmute_24dp); + muteButton.setIconResource(R.drawable.ic_unmute_24dp); } player.addListener(new Player.Listener() { @@ -684,11 +688,11 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe if (isMute) { isMute = false; player.setVolume(1f); - muteButton.setImageResource(R.drawable.ic_unmute_24dp); + muteButton.setIconResource(R.drawable.ic_unmute_24dp); } else { isMute = true; player.setVolume(0f); - muteButton.setImageResource(R.drawable.ic_mute_24dp); + muteButton.setIconResource(R.drawable.ic_mute_24dp); } }); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java index 2d7efb90..6d8b3b18 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java @@ -6,7 +6,6 @@ import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; -import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.net.Uri; @@ -2529,7 +2528,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter { if (helper != null) { if (helper.getVolume() != 0) { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_24dp)); helper.setVolume(0f); volume = 0f; mFragment.videoAutoplayChangeMutingOption(true); } else { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_24dp)); helper.setVolume(1f); volume = 1f; mFragment.videoAutoplayChangeMutingOption(false); @@ -3272,7 +3271,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter { if (helper != null) { if (helper.getVolume() != 0) { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_24dp)); helper.setVolume(0f); volume = 0f; mFragment.videoAutoplayChangeMutingOption(true); } else { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_24dp)); helper.setVolume(1f); volume = 1f; mFragment.videoAutoplayChangeMutingOption(false); @@ -4926,7 +4925,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter { if (helper != null) { if (helper.getVolume() != 0) { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_24dp)); helper.setVolume(0f); volume = 0f; mFragment.videoAutoplayChangeMutingOption(true); } else { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_24dp)); helper.setVolume(1f); volume = 1f; mFragment.videoAutoplayChangeMutingOption(false); @@ -5891,7 +5890,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter { if (helper != null) { if (helper.getVolume() != 0) { - muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_white_rounded_24dp)); + muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_24dp)); helper.setVolume(0f); volume = 0f; } else { - muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_white_rounded_24dp)); + muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_24dp)); helper.setVolume(1f); volume = 1f; } @@ -1702,7 +1702,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter { if (helper != null) { if (helper.getVolume() != 0) { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_24dp)); helper.setVolume(0f); volume = 0f; mFragment.videoAutoplayChangeMutingOption(true); } else { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_24dp)); helper.setVolume(1f); volume = 1f; mFragment.videoAutoplayChangeMutingOption(false); @@ -3437,7 +3437,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter { if (helper != null) { if (helper.getVolume() != 0) { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_24dp)); helper.setVolume(0f); volume = 0f; mFragment.videoAutoplayChangeMutingOption(true); } else { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_24dp)); helper.setVolume(1f); volume = 1f; mFragment.videoAutoplayChangeMutingOption(false); @@ -5153,7 +5153,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter { if (helper != null) { if (helper.getVolume() != 0) { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_mute_24dp)); helper.setVolume(0f); volume = 0f; mFragment.videoAutoplayChangeMutingOption(true); } else { - muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_white_rounded_24dp)); + muteButton.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.ic_unmute_24dp)); helper.setVolume(1f); volume = 1f; mFragment.videoAutoplayChangeMutingOption(false); @@ -6161,7 +6161,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter