合并优化代码,优化模块主界面显示效果,加入微信省电的未来计划(新建文件夹)

This commit is contained in:
2021-12-22 00:28:23 +08:00
parent 673dc8127b
commit 15b1bfa498
9 changed files with 158 additions and 19 deletions

7
.idea/misc.xml generated
View File

@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="app/src/main/res/layout/activity_main.xml" value="0.375" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>

View File

@@ -31,7 +31,8 @@
<activity
android:name="com.fankes.tsbattery.ui.MainActivity"
android:exported="true"
android:label="@string/app_name">
android:label="@string/app_name"
android:screenOrientation="behind">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -44,6 +45,7 @@
android:enabled="true"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="behind"
android:targetActivity="com.fankes.tsbattery.ui.MainActivity">
<intent-filter>

View File

@@ -106,6 +106,7 @@ class HookMain : IXposedHookLoadPackage {
replaceToNull(BASE_CHAT_PIE, "bf")
replaceToNull(BASE_CHAT_PIE, "bg")
}
/** 8.8.35 贡献者StarWishsama */
"8.8.35", "8.8.38" -> {
replaceToNull(BASE_CHAT_PIE, "bi")
replaceToNull(BASE_CHAT_PIE, "bj")

View File

@@ -52,7 +52,9 @@ class MainActivity : AppCompatActivity() {
companion object {
private const val moduleVersion = BuildConfig.VERSION_NAME
private const val moduleSupport = "QQ 8.5.5~8.8.50、TIM 2+"
private const val qqSupportVersion = "8.8.17、8.8.23、8.8.35、8.8.38、8.8.50 (8.5.5~8.8.50)"
private const val timSupportVersion = "2+、3+ (并未完全测试每个版本)"
private const val wechatSupportVersion = "敬请期待"
/** 声明当前实例 */
var instance: MainActivity? = null
@@ -86,7 +88,8 @@ class MainActivity : AppCompatActivity() {
.setTitle("模块没有激活")
.setMessage(
"检测到模块没有激活,模块需要 Xposed 环境依赖,同时需要系统拥有 Root 权限(太极阴可以免 Root),请自行查看本页面使用帮助与说明第三条。\n" +
"太极、应用转生、梦境(Pine)和第三方 Xposed 激活后可能不会提示激活,若想验证是否激活请打开“提示模块运行信息”自行检查,如果生效就代表模块运行正常,这里的激活状态只是一个显示意义上的存在。\n" +
"太极、应用转生、梦境(Pine)和第三方 Xposed 激活后可能不会提示激活,若想验证是否激活请打开“提示模块运行信息”自行检查," +
"如果生效就代表模块运行正常,这里的激活状态只是一个显示意义上的存在。\n" +
"太极(无极)在 MIUI 设备上会提示打开授权,请进行允许,然后再次打开本应用查看激活状态。"
)
.setPositiveButton("我知道了", null)
@@ -94,7 +97,36 @@ class MainActivity : AppCompatActivity() {
.show()
/** 设置文本 */
findViewById<TextView>(R.id.main_text_version).text = "当前版本:$moduleVersion"
findViewById<TextView>(R.id.main_text_support).text = "支持 $moduleSupport"
findViewById<TextView>(R.id.main_text_support_qq).apply {
text = qqSupportVersion
setOnClickListener {
AlertDialog.Builder(this@MainActivity)
.setTitle("兼容的 QQ 版本")
.setMessage(qqSupportVersion)
.setPositiveButton("我知道了", null)
.show()
}
}
findViewById<TextView>(R.id.main_text_support_tim).apply {
text = timSupportVersion
setOnClickListener {
AlertDialog.Builder(this@MainActivity)
.setTitle("兼容的 TIM 版本")
.setMessage(timSupportVersion)
.setPositiveButton("我知道了", null)
.show()
}
}
findViewById<TextView>(R.id.main_text_support_wechat).apply {
text = wechatSupportVersion
setOnClickListener {
AlertDialog.Builder(this@MainActivity)
.setTitle("兼容的微信版本")
.setMessage(wechatSupportVersion)
.setPositiveButton("我知道了", null)
.show()
}
}
/** 初始化 View */
val protectModeSwitch = findViewById<SwitchCompat>(R.id.protect_mode_switch)
val hideIconInLauncherSwitch = findViewById<SwitchCompat>(R.id.hide_icon_in_launcher_switch)
@@ -220,6 +252,11 @@ class MainActivity : AppCompatActivity() {
}
}
override fun onBackPressed() {
setWorldReadable()
super.onBackPressed()
}
override fun onDestroy() {
super.onDestroy()
/** 销毁实例防止内存泄漏 */

View File

@@ -5,7 +5,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.MainActivity"
tools:ignore="HardcodedText">
tools:ignore="HardcodedText,UseCompoundDrawables,ContentDescription">
<LinearLayout
android:layout_width="match_parent"
@@ -61,27 +61,120 @@
android:id="@+id/main_text_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginBottom="10dp"
android:alpha="0.8"
android:text="当前版本:%1"
android:textColor="@color/white"
android:textSize="13sp" />
<TextView
android:id="@+id/main_text_support"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:alpha="0.8"
android:text="支持 %1"
android:textColor="@color/white"
android:textSize="12sp" />
android:layout_marginBottom="7dp"
android:gravity="center|start"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginEnd="5dp"
android:src="@mipmap/qq_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:alpha="0.8"
android:text="兼容"
android:textColor="@color/white"
android:textSize="11sp" />
<TextView
android:id="@+id/main_text_support_qq"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.8"
android:ellipsize="end"
android:singleLine="true"
android:text="%1"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:gravity="center|start"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginEnd="5dp"
android:src="@mipmap/tim_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:alpha="0.8"
android:text="兼容"
android:textColor="@color/white"
android:textSize="11sp" />
<TextView
android:id="@+id/main_text_support_tim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.8"
android:ellipsize="end"
android:singleLine="true"
android:text="%1"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:gravity="center|start"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginEnd="5dp"
android:src="@mipmap/wechat_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:alpha="0.8"
android:text="兼容"
android:textColor="@color/white"
android:textSize="11sp" />
<TextView
android:id="@+id/main_text_support_wechat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.8"
android:ellipsize="end"
android:singleLine="true"
android:text="%1"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.6"
android:text="理论在小更新内还会生效,如果失效请看下方的联系方式"
android:lineSpacingExtra="5dp"
android:text="上述列出的版本号为最佳兼容版本,在适配范围内的版本都将有效,但可能不能达到最佳使用效果。\n如果当前版本失效请看下方的联系方式。"
android:textColor="@color/white"
android:textSize="10sp"
tools:ignore="SmallSp" />
@@ -366,8 +459,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:src="@mipmap/qr_pay"
tools:ignore="ContentDescription" />
android:src="@mipmap/qr_pay" />
<TextView
android:layout_width="match_parent"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.6.0"
ext.kotlin_version = "1.6.10"
repositories {
google()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
@@ -9,7 +9,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong