Remove unused files
This commit is contained in:
parent
5ba5f5f94e
commit
48395ba860
3
app/proguard-rules.pro
vendored
3
app/proguard-rules.pro
vendored
@ -36,9 +36,6 @@
|
|||||||
|
|
||||||
# Strip logging
|
# Strip logging
|
||||||
-assumenosideeffects class timber.log.Timber.Tree { *; }
|
-assumenosideeffects class timber.log.Timber.Tree { *; }
|
||||||
-assumenosideeffects class com.topjohnwu.magisk.utils.Logger {
|
|
||||||
public *** debug(...);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Excessive obfuscation
|
# Excessive obfuscation
|
||||||
-repackageclasses 'a'
|
-repackageclasses 'a'
|
||||||
|
@ -8,8 +8,12 @@ import android.os.Bundle
|
|||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.skoumal.teanity.rxbus.RxBus
|
import com.skoumal.teanity.rxbus.RxBus
|
||||||
import com.topjohnwu.magisk.App
|
import com.topjohnwu.magisk.App
|
||||||
|
import org.koin.core.qualifier.named
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
|
val SUTimeout = named("su_timeout")
|
||||||
|
val Protected = named("protected")
|
||||||
|
|
||||||
val applicationModule = module {
|
val applicationModule = module {
|
||||||
single { RxBus() }
|
single { RxBus() }
|
||||||
factory { get<Context>().resources }
|
factory { get<Context>().resources }
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.di
|
|
||||||
|
|
||||||
import org.koin.dsl.module
|
|
||||||
|
|
||||||
|
|
||||||
val miscModule = module {
|
|
||||||
|
|
||||||
// define miscs here
|
|
||||||
|
|
||||||
}
|
|
@ -5,6 +5,5 @@ val koinModules = listOf(
|
|||||||
networkingModule,
|
networkingModule,
|
||||||
databaseModule,
|
databaseModule,
|
||||||
repositoryModule,
|
repositoryModule,
|
||||||
viewModelModules,
|
viewModelModules
|
||||||
miscModule
|
|
||||||
)
|
)
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.di
|
|
||||||
|
|
||||||
import org.koin.core.qualifier.named
|
|
||||||
|
|
||||||
val SUTimeout = named("su_timeout")
|
|
||||||
val Protected = named("protected")
|
|
@ -1,61 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.model.entity;
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
|
||||||
|
|
||||||
|
|
||||||
public class Policy implements Comparable<Policy>{
|
|
||||||
public static final int INTERACTIVE = 0;
|
|
||||||
public static final int DENY = 1;
|
|
||||||
public static final int ALLOW = 2;
|
|
||||||
|
|
||||||
public int uid, policy = INTERACTIVE;
|
|
||||||
public long until;
|
|
||||||
public boolean logging = true, notification = true;
|
|
||||||
public String packageName, appName;
|
|
||||||
public ApplicationInfo info;
|
|
||||||
|
|
||||||
public Policy(int uid, PackageManager pm) throws PackageManager.NameNotFoundException {
|
|
||||||
String[] pkgs = pm.getPackagesForUid(uid);
|
|
||||||
if (pkgs == null || pkgs.length == 0)
|
|
||||||
throw new PackageManager.NameNotFoundException();
|
|
||||||
this.uid = uid;
|
|
||||||
packageName = pkgs[0];
|
|
||||||
info = pm.getApplicationInfo(packageName, 0);
|
|
||||||
appName = Utils.INSTANCE.getAppLabel(info, pm);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Policy(ContentValues values, PackageManager pm) throws PackageManager.NameNotFoundException {
|
|
||||||
uid = values.getAsInteger("uid");
|
|
||||||
packageName = values.getAsString("package_name");
|
|
||||||
policy = values.getAsInteger("policy");
|
|
||||||
until = values.getAsInteger("until");
|
|
||||||
logging = values.getAsInteger("logging") != 0;
|
|
||||||
notification = values.getAsInteger("notification") != 0;
|
|
||||||
info = pm.getApplicationInfo(packageName, 0);
|
|
||||||
if (info.uid != uid)
|
|
||||||
throw new PackageManager.NameNotFoundException();
|
|
||||||
appName = info.loadLabel(pm).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContentValues getContentValues() {
|
|
||||||
ContentValues values = new ContentValues();
|
|
||||||
values.put("uid", uid);
|
|
||||||
values.put("package_name", packageName);
|
|
||||||
values.put("policy", policy);
|
|
||||||
values.put("until", until);
|
|
||||||
values.put("logging", logging ? 1 : 0);
|
|
||||||
values.put("notification", notification ? 1 : 0);
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(@NonNull Policy policy) {
|
|
||||||
return appName.toLowerCase().compareTo(policy.appName.toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,7 +9,6 @@ import com.topjohnwu.magisk.R
|
|||||||
import com.topjohnwu.magisk.extensions.inject
|
import com.topjohnwu.magisk.extensions.inject
|
||||||
import com.topjohnwu.magisk.extensions.toggle
|
import com.topjohnwu.magisk.extensions.toggle
|
||||||
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
||||||
import com.topjohnwu.magisk.model.entity.Policy
|
|
||||||
import com.topjohnwu.magisk.model.events.PolicyEnableEvent
|
import com.topjohnwu.magisk.model.events.PolicyEnableEvent
|
||||||
import com.topjohnwu.magisk.model.events.PolicyUpdateEvent
|
import com.topjohnwu.magisk.model.events.PolicyUpdateEvent
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvIte
|
|||||||
override val layoutRes: Int = R.layout.item_policy
|
override val layoutRes: Int = R.layout.item_policy
|
||||||
|
|
||||||
val isExpanded = KObservableField(false)
|
val isExpanded = KObservableField(false)
|
||||||
val isEnabled = KObservableField(item.policy == Policy.ALLOW)
|
val isEnabled = KObservableField(item.policy == MagiskPolicy.ALLOW)
|
||||||
val shouldNotify = KObservableField(item.notification)
|
val shouldNotify = KObservableField(item.notification)
|
||||||
val shouldLog = KObservableField(item.logging)
|
val shouldLog = KObservableField(item.logging)
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvIte
|
|||||||
|
|
||||||
private val currentStateItem
|
private val currentStateItem
|
||||||
get() = item.copy(
|
get() = item.copy(
|
||||||
policy = if (isEnabled.value) Policy.ALLOW else Policy.DENY,
|
policy = if (isEnabled.value) MagiskPolicy.ALLOW else MagiskPolicy.DENY,
|
||||||
notification = shouldNotify.value,
|
notification = shouldNotify.value,
|
||||||
logging = shouldLog.value
|
logging = shouldLog.value
|
||||||
)
|
)
|
||||||
|
@ -2,7 +2,6 @@ package com.topjohnwu.magisk.model.events
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import com.skoumal.teanity.viewevents.ViewEvent
|
import com.skoumal.teanity.viewevents.ViewEvent
|
||||||
import com.topjohnwu.magisk.model.entity.Policy
|
|
||||||
import com.topjohnwu.magisk.model.entity.module.Repo
|
import com.topjohnwu.magisk.model.entity.module.Repo
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.subjects.PublishSubject
|
||||||
|
|
||||||
@ -36,5 +35,4 @@ class PermissionEvent(
|
|||||||
|
|
||||||
class BackPressEvent : ViewEvent()
|
class BackPressEvent : ViewEvent()
|
||||||
|
|
||||||
class SuDialogEvent(val policy: Policy) : ViewEvent()
|
|
||||||
class DieEvent : ViewEvent()
|
class DieEvent : ViewEvent()
|
@ -1,18 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.tasks
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.net.Uri
|
|
||||||
import com.topjohnwu.magisk.extensions.get
|
|
||||||
import com.topjohnwu.magisk.extensions.readUri
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
object InstallerHelper {
|
|
||||||
@JvmStatic
|
|
||||||
fun copyFileTo(uri: Uri, zip: File) {
|
|
||||||
zip.deleteRecursively()
|
|
||||||
|
|
||||||
get<Context>().readUri(uri).use { input ->
|
|
||||||
zip.outputStream().use { out -> input.copyTo(out) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,6 +15,17 @@ import com.topjohnwu.magisk.ui.base.MagiskViewModel
|
|||||||
import com.topjohnwu.magisk.utils.ISafetyNetHelper
|
import com.topjohnwu.magisk.utils.ISafetyNetHelper
|
||||||
import com.topjohnwu.superuser.Shell
|
import com.topjohnwu.superuser.Shell
|
||||||
|
|
||||||
|
enum class SafetyNetState {
|
||||||
|
LOADING, PASS, FAILED, IDLE
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class MagiskState {
|
||||||
|
NO_ROOT, NOT_INSTALLED, UP_TO_DATE, OBSOLETE, LOADING
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class MagiskItem {
|
||||||
|
MANAGER, MAGISK
|
||||||
|
}
|
||||||
|
|
||||||
class HomeViewModel(
|
class HomeViewModel(
|
||||||
private val magiskRepo: MagiskRepository
|
private val magiskRepo: MagiskRepository
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.ui.home
|
|
||||||
|
|
||||||
|
|
||||||
enum class MagiskItem {
|
|
||||||
MANAGER, MAGISK
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.ui.home
|
|
||||||
|
|
||||||
|
|
||||||
enum class MagiskState {
|
|
||||||
NO_ROOT, NOT_INSTALLED, UP_TO_DATE, OBSOLETE, LOADING
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.ui.home
|
|
||||||
|
|
||||||
enum class SafetyNetState {
|
|
||||||
LOADING, PASS, FAILED, IDLE
|
|
||||||
}
|
|
@ -13,7 +13,6 @@ import com.topjohnwu.magisk.R
|
|||||||
import com.topjohnwu.magisk.data.database.PolicyDao
|
import com.topjohnwu.magisk.data.database.PolicyDao
|
||||||
import com.topjohnwu.magisk.extensions.toggle
|
import com.topjohnwu.magisk.extensions.toggle
|
||||||
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
||||||
import com.topjohnwu.magisk.model.entity.Policy
|
|
||||||
import com.topjohnwu.magisk.model.entity.recycler.PolicyRvItem
|
import com.topjohnwu.magisk.model.entity.recycler.PolicyRvItem
|
||||||
import com.topjohnwu.magisk.model.events.PolicyEnableEvent
|
import com.topjohnwu.magisk.model.events.PolicyEnableEvent
|
||||||
import com.topjohnwu.magisk.model.events.PolicyUpdateEvent
|
import com.topjohnwu.magisk.model.events.PolicyUpdateEvent
|
||||||
@ -118,7 +117,7 @@ class SuperuserViewModel(
|
|||||||
val app = item.item.copy(policy = if (enable) MagiskPolicy.ALLOW else MagiskPolicy.DENY)
|
val app = item.item.copy(policy = if (enable) MagiskPolicy.ALLOW else MagiskPolicy.DENY)
|
||||||
|
|
||||||
updatePolicy(app)
|
updatePolicy(app)
|
||||||
.map { it.policy == Policy.ALLOW }
|
.map { it.policy == MagiskPolicy.ALLOW }
|
||||||
.subscribeK {
|
.subscribeK {
|
||||||
val textId = if (it) R.string.su_snack_grant else R.string.su_snack_deny
|
val textId = if (it) R.string.su_snack_grant else R.string.su_snack_deny
|
||||||
val text = resources.getString(textId).format(item.item.appName)
|
val text = resources.getString(textId).format(item.item.appName)
|
||||||
|
@ -8,7 +8,7 @@ import android.view.Window
|
|||||||
import com.skoumal.teanity.viewevents.ViewEvent
|
import com.skoumal.teanity.viewevents.ViewEvent
|
||||||
import com.topjohnwu.magisk.R
|
import com.topjohnwu.magisk.R
|
||||||
import com.topjohnwu.magisk.databinding.ActivityRequestBinding
|
import com.topjohnwu.magisk.databinding.ActivityRequestBinding
|
||||||
import com.topjohnwu.magisk.model.entity.Policy
|
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
||||||
import com.topjohnwu.magisk.model.events.DieEvent
|
import com.topjohnwu.magisk.model.events.DieEvent
|
||||||
import com.topjohnwu.magisk.model.receiver.GeneralReceiver
|
import com.topjohnwu.magisk.model.receiver.GeneralReceiver
|
||||||
import com.topjohnwu.magisk.ui.base.MagiskActivity
|
import com.topjohnwu.magisk.ui.base.MagiskActivity
|
||||||
@ -21,7 +21,7 @@ open class SuRequestActivity : MagiskActivity<SuRequestViewModel, ActivityReques
|
|||||||
override val viewModel: SuRequestViewModel by viewModel()
|
override val viewModel: SuRequestViewModel by viewModel()
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
viewModel.handler?.handleAction(Policy.DENY, -1)
|
viewModel.handler?.handleAction(MagiskPolicy.DENY, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -19,7 +19,6 @@ import com.topjohnwu.magisk.R
|
|||||||
import com.topjohnwu.magisk.data.database.PolicyDao
|
import com.topjohnwu.magisk.data.database.PolicyDao
|
||||||
import com.topjohnwu.magisk.extensions.now
|
import com.topjohnwu.magisk.extensions.now
|
||||||
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
||||||
import com.topjohnwu.magisk.model.entity.Policy
|
|
||||||
import com.topjohnwu.magisk.model.entity.recycler.SpinnerRvItem
|
import com.topjohnwu.magisk.model.entity.recycler.SpinnerRvItem
|
||||||
import com.topjohnwu.magisk.model.entity.toPolicy
|
import com.topjohnwu.magisk.model.entity.toPolicy
|
||||||
import com.topjohnwu.magisk.model.events.DieEvent
|
import com.topjohnwu.magisk.model.events.DieEvent
|
||||||
@ -94,12 +93,12 @@ class SuRequestViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun grantPressed() {
|
fun grantPressed() {
|
||||||
handler?.handleAction(Policy.ALLOW)
|
handler?.handleAction(MagiskPolicy.ALLOW)
|
||||||
timer?.cancel()
|
timer?.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun denyPressed() {
|
fun denyPressed() {
|
||||||
handler?.handleAction(Policy.DENY)
|
handler?.handleAction(MagiskPolicy.DENY)
|
||||||
timer?.cancel()
|
timer?.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,18 +167,18 @@ class SuRequestViewModel(
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
// If not interactive, response directly
|
// If not interactive, response directly
|
||||||
if (policy?.policy != Policy.INTERACTIVE) {
|
if (policy?.policy != MagiskPolicy.INTERACTIVE) {
|
||||||
handler?.handleAction()
|
handler?.handleAction()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
when (Config.suAutoReponse) {
|
when (Config.suAutoReponse) {
|
||||||
Config.Value.SU_AUTO_DENY -> {
|
Config.Value.SU_AUTO_DENY -> {
|
||||||
handler?.handleAction(Policy.DENY, 0)
|
handler?.handleAction(MagiskPolicy.DENY, 0)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
Config.Value.SU_AUTO_ALLOW -> {
|
Config.Value.SU_AUTO_ALLOW -> {
|
||||||
handler?.handleAction(Policy.ALLOW, 0)
|
handler?.handleAction(MagiskPolicy.ALLOW, 0)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,7 +198,7 @@ class SuRequestViewModel(
|
|||||||
|
|
||||||
override fun onFinish() {
|
override fun onFinish() {
|
||||||
denyText.value = resources.getString(R.string.deny)
|
denyText.value = resources.getString(R.string.deny)
|
||||||
handler?.handleAction(Policy.DENY)
|
handler?.handleAction(MagiskPolicy.DENY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timer?.start()
|
timer?.start()
|
||||||
@ -229,7 +228,7 @@ class SuRequestViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onAuthenticationSucceeded(result: FingerprintManager.AuthenticationResult) {
|
override fun onAuthenticationSucceeded(result: FingerprintManager.AuthenticationResult) {
|
||||||
handler?.handleAction(Policy.ALLOW)
|
handler?.handleAction(MagiskPolicy.ALLOW)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAuthenticationFailed() {
|
override fun onAuthenticationFailed() {
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.utils;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.topjohnwu.magisk.BuildConfig;
|
|
||||||
import com.topjohnwu.magisk.Const;
|
|
||||||
|
|
||||||
public class Logger {
|
|
||||||
|
|
||||||
public static void debug(String line) {
|
|
||||||
if (BuildConfig.DEBUG)
|
|
||||||
Log.d(Const.DEBUG_TAG, "DEBUG: " + line);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(String fmt, Object... args) {
|
|
||||||
debug(Utils.INSTANCE.fmt(fmt, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(String line) {
|
|
||||||
Log.e(Const.DEBUG_TAG, "ERROR: " + line);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(String fmt, Object... args) {
|
|
||||||
error(Utils.INSTANCE.fmt(fmt, args));
|
|
||||||
}
|
|
||||||
}
|
|
@ -153,7 +153,6 @@ class RootUtils : Shell.Initializer() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun rmAndLaunch(rm: String, component: ComponentName) {
|
fun rmAndLaunch(rm: String, component: ComponentName) {
|
||||||
Shell.su("(rm_launch $rm ${component.flattenToString()})").exec()
|
Shell.su("(rm_launch $rm ${component.flattenToString()})").exec()
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import com.topjohnwu.magisk.data.database.PolicyDao
|
|||||||
import com.topjohnwu.magisk.data.repository.LogRepository
|
import com.topjohnwu.magisk.data.repository.LogRepository
|
||||||
import com.topjohnwu.magisk.extensions.inject
|
import com.topjohnwu.magisk.extensions.inject
|
||||||
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
import com.topjohnwu.magisk.model.entity.MagiskPolicy
|
||||||
import com.topjohnwu.magisk.model.entity.Policy
|
|
||||||
import com.topjohnwu.magisk.model.entity.toLog
|
import com.topjohnwu.magisk.model.entity.toLog
|
||||||
import com.topjohnwu.magisk.model.entity.toPolicy
|
import com.topjohnwu.magisk.model.entity.toPolicy
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -20,7 +19,6 @@ object SuLogger {
|
|||||||
|
|
||||||
private val context: Context by inject()
|
private val context: Context by inject()
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun handleLogs(intent: Intent) {
|
fun handleLogs(intent: Intent) {
|
||||||
|
|
||||||
val fromUid = intent.getIntExtra("from.uid", -1)
|
val fromUid = intent.getIntExtra("from.uid", -1)
|
||||||
@ -72,7 +70,7 @@ object SuLogger {
|
|||||||
if (policy.notification && Config.suNotification == Config.Value.NOTIFICATION_TOAST) {
|
if (policy.notification && Config.suNotification == Config.Value.NOTIFICATION_TOAST) {
|
||||||
Utils.toast(
|
Utils.toast(
|
||||||
context.getString(
|
context.getString(
|
||||||
if (policy.policy == Policy.ALLOW)
|
if (policy.policy == MagiskPolicy.ALLOW)
|
||||||
R.string.su_allow_toast
|
R.string.su_allow_toast
|
||||||
else
|
else
|
||||||
R.string.su_deny_toast, policy.appName
|
R.string.su_deny_toast, policy.appName
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.utils;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ValueSortedMap<K, V extends Comparable<? super V>> extends HashMap<K, V> {
|
|
||||||
|
|
||||||
private List<V> sorted = new ArrayList<>();
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Collection<V> values() {
|
|
||||||
if (sorted.isEmpty()) {
|
|
||||||
sorted.addAll(super.values());
|
|
||||||
Collections.sort(sorted);
|
|
||||||
}
|
|
||||||
return sorted;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public V put(K key, V value) {
|
|
||||||
sorted.clear();
|
|
||||||
return super.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putAll(Map<? extends K, ? extends V> m) {
|
|
||||||
sorted.clear();
|
|
||||||
super.putAll(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public V remove(Object key) {
|
|
||||||
sorted.clear();
|
|
||||||
return super.remove(key);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.utils.feature
|
|
||||||
|
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
|
||||||
annotation class WIP
|
|
||||||
|
|
||||||
|
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
|
||||||
annotation class Beta
|
|
||||||
|
|
||||||
|
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
|
||||||
annotation class Alpha
|
|
||||||
|
|
||||||
|
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
|
||||||
annotation class Unstable
|
|
@ -1,46 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.view
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.net.Uri
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import com.google.android.material.snackbar.Snackbar
|
|
||||||
import com.topjohnwu.magisk.R
|
|
||||||
import com.topjohnwu.magisk.extensions.fileName
|
|
||||||
|
|
||||||
object SnackbarMaker {
|
|
||||||
|
|
||||||
fun make(activity: Activity, text: CharSequence, duration: Int): Snackbar {
|
|
||||||
val view = activity.findViewById<View>(android.R.id.content)
|
|
||||||
return make(view, text, duration)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun make(activity: Activity, @StringRes resId: Int, duration: Int): Snackbar {
|
|
||||||
return make(activity, activity.getString(resId), duration)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun make(view: View, text: CharSequence, duration: Int): Snackbar {
|
|
||||||
val snack = Snackbar.make(view, text, duration)
|
|
||||||
setup(snack)
|
|
||||||
return snack
|
|
||||||
}
|
|
||||||
|
|
||||||
fun make(view: View, @StringRes resId: Int, duration: Int): Snackbar {
|
|
||||||
val snack = Snackbar.make(view, resId, duration)
|
|
||||||
setup(snack)
|
|
||||||
return snack
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setup(snack: Snackbar) {
|
|
||||||
val text = snack.view.findViewById<TextView>(com.google.android.material.R.id.snackbar_text)
|
|
||||||
text.maxLines = Integer.MAX_VALUE
|
|
||||||
}
|
|
||||||
|
|
||||||
fun showUri(activity: Activity, uri: Uri) {
|
|
||||||
make(activity, activity.getString(R.string.internal_storage,
|
|
||||||
"/Download/" + uri.fileName),
|
|
||||||
Snackbar.LENGTH_LONG)
|
|
||||||
.setAction(R.string.ok) { }.show()
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user