diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 163ef7469..311368cef 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -22,6 +22,10 @@
android:name="a.b"
android:configChanges="orientation|screenSize"
android:exported="true" />
+
>get(c: Class<*>): T {
diff --git a/app/src/main/java/com/topjohnwu/magisk/Config.kt b/app/src/main/java/com/topjohnwu/magisk/Config.kt
index e6dddcbf9..932467dd7 100644
--- a/app/src/main/java/com/topjohnwu/magisk/Config.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/Config.kt
@@ -48,6 +48,7 @@ object Config : PreferenceModel, DBConfig {
const val REPO_ORDER = "repo_order"
const val SHOW_SYSTEM_APP = "show_system"
const val DOWNLOAD_PATH = "download_path"
+ const val REDESIGN = "redesign"
// system state
const val MAGISKHIDE = "magiskhide"
@@ -108,6 +109,7 @@ object Config : PreferenceModel, DBConfig {
var suNotification by preferenceStrInt(Key.SU_NOTIFICATION, Value.NOTIFICATION_TOAST)
var updateChannel by preferenceStrInt(Key.UPDATE_CHANNEL, defaultChannel)
+ var redesign by preference(Key.REDESIGN, false)
var darkTheme by preference(Key.DARK_THEME, true)
var suReAuth by preference(Key.SU_REAUTH, false)
var checkUpdate by preference(Key.CHECK_UPDATES, true)
diff --git a/app/src/main/java/com/topjohnwu/magisk/di/ViewModelsModule.kt b/app/src/main/java/com/topjohnwu/magisk/di/ViewModelsModule.kt
index b76c897f0..7d8b41871 100644
--- a/app/src/main/java/com/topjohnwu/magisk/di/ViewModelsModule.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/di/ViewModelsModule.kt
@@ -11,6 +11,7 @@ import com.topjohnwu.magisk.ui.superuser.SuperuserViewModel
import com.topjohnwu.magisk.ui.surequest.SuRequestViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module
+import com.topjohnwu.magisk.redesign.MainViewModel as RedesignViewModel
val viewModelModules = module {
@@ -24,4 +25,8 @@ val viewModelModules = module {
FlashViewModel(action, file, additional, get())
}
viewModel { SuRequestViewModel(get(), get(), get(SUTimeout), get()) }
+
+ // redesign
+
+ viewModel { RedesignViewModel() }
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/model/navigation/Navigation.kt b/app/src/main/java/com/topjohnwu/magisk/model/navigation/Navigation.kt
index a08e4c15a..f339fff30 100644
--- a/app/src/main/java/com/topjohnwu/magisk/model/navigation/Navigation.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/model/navigation/Navigation.kt
@@ -1,5 +1,11 @@
package com.topjohnwu.magisk.model.navigation
+import android.content.Context
+import android.content.Intent
+import com.topjohnwu.magisk.ClassMap
+import com.topjohnwu.magisk.Config
+import com.topjohnwu.magisk.Const
+import com.topjohnwu.magisk.ui.MainActivity
import com.topjohnwu.magisk.ui.hide.MagiskHideFragment
import com.topjohnwu.magisk.ui.home.HomeFragment
import com.topjohnwu.magisk.ui.log.LogFragment
@@ -7,7 +13,7 @@ import com.topjohnwu.magisk.ui.module.ModulesFragment
import com.topjohnwu.magisk.ui.module.ReposFragment
import com.topjohnwu.magisk.ui.settings.SettingsFragment
import com.topjohnwu.magisk.ui.superuser.SuperuserFragment
-
+import com.topjohnwu.magisk.redesign.MainActivity as RedesignActivity
object Navigation {
@@ -50,6 +56,17 @@ object Navigation {
else -> home()
}
+ // redesign starts here
+
+ fun start(launchIntent: Intent, context: Context) {
+ val destination = when {
+ Config.redesign -> RedesignActivity::class.java
+ else -> MainActivity::class.java
+ }
+ val intent = Intent(context, ClassMap[destination])
+ intent.putExtra(Const.Key.OPEN_SECTION, launchIntent.getStringExtra(Const.Key.OPEN_SECTION))
+ context.startActivity(intent)
+ }
object Main {
const val OPEN_NAV = 1
diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt
new file mode 100644
index 000000000..cf46defd5
--- /dev/null
+++ b/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt
@@ -0,0 +1,13 @@
+package com.topjohnwu.magisk.redesign
+
+import com.topjohnwu.magisk.R
+import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
+import com.topjohnwu.magisk.ui.base.MagiskActivity
+import org.koin.androidx.viewmodel.ext.android.viewModel
+
+open class MainActivity : MagiskActivity() {
+
+ override val layoutRes = R.layout.activity_main_md2
+ override val viewModel by viewModel()
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/MainViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/MainViewModel.kt
new file mode 100644
index 000000000..9da0545fd
--- /dev/null
+++ b/app/src/main/java/com/topjohnwu/magisk/redesign/MainViewModel.kt
@@ -0,0 +1,5 @@
+package com.topjohnwu.magisk.redesign
+
+import com.topjohnwu.magisk.ui.base.MagiskViewModel
+
+class MainViewModel : MagiskViewModel()
\ No newline at end of file
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
index 7021b62ba..83bb66ec4 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
@@ -1,11 +1,11 @@
package com.topjohnwu.magisk.ui
-import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import com.topjohnwu.magisk.*
+import com.topjohnwu.magisk.model.navigation.Navigation
import com.topjohnwu.magisk.utils.Utils
import com.topjohnwu.magisk.view.Notifications
import com.topjohnwu.magisk.view.Shortcuts
@@ -56,10 +56,8 @@ open class SplashActivity : AppCompatActivity() {
// Setup shortcuts
Shortcuts.setup(this)
- val intent = Intent(this, ClassMap[MainActivity::class.java])
- intent.putExtra(Const.Key.OPEN_SECTION, getIntent().getStringExtra(Const.Key.OPEN_SECTION))
DONE = true
- startActivity(intent)
+ Navigation.start(intent, this)
finish()
}
diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt
index 0f5f82aba..cd03c6d37 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.kt
@@ -57,6 +57,8 @@ class SettingsFragment : BasePreferenceFragment() {
preferenceManager.setStorageDeviceProtected()
setPreferencesFromResource(R.xml.app_settings, rootKey)
+ findPreference("redesign_cat")?.isVisible = BuildConfig.DEBUG
+
updateChannel = findPreference(Config.Key.UPDATE_CHANNEL)!!
rootConfig = findPreference(Config.Key.ROOT_ACCESS)!!
autoRes = findPreference(Config.Key.SU_AUTO_RESPONSE)!!
@@ -227,26 +229,26 @@ class SettingsFragment : BasePreferenceFragment() {
private fun setLocalePreference(lp: ListPreference) {
lp.isEnabled = false
availableLocales.map {
- val names = mutableListOf()
- val values = mutableListOf()
+ val names = mutableListOf()
+ val values = mutableListOf()
- names.add(
- LocaleManager.getString(defaultLocale, R.string.system_default)
- )
- values.add("")
+ names.add(
+ LocaleManager.getString(defaultLocale, R.string.system_default)
+ )
+ values.add("")
- it.forEach { locale ->
- names.add(locale.getDisplayName(locale))
- values.add(locale.toLangTag())
- }
-
- Pair(names.toTypedArray(), values.toTypedArray())
- }.subscribeK { (names, values) ->
- lp.isEnabled = true
- lp.entries = names
- lp.entryValues = values
- lp.summary = currentLocale.getDisplayName(currentLocale)
+ it.forEach { locale ->
+ names.add(locale.getDisplayName(locale))
+ values.add(locale.toLangTag())
}
+
+ Pair(names.toTypedArray(), values.toTypedArray())
+ }.subscribeK { (names, values) ->
+ lp.isEnabled = true
+ lp.entries = names
+ lp.entryValues = values
+ lp.summary = currentLocale.getDisplayName(currentLocale)
+ }
}
private fun setSummary(key: String) {
diff --git a/app/src/main/res/layout/activity_main_md2.xml b/app/src/main/res/layout/activity_main_md2.xml
new file mode 100644
index 000000000..eb085bdd0
--- /dev/null
+++ b/app/src/main/res/layout/activity_main_md2.xml
@@ -0,0 +1,450 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/test.xml b/app/src/main/res/layout/test.xml
deleted file mode 100644
index 33dc79f4b..000000000
--- a/app/src/main/res/layout/test.xml
+++ /dev/null
@@ -1,434 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/styles_md2.xml b/app/src/main/res/values/styles_md2.xml
index 02f4889dd..36d69b7b0 100644
--- a/app/src/main/res/values/styles_md2.xml
+++ b/app/src/main/res/values/styles_md2.xml
@@ -45,33 +45,35 @@
- - @style/AppearanceFoundation.Display>
-
- @style/AppearanceFoundation.Display.Variant>
-
- @style/AppearanceFoundation.Display.OnPrimary>
+
- @style/AppearanceFoundation.Display
+ - @style/AppearanceFoundation.Display.Variant
+ - @style/AppearanceFoundation.Display.OnPrimary
+
-
@style/AppearanceFoundation.Display.OnPrimary.Variant
- >
+
- - @style/AppearanceFoundation.Title>
-
- @style/AppearanceFoundation.Title.Variant>
-
- @style/AppearanceFoundation.Title.OnPrimary>
+
- @style/AppearanceFoundation.Title
+ - @style/AppearanceFoundation.Title.Variant
+ - @style/AppearanceFoundation.Title.OnPrimary
-
@style/AppearanceFoundation.Title.OnPrimary.Variant
- >
+
- - @style/AppearanceFoundation.Body>
-
- @style/AppearanceFoundation.Body.Variant>
-
- @style/AppearanceFoundation.Body.OnPrimary>
+
- @style/AppearanceFoundation.Body
+ - @style/AppearanceFoundation.Body.Variant
+ - @style/AppearanceFoundation.Body.OnPrimary
-
@style/AppearanceFoundation.Body.OnPrimary.Variant
- >
+
- - @style/AppearanceFoundation.Caption>
-
- @style/AppearanceFoundation.Caption.Variant>
-
- @style/AppearanceFoundation.Caption.OnPrimary>
+
- @style/AppearanceFoundation.Caption
+ - @style/AppearanceFoundation.Caption.Variant
+ - @style/AppearanceFoundation.Caption.OnPrimary
+
-
@style/AppearanceFoundation.Caption.OnPrimary.Variant
- >
+