From 9f2cfa522ad31268845e4c704c7946a63db44353 Mon Sep 17 00:00:00 2001 From: xihan123 Date: Sat, 19 Aug 2023 00:43:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=9A=90=E8=97=8F=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE):=20`827`~`970`=20=E7=89=88=E6=9C=AC=20`?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=BA=95=E9=83=A8=E5=AF=BC=E8=88=AA=E6=A0=8F?= =?UTF-8?q?`=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xihan123 --- app/src/main/kotlin/cn/xihan/qdds/ViewHide.kt | 114 +++--------------- 1 file changed, 20 insertions(+), 94 deletions(-) diff --git a/app/src/main/kotlin/cn/xihan/qdds/ViewHide.kt b/app/src/main/kotlin/cn/xihan/qdds/ViewHide.kt index f9d9a63..09173ad 100644 --- a/app/src/main/kotlin/cn/xihan/qdds/ViewHide.kt +++ b/app/src/main/kotlin/cn/xihan/qdds/ViewHide.kt @@ -541,82 +541,34 @@ fun PackageParam.hideBottomNavigation(versionCode: Int) { 970 -> "s" else -> null } + if (needHookMethod == null) { + "隐藏底部导航栏".printlnNotSupportVersion(versionCode) + return + } when (versionCode) { - in 827..958 -> { - findClass("com.qidian.QDReader.ui.widget.maintab.PagerSlidingTabStrip").hook { - injectMember { - method { - name = needHookMethod!! - emptyParam() - returnType = UnitType - } - afterHook { - val i = instance.getView("i") - i?.let { - val childCount = it.childCount - for (index in 0.. { + in 827..970 -> { findClass("com.qidian.QDReader.ui.widget.maintab.PagerSlidingTabStrip").hook { injectMember { method { - name = needHookMethod!! + name = needHookMethod emptyParam() returnType = UnitType } afterHook { - val i = instance.getView("j") - i?.let { - val childCount = it.childCount - for (index in 0..() + if (linearLayouts.isNotEmpty()) { + linearLayouts.forEach { + val textViews = it.findViewsByType(TextViewClass) + .filter { textView -> (textView as TextView).text.isNotBlank() } + if (textViews.isNotEmpty()) { + textViews.forEach { textView -> + val text = (textView as TextView).text + HookEntry.optionEntity.viewHideOption.homeOption.configurations.findOrPlus( + title = "主页底部导航栏${text}" + ) { + val parent = textView.parent.parent as? View + parent?.visibility = View.GONE } } } @@ -626,34 +578,8 @@ fun PackageParam.hideBottomNavigation(versionCode: Int) { } } } - } -} - -/** - * 隐藏底部导航栏-发现 - */ -fun PackageParam.hideBottomNavigationFind(versionCode: Int) { - when (versionCode) { - in 792..880 -> { - findClass("com.qidian.QDReader.ui.widget.maintab.PagerSlidingTabStrip").hook { - injectMember { - method { - name = "s" - emptyParam() - returnType = UnitType - } - afterHook { - val i = instance.getView("i") - i?.let { - val view = it.getChildAt(2) - view?.visibility = View.GONE - } - } - } - } - } - else -> "隐藏底部导航栏-发现".printlnNotSupportVersion(versionCode) + else -> "隐藏底部导航栏".printlnNotSupportVersion(versionCode) } }