Add debug settings screen and move widget settings to sub screen
This commit is contained in:
@@ -42,12 +42,12 @@ fun SettingsMainScreen() {
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.LightMode,
|
||||
title = stringResource(id = R.string.preference_screen_weather),
|
||||
title = stringResource(id = R.string.preference_screen_weatherwidget),
|
||||
summary = stringResource(id = R.string.preference_screen_weather_summary)
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.Today,
|
||||
title = stringResource(id = R.string.preference_screen_calendar),
|
||||
title = stringResource(id = R.string.preference_screen_calendarwidget),
|
||||
summary = stringResource(id = R.string.preference_screen_calendar_summary)
|
||||
)
|
||||
Preference(
|
||||
|
||||
@@ -23,9 +23,11 @@ import de.mm20.launcher2.ui.base.BaseActivity
|
||||
import de.mm20.launcher2.ui.locals.LocalNavController
|
||||
import de.mm20.launcher2.ui.settings.about.AboutSettingsScreen
|
||||
import de.mm20.launcher2.ui.settings.appearance.AppearanceSettingsScreen
|
||||
import de.mm20.launcher2.ui.settings.debug.DebugSettingsScreen
|
||||
import de.mm20.launcher2.ui.settings.license.LicenseScreen
|
||||
import de.mm20.launcher2.ui.settings.main.MainSettingsScreen
|
||||
import de.mm20.launcher2.ui.settings.weatherwidget.WeatherWidgetSettingsScreen
|
||||
import de.mm20.launcher2.ui.settings.widgets.WidgetsSettingsScreen
|
||||
|
||||
class SettingsActivity : BaseActivity() {
|
||||
|
||||
@@ -81,12 +83,18 @@ class SettingsActivity : BaseActivity() {
|
||||
composable("settings/appearance") {
|
||||
AppearanceSettingsScreen()
|
||||
}
|
||||
composable("settings/weather") {
|
||||
composable("settings/widgets") {
|
||||
WidgetsSettingsScreen()
|
||||
}
|
||||
composable("settings/widgets/weather") {
|
||||
WeatherWidgetSettingsScreen()
|
||||
}
|
||||
composable("settings/about") {
|
||||
AboutSettingsScreen()
|
||||
}
|
||||
composable("settings/debug") {
|
||||
DebugSettingsScreen()
|
||||
}
|
||||
composable(
|
||||
"settings/license?library={libraryName}",
|
||||
arguments = listOf(navArgument("libraryName") {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package de.mm20.launcher2.ui.settings.debug
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import de.mm20.launcher2.crashreporter.CrashReporter
|
||||
import de.mm20.launcher2.ui.R
|
||||
import de.mm20.launcher2.ui.component.preferences.Preference
|
||||
import de.mm20.launcher2.ui.component.preferences.PreferenceScreen
|
||||
|
||||
@Composable
|
||||
fun DebugSettingsScreen() {
|
||||
val context = LocalContext.current
|
||||
PreferenceScreen(
|
||||
stringResource(R.string.preference_screen_debug)
|
||||
) {
|
||||
item {
|
||||
Preference(
|
||||
title = stringResource(R.string.preference_crash_reporter),
|
||||
summary = stringResource(R.string.preference_crash_reporter_summary),
|
||||
onClick = {
|
||||
context.startActivity(CrashReporter.getLaunchIntent())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package de.mm20.launcher2.ui.settings.debug
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import org.koin.core.component.KoinComponent
|
||||
|
||||
class DebugSettingsScreenVM: ViewModel(), KoinComponent {
|
||||
fun exportLog() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,14 @@ fun MainSettingsScreen() {
|
||||
title = stringResource(id = R.string.preference_screen_search),
|
||||
summary = stringResource(id = R.string.preference_screen_search_summary)
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.Widgets,
|
||||
title = stringResource(id = R.string.preference_screen_widgets),
|
||||
summary = stringResource(id = R.string.preference_screen_widgets_summary),
|
||||
onClick = {
|
||||
navController?.navigate("settings/widgets")
|
||||
}
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.NotificationBadge,
|
||||
title = stringResource(id = R.string.preference_screen_badges),
|
||||
@@ -43,19 +51,6 @@ fun MainSettingsScreen() {
|
||||
navController?.navigate("settings/badges")
|
||||
}
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.LightMode,
|
||||
title = stringResource(id = R.string.preference_screen_weather),
|
||||
summary = stringResource(id = R.string.preference_screen_weather_summary),
|
||||
onClick = {
|
||||
navController?.navigate("settings/weather")
|
||||
}
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.Today,
|
||||
title = stringResource(id = R.string.preference_screen_calendar),
|
||||
summary = stringResource(id = R.string.preference_screen_calendar_summary)
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.AccountBox,
|
||||
title = stringResource(id = R.string.preference_screen_services),
|
||||
@@ -64,6 +59,14 @@ fun MainSettingsScreen() {
|
||||
navController?.navigate("settings/accounts")
|
||||
}
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.BugReport,
|
||||
title = stringResource(id = R.string.preference_screen_debug),
|
||||
summary = stringResource(id = R.string.preference_screen_debug_summary),
|
||||
onClick = {
|
||||
navController?.navigate("settings/debug")
|
||||
}
|
||||
)
|
||||
Preference(
|
||||
icon = Icons.Rounded.Info,
|
||||
title = stringResource(id = R.string.preference_screen_about),
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ fun WeatherWidgetSettingsScreen() {
|
||||
val viewModel: WeatherWidgetSettingsScreenVM = viewModel()
|
||||
val context = LocalContext.current
|
||||
|
||||
PreferenceScreen(title = stringResource(R.string.preference_screen_weather)) {
|
||||
PreferenceScreen(title = stringResource(R.string.preference_screen_weatherwidget)) {
|
||||
item {
|
||||
PreferenceCategory {
|
||||
val weatherProvider by viewModel.weatherProvider.observeAsState()
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package de.mm20.launcher2.ui.settings.widgets
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.LightMode
|
||||
import androidx.compose.material.icons.rounded.Today
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import de.mm20.launcher2.ui.R
|
||||
import de.mm20.launcher2.ui.component.preferences.Preference
|
||||
import de.mm20.launcher2.ui.component.preferences.PreferenceScreen
|
||||
import de.mm20.launcher2.ui.locals.LocalNavController
|
||||
|
||||
@Composable
|
||||
fun WidgetsSettingsScreen() {
|
||||
val navController = LocalNavController.current
|
||||
PreferenceScreen(title = stringResource(R.string.preference_screen_widgets)) {
|
||||
item {
|
||||
Preference(
|
||||
title = stringResource(R.string.preference_screen_weatherwidget),
|
||||
icon = Icons.Rounded.LightMode,
|
||||
onClick = {
|
||||
navController?.navigate("settings/widgets/weather")
|
||||
}
|
||||
)
|
||||
Preference(
|
||||
title = stringResource(R.string.preference_screen_calendarwidget),
|
||||
icon = Icons.Rounded.Today
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user