加入快捷跳转应用信息页面操作

This commit is contained in:
2022-01-25 04:36:38 +08:00
parent 5eb2729eb6
commit bacff6b275
6 changed files with 131 additions and 2 deletions

3
.idea/misc.xml generated
View File

@@ -4,10 +4,11 @@
<option name="filePathToZoomLevelMap">
<map>
<entry key="app/src/main/res/drawable-v24/dark_round.xml" value="0.4482051282051282" />
<entry key="app/src/main/res/drawable/button_round.xml" value="0.44871794871794873" />
<entry key="app/src/main/res/drawable/dark_round.xml" value="0.4482051282051282" />
<entry key="app/src/main/res/drawable/permotion_round.xml" value="0.4482051282051282" />
<entry key="app/src/main/res/drawable/red_round.xml" value="0.4482051282051282" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.375" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.3586910327241819" />
</map>
</option>
</component>

View File

@@ -48,6 +48,7 @@ import com.fankes.tsbattery.hook.HookMedium.TIM_PACKAGE_NAME
import com.fankes.tsbattery.hook.HookMedium.WECHAT_PACKAGE_NAME
import com.fankes.tsbattery.utils.FileUtils
import com.fankes.tsbattery.utils.isInstall
import com.fankes.tsbattery.utils.openSelfSetting
import com.fankes.tsbattery.utils.showDialog
import com.gyf.immersionbar.ImmersionBar
import java.io.File
@@ -181,6 +182,12 @@ class MainActivity : AppCompatActivity() {
if (!btn.isPressed) return@setOnCheckedChangeListener
putBoolean(HookMedium.ENABLE_RUN_INFO, b)
}
/** 快捷操作 QQ */
findViewById<View>(R.id.quick_qq_button).setOnClickListener { openSelfSetting(QQ_PACKAGE_NAME) }
/** 快捷操作 TIM */
findViewById<View>(R.id.quick_tim_button).setOnClickListener { openSelfSetting(TIM_PACKAGE_NAME) }
/** 快捷操作微信 */
findViewById<View>(R.id.quick_wechat_button).setOnClickListener { openSelfSetting(WECHAT_PACKAGE_NAME) }
/** 恰饭! */
findViewById<View>(R.id.link_with_follow_me).setOnClickListener {
try {

View File

@@ -23,8 +23,12 @@
package com.fankes.tsbattery.utils
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.provider.Settings
import android.widget.Toast
import com.fankes.tsbattery.application.TSApplication.Companion.appContext
/**
@@ -74,3 +78,19 @@ val Number.dp get() = (toFloat() * appContext.resources.displayMetrics.density).
*/
fun Number.dp(context: Context) = toFloat() * context.resources.displayMetrics.density
/**
* 跳转 APP 自身设置界面
* @param packageName 包名
*/
fun Context.openSelfSetting(packageName: String) {
try {
startActivity(Intent().apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
data = Uri.fromParts("package", packageName, null)
})
} catch (_: Exception) {
Toast.makeText(this, "启动 $packageName 应用信息失败", Toast.LENGTH_SHORT).show()
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#777777">
<item>
<shape android:shape="rectangle">
<solid android:color="#66DAD9D9" />
<corners android:radius="15dp" />
</shape>
</item>
</ripple>

View File

@@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.MainActivity"
tools:ignore="HardcodedText,UseCompoundDrawables,ContentDescription">
tools:ignore="HardcodedText,UseCompoundDrawables,ContentDescription,TooManyViews">
<LinearLayout
android:layout_width="match_parent"
@@ -418,6 +418,87 @@
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:background="@drawable/permotion_round"
android:elevation="0dp"
android:gravity="center"
android:orientation="vertical"
android:padding="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:gravity="center|start">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginEnd="10dp"
android:src="@mipmap/shot_icon" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.85"
android:singleLine="true"
android:text="快捷操作"
android:textColor="#FF323B42"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/quick_qq_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:background="@drawable/button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="QQ"
android:textColor="#FF323B42"
android:textSize="15sp" />
<TextView
android:id="@+id/quick_tim_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:background="@drawable/button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="TIM"
android:textColor="#FF323B42"
android:textSize="15sp" />
<TextView
android:id="@+id/quick_wechat_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="微信"
android:textColor="#FF323B42"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -558,6 +639,16 @@
android:textColor="#777777"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:alpha="0.8"
android:lineSpacingExtra="6dp"
android:text="Q.模块是否需要挂后台?\nA.模块完全不需要挂后台,模块只是一个控制和显示的工具,真正的任务交由 Hook 处理,若出现失效的情况请发送模块运行日志给我们而不是将模块挂后台。"
android:textColor="#777777"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB