Skip to content

Commit

Permalink
优化移动网络类型显示逻辑 && 优化通知中心天气点击逻辑 (#1014)
Browse files Browse the repository at this point in the history
- 暂时移除对于 OS1 安装新版桌面的解锁布局 HOOK
- 优化跳转天气应用后自动关闭通知中心
- 优化大 5G 反色逻辑
- 修复移动网络活动指示器在部分情况显示多余 padding 的问题

Co-authored-by: 铃柒柒 <[email protected]>
  • Loading branch information
xzakota and lingqiqi5211 authored Dec 2, 2024
1 parent 3331797 commit 96c263d
Show file tree
Hide file tree
Showing 12 changed files with 324 additions and 272 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ public void handleLoadPackage() {
initHook(new BackGestureAreaWidth(), mPrefsMap.getInt("home_navigation_back_area_width", 100) != 100);

// 布局
initHook(LayoutRules.INSTANCE, mPrefsMap.getBoolean("home_layout_unlock_grids_new") ||
mPrefsMap.getBoolean("home_layout_unlock_grids") ||
mPrefsMap.getBoolean("home_layout_workspace_padding_bottom_enable") ||
mPrefsMap.getBoolean("home_layout_workspace_padding_top_enable") ||
mPrefsMap.getBoolean("home_layout_workspace_padding_horizontal_enable"));
initHook(new UnlockGrids(), mPrefsMap.getBoolean("home_layout_unlock_grids"));
// initHook(new UnlockGridsNoWord(), mPrefsMap.getBoolean("home_layout_unlock_grids_no_word"));
initHook(new WorkspacePadding(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ public void handleLoadPackage() {

// 布局
initHook(LayoutRules.INSTANCE, mPrefsMap.getBoolean("home_layout_unlock_grids_new") ||
mPrefsMap.getBoolean("home_layout_unlock_grids") ||
mPrefsMap.getBoolean("home_layout_workspace_padding_bottom_enable") ||
mPrefsMap.getBoolean("home_layout_workspace_padding_top_enable") ||
mPrefsMap.getBoolean("home_layout_workspace_padding_horizontal_enable"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ public void handleLoadPackage() {
initHook(new StatusBarIconPositionAdjust(), mPrefsMap.getBoolean("system_ui_status_bar_swap_wifi_and_mobile_network"));

// 移动网络图标
boolean isEnableMobilePublic = mPrefsMap.getBoolean("system_ui_status_bar_icon_mobile_network_hide_card_1") ||
boolean isEnabledDualRowSignal = mPrefsMap.getBoolean("system_ui_statusbar_network_icon_enable");
initHook(new DualRowSignalHookV(), isEnabledDualRowSignal);
initHook(new MobilePublicHookV(), isEnabledDualRowSignal ||
mPrefsMap.getBoolean("system_ui_status_bar_icon_mobile_network_hide_card_1") ||
mPrefsMap.getBoolean("system_ui_status_bar_icon_mobile_network_hide_card_2") ||
mPrefsMap.getStringAsInt("system_ui_status_bar_icon_show_mobile_network_type", 0) != 0 ||
mPrefsMap.getBoolean("system_ui_status_bar_mobile_hide_roaming_icon") ||
mPrefsMap.getBoolean("system_ui_statusbar_mobile_type_enable") ||
mPrefsMap.getBoolean("system_ui_status_bar_mobile_indicator") ||
mPrefsMap.getStringAsInt("system_ui_status_bar_icon_small_hd", 0) != 0 ||
mPrefsMap.getStringAsInt("system_ui_status_bar_icon_big_hd", 0) != 0;
initHook(new DualRowSignalHookV(), mPrefsMap.getBoolean("system_ui_statusbar_network_icon_enable"));
initHook(new MobilePublicHookV(), true);
initHook(MobileTypeSingle2Hook.INSTANCE, isEnableMobilePublic);
mPrefsMap.getStringAsInt("system_ui_status_bar_icon_big_hd", 0) != 0);
initHook(MobileTypeSingle2Hook.INSTANCE, mPrefsMap.getStringAsInt("system_ui_status_bar_icon_show_mobile_network_type", 0) != 0 ||
mPrefsMap.getBoolean("system_ui_statusbar_mobile_type_enable"));
initHook(MobileTypeTextCustom.INSTANCE, !Objects.equals(mPrefsMap.getString("system_ui_status_bar_mobile_type_custom", ""), ""));

// 电池相关
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ object LayoutRules : HomeBaseHook() {
private const val PHONE_RULES = "com.miui.home.launcher.compat.PhoneDeviceRules"
private const val HOME_SETTINGS = "com.miui.home.settings.MiuiHomeSettings"

private var isUnlockGridsHook = false
private var isSetWSPaddingTopHook = false
private var isSetWSPaddingBottomHook = false
private var isSetWSPaddingSideHook = false
private val isUnlockGridsHook by lazy {
mPrefsMap.getBoolean("home_layout_unlock_grids_new")
}
private val isSetWSPaddingTopHook by lazy {
mPrefsMap.getBoolean("home_layout_workspace_padding_top_enable")
}
private val isSetWSPaddingBottomHook by lazy {
mPrefsMap.getBoolean("home_layout_workspace_padding_bottom_enable")
}
private val isSetWSPaddingSideHook by lazy {
mPrefsMap.getBoolean("home_layout_workspace_padding_horizontal_enable")
}

private var sCellCountX = 0
private var sCellCountY = 0
Expand All @@ -42,14 +50,6 @@ object LayoutRules : HomeBaseHook() {
private var currentCellHeight = 0

override fun initForNewHome() {
isUnlockGridsHook = mPrefsMap.getBoolean("home_layout_unlock_grids_new") ||
mPrefsMap.getBoolean("home_layout_unlock_grids")
isSetWSPaddingTopHook = mPrefsMap.getBoolean("home_layout_workspace_padding_top_enable")
isSetWSPaddingBottomHook =
mPrefsMap.getBoolean("home_layout_workspace_padding_bottom_enable")
isSetWSPaddingSideHook =
mPrefsMap.getBoolean("home_layout_workspace_padding_horizontal_enable")

if (isUnlockGridsHook) {
sCellCountX = mPrefsMap.getInt("home_layout_unlock_grids_cell_x", 0)
sCellCountY = mPrefsMap.getInt("home_layout_unlock_grids_cell_y", 0)
Expand All @@ -67,8 +67,7 @@ object LayoutRules : HomeBaseHook() {

mMiuiHomeConfig?.callMethod("removePreference", mScreenCellsConfig)
logI(
TAG,
lpparam.packageName,
TAG, lpparam.packageName,
"Remove preference($mScreenCellsConfig) form MIUIHomeSettings"
)
param.result = null
Expand Down Expand Up @@ -125,8 +124,9 @@ object LayoutRules : HomeBaseHook() {
val mCellSize = rules.getIntField("mCellSize")
val mCellCountY = rules.getIntField("mCellCountY")
val mWorkspaceTopPadding = rules.callMethodAs<Int>("getWorkspacePaddingTop")
val mWorkspaceCellPaddingBottom = rules.getObjectFieldAs<Any>("mWorkspaceCellPaddingBottom")
.callMethodAs<Int>("getValue")
val mWorkspaceCellPaddingBottom =
rules.getObjectFieldAs<Any>("mWorkspaceCellPaddingBottom")
.callMethodAs<Int>("getValue")

val sWorkspacePaddingTop = if (isSetWSPaddingTopHook) {
DisplayUtils.dp2px(
Expand Down Expand Up @@ -232,4 +232,4 @@ object LayoutRules : HomeBaseHook() {
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,47 @@
package com.sevtinge.hyperceiler.module.hook.systemui

import com.github.kyuubiran.ezxhelper.*
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.model.MobileTypeSingle2Hook.findClass
import com.sevtinge.hyperceiler.utils.*

import de.robv.android.xposed.XposedHelpers.*

@Suppress("MemberVisibilityCanBePrivate")
object Dependency {
private const val DEPENDENCY = "com.android.systemui.Dependency"
val sDependency by lazy {
findClass(DEPENDENCY, EzXHelper.classLoader).getStaticObjectField("sDependency")

private val dependencyClz by lazy {
findClass(DEPENDENCY, EzXHelper.classLoader)
}
val mMiuiLegacyDependency : Any?

/* ========================== only for HyperOS2 ========================== */
@JvmStatic
@get:JvmName(name = "getDependency")
val sDependency: Any?
get() = dependencyClz.getStaticObjectField("sDependency")

@JvmStatic
@get:JvmName(name = "getMiuiLegacyDependency")
val mMiuiLegacyDependency: Any?
get() = sDependency?.getObjectField("mMiuiLegacyDependency")
val mDependencies : Map<*, *>?

@JvmStatic
@get:JvmName(name = "getDependencies")
val mDependencies: Map<*, *>?
get() = sDependency?.getObjectField("mDependencies") as Map<*, *>?

@JvmStatic
fun getDependencyInner(depClz: Class<*>): Any? {
return sDependency?.callMethod("getDependencyInner", depClz)
}

@JvmStatic
fun getDependencyInner(depClzName: String): Any? {
return getDependencyInner(findClass(depClzName, EzXHelper.classLoader))
}

/* ========================== only for HyperOS1 ========================== */
@JvmStatic
fun get(depClz: Class<*>): Any? {
return dependencyClz.callStaticMethod("get", depClz)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.sevtinge.hyperceiler.module.hook.systemui

import com.github.kyuubiran.ezxhelper.*
import com.sevtinge.hyperceiler.utils.*
import de.robv.android.xposed.XposedHelpers.*

/**
* only for HyperOS2
*/
object InterfacesImplManager {
private const val IMPL_MANAGER = "com.miui.systemui.interfacesmanager.InterfacesImplManager"

const val I_ACTIVITY_STARTER = "com.android.systemui.plugins.ActivityStarter"

@JvmStatic
@get:JvmName(name = "getClassContainer")
val sClassContainer by lazy {
managerClz.getStaticObjectFieldAs<Map<Class<*>, Any>>("sClassContainer")
}

private val managerClz by lazy {
findClass(IMPL_MANAGER, EzXHelper.classLoader)
}

@JvmStatic
fun registerImpl(clz: Class<*>, obj: Any) {
managerClz.callStaticMethod("registerImpl", clz, obj)
}
}
Loading

0 comments on commit 96c263d

Please sign in to comment.