mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 03:11:18 +08:00
Merge pull request #213
* Fix MaxWallpaperScale on MIUI14 * Fix ShowBatteryTemperature on MIUI14 * fix UnlockUnlimitedCropping on MIUI14 * Update UnlockUnlimitedCropping.kt
This commit is contained in:
@@ -7,7 +7,6 @@ plugins {
|
||||
|
||||
android {
|
||||
compileSdk = 33
|
||||
buildToolsVersion = "33.0.0"
|
||||
defaultConfig {
|
||||
applicationId = "com.lt2333.simplicitytools"
|
||||
minSdk = 31
|
||||
@@ -52,7 +51,7 @@ android {
|
||||
dependencies {
|
||||
//API
|
||||
compileOnly("de.robv.android.xposed:api:82")
|
||||
implementation("com.github.kyuubiran:EzXHelper:0.9.2")
|
||||
implementation("com.github.kyuubiran:EzXHelper:1.0.3")
|
||||
//UI
|
||||
implementation(project(":blockmiui"))
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
|
||||
|
||||
@@ -924,8 +924,8 @@ class SettingsActivity : MIUIActivity() {
|
||||
setTitle(R.string.max_wallpaper_scale)
|
||||
setEditText(
|
||||
"",
|
||||
"${activity.getString(R.string.def)}1.1, ${activity.getString(R.string.current)}${
|
||||
safeSP.getFloat("max_wallpaper_scale", 1.1f)
|
||||
"${activity.getString(R.string.def)}1.2, ${activity.getString(R.string.current)}${
|
||||
safeSP.getFloat("max_wallpaper_scale", 1.2f)
|
||||
}"
|
||||
)
|
||||
setLButton(textId = R.string.cancel) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.lt2333.simplicitytools.hook.app.android
|
||||
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAllConstructorAfter
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.github.kyuubiran.ezxhelper.utils.putObject
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
@@ -11,7 +12,11 @@ object MaxWallpaperScale : HookRegister() {
|
||||
findMethod("com.android.server.wm.WallpaperController") {
|
||||
name == "zoomOutToScale" && parameterTypes[0] == Float::class.java
|
||||
}.hookBefore {
|
||||
val value = XSPUtils.getFloat("max_wallpaper_scale", 1.1f)
|
||||
val value = XSPUtils.getFloat("max_wallpaper_scale", 1.2f)
|
||||
it.thisObject.putObject("mMaxWallpaperScale", value)
|
||||
}
|
||||
hookAllConstructorAfter("com.android.server.wm.WallpaperController") {
|
||||
val value = XSPUtils.getFloat("max_wallpaper_scale", 1.2f)
|
||||
it.thisObject.putObject("mMaxWallpaperScale", value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.lt2333.simplicitytools.hook.app.mediaeditor
|
||||
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.github.kyuubiran.ezxhelper.utils.loadClassOrNull
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
@@ -9,21 +10,57 @@ object UnlockUnlimitedCropping : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
//解锁图库裁切最小值
|
||||
findMethod("com.miui.gallery.editor.photo.core.imports.obsoletes.Crop\$ResizeDetector") {
|
||||
name == "calculateMinSize"
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
val resizeDetectorClass = loadClassOrNull("com.miui.gallery.editor.photo.core.imports.obsoletes.Crop\$ResizeDetector")
|
||||
if (resizeDetectorClass != null) {
|
||||
findMethod("com.miui.gallery.editor.photo.core.imports.obsoletes.Crop\$ResizeDetector") {
|
||||
name == "calculateMinSize"
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var resizeDetector = 'a'
|
||||
for (i in 0..25) {
|
||||
try {
|
||||
findMethod("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$${resizeDetector}") {
|
||||
returnType == Int::class.javaPrimitiveType && parameterCount == 0
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
}
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
resizeDetector++
|
||||
}
|
||||
}
|
||||
}
|
||||
//截图无限裁切
|
||||
findMethod("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$ResizeDetector") {
|
||||
name == "calculateMinSize"
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
val resizeDetectorClass1 = loadClassOrNull("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$ResizeDetector")
|
||||
if (resizeDetectorClass1 != null) {
|
||||
findMethod("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$ResizeDetector") {
|
||||
name == "calculateMinSize"
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var resizeDetector1 = 'a'
|
||||
for (i in 0..25) {
|
||||
try {
|
||||
findMethod("com.miui.gallery.editor.photo.core.imports.obsoletes.Crop\$${resizeDetector1}") {
|
||||
returnType == Int::class.javaPrimitiveType && parameterCount == 0
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
}
|
||||
}
|
||||
} catch (_: Throwable) {
|
||||
resizeDetector1++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ object ShowBatteryTemperature : HookRegister() {
|
||||
findMethod("com.miui.powercenter.a") {
|
||||
name == "b" && parameterTypes[0] == Context::class.java
|
||||
}
|
||||
} catch (e : Exception) {
|
||||
} catch (e: Exception) {
|
||||
findMethod("com.miui.powercenter.BatteryFragment") {
|
||||
name == "b" && parameterTypes[0] == Context::class.java
|
||||
}
|
||||
@@ -46,58 +46,53 @@ object ShowBatteryTemperature : HookRegister() {
|
||||
findMethod("com.miui.powercenter.a\$a") {
|
||||
name == "run"
|
||||
}
|
||||
} catch (e : Exception) {
|
||||
} catch (e: Exception) {
|
||||
findMethod("com.miui.powercenter.BatteryFragment\$a") {
|
||||
name == "run"
|
||||
}
|
||||
}.hookAfter {
|
||||
val context = AndroidAppHelper.currentApplication().applicationContext
|
||||
val isDarkMode =
|
||||
context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
|
||||
val currentTemperatureValue = context.resources.getIdentifier(
|
||||
"current_temperature_value",
|
||||
"id",
|
||||
"com.miui.securitycenter"
|
||||
)
|
||||
|
||||
val isDarkMode = context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
|
||||
val currentTemperatureState = context.resources.getIdentifier("current_temperature_state", "id", "com.miui.securitycenter")
|
||||
val view = it.thisObject.getObjectAs<View>("a")
|
||||
|
||||
val textView = view.findViewById<TextView>(currentTemperatureValue)
|
||||
val textView = view.findViewById<TextView>(currentTemperatureState)
|
||||
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)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36.4f)
|
||||
setPadding(0, dp2px(context, 4f), 0, 0)
|
||||
gravity = Gravity.NO_GRAVITY
|
||||
typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
height = dp2px(context, 49.099983f)
|
||||
typeface = Typeface.create(null, 700, false)
|
||||
height = dp2px(context, 49f)
|
||||
textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
||||
}
|
||||
|
||||
val tempView = TextView(context)
|
||||
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)
|
||||
val temperatureContainer = context.resources.getIdentifier("temperature_container", "id", "com.miui.securitycenter")
|
||||
val linearL = view.findViewById<LinearLayout>(temperatureContainer).getChildAt(1) as LinearLayout
|
||||
linearL.orientation = LinearLayout.VERTICAL
|
||||
val l1 = linearL.getChildAt(0)
|
||||
val l2 = linearL.getChildAt(1)
|
||||
val linearLayout = LinearLayout(context)
|
||||
val linearLayout1 = LinearLayout(context).apply { orientation = LinearLayout.HORIZONTAL }
|
||||
val tempView = TextView(context).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
(layoutParams as LinearLayout.LayoutParams).marginStart = dp2px(context, 3.599976f)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.1f)
|
||||
setTextColor(Color.parseColor(if (isDarkMode) "#e6e6e6" else "#333333"))
|
||||
setPadding(0, dp2px(context, 25f), 0, 0)
|
||||
setPadding(0, dp2px(context, 26f), 0, 0)
|
||||
text = "℃"
|
||||
typeface = Typeface.create(null, 500, false)
|
||||
gravity = Gravity.NO_GRAVITY
|
||||
typeface = Typeface.create(null, 700, false)
|
||||
textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
||||
}
|
||||
linearL.removeAllViews()
|
||||
|
||||
val tempeValueContainer = context.resources.getIdentifier(
|
||||
"tempe_value_container",
|
||||
"id",
|
||||
"com.miui.securitycenter"
|
||||
)
|
||||
linearLayout.addView(l1)
|
||||
linearLayout1.addView(l2)
|
||||
linearLayout1.addView(tempView)
|
||||
|
||||
val linearLayout = view.findViewById<LinearLayout>(tempeValueContainer)
|
||||
linearLayout.addView(tempView)
|
||||
linearL.addView(linearLayout)
|
||||
linearL.addView(linearLayout1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:7.2.1")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
|
||||
classpath("com.android.tools.build:gradle:7.4.0")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0")
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle.kts files
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Sat Apr 23 16:13:18 CST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Reference in New Issue
Block a user