-
Notifications
You must be signed in to change notification settings - Fork 0
Derive states from MainActivity alias enabled #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b9c3ca5
e889906
0327277
85a18d7
509e0c8
eb1245b
c779e11
f6aa101
df96231
33db1dd
1ca7e61
cdf537d
0e43e0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| package com.github.kr328.clash.design.store | ||
|
|
||
| import android.content.ComponentName | ||
| import android.content.Context | ||
| import android.content.pm.PackageManager | ||
| import com.github.kr328.clash.common.store.Store | ||
| import com.github.kr328.clash.common.store.asStoreProvider | ||
| import com.github.kr328.clash.core.model.ProxySort | ||
|
|
@@ -27,7 +29,11 @@ class UiStore(context: Context) { | |
|
|
||
| var hideAppIcon: Boolean by store.boolean( | ||
| key = "hide_app_icon", | ||
| defaultValue = false | ||
| defaultValue = context.packageManager.getComponentEnabledSetting(context.mainActivityAlias) | ||
| .let { state -> | ||
| state != PackageManager.COMPONENT_ENABLED_STATE_ENABLED && | ||
| state != PackageManager.COMPONENT_ENABLED_STATE_DEFAULT | ||
| }, | ||
| ) | ||
|
Comment on lines
30
to
37
|
||
|
|
||
| var hideFromRecents: Boolean by store.boolean( | ||
|
|
@@ -74,5 +80,8 @@ class UiStore(context: Context) { | |
|
|
||
| companion object { | ||
| private const val PREFERENCE_NAME = "ui" | ||
|
|
||
| val Context.mainActivityAlias: ComponentName | ||
| get() = ComponentName(this, "com.github.kr328.clash.MainActivityAlias") | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.