Skip to content

Commit

Permalink
支持视频半屏长按
Browse files Browse the repository at this point in the history
  • Loading branch information
GangJust committed Jun 21, 2023
1 parent 3edf615 commit 31f62db
Show file tree
Hide file tree
Showing 22 changed files with 539 additions and 406 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
applicationId "com.freegang.fplus"
minSdk 24
targetSdk 33
versionCode 28
versionCode 32
versionName "1.1.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/assets/update.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
v1.1.3
适配抖音25.6.0
适配太极
适配抖音25.6.0、25.7.0、25.8.0、25.9.0
隐藏评论区我也发一张
修改清爽模式为半屏长按
迁移模块内置菜单
修复部分小问题

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.3-28
1.1.3-32
29 changes: 14 additions & 15 deletions core/src/main/java/com/freegang/base/BaseHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ abstract class BaseHook<T>(lpparam: XC_LoadPackage.LoadPackageParam) : KtOnHook<
vibrator.vibrate(milliseconds)
}

@Synchronized
fun showDialog(
view: View,
needMultiple: Boolean = false,
) {
kDialog = if (kDialog == null) KDialog() else kDialog
val kDialog = if (needMultiple) KDialog() else kDialog
kDialog!!.setView(view)
kDialog.show()
}

fun showMessageDialog(
context: Context,
title: CharSequence,
Expand All @@ -108,9 +119,6 @@ abstract class BaseHook<T>(lpparam: XC_LoadPackage.LoadPackageParam) : KtOnHook<
onConfirm: () -> Unit = {},
onCancel: () -> Unit = {},
) {
kDialog = if (kDialog == null) KDialog() else kDialog
val kDialog = if (needMultiple) KDialog() else kDialog

val dialogView = context.inflateModuleView<FrameLayout>(R.layout.dialog_message_layout)
val binding = DialogMessageLayoutBinding.bind(dialogView)

Expand All @@ -135,8 +143,7 @@ abstract class BaseHook<T>(lpparam: XC_LoadPackage.LoadPackageParam) : KtOnHook<
onConfirm.invoke()
}

kDialog!!.setView(binding.root)
kDialog.show()
showDialog(binding.root, needMultiple)
}

fun showProgressDialog(
Expand All @@ -146,9 +153,6 @@ abstract class BaseHook<T>(lpparam: XC_LoadPackage.LoadPackageParam) : KtOnHook<
progress: Int = 0,
listener: (dialog: KDialog, progress: ProgressDialogNotification) -> Unit,
) {
kDialog = if (kDialog == null) KDialog() else kDialog
val kDialog = if (needMultiple) KDialog() else kDialog

val dialogView = KtXposedHelpers.inflateView<FrameLayout>(context, R.layout.dialog_progress_layout)
val binding = DialogProgressLayoutBinding.bind(dialogView)

Expand All @@ -157,8 +161,7 @@ abstract class BaseHook<T>(lpparam: XC_LoadPackage.LoadPackageParam) : KtOnHook<
binding.progressDialogTitle.text = title
listener.invoke(kDialog!!, ProgressDialogNotification(binding.progressDialogBar, binding.progressDialogText))

kDialog.setView(binding.root)
kDialog.show()
showDialog(binding.root, needMultiple)
}

fun showChoiceDialog(
Expand All @@ -175,9 +178,6 @@ abstract class BaseHook<T>(lpparam: XC_LoadPackage.LoadPackageParam) : KtOnHook<
onChoice: (view: View, owner: String, filename: String, item: CharSequence, position: Int) -> Unit,
onCancel: () -> Unit = {},
) {
kDialog = if (kDialog == null) KDialog() else kDialog
val kDialog = if (needMultiple) KDialog() else kDialog

val dialogView = KtXposedHelpers.inflateView<FrameLayout>(context, R.layout.dialog_choice_layout)
val binding = DialogChoiceLayoutBinding.bind(dialogView)

Expand Down Expand Up @@ -218,8 +218,7 @@ abstract class BaseHook<T>(lpparam: XC_LoadPackage.LoadPackageParam) : KtOnHook<
)
}

kDialog!!.setView(binding.root)
kDialog.show()
showDialog(binding.root, needMultiple)
}

