From 1af8bbfd78d423ad889283db2ddd8b0aa3906035 Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Mon, 1 Apr 2024 14:54:38 -0500 Subject: [PATCH] Add help screen --- java/res/drawable/help_circle.xml | 27 ++++++++++++++ .../latin/uix/settings/SettingsNavigator.kt | 2 ++ .../latin/uix/settings/pages/Help.kt | 36 +++++++++++++++++++ .../latin/uix/settings/pages/Home.kt | 7 ++++ 4 files changed, 72 insertions(+) create mode 100644 java/res/drawable/help_circle.xml create mode 100644 java/src/org/futo/inputmethod/latin/uix/settings/pages/Help.kt diff --git a/java/res/drawable/help_circle.xml b/java/res/drawable/help_circle.xml new file mode 100644 index 000000000..8e01b0bdd --- /dev/null +++ b/java/res/drawable/help_circle.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/java/src/org/futo/inputmethod/latin/uix/settings/SettingsNavigator.kt b/java/src/org/futo/inputmethod/latin/uix/settings/SettingsNavigator.kt index 4255d431c..d3ec5fd6a 100644 --- a/java/src/org/futo/inputmethod/latin/uix/settings/SettingsNavigator.kt +++ b/java/src/org/futo/inputmethod/latin/uix/settings/SettingsNavigator.kt @@ -12,6 +12,7 @@ import org.futo.inputmethod.latin.uix.ErrorDialog import org.futo.inputmethod.latin.uix.InfoDialog import org.futo.inputmethod.latin.uix.settings.pages.AdvancedParametersScreen import org.futo.inputmethod.latin.uix.settings.pages.BlacklistScreen +import org.futo.inputmethod.latin.uix.settings.pages.HelpScreen import org.futo.inputmethod.latin.uix.settings.pages.HomeScreen import org.futo.inputmethod.latin.uix.settings.pages.LanguagesScreen import org.futo.inputmethod.latin.uix.settings.pages.PredictiveTextScreen @@ -46,6 +47,7 @@ fun SettingsNavigator( composable("typing") { TypingScreen(navController) } composable("voiceInput") { VoiceInputScreen(navController) } composable("themes") { ThemeScreen(navController) } + composable("help") { HelpScreen(navController) } composable("blacklist") { BlacklistScreen(navController) } dialog("error/{title}/{body}") { ErrorDialog( diff --git a/java/src/org/futo/inputmethod/latin/uix/settings/pages/Help.kt b/java/src/org/futo/inputmethod/latin/uix/settings/pages/Help.kt new file mode 100644 index 000000000..09323c851 --- /dev/null +++ b/java/src/org/futo/inputmethod/latin/uix/settings/pages/Help.kt @@ -0,0 +1,36 @@ +package org.futo.inputmethod.latin.uix.settings.pages + +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.tooling.preview.Preview +import androidx.navigation.NavHostController +import androidx.navigation.compose.rememberNavController +import org.futo.inputmethod.latin.BuildConfig +import org.futo.inputmethod.latin.uix.settings.NavigationItem +import org.futo.inputmethod.latin.uix.settings.NavigationItemStyle +import org.futo.inputmethod.latin.uix.settings.ScreenTitle +import org.futo.inputmethod.latin.uix.settings.ScrollableList +import org.futo.inputmethod.latin.uix.settings.Tip +import org.futo.inputmethod.updates.openURI + +@Preview(showBackground = true) +@Composable +fun HelpScreen(navController: NavHostController = rememberNavController()) { + val context = LocalContext.current + + ScrollableList { + ScreenTitle("Help & Feedback", showBack = true, navController) + + Tip("We wanna hear from you! If you're reporting an issue, your version may be relevant: zv${BuildConfig.VERSION_NAME}") + + NavigationItem(title = "Discord Server", style = NavigationItemStyle.Misc, navigate = { + context.openURI("https://keyboard.futo.org/discord") + }) + NavigationItem(title = "FUTO Chat", style = NavigationItemStyle.Misc, navigate = { + context.openURI("https://chat.futo.org/") + }) + NavigationItem(title = "Email us", style = NavigationItemStyle.Misc, navigate = { + context.openURI("mailto:keyboard@futo.org") + }) + } +} \ No newline at end of file diff --git a/java/src/org/futo/inputmethod/latin/uix/settings/pages/Home.kt b/java/src/org/futo/inputmethod/latin/uix/settings/pages/Home.kt index bbe9af72c..6cc06901f 100644 --- a/java/src/org/futo/inputmethod/latin/uix/settings/pages/Home.kt +++ b/java/src/org/futo/inputmethod/latin/uix/settings/pages/Home.kt @@ -102,6 +102,13 @@ fun HomeScreen(navController: NavHostController = rememberNavController()) { icon = painterResource(id = R.drawable.eye) ) + NavigationItem( + title = "Help & Feedback", + style = NavigationItemStyle.HomePrimary, + navigate = { navController.navigate("help") }, + icon = painterResource(id = R.drawable.help_circle) + ) + Spacer(modifier = Modifier.height(32.dp)) Text(