Add debug settings screen and move widget settings to sub screen

This commit is contained in:
MM20 2022-01-04 21:30:07 +01:00
parent c360753904
commit 2c07b97e01
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
12 changed files with 123 additions and 27 deletions

View File

@ -108,7 +108,7 @@ class PreferencesCalendarFragment : PreferenceFragmentCompat() {
override fun onResume() {
super.onResume()
(activity as AppCompatActivity).supportActionBar?.setTitle(R.string.preference_screen_calendar)
(activity as AppCompatActivity).supportActionBar?.setTitle(R.string.preference_screen_calendarwidget)
hasCalendarPermission = requireActivity().checkPermission(Manifest.permission.READ_CALENDAR)
&& requireActivity().checkPermission(Manifest.permission.WRITE_CALENDAR)
}

View File

@ -146,7 +146,7 @@ class PreferencesWeatherFragment : PreferenceFragmentCompat() {
override fun onResume() {
super.onResume()
(activity as AppCompatActivity).supportActionBar?.setTitle(R.string.preference_screen_weather)
(activity as AppCompatActivity).supportActionBar?.setTitle(R.string.preference_screen_weatherwidget)
}
}

View File

@ -19,12 +19,12 @@
app:icon="@drawable/ic_pref_weather"
app:key="screen_weather"
app:summary="@string/preference_screen_weather_summary"
app:title="@string/preference_screen_weather" />
app:title="@string/preference_screen_weatherwidget" />
<Preference
app:icon="@drawable/ic_pref_calendar"
app:key="screen_calendar"
app:summary="@string/preference_screen_calendar_summary"
app:title="@string/preference_screen_calendar" />
app:title="@string/preference_screen_calendarwidget" />
<Preference
app:icon="@drawable/ic_pref_account"
app:key="screen_services"

View File

@ -42,7 +42,6 @@
<string name="preference_screen_about_summary">Version, Entwickler, Open-Source-Lizenzen</string>
<string name="preference_screen_appearance_summary">Design, Symbole, Suchleiste, Systemleisten</string>
<string name="preference_screen_weather_summary">Provider, Einheiten, Standort</string>
<string name="preference_screen_weather">Wetter</string>
<string name="preference_category_location">Standort</string>
<string name="preference_automatic_location">Automatischer Standort</string>
<string name="preference_automatic_location_summary">GPS und Ortungsdienste verwenden, um Standort automatisch zu ermitteln</string>
@ -160,7 +159,7 @@
<string name="preference_dynamic_icon_bg">Dynamischer Hintergrund</string>
<string name="preference_dynamic_icon_bg_summary">Hintergrundfarbe an Symbol anpassen</string>
<string name="preference_category_widget">Widget</string>
<string name="preference_screen_calendar">Kalender</string>
<string name="preference_screen_calendarwidget">Kalender</string>
<string name="preference_screen_calendar_summary">Kalender, Widgets</string>
<string name="preference_calendar_calendars">Kalender</string>
<string name="preference_permission_denied">Berechtigung fehlt</string>
@ -343,7 +342,6 @@
<string name="storage_onedrive">OneDrive</string>
<string name="preference_about_telegram">Telegram-Gruppe</string>
<string name="preference_about_fdroid">F-Droid-Repository</string>
<string name="preference_crash_reporter">Crash-Reporter</string>
<string name="preference_screen_plugins">Plug-Ins</string>
<string name="preference_screen_plugins_summary">Plug-Ins aktivieren oder deaktivieren</string>
<string name="preference_plugins_installed">Installierte Plug-Ins</string>
@ -424,4 +422,15 @@
<string name="grant_permission">Gewähren</string>
<string name="missing_permission_auto_location">Standortzugriff wird benötigt, um den Standort automatisch zu ermitteln</string>
<string name="weather_widget_set_location">Standort festlegen</string>
<string name="preference_screen_debug">Debug</string>
<string name="preference_screen_debug_summary">Werkzeuge zur Fehlerbehebung</string>
<string name="preference_screen_widgets">Widgets</string>
<string name="preference_screen_widgets_summary">Widgets konfigurieren</string>
<string name="preference_screen_weatherwidget">Wetter</string>
<string name="preference_crash_reporter">Crash-Reporter</string>
<string name="preference_crash_reporter_summary">Fehler- und Absturzberichte</string>
</resources>

View File

@ -83,7 +83,6 @@
<string name="preference_screen_about_summary">Version, Developer, Open source licenses</string>
<string name="preference_screen_appearance_summary">Theme, Icons, Search bar, System bars</string>
<string name="preference_screen_weather_summary">Provider, Units, location</string>
<string name="preference_screen_weather">Weather</string>
<string name="preference_category_location">Location</string>
<string name="preference_automatic_location">Automatic location</string>
<string name="preference_automatic_location_summary">Use GPS and location services to determine location automatically</string>
@ -210,7 +209,7 @@
<string name="preference_dynamic_icon_bg">Dynamic background</string>
<string name="preference_dynamic_icon_bg_summary">Adjust background color to icon</string>
<string name="preference_category_widget">Widget</string>
<string name="preference_screen_calendar">Calendar</string>
<string name="preference_screen_calendarwidget">Calendar</string>
<string name="preference_screen_calendar_summary">Calendars, Widget settings</string>
<string name="preference_calendar_calendars">Calendars</string>
<string name="preference_permission_denied">Permission denied</string>
@ -342,7 +341,6 @@
<string name="storage_onedrive">OneDrive</string>
<string name="preference_about_telegram">Telegram group</string>
<string name="preference_about_fdroid">F-Droid repository</string>
<string name="preference_crash_reporter">Crash reporter</string>
<string name="preference_screen_plugins">Plugins</string>
<string name="preference_screen_plugins_summary">Enable or disable plugins</string>
<string name="preference_plugins_installed">Installed plugins</string>
@ -462,4 +460,15 @@
<string name="grant_permission">Grant</string>
<string name="missing_permission_auto_location">Location access is required to determine the location automatically</string>
<string name="weather_widget_set_location">Set location</string>
<string name="preference_screen_debug">Debug</string>
<string name="preference_screen_debug_summary">Troubleshooting tools</string>
<string name="preference_screen_widgets">Widgets</string>
<string name="preference_screen_widgets_summary">Configure widgets</string>
<string name="preference_screen_weatherwidget">Weather</string>
<string name="preference_crash_reporter">Crash reporter</string>
<string name="preference_crash_reporter_summary">Error and crash reports</string>
</resources>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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