-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ecffec
commit 8bd3552
Showing
129 changed files
with
746 additions
and
360 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/DevSettings.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.tonapps.tonkeeper.core | ||
|
||
import com.tonapps.tonkeeper.App | ||
|
||
object DevSettings { | ||
|
||
private val prefs = App.instance.getSharedPreferences("dev_settings", 0) | ||
|
||
var blurEnabled: Boolean = prefs.getBoolean("blur_enabled", true) | ||
set(value) { | ||
if (field != value) { | ||
field = value | ||
prefs.edit().putBoolean("blur_enabled", value).apply() | ||
} | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/core/LauncherIcon.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.tonapps.tonkeeper.core | ||
|
||
import android.content.ComponentName | ||
import android.content.Context | ||
import android.content.pm.PackageManager | ||
import androidx.annotation.DrawableRes | ||
import androidx.webkit.internal.ApiFeature.T | ||
import com.google.firebase.crashlytics.FirebaseCrashlytics | ||
import com.tonapps.tonkeeperx.R | ||
|
||
enum class LauncherIcon(val type: String, @DrawableRes val iconRes: Int) { | ||
Default("Default", R.mipmap.ic_launcher), | ||
Green("Green", R.mipmap.ic_green_launcher), | ||
Red("Red", R.mipmap.ic_red_launcher), | ||
Orange("Orange", R.mipmap.ic_orange_launcher), | ||
Purple("Purple", R.mipmap.ic_purple_launcher), | ||
Blue("Blue", R.mipmap.ic_blue_launcher), | ||
Black("Black", R.mipmap.ic_black_launcher); | ||
|
||
fun getComponent(context: Context): ComponentName { | ||
return ComponentName(context.packageName, "com.tonapps.tonkeeper.${type}LauncherIcon") | ||
} | ||
|
||
fun isEnabled(context: Context): Boolean { | ||
val enableState = context.packageManager.getComponentEnabledSetting(getComponent(context)) | ||
return enableState == PackageManager.COMPONENT_ENABLED_STATE_ENABLED || enableState == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT && this == Default | ||
} | ||
|
||
companion object { | ||
|
||
fun setEnable(context: Context, newIcon: LauncherIcon): Boolean { | ||
try { | ||
if (newIcon.isEnabled(context)) { | ||
return false | ||
} | ||
|
||
val packageManager = context.packageManager | ||
for (icon in entries) { | ||
val component = icon.getComponent(context) | ||
val newState = if (icon == newIcon) { | ||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED | ||
} else { | ||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED | ||
} | ||
packageManager.setComponentEnabledSetting(component, newState, PackageManager.DONT_KILL_APP) | ||
} | ||
return true | ||
} catch (e: Throwable) { | ||
FirebaseCrashlytics.getInstance().recordException(e) | ||
return false | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.