mirror of
https://github.com/fankes/TSBattery.git
synced 2025-09-04 17:55:30 +08:00
Added directly open module app function in ConfigActivity
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
|
||||
package com.fankes.tsbattery.ui.activity.parasitic
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
@@ -32,6 +34,7 @@ import com.fankes.tsbattery.data.ConfigData
|
||||
import com.fankes.tsbattery.data.ConfigData.bind
|
||||
import com.fankes.tsbattery.databinding.ActivityConfigBinding
|
||||
import com.fankes.tsbattery.hook.HookEntry
|
||||
import com.fankes.tsbattery.ui.activity.MainActivity
|
||||
import com.fankes.tsbattery.ui.activity.base.BaseActivity
|
||||
import com.fankes.tsbattery.utils.factory.*
|
||||
import com.fankes.tsbattery.utils.tool.GithubReleaseTool
|
||||
@@ -49,6 +52,21 @@ class ConfigActivity : BaseActivity<ActivityConfigBinding>() {
|
||||
}
|
||||
}
|
||||
binding.titleBackIcon.setOnClickListener { finish() }
|
||||
binding.titleModuleIcon.setOnClickListener {
|
||||
showDialog {
|
||||
title = "打开模块主界面"
|
||||
msg = "点击确定后将打开模块主界面,如果未安装模块本体将会无法打开。"
|
||||
confirmButton {
|
||||
runCatching {
|
||||
startActivity(Intent().apply {
|
||||
component = ComponentName(BuildConfig.APPLICATION_ID, MainActivity::class.java.name)
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
})
|
||||
}.onFailure { snake(msg = "打开失败,请确认你已安装模块 APP\n$it") }
|
||||
}
|
||||
cancelButton()
|
||||
}
|
||||
}
|
||||
binding.titleNameText.text = "TSBattery 设置 (${appName.trim()})"
|
||||
binding.appIcon.setImageDrawable(findAppIcon())
|
||||
binding.appName.text = appName.trim()
|
||||
|
@@ -32,14 +32,25 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_name_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="2.5dp"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/colorTextGray"
|
||||
android:textSize="19sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
android:id="@+id/title_module_icon"
|
||||
android:layout_width="23dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:padding="1.5dp"
|
||||
android:src="@drawable/ic_icon"
|
||||
android:tint="@color/colorTextGray"
|
||||
android:tooltipText="打开模块主界面" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
Reference in New Issue
Block a user