|
1 | 1 | package app.revanced.integrations.patches; |
2 | 2 |
|
3 | | -import android.os.Handler; |
4 | | -import android.os.Looper; |
| 3 | +import android.graphics.Color; |
| 4 | +import android.graphics.drawable.ColorDrawable; |
5 | 5 | import android.util.Log; |
6 | 6 | import android.view.View; |
7 | 7 | import android.view.ViewGroup; |
| 8 | +import android.view.Window; |
8 | 9 | import android.widget.ListView; |
9 | 10 | import android.widget.RelativeLayout; |
10 | 11 |
|
|
14 | 15 | import app.revanced.integrations.utils.LogHelper; |
15 | 16 |
|
16 | 17 | public class OldQualityLayoutPatch { |
17 | | - // TODO: hide listView, OnHierarchyChange will not be triggered though |
| 18 | + public static Window window; |
| 19 | + private static boolean hideWindow = true; |
| 20 | + |
18 | 21 | public static void showOldQualityMenu(ListView listView) |
19 | 22 | { |
20 | 23 | if (!SettingsEnum.OLD_STYLE_QUALITY_SETTINGS.getBoolean()) return; |
21 | 24 |
|
| 25 | + hideWindow = true; |
| 26 | + |
22 | 27 | listView.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() { |
23 | 28 | @Override |
24 | 29 | public void onChildViewAdded(View parent, View child) { |
25 | 30 | LogHelper.debug(OldQualityLayoutPatch.class, "Added: " + child); |
26 | 31 |
|
| 32 | + parent.setVisibility(View.GONE); |
| 33 | + if (window != null && hideWindow) { |
| 34 | + window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
| 35 | + |
| 36 | + hideWindow = false; |
| 37 | + } |
| 38 | + |
27 | 39 | final var indexOfAdvancedQualityMenuItem = 4; |
28 | 40 | if (listView.indexOfChild(child) != indexOfAdvancedQualityMenuItem) return; |
29 | 41 |
|
|
0 commit comments