Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
fix(YouTube): Prevent playing touch interaction sound when unintended
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Nov 6, 2023
1 parent 7216ec1 commit 624c2a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static void closeEndScreen(final ImageView imageView) {
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop,
int oldRight, int oldBottom) {
// Disable sound effects to prevent the click sound.
imageView.setSoundEffectsEnabled(false);
imageView.performClick();

// Remove the listener to prevent it from being called multiple times.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static void onFlyoutMenuCreate(RecyclerView recyclerView) {
View advancedQualityView = ((ViewGroup) recyclerView.getChildAt(0)).getChildAt(3);
if (advancedQualityView != null) {
// Click the "Advanced" quality menu to show the "old" quality menu.
advancedQualityView.setSoundEffectsEnabled(false);
advancedQualityView.performClick();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import java.util.Arrays;

import app.revanced.integrations.patches.components.PlaybackSpeedMenuFilterPatch;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;

import java.util.Arrays;

public class CustomPlaybackSpeedPatch {
/**
* Maximum playback speed, exclusive value. Custom speeds must be less than this value.
Expand Down Expand Up @@ -111,7 +109,10 @@ public static void onFlyoutMenuCreate(RecyclerView recyclerView) {

// Dismiss View [R.id.touch_outside] is the 1st ChildView of the 4th ParentView.
// This only shows in phone layout.
parentView4th.getChildAt(0).performClick();

final var touchInsidedView = parentView4th.getChildAt(0);
touchInsidedView.setSoundEffectsEnabled(false);
touchInsidedView.performClick();

// In tablet layout there is no Dismiss View, instead we just hide all two parent views.
parentView3rd.setVisibility(View.GONE);
Expand Down

0 comments on commit 624c2a3

Please sign in to comment.