File tree Expand file tree Collapse file tree
app/src/main/java/com/zacharee1/systemuituner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ import androidx.core.view.WindowCompat
2323import com.zacharee1.systemuituner.R
2424import com.zacharee1.systemuituner.data.SettingsType
2525import com.zacharee1.systemuituner.util.launchUrl
26+ import com.zacharee1.systemuituner.util.openShizuku
27+ import com.zacharee1.systemuituner.util.openShizukuWebsite
2628import com.zacharee1.systemuituner.util.shizukuServiceManager
2729import dev.zwander.composeintroslider.IntroSlider
2830import dev.zwander.composeintroslider.SimpleIntroPage
@@ -77,16 +79,13 @@ class ReadSettingFailActivity : ComponentActivity() {
7779
7880 if (shizukuServiceManager.isShizukuInstalled) {
7981 OutlinedButton (onClick = {
80- startActivity(Intent (Intent .ACTION_MAIN ).apply {
81- addCategory(Intent .CATEGORY_LAUNCHER )
82- `package` = " moe.shizuku.privileged.api"
83- })
82+ openShizuku()
8483 }) {
8584 Text (text = stringResource(id = R .string.open_shizuku))
8685 }
8786 } else {
8887 OutlinedButton (onClick = {
89- launchUrl( " https://shizuku.rikka.app " )
88+ openShizukuWebsite( )
9089 }) {
9190 Text (text = stringResource(id = R .string.download_shizuku))
9291 }
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ import androidx.core.view.WindowCompat
2323import com.zacharee1.systemuituner.R
2424import com.zacharee1.systemuituner.data.SettingsType
2525import com.zacharee1.systemuituner.util.launchUrl
26+ import com.zacharee1.systemuituner.util.openShizuku
27+ import com.zacharee1.systemuituner.util.openShizukuWebsite
2628import com.zacharee1.systemuituner.util.shizukuServiceManager
2729import dev.zwander.composeintroslider.IntroSlider
2830import dev.zwander.composeintroslider.SimpleIntroPage
@@ -80,16 +82,13 @@ class WriteSettingFailActivity : ComponentActivity() {
8082
8183 if (shizukuServiceManager.isShizukuInstalled) {
8284 OutlinedButton (onClick = {
83- startActivity(Intent (Intent .ACTION_MAIN ).apply {
84- addCategory(Intent .CATEGORY_LAUNCHER )
85- `package` = " moe.shizuku.privileged.api"
86- })
85+ openShizuku()
8786 }) {
8887 Text (text = stringResource(id = R .string.open_shizuku))
8988 }
9089 } else {
9190 OutlinedButton (onClick = {
92- launchUrl( " https://shizuku.rikka.app " )
91+ openShizukuWebsite( )
9392 }) {
9493 Text (text = stringResource(id = R .string.download_shizuku))
9594 }
Original file line number Diff line number Diff line change 1+ package com.zacharee1.systemuituner.util
2+
3+ import android.content.ActivityNotFoundException
4+ import android.content.Context
5+ import android.content.Intent
6+
7+ fun Context.openShizuku () {
8+ try {
9+ startActivity(Intent (Intent .ACTION_MAIN ).apply {
10+ addCategory(Intent .CATEGORY_LAUNCHER )
11+ `package` = " moe.shizuku.privileged.api"
12+ })
13+ } catch (e: ActivityNotFoundException ) {
14+ openShizukuWebsite()
15+ }
16+ }
17+
18+ fun Context.openShizukuWebsite () {
19+ launchUrl(" https://shizuku.rikka.app" )
20+ }
You can’t perform that action at this time.
0 commit comments