mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-01 00:02:55 +01:00
fix: quick quality list flyout view visibility in old-quality-layout
patch (#86)
This commit is contained in:
parent
5549b95825
commit
996434c574
@ -1,10 +1,11 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
@ -14,16 +15,27 @@ import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
public class OldQualityLayoutPatch {
|
||||
// TODO: hide listView, OnHierarchyChange will not be triggered though
|
||||
public static Window window;
|
||||
private static boolean hideWindow = true;
|
||||
|
||||
public static void showOldQualityMenu(ListView listView)
|
||||
{
|
||||
if (!SettingsEnum.OLD_STYLE_QUALITY_SETTINGS.getBoolean()) return;
|
||||
|
||||
hideWindow = true;
|
||||
|
||||
listView.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
|
||||
@Override
|
||||
public void onChildViewAdded(View parent, View child) {
|
||||
LogHelper.debug(OldQualityLayoutPatch.class, "Added: " + child);
|
||||
|
||||
parent.setVisibility(View.GONE);
|
||||
if (window != null && hideWindow) {
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
hideWindow = false;
|
||||
}
|
||||
|
||||
final var indexOfAdvancedQualityMenuItem = 4;
|
||||
if (listView.indexOfChild(child) != indexOfAdvancedQualityMenuItem) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user