fun showNotification(
Expand Down
5 changes: 4 additions & 1 deletion core/src/main/java/com/freegang/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ data class Config(
var isVibrate: Boolean = false, //是否开启震动反馈
var isTranslucent: Boolean = false, //是否开启首页控件半透明
var isNeat: Boolean = false, //是否开启清爽模式
var isLongPressMode: Boolean = false, //清爽模式弹窗响应模式 true上半, false下半
var neatState: Boolean = false, //当前是否处于清爽模式
var isNotification: Boolean = false, //是否通知栏下载
var isWebDav: Boolean = false, //是否开启WebDav
var webDavHost: String = "", //WebDav地址
var webDavUsername: String = "", //WebDav用户名
var webDavPassword: String = "", //WebDav密码
var isHideTab: Boolean = false, //是否开启隐藏顶部tab
var hideTabKeywords: String = "探索, 商城", //隐藏顶部tab包含的关键字, 逗号隔开
var hideTabKeywords: String = "经验, 探索, 商城", //隐藏顶部tab包含的关键字, 逗号隔开
var versionName: String = "", //版本名称
var versionCode: Long = 0L, //版本代码
var dyVersionName: String = "", //抖音版本名称
Expand Down Expand Up @@ -58,6 +59,7 @@ data class Config(
isVibrate = json.getBooleanOrDefault("isVibrate"),
isTranslucent = json.getBooleanOrDefault("isTranslucent"),
isNeat = json.getBooleanOrDefault("isNeat"),
isLongPressMode = json.getBooleanOrDefault("isLongPressMode"),
neatState = json.getBooleanOrDefault("neatState"),
isNotification = json.getBooleanOrDefault("isNotification"),
isWebDav = json.getBooleanOrDefault("isWebDav"),
Expand Down Expand Up @@ -104,6 +106,7 @@ data class Config(
.name("isVibrate").value(isVibrate)
.name("isTranslucent").value(isTranslucent)
.name("isNeat").value(isNeat)
.name("isLongPressMode").value(isLongPressMode)
.name("neatState").value(neatState)
.name("isNotification").value(isNotification)
.name("isWebDav").value(isWebDav)
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/com/freegang/config/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ object Version {

// 获取Github最后一次 releases
fun getRemoteReleasesLatest(): VersionConfig? {
//if (null == null) return null//一般用作逻辑阻断

val get = KHttpUtils.get(githubReleasesApi)
if (get.isEmpty()) return null
if (!get.contains("browser_download_url")) return null
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/java/com/freegang/douyin/DouYinMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class DouYinMain(private val app: Application) {
companion object {
val awemeHostApplication get() = "com.ss.android.ugc.aweme.app.host.AwemeHostApplication".toClass(lpparam.classLoader)!!

var diggClazz: Class<*>? = null
var longPressPanel: Class<*>? = null
//var diggClazz: Class<*>? = null
//var longPressPanel: Class<*>? = null
var commonPageClazz: Class<*>? = null
var emojiMethods: List<Method> = emptyList()
}
Expand Down Expand Up @@ -65,7 +65,7 @@ class DouYinMain(private val app: Application) {
private fun initDexKit() {
System.loadLibrary("dexkit")
DexKitBridge.create(lpparam.appInfo.sourceDir)?.use { bridge ->
if (diggClazz == null) {
/*if (diggClazz == null) {
val findMaps = bridge.batchFindClassesUsingStrings {
addQuery(
"Digg",
Expand All @@ -79,13 +79,13 @@ class DouYinMain(private val app: Application) {
)
}
diggClazz = findMaps["Digg"]?.firstOrNull()?.getClassInstance(lpparam.classLoader)
}
if (longPressPanel == null) {
}*/
/*if (longPressPanel == null) {
val findMaps = bridge.batchFindClassesUsingStrings {
addQuery("longPressPanel", setOf("LongPressPanelFragmentImpl"))
}
longPressPanel = findMaps["longPressPanel"]?.firstOrNull()?.getClassInstance(lpparam.classLoader)
}
}*/
if (commonPageClazz == null) {
val findMaps = bridge.batchFindClassesUsingStrings {
addQuery("CommonPage", setOf("a1128.b7947", "DetailActOtherNitaView"))
Expand Down
14 changes: 14 additions & 0 deletions core/src/main/java/com/freegang/douyin/HCommonPageFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import com.freegang.base.BaseHook
import com.freegang.config.Config
import com.freegang.douyin.logic.SaveCommentLogic
import com.freegang.ktutils.view.KViewUtils
import com.freegang.ktutils.view.traverse
import com.freegang.xpler.R
import com.freegang.xpler.core.KtXposedHelpers
import com.freegang.xpler.core.NoneHook
Expand All @@ -31,6 +33,7 @@ class HCommonPageFragment(lpparam: XC_LoadPackage.LoadPackageParam) : BaseHook<A
hookBlock(param) {
if (!config.isEmoji) return
rebuildTopBarView(thisObject, view as ViewGroup)
rebuildOtherView(view)
}
}

Expand Down Expand Up @@ -70,4 +73,15 @@ class HCommonPageFragment(lpparam: XC_LoadPackage.LoadPackageParam) : BaseHook<A
viewGroup.addView(appbar)
}
}

private fun rebuildOtherView(view: ViewGroup) {
launch {
delay(200L)
view.traverse {
if (it is TextView && it.text.contains("我也发一张")) {
KViewUtils.hideAll(it.parent as ViewGroup)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import de.robv.android.xposed.callbacks.XC_LoadPackage
import kotlinx.coroutines.delay

class HGifEmojiDetailActivity(lpparam: XC_LoadPackage.LoadPackageParam) : BaseHook<GifEmojiDetailActivity>(lpparam) {
private val config: Config get() = Config.get()
private val config get() = Config.get()
private var urlList: List<String> = emptyList()

@OnBefore("onCreate")
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/com/freegang/douyin/HMainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class HMainActivity(lpparam: XC_LoadPackage.LoadPackageParam) : BaseHook<MainAct
"24.0.0", "24.1.0", "24.2.0", "24.3.0", "24.4.0",
"24.5.0", "24.6.0", "24.7.0", "24.8.0", "24.9.0",
"25.0.0", "25.1.0", "25.2.0", "25.3.0", "25.4.0",
"25.5.0", "25.6.0", "25.7.0",
"25.5.0", "25.6.0", "25.7.0", "25.8.0", "25.9.0",
)

@OnAfter("onCreate")
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/com/freegang/douyin/HMainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class HMainFragment(lpparam: XC_LoadPackage.LoadPackageParam) : BaseHook<MainFra
viewGroup.traverse {
if (it is MainTabStripScrollView) {
val hideTabKeywords = config.hideTabKeywords
.removePrefix(",").removePrefix("")
.removeSuffix(",").removeSuffix("")
.replace("\\s".toRegex(), "")
.replace("[,,]".toRegex(), "|")
it.findViewsByDesc(View::class.java, hideTabKeywords.toRegex()).forEach { v -> v.isVisible = false }
Expand Down
Loading

0 comments on commit 31f62db

Please sign in to comment.