mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
Merge branch 'main' into main
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package com.lt2333.simplicitytools.hook.app.systemui
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.view.WeatherView
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||
@@ -76,6 +79,19 @@ class ControlCenterWeather : IXposedHookLoadPackage {
|
||||
}
|
||||
|
||||
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",
|
||||
object : XC_MethodHook() {
|
||||
override fun afterHookedMethod(param: MethodHookParam) {
|
||||
//隐藏WIFI箭头
|
||||
if (XSPUtils.getBoolean("hide_wifi_activity_icon", false)) {
|
||||
(XposedHelpers.getObjectField(
|
||||
param.thisObject,
|
||||
"mWifiActivityView"
|
||||
) 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
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.view.WeatherView
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||
@@ -64,7 +67,7 @@ class NotificationWeather : IXposedHookLoadPackage {
|
||||
)
|
||||
)
|
||||
|
||||
mWeatherView = WeatherView(viewGroup.context,isDisplayCity).also {
|
||||
mWeatherView = WeatherView(viewGroup.context, isDisplayCity).also {
|
||||
it.setTextAppearance(
|
||||
viewGroup.context.resources.getIdentifier(
|
||||
"TextAppearance.QSControl.Date",
|
||||
@@ -75,6 +78,20 @@ class NotificationWeather : IXposedHookLoadPackage {
|
||||
it.layoutParams = layout
|
||||
}
|
||||
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
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.view.WeatherView
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||
@@ -77,6 +80,19 @@ class OldNotificationWeather : IXposedHookLoadPackage {
|
||||
it.layoutParams = layout
|
||||
}
|
||||
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
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
@@ -165,7 +166,7 @@ class StatusBarLayout : IXposedHookLoadPackage {
|
||||
if (custom_right_margin != 0) {
|
||||
status_bar_right = custom_right_margin
|
||||
}
|
||||
updateLayout()
|
||||
updateLayout(context)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -182,7 +183,8 @@ class StatusBarLayout : IXposedHookLoadPackage {
|
||||
object : XC_MethodHook() {
|
||||
override fun afterHookedMethod(param: MethodHookParam) {
|
||||
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() {
|
||||
mLeftLayout!!.setPadding(status_bar_left, 0, 0, 0)
|
||||
mRightLayout!!.setPadding(0, 0, status_bar_right, 0)
|
||||
status_bar!!.setPadding(0, status_bar_top, 0, status_bar_bottom)
|
||||
fun updateLayout(context: Context) {
|
||||
//判断屏幕方向
|
||||
val mConfiguration: Configuration = context.resources.configuration
|
||||
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
mLeftLayout!!.setPadding(status_bar_left, 0, 0, 0)
|
||||
mRightLayout!!.setPadding(0, 0, status_bar_right, 0)
|
||||
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