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) } }