Skip to content

Commit

Permalink
fix: 970 版本 精选-标题隐藏失效
Browse files Browse the repository at this point in the history
Signed-off-by: xihan123 <srxqzxs@vip.qq.com>
  • Loading branch information
xihan123 committed Aug 15, 2023
1 parent c89412a commit 44b12c3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
description: ${{ steps.get_latest_release.outputs.description }}
run: |
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
OUTPUT="app/release/"
OUTPUT="app/build/outputs/apk/release/"
export apkRelease=$(find $OUTPUT -name "*.apk")
ESCAPED=`python3 -c '''import requests,os;body = os.environ["description"]; r = requests.get("https://api.github.com/repos/${{github.repository}}/releases/latest"); tag_name = r.json()["tag_name"]; html_url = r.json()["html_url"]; change_log = "# 完整更新日志 " + "[" + tag_name + "](" + html_url + ")"; print(body + "\n\n" + change_log if len(body) <= 1024 else change_log)'''`
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendDocument?chat_id=${CHANNEL_ID}" -F document="@$apkRelease" -F caption="${ESCAPED}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
token: ${{ secrets.RELEASE_TOKEN }}
release-type: node
package-name: release-please-action
release-as: 2.2.5
release-as: 2.2.6
signoff: "xihan123<srxqzxs@vip.qq.com>"
changelog-types: '[{"type":"types","section":"Types","hidden":false},{"type":"revert","section":"Reverts","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"improvement","section":"Feature Improvements","hidden":false},{"type":"docs","section":"Docs","hidden":false},{"type":"ci","section":"CI","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]'
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
## [2.2.5](https://github.com/xihan123/QDReadHook/compare/v2.2.4...v2.2.5) (2023-08-15)


### Features

* `970` 版本`阅读积分`页面自动领取奖励 ([c89412a](https://github.com/xihan123/QDReadHook/commit/c89412a7ac87f18c88d409ab1e25a4f573526d1f))

## [2.2.4](https://github.com/xihan123/QDReadHook/compare/v2.2.3...v2.2.4) (2023-08-12)

Expand Down
24 changes: 23 additions & 1 deletion app/src/main/kotlin/cn/xihan/qdds/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import android.os.Environment
import android.os.Looper
import android.os.Parcelable
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
Expand Down Expand Up @@ -884,8 +885,29 @@ fun String.md5(): String {
return sb.toString()
}

/**
* 找到视图类型
* @param [viewClass] 视图类
* @return [List<View>]
*/
fun ViewGroup.findViewsByType(viewClass: Class<*>): ArrayList<View> {
val result = arrayListOf<View>()
val queue = ArrayDeque<View>()
queue.add(this)

while (queue.isNotEmpty()) {
val view = queue.removeFirst()
if (viewClass.isInstance(view)) {
result.add(view)
}

if (view is ViewGroup) {
for (i in 0 until view.childCount) {
queue.add(view.getChildAt(i))
}
}
}


return result
}

40 changes: 11 additions & 29 deletions app/src/main/kotlin/cn/xihan/qdds/ViewHide.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.alibaba.fastjson2.toJSONString
import com.highcapable.yukihookapi.hook.factory.constructor
import com.highcapable.yukihookapi.hook.factory.current
import com.highcapable.yukihookapi.hook.param.PackageParam
import com.highcapable.yukihookapi.hook.type.android.TextViewClass
import com.highcapable.yukihookapi.hook.type.android.ViewClass
import com.highcapable.yukihookapi.hook.type.java.BooleanType
import com.highcapable.yukihookapi.hook.type.java.IntType
Expand Down Expand Up @@ -261,17 +262,6 @@ fun PackageParam.selectedTitleOption(versionCode: Int) {
val pageList = mutableListOf<Any?>()
val needShieldTitleList = HookEntry.getNeedShieldTitleList()
if (countSize > 0 && needShieldTitleList.isNotEmpty()) {
/*
for (i in 0 until countSize) {
val type = superClass().method {
name = "getType"
paramCount(1)
returnType = IntType
}.int(i)
typeList.add(type)
}
*/
needShieldTitleList.forEach {
val page = superClass().method {
name = "getItemByType"
Expand Down Expand Up @@ -311,28 +301,19 @@ fun PackageParam.selectedTitleOption(versionCode: Int) {
}.call()
}

val child = mTabLayout.getChildAt(0) as FrameLayout
val child2 = child.getChildAt(0) as FrameLayout
val child3 = child2.getChildAt(1) as LinearLayout
val needRemoveView = mutableListOf<View>()
for (i in 0 until child3.childCount) {
val childAt = child3.getChildAt(i) as FrameLayout
val textView = childAt.getView<TextView>("j") ?: continue
if (textView.text.isNotBlank()) {
val textViews = mTabLayout.findViewsByType(TextViewClass)

textViews.forEach { view ->
val text = (view as TextView).text.toString()
if (text.isNotBlank()) {
HookEntry.optionEntity.viewHideOption.selectedOption.selectedTitleConfigurations.findOrPlus(
title = textView.text.toString()
title = text
) {
needRemoveView.add(childAt)
// childAt.visibility = View.INVISIBLE
val parent = view.parent.parent.parent as LinearLayout
parent.removeView(view.parent.parent as View)
}
}
}
if (needRemoveView.isNotEmpty()) {
needRemoveView.forEach {
child3.removeView(it)
}
}

}
}

Expand Down Expand Up @@ -630,7 +611,8 @@ fun PackageParam.hideBottomNavigation(versionCode: Int) {
HookEntry.optionEntity.viewHideOption.homeOption.configurations.findOrPlus(
title = "主页底部导航栏${childViewChild3.text}"
) {
val view = childViewChild3.parent.parent as? View
val view =
childViewChild3.parent.parent as? View
view?.visibility = View.GONE
}
}
Expand Down

0 comments on commit 44b12c3

Please sign in to comment.