diff options
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index 0e8bd1da..26a2522c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -1867,6 +1867,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Nullable ExoPlayerViewHelper helper; private Uri mediaUri; + private float volume = 0f; PostVideoAutoplayViewHolder(View itemView) { super(itemView); @@ -1901,9 +1902,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView if (helper.getVolume() != 0) { muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_24dp)); helper.setVolume(0f); + volume = 0f; } else { muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_24dp)); helper.setVolume(1f); + volume = 1f; } } }); @@ -1936,8 +1939,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView for (int i = 0; i < trackGroups.length; i++) { String mimeType = trackGroups.get(i).getFormat(0).sampleMimeType; if (mimeType != null && mimeType.contains("audio")) { - helper.setVolume(0f); + helper.setVolume(volume); muteButton.setVisibility(View.VISIBLE); + if (volume != 0f) { + muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_24dp)); + } else { + muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_24dp)); + } break; } } |