aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-05-01 11:22:18 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-05-01 11:22:18 +0000
commita88f43ff38bd441b945110cf3f2f8c5a7883458b (patch)
treef182aafe906b4c590bdd000451a77714fe5df1a7 /app/src/main/java/ml
parent25328e5d18455a5817b39702a7cb389f29037380 (diff)
downloadinfinity-for-reddit-a88f43ff38bd441b945110cf3f2f8c5a7883458b.tar
infinity-for-reddit-a88f43ff38bd441b945110cf3f2f8c5a7883458b.tar.gz
infinity-for-reddit-a88f43ff38bd441b945110cf3f2f8c5a7883458b.tar.bz2
infinity-for-reddit-a88f43ff38bd441b945110cf3f2f8c5a7883458b.tar.lz
infinity-for-reddit-a88f43ff38bd441b945110cf3f2f8c5a7883458b.tar.xz
infinity-for-reddit-a88f43ff38bd441b945110cf3f2f8c5a7883458b.tar.zst
infinity-for-reddit-a88f43ff38bd441b945110cf3f2f8c5a7883458b.zip
Fix muting audio after video play ends.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java10
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;
}
}