mirror of
https://github.com/revanced/revanced-integrations
synced 2025-04-16 01:01:11 +02:00
fix(youtube/general-ads): restore swipe back to exit gesture (#264)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
f6335267f2
commit
76c36daee0
app/src/main/java/app/revanced/integrations/patches
dummy/src/main/java/com/google/android/apps/youtube/app/watchwhile
@ -0,0 +1,42 @@
|
|||||||
|
package app.revanced.integrations.patches;
|
||||||
|
|
||||||
|
import com.google.android.apps.youtube.app.watchwhile.WatchWhileActivity;
|
||||||
|
import app.revanced.integrations.utils.LogHelper;
|
||||||
|
|
||||||
|
public class FixBackToExitGesturePatch {
|
||||||
|
/**
|
||||||
|
* State whether the scroll position reaches the top.
|
||||||
|
*/
|
||||||
|
public static boolean isTopView = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event after clicking the back button.
|
||||||
|
*
|
||||||
|
* @param activity The activity, the app is launched with to finish.
|
||||||
|
*/
|
||||||
|
public static void onBackPressed(WatchWhileActivity activity) {
|
||||||
|
if (!isTopView) return;
|
||||||
|
|
||||||
|
LogHelper.printDebug(() -> "Activity is closed");
|
||||||
|
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event when the homepage list of views is being scrolled.
|
||||||
|
*/
|
||||||
|
public static void onScrollingViews() {
|
||||||
|
LogHelper.printDebug(() -> "Views are scrolling");
|
||||||
|
|
||||||
|
isTopView = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event when the homepage list of views reached the top.
|
||||||
|
*/
|
||||||
|
public static void onTopView() {
|
||||||
|
LogHelper.printDebug(() -> "Scrolling reached the top");
|
||||||
|
|
||||||
|
isTopView = true;
|
||||||
|
}
|
||||||
|
}
|
7
dummy/src/main/java/com/google/android/apps/youtube/app/watchwhile/WatchWhileActivity.java
Normal file
7
dummy/src/main/java/com/google/android/apps/youtube/app/watchwhile/WatchWhileActivity.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package com.google.android.apps.youtube.app.watchwhile;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
// Dummy class
|
||||||
|
public final class WatchWhileActivity extends Activity { }
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user