diff --git a/app/src/main/java/com/lt2333/simplicitytools/activity/SettingsActivity.kt b/app/src/main/java/com/lt2333/simplicitytools/activity/SettingsActivity.kt index 01def458..ad6faef7 100644 --- a/app/src/main/java/com/lt2333/simplicitytools/activity/SettingsActivity.kt +++ b/app/src/main/java/com/lt2333/simplicitytools/activity/SettingsActivity.kt @@ -1103,6 +1103,11 @@ class SettingsActivity : MIUIActivity() { TextV(resId = R.string.hide_bluetooth_icon), SwitchV("hide_bluetooth_icon") ) + + TextWithSwitch( + TextV(resId = R.string.hide_nfc_icon), + SwitchV("hide_nfc_icon") + ) TextWithSwitch( TextV(resId = R.string.hide_bluetooth_battery_icon), SwitchV("hide_bluetooth_battery_icon") diff --git a/app/src/main/java/com/lt2333/simplicitytools/hook/app/securitycenter/ShowBatteryTemperature.kt b/app/src/main/java/com/lt2333/simplicitytools/hook/app/securitycenter/ShowBatteryTemperature.kt index e0cf7b58..09890e5c 100644 --- a/app/src/main/java/com/lt2333/simplicitytools/hook/app/securitycenter/ShowBatteryTemperature.kt +++ b/app/src/main/java/com/lt2333/simplicitytools/hook/app/securitycenter/ShowBatteryTemperature.kt @@ -14,12 +14,11 @@ import android.widget.LinearLayout import android.widget.TextView import cn.fkj233.ui.activity.dp2px import com.github.kyuubiran.ezxhelper.utils.findMethod +import com.github.kyuubiran.ezxhelper.utils.getObjectAs import com.github.kyuubiran.ezxhelper.utils.hookAfter import com.github.kyuubiran.ezxhelper.utils.hookBefore -import com.github.kyuubiran.ezxhelper.utils.loadClass import com.lt2333.simplicitytools.util.* import com.lt2333.simplicitytools.util.xposed.base.HookRegister -import java.lang.reflect.Field object ShowBatteryTemperature : HookRegister() { @@ -31,15 +30,26 @@ object ShowBatteryTemperature : HookRegister() { } override fun init() = hasEnable("battery_life_function") { - findMethod("com.miui.powercenter.a") { - name == "b" && parameterTypes[0] == Context::class.java + try { + findMethod("com.miui.powercenter.a") { + name == "b" && parameterTypes[0] == Context::class.java + } + } catch (e : Exception) { + findMethod("com.miui.powercenter.BatteryFragment") { + name == "b" && parameterTypes[0] == Context::class.java + } }.hookBefore { it.result = getBatteryTemperature(it.args[0] as Context).toString() - } - findMethod("com.miui.powercenter.a\$a") { - name == "run" + try { + findMethod("com.miui.powercenter.a\$a") { + name == "run" + } + } catch (e : Exception) { + findMethod("com.miui.powercenter.BatteryFragment\$a") { + name == "run" + } }.hookAfter { val context = AndroidAppHelper.currentApplication().applicationContext val isDarkMode = @@ -49,36 +59,43 @@ object ShowBatteryTemperature : HookRegister() { "id", "com.miui.securitycenter" ) - val field = loadClass("com.miui.powercenter.a\$a").getDeclaredField("a") as Field - field.isAccessible = true - val view = field.get(it.thisObject) as View + + val view = it.thisObject.getObjectAs("a") + val textView = view.findViewById(currentTemperatureValue) - (textView.layoutParams as LinearLayout.LayoutParams).marginStart = dp2px(context, 25f) - (textView.layoutParams as LinearLayout.LayoutParams).topMargin = 0 - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36.399998f) - textView.setPadding(0, 0, 0, 0) - textView.gravity = Gravity.NO_GRAVITY - textView.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) - textView.height = dp2px(context, 49.099983f) - textView.textAlignment = View.TEXT_ALIGNMENT_VIEW_START + textView.apply { + (layoutParams as LinearLayout.LayoutParams).marginStart = dp2px(context, 25f) + (layoutParams as LinearLayout.LayoutParams).topMargin = 0 + setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36.399998f) + setPadding(0, 0, 0, 0) + gravity = Gravity.NO_GRAVITY + typeface = Typeface.defaultFromStyle(Typeface.NORMAL) + height = dp2px(context, 49.099983f) + textAlignment = View.TEXT_ALIGNMENT_VIEW_START + } + val tempView = TextView(context) - tempView.layoutParams = LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, - dp2px(context, 49.099983f) - ) - (tempView.layoutParams as LinearLayout.LayoutParams).marginStart = - dp2px(context, 3.599976f) - tempView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.099977f) - tempView.setTextColor(Color.parseColor(if (isDarkMode) "#e6e6e6" else "#333333")) - tempView.setPadding(0, dp2px(context, 25f), 0, 0) - tempView.text = "℃" - tempView.typeface = Typeface.create(null, 500, false) - tempView.textAlignment = View.TEXT_ALIGNMENT_VIEW_START + tempView.apply { + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + dp2px(context, 49.099983f) + ) + (layoutParams as LinearLayout.LayoutParams).marginStart = + dp2px(context, 3.599976f) + setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.099977f) + setTextColor(Color.parseColor(if (isDarkMode) "#e6e6e6" else "#333333")) + setPadding(0, dp2px(context, 25f), 0, 0) + text = "℃" + typeface = Typeface.create(null, 500, false) + textAlignment = View.TEXT_ALIGNMENT_VIEW_START + } + val tempeValueContainer = context.resources.getIdentifier( "tempe_value_container", "id", "com.miui.securitycenter" ) + val linearLayout = view.findViewById(tempeValueContainer) linearLayout.addView(tempView) } diff --git a/app/src/main/java/com/lt2333/simplicitytools/hook/app/systemui/HideStatusBarIcon.kt b/app/src/main/java/com/lt2333/simplicitytools/hook/app/systemui/HideStatusBarIcon.kt index 74d9e679..f3434364 100644 --- a/app/src/main/java/com/lt2333/simplicitytools/hook/app/systemui/HideStatusBarIcon.kt +++ b/app/src/main/java/com/lt2333/simplicitytools/hook/app/systemui/HideStatusBarIcon.kt @@ -76,6 +76,10 @@ object HideStatusBarIcon : HookRegister() { "no_sim" -> hasEnable("hide_no_sim_icon") { it.args[1] = false } + //隐藏NFC图标 + "nfc" -> hasEnable("hide_nfc_icon") { + it.args[1] = false + } } } } \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a6fb7913..3115ea58 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -216,4 +216,5 @@ Se activa después de reiniciar Activar esta opción puede hacer que el desplazamiento de la barra de volumen se congele o que el volumen Bluetooth sea anormal Es posible que algunas notificaciones a través de Mi Push no sean soportadas. + Ocultar icono NFC diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 14688656..36cff27b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -172,4 +172,5 @@ Alignement double ligne Gauche Droite + Masquer l\'icône NFC diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 39922575..91cfcbfd 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -163,4 +163,5 @@ Baris Kolom Baris (Horizontal) + Sembunyikan ikon NFC diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 572b7282..b1e7b437 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -216,4 +216,5 @@ 機能は再起動後に有効になります オンにすると、ボリュームバーのスクロールがフリーズしたり、Bluetoothの音量が異常になる場合があります 一部のMi Pushによる通知では機能しない場合があります。 + NFC アイコンを隠す diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index e619f430..7baea1ab 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -55,4 +55,5 @@ Na het inschakelen van de module voor de eerste keer of de module is bijgewerkt, zal de functie hier van kracht worden na het herstarten van het systeem Beveiligingsapp, Gallerij aanpasser, Batterij en prestatie, enz. Batterij en prestatie + Verberg NFC icoon diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7a677a37..308f0f91 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -213,4 +213,5 @@ Dźwięk Kroki głośności multimediów Niektóre powiadomienia Mi Push mogą nie być obsługiwane. + Ukryj ikonę NFC diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index d625c03a..5f493e42 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -216,4 +216,5 @@ Intră în vigoare după repornire Activarea poate provoca înghețarea derulării barei de volum sau volumul Bluetooth să fie anormal Este posibil ca unele notificări prin Mi Push să nu fie acceptate. + Ascunde pictograma NFC diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index a0b127b7..2fd8b9d4 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -220,4 +220,5 @@ Вступит в силу после перезагрузки Включение может привести к ненормальной прокрутке строки громкости Некоторые уведомления через Mi Push могут не поддерживаться. + Скрыть NFC diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 45a0e6b1..810754ed 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -217,4 +217,5 @@ Yeniden başlattıktan sonra etkili ol Açmak, ses seviyesi çubuğunun kaymasının donmasına veya Bluetooth ses seviyesinin anormal olmasına neden olabilir. Mi Push aracılığıyla yapılan bazı bildirimler desteklenmeyebilir. + NFC simgesini gizle diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 7a3e2bf0..af80025d 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -181,4 +181,5 @@ Phạm vi: Căn lề biểu tượng mạng dữ liệu lớn Truyền + Ẩn biểu tượng NFC diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 9aadefed..0859d59f 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -21,6 +21,7 @@ 隐藏 飞行模式 图标 隐藏 WIFI 图标 隐藏 蓝牙 图标 + 隐藏 NFC 图标 隐藏 声音、勿扰 图标 隐藏 闹钟 图标 隐藏 WIFI热点 图标 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index f6440a9e..5934972f 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -156,4 +156,5 @@ 隱藏 勿擾 圖標 隱藏圖標 雙擊鎖定螢幕 + 隱藏 NFC 圖標 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index dcdc27eb..864180c9 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -216,4 +216,5 @@ 重新開機後生效 開啟後可能會導致音量條的滾動卡頓或藍牙音量異常 可能無法支援一些使用小米推送(Mi Push)推播的通知 + 隱藏 NFC 圖示 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2a44baa1..cb8ba09e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,6 +28,7 @@ Hide Portable hotspot icon Hide Headset icon Hide Bluetooth battery icon + Hide NFC icon Hide big HD icon Hide small HD icon Hide HD No Service icon