Added remaining stubs for the redesign

This commit is contained in:
Viktor De Pasquale 2019-10-17 18:57:00 +02:00
parent 1223b48b2c
commit e0e27774ad
31 changed files with 401 additions and 25 deletions

View File

@ -1,7 +0,0 @@
package a;
import com.topjohnwu.magisk.redesign.MainActivity;
public class i extends MainActivity {
/* stub */
}

7
app/src/main/java/a/i.kt Normal file
View File

@ -0,0 +1,7 @@
package a
import com.topjohnwu.magisk.redesign.MainActivity
class i : MainActivity() {
/* stub */
}

View File

@ -5,5 +5,6 @@ val koinModules = listOf(
networkingModule,
databaseModule,
repositoryModule,
viewModelModules
viewModelModules,
redesignModule
)

View File

@ -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() }
}

View File

@ -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()) }
}

View File

@ -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) {

View File

@ -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<MainViewModel, ActivityMainMd2Binding>(),
FragNavController.TransactionListener {
@ -33,9 +34,9 @@ open class MainActivity : CompatActivity<MainViewModel, ActivityMainMd2Binding>(
override val navigation by lazy { CompatNavigationDelegate(this, this) }
override val baseFragments = listOf(
override val baseFragments: List<KClass<out Fragment>> = listOf(
HomeFragment::class,
ModulesFragment::class,
ModuleFragment::class,
SuperuserFragment::class,
LogFragment::class,
SettingsFragment::class

View File

@ -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<FlashViewModel, FragmentFlashMd2Binding>() {
override val layoutRes = R.layout.fragment_flash_md2
override val viewModel by viewModel<FlashViewModel>()
}

View File

@ -0,0 +1,5 @@
package com.topjohnwu.magisk.redesign.flash
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
class FlashViewModel : CompatViewModel()

View File

@ -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<LogViewModel, FragmentLogMd2Binding>() {
override val layoutRes = R.layout.fragment_log_md2
override val viewModel by viewModel<LogViewModel>()
}

View File

@ -0,0 +1,5 @@
package com.topjohnwu.magisk.redesign.log
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
class LogViewModel : CompatViewModel()

View File

@ -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<ModuleViewModel, FragmentModuleMd2Binding>() {
override val layoutRes = R.layout.fragment_module_md2
override val viewModel by viewModel<ModuleViewModel>()
}

View File

@ -0,0 +1,5 @@
package com.topjohnwu.magisk.redesign.module
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
class ModuleViewModel : CompatViewModel()

View File

@ -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<RequestViewModel, ActivityRequestMd2Binding>() {
override val navHost = TODO()
override val layoutRes = R.layout.activity_request_md2
override val viewModel by viewModel<RequestViewModel>()
}

View File

@ -0,0 +1,5 @@
package com.topjohnwu.magisk.redesign.request
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
class RequestViewModel : CompatViewModel()

View File

@ -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<SafetynetViewModel, FragmentSafetynetMd2Binding>() {
override val layoutRes = R.layout.fragment_safetynet_md2
override val viewModel by viewModel<SafetynetViewModel>()
}

View File

@ -0,0 +1,5 @@
package com.topjohnwu.magisk.redesign.safetynet
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
class SafetynetViewModel : CompatViewModel()

View File

@ -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<SettingsViewModel, FragmentSettingsMd2Binding>() {
override val layoutRes = R.layout.fragment_settings_md2
override val viewModel by viewModel<SettingsViewModel>()
}

View File

@ -0,0 +1,5 @@
package com.topjohnwu.magisk.redesign.settings
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
class SettingsViewModel : CompatViewModel()

View File

@ -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<SuperuserViewModel, FragmentSuperuserMd2Binding>() {
override val layoutRes = R.layout.fragment_superuser_md2
override val viewModel by viewModel<SuperuserViewModel>()
}

View File

@ -0,0 +1,5 @@
package com.topjohnwu.magisk.redesign.superuser
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
class SuperuserViewModel : CompatViewModel()

View File

@ -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<ThemeViewModel, FragmentThemeMd2Binding>() {
override val layoutRes = R.layout.fragment_theme_md2
override val viewModel by viewModel<ThemeViewModel>()
}

View File

@ -0,0 +1,5 @@
package com.topjohnwu.magisk.redesign.theme
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
class ThemeViewModel : CompatViewModel()

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.request.RequestViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</layout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.flash.FlashViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</layout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.log.LogViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</layout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</layout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.safetynet.SafetynetViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</layout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.settings.SettingsViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</layout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.superuser.SuperuserViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</layout>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.theme.ThemeViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</layout>