mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
破烂乌龟 (#184)
* 同步blockmiui上游 显示编译时间 优化命名,简化方法等 * 同步blockmiui上游 显示编译时间 优化命名,简化方法等
This commit is contained in:
@@ -14,6 +14,7 @@ android {
|
||||
targetSdk = 33
|
||||
versionCode = 68
|
||||
versionName = "1.6.7"
|
||||
buildConfigField("String", "BUILD_TIME", "\"${System.currentTimeMillis()}\"")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="miui.cn.fkj233.xposed.statusbarlyric.SettingsFragment"/>
|
||||
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES"/>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="de.robv.android.xposed.category.MODULE_SETTINGS" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ object Updater : AppRegister() {
|
||||
hasEnable("remove_ota_validate") {
|
||||
Array(26) { "com.android.updater.common.utils.${'a' + it}" }
|
||||
.mapNotNull { loadClassOrNull(it) }
|
||||
.firstOrNull() { it.declaredFields.size >= 9 && it.declaredMethods.size > 60 }
|
||||
.firstOrNull { it.declaredFields.size >= 9 && it.declaredMethods.size > 60 }
|
||||
?.findMethod { name == "T" && returnType == Boolean::class.java }
|
||||
?.hookReturnConstant(false)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.security.cert.Certificate;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage;
|
||||
@@ -133,7 +134,7 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage, I
|
||||
if(prefs.getBoolean("UsePreSig", false)) {
|
||||
PackageManager PM = AndroidAppHelper.currentApplication().getPackageManager();
|
||||
if(PM == null){
|
||||
XposedBridge.log("E: " + BuildConfig.APPLICATION_ID + " Cannot get the Package Manager... Are you using MiUI?");
|
||||
XposedBridge.log("E: ${}" + BuildConfig.APPLICATION_ID + " Cannot get the Package Manager... Are you using MiUI?");
|
||||
}else {
|
||||
PackageInfo pI = PM.getPackageArchiveInfo((String) methodHookParam.args[0], 0);
|
||||
PackageInfo InstpI = PM.getPackageInfo(pI.packageName, PackageManager.GET_SIGNATURES);
|
||||
@@ -147,11 +148,7 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage, I
|
||||
lastSigs = (Signature[]) XposedHelpers.callStaticMethod(ASV, "convertToSignatures", (Object) lastCerts);
|
||||
}
|
||||
}
|
||||
if (lastSigs != null) {
|
||||
signingDetailsArgs[0] = lastSigs;
|
||||
} else {
|
||||
signingDetailsArgs[0] = new Signature[]{new Signature(SIGNATURE)};
|
||||
}
|
||||
signingDetailsArgs[0] = Objects.requireNonNullElseGet(lastSigs, () -> new Signature[]{new Signature(SIGNATURE)});
|
||||
Object newInstance = findConstructorExact.newInstance(signingDetailsArgs);
|
||||
|
||||
//修复 java.lang.ClassCastException: Cannot cast android.content.pm.PackageParser$SigningDetails to android.util.apk.ApkSignatureVerifier$SigningDetailsWithDigests
|
||||
@@ -159,7 +156,7 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage, I
|
||||
if (signingDetailsWithDigests != null) {
|
||||
Constructor<?> signingDetailsWithDigestsConstructorExact = XposedHelpers.findConstructorExact(signingDetailsWithDigests, signingDetails, Map.class);
|
||||
signingDetailsWithDigestsConstructorExact.setAccessible(true);
|
||||
newInstance = signingDetailsWithDigestsConstructorExact.newInstance(new Object[]{newInstance, null});
|
||||
newInstance = signingDetailsWithDigestsConstructorExact.newInstance(newInstance, null);
|
||||
}
|
||||
|
||||
Throwable cause = throwable.getCause();
|
||||
@@ -211,7 +208,7 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage, I
|
||||
Class<?> pPClass = findClass("com.android.server.pm.parsing.pkg.ParsedPackage", loadPackageParam.classLoader);
|
||||
XposedHelpers.findAndHookMethod(pmClass, "doesSignatureMatchForPermissions", String.class, pPClass, int.class, new XC_MethodHook() {
|
||||
@Override
|
||||
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
|
||||
protected void afterHookedMethod(MethodHookParam param) {
|
||||
//If we decide to crack this then at least make sure they are same apks, avoid another one that tries to impersonate.
|
||||
if (param.getResult().equals(false)) {
|
||||
String pPname = (String) XposedHelpers.callMethod(param.args[1], "getPackageName");
|
||||
|
||||
@@ -13,34 +13,22 @@ object ShowNotificationImportance : HookRegister() {
|
||||
name == "removeDefaultPrefs"
|
||||
}.hookBefore {
|
||||
if (!XSPUtils.getBoolean("show_notification_importance", false)) return@hookBefore
|
||||
val importance =
|
||||
it.thisObject.invokeMethodAuto("findPreference", "importance") ?: return@hookBefore
|
||||
val importance = it.thisObject.invokeMethodAuto("findPreference", "importance") ?: return@hookBefore
|
||||
val mChannel = it.thisObject.getObject("mChannel") as NotificationChannel
|
||||
val index = importance.invokeMethodAutoAs<Int>(
|
||||
"findSpinnerIndexOfValue",
|
||||
mChannel.importance.toString()
|
||||
) as Int
|
||||
val index = importance.invokeMethodAutoAs<Int>("findSpinnerIndexOfValue", mChannel.importance.toString())!!
|
||||
if (index < 0) return@hookBefore
|
||||
importance.invokeMethodAuto("setValueIndex", index)
|
||||
XposedHelpers.setAdditionalInstanceField(
|
||||
importance,
|
||||
"channelNotificationSettings",
|
||||
it.thisObject
|
||||
)
|
||||
XposedHelpers.setAdditionalInstanceField(importance, "channelNotificationSettings", it.thisObject)
|
||||
it.result = null
|
||||
}
|
||||
|
||||
findMethod("androidx.preference.Preference") {
|
||||
name == "callChangeListener" && parameterTypes[0] == Any::class.java
|
||||
}.hookAfter {
|
||||
val channelNotificationSettings = XposedHelpers.getAdditionalInstanceField(
|
||||
it.thisObject,
|
||||
"channelNotificationSettings"
|
||||
) ?: return@hookAfter
|
||||
val channelNotificationSettings = XposedHelpers.getAdditionalInstanceField(it.thisObject, "channelNotificationSettings") ?: return@hookAfter
|
||||
val mChannel = channelNotificationSettings.getObject("mChannel") as NotificationChannel
|
||||
mChannel.invokeMethodAuto("setImportance", (it.args[0] as String).toInt())
|
||||
val mBackend =
|
||||
channelNotificationSettings.getObjectOrNull("mBackend") ?: return@hookAfter
|
||||
val mBackend = channelNotificationSettings.getObjectOrNull("mBackend") ?: return@hookAfter
|
||||
val mPkg = channelNotificationSettings.getObjectAs<String>("mPkg")
|
||||
val mUid = channelNotificationSettings.getObjectAs<Int>("mUid")
|
||||
mBackend.invokeMethodAuto("updateChannel", mPkg, mUid, mChannel)
|
||||
|
||||
@@ -33,13 +33,13 @@ object ControlCenterWeather : HookRegister() {
|
||||
!SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
|
||||
) {
|
||||
//获取原组件
|
||||
val big_time_ID =
|
||||
val bigTimeId =
|
||||
context.resources.getIdentifier("big_time", "id", context.packageName)
|
||||
val big_time: TextView = viewGroup.findViewById(big_time_ID)
|
||||
val big_time: TextView = viewGroup.findViewById(bigTimeId)
|
||||
|
||||
val date_time_ID =
|
||||
val dateTimeId =
|
||||
context.resources.getIdentifier("date_time", "id", context.packageName)
|
||||
val date_time: TextView = viewGroup.findViewById(date_time_ID)
|
||||
val dateTime: TextView = viewGroup.findViewById(dateTimeId)
|
||||
|
||||
//创建新布局
|
||||
val mConstraintLayoutLp = LinearLayout.LayoutParams(
|
||||
@@ -62,18 +62,18 @@ object ControlCenterWeather : HookRegister() {
|
||||
|
||||
//从原布局中删除组件
|
||||
(big_time.parent as ViewGroup).removeView(big_time)
|
||||
(date_time.parent as ViewGroup).removeView(date_time)
|
||||
(dateTime.parent as ViewGroup).removeView(dateTime)
|
||||
|
||||
//添加组件至新布局
|
||||
mConstraintLayout!!.addView(big_time)
|
||||
mConstraintLayout!!.addView(date_time)
|
||||
mConstraintLayout!!.addView(dateTime)
|
||||
|
||||
//组件属性
|
||||
val date_time_LP = ConstraintLayout.LayoutParams(
|
||||
val dateTimeLp = ConstraintLayout.LayoutParams(
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
).also {
|
||||
it.startToEnd = big_time_ID
|
||||
it.startToEnd = bigTimeId
|
||||
it.bottomToBottom = 0
|
||||
it.marginStart = context.resources.getDimensionPixelSize(
|
||||
context.resources.getIdentifier(
|
||||
@@ -84,7 +84,7 @@ object ControlCenterWeather : HookRegister() {
|
||||
)
|
||||
it.bottomMargin = dp2px(context, 5f)
|
||||
}
|
||||
date_time.layoutParams = date_time_LP
|
||||
dateTime.layoutParams = dateTimeLp
|
||||
|
||||
|
||||
//创建天气组件
|
||||
@@ -100,12 +100,12 @@ object ControlCenterWeather : HookRegister() {
|
||||
}
|
||||
mConstraintLayout!!.addView(mWeatherView)
|
||||
|
||||
val mWeatherView_LP = ConstraintLayout.LayoutParams(
|
||||
val mweatherviewLp = ConstraintLayout.LayoutParams(
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
).also {
|
||||
it.startToEnd = big_time_ID
|
||||
it.bottomToTop = date_time_ID
|
||||
it.startToEnd = bigTimeId
|
||||
it.bottomToTop = dateTimeId
|
||||
it.marginStart = context.resources.getDimensionPixelSize(
|
||||
context.resources.getIdentifier(
|
||||
"notification_panel_time_date_space",
|
||||
@@ -115,7 +115,7 @@ object ControlCenterWeather : HookRegister() {
|
||||
)
|
||||
}
|
||||
|
||||
(mWeatherView as WeatherView).layoutParams = mWeatherView_LP
|
||||
(mWeatherView as WeatherView).layoutParams = mweatherviewLp
|
||||
|
||||
} else {
|
||||
val layoutParam =
|
||||
|
||||
@@ -35,10 +35,8 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
val none = InitFields.moduleRes.getString(R.string.none)
|
||||
|
||||
if (XSPUtils.getString("status_bar_network_speed_dual_row_icon", none) != none) {
|
||||
upIcon = XSPUtils.getString("status_bar_network_speed_dual_row_icon", none)
|
||||
?.firstOrNull().toString()
|
||||
downIcon = XSPUtils.getString("status_bar_network_speed_dual_row_icon", none)
|
||||
?.lastOrNull().toString()
|
||||
upIcon = XSPUtils.getString("status_bar_network_speed_dual_row_icon", none)?.firstOrNull().toString()
|
||||
downIcon = XSPUtils.getString("status_bar_network_speed_dual_row_icon", none)?.lastOrNull().toString()
|
||||
}
|
||||
|
||||
findConstructor("com.android.systemui.statusbar.views.NetworkSpeedView") {
|
||||
@@ -62,16 +60,12 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
name == "formatSpeed" && parameterCount == 2
|
||||
}.hookBefore {
|
||||
if (getDualAlign == 0) {
|
||||
it.result =
|
||||
"$upIcon ${getTotalUpSpeed(it.args[0] as Context)}\n${downIcon} ${
|
||||
it.result = "$upIcon ${getTotalUpSpeed(it.args[0] as Context)}\n${downIcon} ${
|
||||
getTotalDownloadSpeed(it.args[0] as Context)
|
||||
}"
|
||||
} else {
|
||||
it.result =
|
||||
"${getTotalUpSpeed(it.args[0] as Context)} ${upIcon}\n${
|
||||
getTotalDownloadSpeed(
|
||||
it.args[0] as Context
|
||||
)
|
||||
it.result = "${getTotalUpSpeed(it.args[0] as Context)} ${upIcon}\n${
|
||||
getTotalDownloadSpeed(it.args[0] as Context)
|
||||
} $downIcon"
|
||||
}
|
||||
}
|
||||
@@ -85,30 +79,15 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
val nowTimeStampTotalUp = System.currentTimeMillis()
|
||||
|
||||
//计算上传速度
|
||||
val bytes =
|
||||
(currentTotalTxBytes - mLastTotalUp) * 1000 / (nowTimeStampTotalUp - lastTimeStampTotalUp).toFloat()
|
||||
val bytes = (currentTotalTxBytes - mLastTotalUp) * 1000 / (nowTimeStampTotalUp - lastTimeStampTotalUp).toFloat()
|
||||
val unit: String
|
||||
|
||||
if (bytes >= 1048576) {
|
||||
totalUpSpeed =
|
||||
DecimalFormat("0.0").format(bytes / 1048576).toFloat()
|
||||
unit = context.resources.getString(
|
||||
context.resources.getIdentifier(
|
||||
"megabyte_per_second",
|
||||
"string",
|
||||
context.packageName
|
||||
)
|
||||
)
|
||||
totalUpSpeed = DecimalFormat("0.0").format(bytes / 1048576).toFloat()
|
||||
unit = context.resources.getString(context.resources.getIdentifier("megabyte_per_second", "string", context.packageName))
|
||||
} else {
|
||||
totalUpSpeed =
|
||||
DecimalFormat("0.0").format(bytes / 1024).toFloat()
|
||||
unit = context.resources.getString(
|
||||
context.resources.getIdentifier(
|
||||
"kilobyte_per_second",
|
||||
"string",
|
||||
context.packageName
|
||||
)
|
||||
)
|
||||
totalUpSpeed = DecimalFormat("0.0").format(bytes / 1024).toFloat()
|
||||
unit = context.resources.getString(context.resources.getIdentifier("kilobyte_per_second", "string", context.packageName))
|
||||
}
|
||||
|
||||
//保存当前的流量总和和上次的时间戳
|
||||
@@ -116,9 +95,9 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
lastTimeStampTotalUp = nowTimeStampTotalUp
|
||||
|
||||
return if (totalUpSpeed >= 100) {
|
||||
"" + totalUpSpeed.toInt() + unit
|
||||
"${totalUpSpeed.toInt()}$unit"
|
||||
} else {
|
||||
"" + totalUpSpeed + unit
|
||||
"${totalUpSpeed}$unit"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,40 +108,25 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
val nowTimeStampTotalDown = System.currentTimeMillis()
|
||||
|
||||
//计算下行速度
|
||||
val bytes =
|
||||
(currentTotalRxBytes - mLastTotalDown) * 1000 / (nowTimeStampTotalDown - lastTimeStampTotalDown).toFloat()
|
||||
val bytes = (currentTotalRxBytes - mLastTotalDown) * 1000 / (nowTimeStampTotalDown - lastTimeStampTotalDown).toFloat()
|
||||
|
||||
val unit: String
|
||||
|
||||
if (bytes >= 1048576) {
|
||||
totalDownSpeed =
|
||||
DecimalFormat("0.0").format(bytes / 1048576).toFloat()
|
||||
unit = context.resources.getString(
|
||||
context.resources.getIdentifier(
|
||||
"megabyte_per_second",
|
||||
"string",
|
||||
context.packageName
|
||||
)
|
||||
)
|
||||
totalDownSpeed = DecimalFormat("0.0").format(bytes / 1048576).toFloat()
|
||||
unit = context.resources.getString(context.resources.getIdentifier("megabyte_per_second", "string", context.packageName))
|
||||
} else {
|
||||
totalDownSpeed =
|
||||
DecimalFormat("0.0").format(bytes / 1024).toFloat()
|
||||
unit = context.resources.getString(
|
||||
context.resources.getIdentifier(
|
||||
"kilobyte_per_second",
|
||||
"string",
|
||||
context.packageName
|
||||
)
|
||||
)
|
||||
totalDownSpeed = DecimalFormat("0.0").format(bytes / 1024).toFloat()
|
||||
unit = context.resources.getString(context.resources.getIdentifier("kilobyte_per_second", "string", context.packageName))
|
||||
}
|
||||
//保存当前的流量总和和上次的时间戳
|
||||
mLastTotalDown = currentTotalRxBytes
|
||||
lastTimeStampTotalDown = nowTimeStampTotalDown
|
||||
|
||||
return if (totalDownSpeed >= 100) {
|
||||
"" + totalDownSpeed.toInt() + unit
|
||||
"${totalDownSpeed.toInt()}$unit"
|
||||
} else {
|
||||
"" + totalDownSpeed + unit
|
||||
"${totalDownSpeed}$unit"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,14 +62,8 @@ object LockScreenClockDisplaySeconds : HookRegister() {
|
||||
val textV = it.thisObject.getObjectAs<TextView>("mTimeText")
|
||||
val c: Context = textV.context
|
||||
|
||||
Log.d(
|
||||
"lock_screen_clock_display_seconds",
|
||||
"updateTime: " + it.thisObject.javaClass.simpleName
|
||||
)
|
||||
val is24 = Settings.System.getString(
|
||||
c.contentResolver,
|
||||
Settings.System.TIME_12_24
|
||||
) == "24"
|
||||
Log.d("lock_screen_clock_display_seconds", "updateTime: ${it.thisObject.javaClass.simpleName}")
|
||||
val is24 = Settings.System.getString(c.contentResolver, Settings.System.TIME_12_24) == "24"
|
||||
|
||||
nowTime = Calendar.getInstance().time
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.lt2333.simplicitytools.hook.app.systemui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
import android.app.AndroidAppHelper
|
||||
import android.content.Context
|
||||
import android.os.BatteryManager
|
||||
import android.widget.TextView
|
||||
import com.github.kyuubiran.ezxhelper.init.InitFields
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
@@ -11,8 +14,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import java.io.BufferedReader
|
||||
import java.io.FileReader
|
||||
import java.lang.reflect.Method
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.math.abs
|
||||
|
||||
object LockScreenCurrent : HookRegister() {
|
||||
|
||||
@@ -20,43 +22,22 @@ object LockScreenCurrent : HookRegister() {
|
||||
findMethod("com.android.keyguard.charge.ChargeUtils") {
|
||||
name == "getChargingHintText" && parameterCount == 3
|
||||
}.hookAfter {
|
||||
it.result = getCurrent() + "\n" + it.result
|
||||
it.result = "${getCurrent()}\n${it.result}"
|
||||
}
|
||||
|
||||
findMethod("com.android.systemui.statusbar.phone.KeyguardBottomAreaView") {
|
||||
name == "onFinishInflate"
|
||||
}.hookAfter {
|
||||
(it.thisObject.getObject(
|
||||
"mIndicationText"
|
||||
) as TextView).isSingleLine = false
|
||||
(it.thisObject.getObject("mIndicationText") as TextView).isSingleLine = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 原始代码来自 CSDN
|
||||
* https://blog.csdn.net/zhangyongfeiyong/article/details/53641809
|
||||
*/
|
||||
@SuppressLint("PrivateApi")
|
||||
|
||||
|
||||
private fun getCurrent(): String {
|
||||
var result = ""
|
||||
try {
|
||||
val systemProperties = Class.forName("android.os.SystemProperties")
|
||||
val get = systemProperties.getDeclaredMethod("get", String::class.java) as Method
|
||||
val platName = get.invoke(null, "ro.hardware") as String
|
||||
if (platName.startsWith("mt") || platName.startsWith("MT")) {
|
||||
val filePath =
|
||||
"/sys/class/power_supply/battery/device/FG_Battery_CurrentConsumption"
|
||||
val current = (-getMeanCurrentVal(filePath, 5, 0) / 1000.0f).roundToInt()
|
||||
result = "${InitFields.moduleRes.getString(R.string.current_current)} ${current}mA"
|
||||
} else if (platName.startsWith("qcom")) {
|
||||
val filePath = "/sys/class/power_supply/battery/current_now"
|
||||
val current = (-getMeanCurrentVal(filePath, 5, 0) / 1000.0f).roundToInt()
|
||||
result = "${InitFields.moduleRes.getString(R.string.current_current)} ${current}mA"
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return result
|
||||
val batteryManager = AndroidAppHelper.currentApplication().getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||
val current = abs(batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW) / 1000)
|
||||
return "${InitFields.moduleRes.getString(R.string.current_current)} ${current}mA"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,17 +29,17 @@ object NotificationWeather : HookRegister() {
|
||||
val context = viewGroup.context
|
||||
|
||||
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||
if (SystemProperties[context, "ro.build.date.utc"]!!.toInt() >= 1647014400 &&
|
||||
!SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
|
||||
if (SystemProperties[context, "ro.build.date.utc"].toInt() >= 1647014400 &&
|
||||
!SystemProperties[context, "ro.build.version.incremental"].endsWith("XM")
|
||||
) {
|
||||
//获取原组件
|
||||
val big_time_ID =
|
||||
val bigTimeId =
|
||||
context.resources.getIdentifier("big_time", "id", context.packageName)
|
||||
val big_time: TextView = viewGroup.findViewById(big_time_ID)
|
||||
val bigTime: TextView = viewGroup.findViewById(bigTimeId)
|
||||
|
||||
val date_time_ID =
|
||||
val dateTimeId =
|
||||
context.resources.getIdentifier("date_time", "id", context.packageName)
|
||||
val date_time: TextView = viewGroup.findViewById(date_time_ID)
|
||||
val dateTime: TextView = viewGroup.findViewById(dateTimeId)
|
||||
|
||||
//创建新布局
|
||||
val mConstraintLayoutLp = LinearLayout.LayoutParams(
|
||||
@@ -58,25 +58,25 @@ object NotificationWeather : HookRegister() {
|
||||
mConstraintLayout =
|
||||
ConstraintLayout(context).also { it.layoutParams = mConstraintLayoutLp }
|
||||
|
||||
(big_time.parent as ViewGroup).addView(mConstraintLayout, 0)
|
||||
(bigTime.parent as ViewGroup).addView(mConstraintLayout, 0)
|
||||
|
||||
|
||||
//从原布局中删除组件
|
||||
(big_time.parent as ViewGroup).removeView(big_time)
|
||||
(date_time.parent as ViewGroup).removeView(date_time)
|
||||
(bigTime.parent as ViewGroup).removeView(bigTime)
|
||||
(dateTime.parent as ViewGroup).removeView(dateTime)
|
||||
|
||||
|
||||
//添加组件至新布局
|
||||
mConstraintLayout!!.addView(big_time)
|
||||
mConstraintLayout!!.addView(date_time)
|
||||
mConstraintLayout!!.addView(bigTime)
|
||||
mConstraintLayout!!.addView(dateTime)
|
||||
|
||||
//组件属性
|
||||
|
||||
val date_time_LP = ConstraintLayout.LayoutParams(
|
||||
val dateTimeLp = ConstraintLayout.LayoutParams(
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
).also {
|
||||
it.startToEnd = big_time_ID
|
||||
it.startToEnd = bigTimeId
|
||||
it.bottomToBottom = 0
|
||||
it.marginStart = context.resources.getDimensionPixelSize(
|
||||
context.resources.getIdentifier(
|
||||
@@ -87,7 +87,7 @@ object NotificationWeather : HookRegister() {
|
||||
)
|
||||
it.bottomMargin = dp2px(context, 5f)
|
||||
}
|
||||
date_time.layoutParams = date_time_LP
|
||||
dateTime.layoutParams = dateTimeLp
|
||||
|
||||
|
||||
//创建天气组件
|
||||
@@ -103,12 +103,12 @@ object NotificationWeather : HookRegister() {
|
||||
}
|
||||
mConstraintLayout!!.addView(mWeatherView)
|
||||
|
||||
val mWeatherView_LP = ConstraintLayout.LayoutParams(
|
||||
val mweatherviewLp = ConstraintLayout.LayoutParams(
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
).also {
|
||||
it.startToEnd = big_time_ID
|
||||
it.bottomToTop = date_time_ID
|
||||
it.startToEnd = bigTimeId
|
||||
it.bottomToTop = dateTimeId
|
||||
it.marginStart = context.resources.getDimensionPixelSize(
|
||||
context.resources.getIdentifier(
|
||||
"notification_panel_time_date_space",
|
||||
@@ -118,7 +118,7 @@ object NotificationWeather : HookRegister() {
|
||||
)
|
||||
}
|
||||
|
||||
(mWeatherView as WeatherView).layoutParams = mWeatherView_LP
|
||||
(mWeatherView as WeatherView).layoutParams = mweatherviewLp
|
||||
|
||||
} else {
|
||||
val layoutParam =
|
||||
|
||||
@@ -118,12 +118,12 @@ object StatusBarLayout : HookRegister() {
|
||||
|
||||
mConstraintLayout.addView(notificationIconAreaInner)
|
||||
|
||||
val fullscreen_notification_icon_area_lp = LinearLayout.LayoutParams(
|
||||
val fullscreenNotificationIconAreaLp = LinearLayout.LayoutParams(
|
||||
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
|
||||
notificationIconAreaInner.layoutParams = fullscreen_notification_icon_area_lp
|
||||
notificationIconAreaInner.layoutParams = fullscreenNotificationIconAreaLp
|
||||
|
||||
//增加一个左对齐布局
|
||||
mLeftLayout = LinearLayout(context)
|
||||
@@ -404,16 +404,16 @@ object StatusBarLayout : HookRegister() {
|
||||
}.hookAfter {
|
||||
val miuiPhoneStatusBarView = it.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||
val res = miuiPhoneStatusBarView.resources
|
||||
val status_bar_ID =
|
||||
val statusBarId =
|
||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||
val status_bar = miuiPhoneStatusBarView.findViewById<ViewGroup>(status_bar_ID)
|
||||
val statusBar1 = miuiPhoneStatusBarView.findViewById<ViewGroup>(statusBarId)
|
||||
//非锁屏下整个状态栏布局
|
||||
val keyguardMgr =
|
||||
status_bar.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||
statusBar1.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||
if (keyguardMgr.isKeyguardLocked) {
|
||||
status_bar!!.visibility = View.GONE
|
||||
statusBar1!!.visibility = View.GONE
|
||||
} else {
|
||||
status_bar!!.visibility = View.VISIBLE
|
||||
statusBar1!!.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.service.quicksettings.Tile
|
||||
import android.service.quicksettings.TileService
|
||||
|
||||
class AllowScreenshots : TileService() {
|
||||
val key = "disable_flag_secure"
|
||||
private val key = "disable_flag_secure"
|
||||
|
||||
override fun onClick() {
|
||||
super.onClick()
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.service.quicksettings.TileService
|
||||
|
||||
class LockMaxFpsTile : TileService() {
|
||||
|
||||
val key = "lock_max_fps"
|
||||
private val key = "lock_max_fps"
|
||||
|
||||
override fun onClick() {
|
||||
super.onClick()
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.content.Context
|
||||
|
||||
object SystemProperties {
|
||||
@SuppressLint("PrivateApi")
|
||||
operator fun get(context: Context, key: String?): String? {
|
||||
operator fun get(context: Context, key: String?): String {
|
||||
var ret = ""
|
||||
try {
|
||||
val cl = context.classLoader
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.github.kyuubiran.ezxhelper.utils.Log.logexIfThrow
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||
import de.robv.android.xposed.IXposedHookZygoteInit
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
abstract class EasyXposedInit : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
|
||||
@@ -14,7 +14,7 @@ import android.widget.TextView
|
||||
class WeatherView(context: Context?, private val showCity: Boolean) : TextView(context) {
|
||||
|
||||
private val mContext: Context
|
||||
private val WEATHER_URI = Uri.parse("content://weather/weather")
|
||||
private val weatherUri = Uri.parse("content://weather/weather")
|
||||
private val mHandler: Handler
|
||||
private val mWeatherObserver: ContentObserver?
|
||||
private val mWeatherRunnable: WeatherRunnable
|
||||
@@ -30,7 +30,7 @@ class WeatherView(context: Context?, private val showCity: Boolean) : TextView(c
|
||||
mWeatherObserver = WeatherContentObserver(mHandler)
|
||||
mContext = context!!
|
||||
mWeatherRunnable = WeatherRunnable()
|
||||
context.contentResolver.registerContentObserver(WEATHER_URI, true, mWeatherObserver)
|
||||
context.contentResolver.registerContentObserver(weatherUri, true, mWeatherObserver)
|
||||
updateWeatherInfo()
|
||||
}
|
||||
|
||||
@@ -44,19 +44,13 @@ class WeatherView(context: Context?, private val showCity: Boolean) : TextView(c
|
||||
override fun run() {
|
||||
var str = ""
|
||||
try {
|
||||
val query = mContext.contentResolver.query(WEATHER_URI, null, null, null, null)
|
||||
val query = mContext.contentResolver.query(weatherUri, null, null, null, null)
|
||||
if (query != null) {
|
||||
if (query.moveToFirst()) {
|
||||
if (showCity) {
|
||||
str =
|
||||
query.getString(query.getColumnIndexOrThrow("city_name")) + " " + query.getString(
|
||||
query.getColumnIndexOrThrow("description")
|
||||
) + " " + query.getString(query.getColumnIndexOrThrow("temperature"))
|
||||
str = if (showCity) {
|
||||
query.getString(query.getColumnIndexOrThrow("city_name")) + " " + query.getString(query.getColumnIndexOrThrow("description")) + " " + query.getString(query.getColumnIndexOrThrow("temperature"))
|
||||
} else {
|
||||
str =
|
||||
query.getString(
|
||||
query.getColumnIndexOrThrow("description")
|
||||
) + " " + query.getString(query.getColumnIndexOrThrow("temperature"))
|
||||
query.getString(query.getColumnIndexOrThrow("description")) + " " + query.getString(query.getColumnIndexOrThrow("temperature"))
|
||||
}
|
||||
}
|
||||
query.close()
|
||||
|
||||
Submodule blockmiui updated: fbaed7f8ed...63e7817f3f
Reference in New Issue
Block a user