mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 11:21:18 +08:00
Merge branch 'main' into main
This commit is contained in:
@@ -12,8 +12,8 @@ android {
|
|||||||
applicationId = "com.lt2333.simplicitytools"
|
applicationId = "com.lt2333.simplicitytools"
|
||||||
minSdk = 31
|
minSdk = 31
|
||||||
targetSdk = 32
|
targetSdk = 32
|
||||||
versionCode = 39
|
versionCode = 40
|
||||||
versionName = "1.3.8"
|
versionName = "1.3.9"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.view.WeatherView
|
import com.lt2333.simplicitytools.view.WeatherView
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
@@ -76,6 +79,19 @@ class ControlCenterWeather : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewGroup.addView(mWeatherView)
|
viewGroup.addView(mWeatherView)
|
||||||
|
(mWeatherView as WeatherView).setOnClickListener {
|
||||||
|
try {
|
||||||
|
val intent = Intent()
|
||||||
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
intent.component = ComponentName(
|
||||||
|
"com.miui.weather2",
|
||||||
|
"com.miui.weather2.ActivityWeatherMain"
|
||||||
|
)
|
||||||
|
viewGroup.context.startActivity(intent)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Toast.makeText(viewGroup.context, "启动失败,可能是不支持", Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//解决横屏重叠
|
//解决横屏重叠
|
||||||
|
|||||||
@@ -45,12 +45,22 @@ class HideWifiActivityIcon : IXposedHookLoadPackage {
|
|||||||
"com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState",
|
"com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState",
|
||||||
object : XC_MethodHook() {
|
object : XC_MethodHook() {
|
||||||
override fun afterHookedMethod(param: MethodHookParam) {
|
override fun afterHookedMethod(param: MethodHookParam) {
|
||||||
|
//隐藏WIFI箭头
|
||||||
if (XSPUtils.getBoolean("hide_wifi_activity_icon", false)) {
|
if (XSPUtils.getBoolean("hide_wifi_activity_icon", false)) {
|
||||||
(XposedHelpers.getObjectField(
|
(XposedHelpers.getObjectField(
|
||||||
param.thisObject,
|
param.thisObject,
|
||||||
"mWifiActivityView"
|
"mWifiActivityView"
|
||||||
) as ImageView).visibility = View.INVISIBLE
|
) as ImageView).visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//隐藏WIFI标准图标
|
||||||
|
if (XSPUtils.getBoolean("hide_wifi_standard_icon", false)) {
|
||||||
|
(XposedHelpers.getObjectField(
|
||||||
|
param.thisObject,
|
||||||
|
"mWifiStandardView"
|
||||||
|
) as TextView).visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.view.WeatherView
|
import com.lt2333.simplicitytools.view.WeatherView
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
@@ -75,6 +78,20 @@ class NotificationWeather : IXposedHookLoadPackage {
|
|||||||
it.layoutParams = layout
|
it.layoutParams = layout
|
||||||
}
|
}
|
||||||
viewGroup.addView(mWeatherView)
|
viewGroup.addView(mWeatherView)
|
||||||
|
|
||||||
|
(mWeatherView as WeatherView).setOnClickListener {
|
||||||
|
try {
|
||||||
|
val intent = Intent()
|
||||||
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
intent.component = ComponentName(
|
||||||
|
"com.miui.weather2",
|
||||||
|
"com.miui.weather2.ActivityWeatherMain"
|
||||||
|
)
|
||||||
|
viewGroup.context.startActivity(intent)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Toast.makeText(viewGroup.context, "启动失败", Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//解决横屏重叠
|
//解决横屏重叠
|
||||||
@@ -90,6 +107,9 @@ class NotificationWeather : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.view.WeatherView
|
import com.lt2333.simplicitytools.view.WeatherView
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
@@ -77,6 +80,19 @@ class OldNotificationWeather : IXposedHookLoadPackage {
|
|||||||
it.layoutParams = layout
|
it.layoutParams = layout
|
||||||
}
|
}
|
||||||
viewGroup.addView(mWeatherView)
|
viewGroup.addView(mWeatherView)
|
||||||
|
(mWeatherView as WeatherView).setOnClickListener {
|
||||||
|
try {
|
||||||
|
val intent = Intent()
|
||||||
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
intent.component = ComponentName(
|
||||||
|
"com.miui.weather2",
|
||||||
|
"com.miui.weather2.ActivityWeatherMain"
|
||||||
|
)
|
||||||
|
viewGroup.context.startActivity(intent)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Toast.makeText(viewGroup.context, "启动失败,可能是不支持", Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//解决横屏重叠
|
//解决横屏重叠
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.res.Configuration
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
@@ -165,7 +166,7 @@ class StatusBarLayout : IXposedHookLoadPackage {
|
|||||||
if (custom_right_margin != 0) {
|
if (custom_right_margin != 0) {
|
||||||
status_bar_right = custom_right_margin
|
status_bar_right = custom_right_margin
|
||||||
}
|
}
|
||||||
updateLayout()
|
updateLayout(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -182,7 +183,8 @@ class StatusBarLayout : IXposedHookLoadPackage {
|
|||||||
object : XC_MethodHook() {
|
object : XC_MethodHook() {
|
||||||
override fun afterHookedMethod(param: MethodHookParam) {
|
override fun afterHookedMethod(param: MethodHookParam) {
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
||||||
updateLayout()
|
val context = (param.thisObject as ViewGroup).context
|
||||||
|
updateLayout(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,10 +192,19 @@ class StatusBarLayout : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun updateLayout() {
|
fun updateLayout(context: Context) {
|
||||||
|
//判断屏幕方向
|
||||||
|
val mConfiguration: Configuration = context.resources.configuration
|
||||||
|
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
mLeftLayout!!.setPadding(status_bar_left, 0, 0, 0)
|
mLeftLayout!!.setPadding(status_bar_left, 0, 0, 0)
|
||||||
mRightLayout!!.setPadding(0, 0, status_bar_right, 0)
|
mRightLayout!!.setPadding(0, 0, status_bar_right, 0)
|
||||||
status_bar!!.setPadding(0, status_bar_top, 0, status_bar_bottom)
|
status_bar!!.setPadding(0, status_bar_top, 0, status_bar_bottom)
|
||||||
|
} else {
|
||||||
|
//横屏状态
|
||||||
|
mLeftLayout!!.setPadding(175, 0, 0, 0)
|
||||||
|
mRightLayout!!.setPadding(0, 0, 175, 0)
|
||||||
|
status_bar!!.setPadding(0, status_bar_top, 0, status_bar_bottom)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user