diff --git a/app/src/main/java/a/i.java b/app/src/main/java/a/i.java deleted file mode 100644 index 0f704618c..000000000 --- a/app/src/main/java/a/i.java +++ /dev/null @@ -1,7 +0,0 @@ -package a; - -import com.topjohnwu.magisk.redesign.MainActivity; - -public class i extends MainActivity { - /* stub */ -} diff --git a/app/src/main/java/a/i.kt b/app/src/main/java/a/i.kt new file mode 100644 index 000000000..b02385431 --- /dev/null +++ b/app/src/main/java/a/i.kt @@ -0,0 +1,7 @@ +package a + +import com.topjohnwu.magisk.redesign.MainActivity + +class i : MainActivity() { + /* stub */ +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/di/Modules.kt b/app/src/main/java/com/topjohnwu/magisk/di/Modules.kt index 8fd05268e..45bb22ef9 100644 --- a/app/src/main/java/com/topjohnwu/magisk/di/Modules.kt +++ b/app/src/main/java/com/topjohnwu/magisk/di/Modules.kt @@ -5,5 +5,6 @@ val koinModules = listOf( networkingModule, databaseModule, repositoryModule, - viewModelModules + viewModelModules, + redesignModule ) diff --git a/app/src/main/java/com/topjohnwu/magisk/di/RedesignModule.kt b/app/src/main/java/com/topjohnwu/magisk/di/RedesignModule.kt new file mode 100644 index 000000000..da9203782 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/di/RedesignModule.kt @@ -0,0 +1,28 @@ +package com.topjohnwu.magisk.di + +import com.topjohnwu.magisk.redesign.MainViewModel +import com.topjohnwu.magisk.redesign.flash.FlashViewModel +import com.topjohnwu.magisk.redesign.home.HomeViewModel +import com.topjohnwu.magisk.redesign.log.LogViewModel +import com.topjohnwu.magisk.redesign.module.ModuleViewModel +import com.topjohnwu.magisk.redesign.request.RequestViewModel +import com.topjohnwu.magisk.redesign.safetynet.SafetynetViewModel +import com.topjohnwu.magisk.redesign.settings.SettingsViewModel +import com.topjohnwu.magisk.redesign.superuser.SuperuserViewModel +import com.topjohnwu.magisk.redesign.theme.ThemeViewModel +import org.koin.androidx.viewmodel.dsl.viewModel +import org.koin.dsl.module + +val redesignModule = module { + viewModel { FlashViewModel() } + viewModel { HomeViewModel(get()) } + viewModel { LogViewModel() } + viewModel { ModuleViewModel() } + viewModel { RequestViewModel() } + viewModel { SafetynetViewModel() } + viewModel { SettingsViewModel() } + viewModel { SuperuserViewModel() } + viewModel { ThemeViewModel() } + + viewModel { MainViewModel() } +} \ No newline at end of file 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 daaef422f..b76c897f0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/di/ViewModelsModule.kt +++ b/app/src/main/java/com/topjohnwu/magisk/di/ViewModelsModule.kt @@ -11,8 +11,6 @@ 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 -import com.topjohnwu.magisk.redesign.home.HomeViewModel as RedesignHomeViewModel val viewModelModules = module { @@ -26,9 +24,4 @@ val viewModelModules = module { FlashViewModel(action, file, additional, get()) } viewModel { SuRequestViewModel(get(), get(), get(SUTimeout), get()) } - - // redesign - - viewModel { RedesignViewModel() } - viewModel { RedesignHomeViewModel(get()) } } 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 249a7068f..af53b1662 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 @@ -16,6 +16,10 @@ import com.topjohnwu.magisk.ui.settings.SettingsFragment import com.topjohnwu.magisk.ui.superuser.SuperuserFragment import com.topjohnwu.magisk.redesign.MainActivity as RedesignActivity import com.topjohnwu.magisk.redesign.home.HomeFragment as RedesignHomeFragment +import com.topjohnwu.magisk.redesign.log.LogFragment as RedesignLogFragment +import com.topjohnwu.magisk.redesign.module.ModuleFragment as RedesignModulesFragment +import com.topjohnwu.magisk.redesign.settings.SettingsFragment as RedesignSettingsFragment +import com.topjohnwu.magisk.redesign.superuser.SuperuserFragment as RedesignSuperuserFragment object Navigation { @@ -35,11 +39,21 @@ object Navigation { } fun superuser() = MagiskNavigationEvent { - navDirections { destination = SuperuserFragment::class } + navDirections { + destination = when { + Config.redesign -> RedesignSuperuserFragment::class + else -> SuperuserFragment::class + } + } } fun modules() = MagiskNavigationEvent { - navDirections { destination = ModulesFragment::class } + navDirections { + destination = when { + Config.redesign -> RedesignModulesFragment::class + else -> ModulesFragment::class + } + } } fun repos() = MagiskNavigationEvent { @@ -51,11 +65,21 @@ object Navigation { } fun log() = MagiskNavigationEvent { - navDirections { destination = LogFragment::class } + navDirections { + destination = when { + Config.redesign -> RedesignLogFragment::class + else -> LogFragment::class + } + } } fun settings() = MagiskNavigationEvent { - navDirections { destination = SettingsFragment::class } + navDirections { + destination = when { + Config.redesign -> RedesignSettingsFragment::class + else -> SettingsFragment::class + } + } } fun fromSection(section: String) = when (section) { diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt index 59a2f22b7..37bbbee26 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/MainActivity.kt @@ -16,13 +16,14 @@ import com.topjohnwu.magisk.model.navigation.Navigation import com.topjohnwu.magisk.redesign.compat.CompatActivity import com.topjohnwu.magisk.redesign.compat.CompatNavigationDelegate import com.topjohnwu.magisk.redesign.home.HomeFragment -import com.topjohnwu.magisk.ui.log.LogFragment -import com.topjohnwu.magisk.ui.module.ModulesFragment -import com.topjohnwu.magisk.ui.settings.SettingsFragment -import com.topjohnwu.magisk.ui.superuser.SuperuserFragment +import com.topjohnwu.magisk.redesign.log.LogFragment +import com.topjohnwu.magisk.redesign.module.ModuleFragment +import com.topjohnwu.magisk.redesign.settings.SettingsFragment +import com.topjohnwu.magisk.redesign.superuser.SuperuserFragment import com.topjohnwu.magisk.utils.HideTopViewOnScrollBehavior import com.topjohnwu.superuser.Shell import org.koin.androidx.viewmodel.ext.android.viewModel +import kotlin.reflect.KClass open class MainActivity : CompatActivity(), FragNavController.TransactionListener { @@ -33,9 +34,9 @@ open class MainActivity : CompatActivity( override val navigation by lazy { CompatNavigationDelegate(this, this) } - override val baseFragments = listOf( + override val baseFragments: List> = listOf( HomeFragment::class, - ModulesFragment::class, + ModuleFragment::class, SuperuserFragment::class, LogFragment::class, SettingsFragment::class diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/flash/FlashFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/flash/FlashFragment.kt new file mode 100644 index 000000000..63366c484 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/flash/FlashFragment.kt @@ -0,0 +1,13 @@ +package com.topjohnwu.magisk.redesign.flash + +import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.databinding.FragmentFlashMd2Binding +import com.topjohnwu.magisk.redesign.compat.CompatFragment +import org.koin.androidx.viewmodel.ext.android.viewModel + +class FlashFragment : CompatFragment() { + + override val layoutRes = R.layout.fragment_flash_md2 + override val viewModel by viewModel() + +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/flash/FlashViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/flash/FlashViewModel.kt new file mode 100644 index 000000000..ff0fbc1cf --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/flash/FlashViewModel.kt @@ -0,0 +1,5 @@ +package com.topjohnwu.magisk.redesign.flash + +import com.topjohnwu.magisk.redesign.compat.CompatViewModel + +class FlashViewModel : CompatViewModel() \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/log/LogFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/log/LogFragment.kt new file mode 100644 index 000000000..799331eb2 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/log/LogFragment.kt @@ -0,0 +1,13 @@ +package com.topjohnwu.magisk.redesign.log + +import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.databinding.FragmentLogMd2Binding +import com.topjohnwu.magisk.redesign.compat.CompatFragment +import org.koin.androidx.viewmodel.ext.android.viewModel + +class LogFragment : CompatFragment() { + + override val layoutRes = R.layout.fragment_log_md2 + override val viewModel by viewModel() + +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/log/LogViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/log/LogViewModel.kt new file mode 100644 index 000000000..1b3ac4dbe --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/log/LogViewModel.kt @@ -0,0 +1,5 @@ +package com.topjohnwu.magisk.redesign.log + +import com.topjohnwu.magisk.redesign.compat.CompatViewModel + +class LogViewModel : CompatViewModel() \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleFragment.kt new file mode 100644 index 000000000..bd963fb4f --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleFragment.kt @@ -0,0 +1,13 @@ +package com.topjohnwu.magisk.redesign.module + +import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding +import com.topjohnwu.magisk.redesign.compat.CompatFragment +import org.koin.androidx.viewmodel.ext.android.viewModel + +class ModuleFragment : CompatFragment() { + + override val layoutRes = R.layout.fragment_module_md2 + override val viewModel by viewModel() + +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt new file mode 100644 index 000000000..8ae35ecb0 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt @@ -0,0 +1,5 @@ +package com.topjohnwu.magisk.redesign.module + +import com.topjohnwu.magisk.redesign.compat.CompatViewModel + +class ModuleViewModel : CompatViewModel() \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/request/RequestActivity.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/request/RequestActivity.kt new file mode 100644 index 000000000..8e8303bfb --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/request/RequestActivity.kt @@ -0,0 +1,14 @@ +package com.topjohnwu.magisk.redesign.request + +import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.databinding.ActivityRequestMd2Binding +import com.topjohnwu.magisk.redesign.compat.CompatActivity +import org.koin.androidx.viewmodel.ext.android.viewModel + +class RequestActivity : CompatActivity() { + + override val navHost = TODO() + override val layoutRes = R.layout.activity_request_md2 + override val viewModel by viewModel() + +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/request/RequestViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/request/RequestViewModel.kt new file mode 100644 index 000000000..92920eea8 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/request/RequestViewModel.kt @@ -0,0 +1,5 @@ +package com.topjohnwu.magisk.redesign.request + +import com.topjohnwu.magisk.redesign.compat.CompatViewModel + +class RequestViewModel : CompatViewModel() \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetFragment.kt new file mode 100644 index 000000000..419bbcd41 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetFragment.kt @@ -0,0 +1,13 @@ +package com.topjohnwu.magisk.redesign.safetynet + +import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.databinding.FragmentSafetynetMd2Binding +import com.topjohnwu.magisk.redesign.compat.CompatFragment +import org.koin.androidx.viewmodel.ext.android.viewModel + +class SafetynetFragment : CompatFragment() { + + override val layoutRes = R.layout.fragment_safetynet_md2 + override val viewModel by viewModel() + +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetViewModel.kt new file mode 100644 index 000000000..637f3cff9 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetViewModel.kt @@ -0,0 +1,5 @@ +package com.topjohnwu.magisk.redesign.safetynet + +import com.topjohnwu.magisk.redesign.compat.CompatViewModel + +class SafetynetViewModel : CompatViewModel() \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsFragment.kt new file mode 100644 index 000000000..1135e1ee5 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsFragment.kt @@ -0,0 +1,13 @@ +package com.topjohnwu.magisk.redesign.settings + +import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.databinding.FragmentSettingsMd2Binding +import com.topjohnwu.magisk.redesign.compat.CompatFragment +import org.koin.androidx.viewmodel.ext.android.viewModel + +class SettingsFragment : CompatFragment() { + + override val layoutRes = R.layout.fragment_settings_md2 + override val viewModel by viewModel() + +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsViewModel.kt new file mode 100644 index 000000000..76b92fe19 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsViewModel.kt @@ -0,0 +1,5 @@ +package com.topjohnwu.magisk.redesign.settings + +import com.topjohnwu.magisk.redesign.compat.CompatViewModel + +class SettingsViewModel : CompatViewModel() \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/superuser/SuperuserFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/superuser/SuperuserFragment.kt new file mode 100644 index 000000000..16f4ff578 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/superuser/SuperuserFragment.kt @@ -0,0 +1,13 @@ +package com.topjohnwu.magisk.redesign.superuser + +import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.databinding.FragmentSuperuserMd2Binding +import com.topjohnwu.magisk.redesign.compat.CompatFragment +import org.koin.androidx.viewmodel.ext.android.viewModel + +class SuperuserFragment : CompatFragment() { + + override val layoutRes = R.layout.fragment_superuser_md2 + override val viewModel by viewModel() + +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/superuser/SuperuserViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/superuser/SuperuserViewModel.kt new file mode 100644 index 000000000..f5f7e57f7 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/superuser/SuperuserViewModel.kt @@ -0,0 +1,5 @@ +package com.topjohnwu.magisk.redesign.superuser + +import com.topjohnwu.magisk.redesign.compat.CompatViewModel + +class SuperuserViewModel : CompatViewModel() \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/theme/ThemeFragment.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/theme/ThemeFragment.kt new file mode 100644 index 000000000..830846b49 --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/theme/ThemeFragment.kt @@ -0,0 +1,13 @@ +package com.topjohnwu.magisk.redesign.theme + +import com.topjohnwu.magisk.R +import com.topjohnwu.magisk.databinding.FragmentThemeMd2Binding +import com.topjohnwu.magisk.redesign.compat.CompatFragment +import org.koin.androidx.viewmodel.ext.android.viewModel + +class ThemeFragment : CompatFragment() { + + override val layoutRes = R.layout.fragment_theme_md2 + override val viewModel by viewModel() + +} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/theme/ThemeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/theme/ThemeViewModel.kt new file mode 100644 index 000000000..171418aeb --- /dev/null +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/theme/ThemeViewModel.kt @@ -0,0 +1,5 @@ +package com.topjohnwu.magisk.redesign.theme + +import com.topjohnwu.magisk.redesign.compat.CompatViewModel + +class ThemeViewModel : CompatViewModel() \ No newline at end of file diff --git a/app/src/main/res/layout/activity_request_md2.xml b/app/src/main/res/layout/activity_request_md2.xml new file mode 100644 index 000000000..7ab7d92e8 --- /dev/null +++ b/app/src/main/res/layout/activity_request_md2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_flash_md2.xml b/app/src/main/res/layout/fragment_flash_md2.xml new file mode 100644 index 000000000..d7922085b --- /dev/null +++ b/app/src/main/res/layout/fragment_flash_md2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_log_md2.xml b/app/src/main/res/layout/fragment_log_md2.xml new file mode 100644 index 000000000..7c4a5980c --- /dev/null +++ b/app/src/main/res/layout/fragment_log_md2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_module_md2.xml b/app/src/main/res/layout/fragment_module_md2.xml new file mode 100644 index 000000000..aec90e437 --- /dev/null +++ b/app/src/main/res/layout/fragment_module_md2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_safetynet_md2.xml b/app/src/main/res/layout/fragment_safetynet_md2.xml new file mode 100644 index 000000000..6afafba71 --- /dev/null +++ b/app/src/main/res/layout/fragment_safetynet_md2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_settings_md2.xml b/app/src/main/res/layout/fragment_settings_md2.xml new file mode 100644 index 000000000..640519ada --- /dev/null +++ b/app/src/main/res/layout/fragment_settings_md2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_superuser_md2.xml b/app/src/main/res/layout/fragment_superuser_md2.xml new file mode 100644 index 000000000..9bc1e4587 --- /dev/null +++ b/app/src/main/res/layout/fragment_superuser_md2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_theme_md2.xml b/app/src/main/res/layout/fragment_theme_md2.xml new file mode 100644 index 000000000..5d47e2e50 --- /dev/null +++ b/app/src/main/res/layout/fragment_theme_md2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file