diff --git a/app/src/keyboards/java/be/scri/activities/MainActivity.kt b/app/src/keyboards/java/be/scri/activities/MainActivity.kt index 7a1e7f93..603c010a 100644 --- a/app/src/keyboards/java/be/scri/activities/MainActivity.kt +++ b/app/src/keyboards/java/be/scri/activities/MainActivity.kt @@ -14,6 +14,7 @@ import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatDelegate import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -76,6 +77,13 @@ class MainActivity : ComponentActivity() { val navController = rememberNavController() + val navigateTo = intent.getStringExtra("navigate_to") + LaunchedEffect(navigateTo) { + if (navigateTo == "download_data") { + navController.navigate("download_data") + } + } + val isHintChangedMap = remember { mutableStateMapOf() } /** diff --git a/app/src/keyboards/java/be/scri/helpers/KeyboardLanguageMappingConstants.kt b/app/src/keyboards/java/be/scri/helpers/KeyboardLanguageMappingConstants.kt index 9b1b42cf..108b0c12 100644 --- a/app/src/keyboards/java/be/scri/helpers/KeyboardLanguageMappingConstants.kt +++ b/app/src/keyboards/java/be/scri/helpers/KeyboardLanguageMappingConstants.kt @@ -14,6 +14,18 @@ import be.scri.helpers.swedish.SVInterfaceVariables * Object containing keyboard-specific constant mappings related to language-specific UI elements. */ object KeyboardLanguageMappingConstants { + val downloadDataPlaceholder = + mapOf( + "EN" to ENInterfaceVariables.DOWNLOAD_DATA_LBL, + "ES" to ESInterfaceVariables.DOWNLOAD_DATA_LBL, + "DE" to DEInterfaceVariables.DOWNLOAD_DATA_LBL, + "IT" to ITInterfaceVariables.DOWNLOAD_DATA_LBL, + "FR" to FRInterfaceVariables.DOWNLOAD_DATA_LBL, + "PT" to PTInterfaceVariables.DOWNLOAD_DATA_LBL, + "RU" to RUInterfaceVariables.DOWNLOAD_DATA_LBL, + "SV" to SVInterfaceVariables.DOWNLOAD_DATA_LBL, + ) + val translatePlaceholder = mapOf( "EN" to ENInterfaceVariables.TRANSLATE_KEY_LBL, diff --git a/app/src/keyboards/java/be/scri/helpers/english/ENInterfaceVariables.kt b/app/src/keyboards/java/be/scri/helpers/english/ENInterfaceVariables.kt index 6cc774df..dca8f86f 100644 --- a/app/src/keyboards/java/be/scri/helpers/english/ENInterfaceVariables.kt +++ b/app/src/keyboards/java/be/scri/helpers/english/ENInterfaceVariables.kt @@ -6,16 +6,13 @@ package be.scri.helpers.english * Interface variables for English language keyboards. */ object ENInterfaceVariables { - // MARK: Currency Symbols - - const val CURRENCY_SYMBOL = "$" - val CURRENCY_SYMBOL_ALTERNATES = listOf("$", "€", "£", "¥", "₩", "¢") - // MARK: Keyboard Labels const val SPACE_BAR = "space" const val LANGUAGE = "English" + const val DOWNLOAD_DATA_LBL = "Please download language data" + const val INVALID_COMMAND_MSG_WIKIDATA = "Not in Wikidata" const val INVALID_COMMAND_TEXT_WIKIDATA_1 = "Wikidata is a collaboratively edited knowledge graph that's maintained by the Wikimedia Foundation. It serves as a source of open data for projects like Wikipedia and countless others." @@ -35,6 +32,11 @@ object ENInterfaceVariables { val BASE_AUTOSUGGESTIONS = listOf("I", "I'm", "we") val NUMERIC_AUTOSUGGESTIONS = listOf("is", "to", "and") + // MARK: Currency Symbols + + const val CURRENCY_SYMBOL = "$" + val CURRENCY_SYMBOL_ALTERNATES = listOf("$", "€", "£", "¥", "₩", "¢") + // MARK: Suggestion Pronouns val VERBS_AFTER_PRONOUNS_ARRAY = listOf("have", "be", "can") diff --git a/app/src/keyboards/java/be/scri/helpers/french/FRInterfaceVariables.kt b/app/src/keyboards/java/be/scri/helpers/french/FRInterfaceVariables.kt index 75f16ac8..8a214666 100644 --- a/app/src/keyboards/java/be/scri/helpers/french/FRInterfaceVariables.kt +++ b/app/src/keyboards/java/be/scri/helpers/french/FRInterfaceVariables.kt @@ -6,16 +6,13 @@ package be.scri.helpers.french * Interface variables for French language keyboards. */ object FRInterfaceVariables { - // MARK: Currency Symbols - - const val CURRENCY_SYMBOL = "€" - val CURRENCY_SYMBOL_ALTERNATES = listOf("€", "$", "£", "¥", "₩", "¢") - // MARK: Keyboard Labels const val SPACE_BAR = "espace" const val LANGUAGE = "Français" + const val DOWNLOAD_DATA_LBL = "Veuillez télécharger les données linguistiques" + const val INVALID_COMMAND_MSG_WIKIDATA = "Pas dans Wikidata" const val INVALID_COMMAND_TEXT_WIKIDATA_1 = "Wikidata est un réseau de connaissances collaboratif géré par la fondation Wikimedia. Il sert de source de données ouvertes pour des projets tels que Wikipédia et bien d'autres." @@ -35,6 +32,11 @@ object FRInterfaceVariables { val BASE_AUTOSUGGESTIONS = listOf("je", "il", "le") val NUMERIC_AUTOSUGGESTIONS = listOf("je", "que", "c’est") + // MARK: Currency Symbols + + const val CURRENCY_SYMBOL = "€" + val CURRENCY_SYMBOL_ALTERNATES = listOf("€", "$", "£", "¥", "₩", "¢") + // MARK: Suggestion Pronouns val VERBS_AFTER_PRONOUNS_ARRAY = listOf("être", "avoir", "ne") diff --git a/app/src/keyboards/java/be/scri/helpers/german/DEInterfaceVariables.kt b/app/src/keyboards/java/be/scri/helpers/german/DEInterfaceVariables.kt index b96798f4..8da90ab3 100644 --- a/app/src/keyboards/java/be/scri/helpers/german/DEInterfaceVariables.kt +++ b/app/src/keyboards/java/be/scri/helpers/german/DEInterfaceVariables.kt @@ -6,16 +6,13 @@ package be.scri.helpers.german * Interface variables for German language keyboards. */ object DEInterfaceVariables { - // MARK: Currency Symbols - - const val CURRENCY_SYMBOL = "€" - val CURRENCY_SYMBOL_ALTERNATES = listOf("€", "$", "£", "¥", "₩", "¢") - // MARK: Keyboard Labels const val SPACE_BAR = "Leerzeichen" const val LANGUAGE = "Deutsch" + const val DOWNLOAD_DATA_LBL = "Bitte Sprachdaten herunterladen" + const val INVALID_COMMAND_MSG_WIKIDATA = "Nicht in Wikidata" const val INVALID_COMMAND_TEXT_WIKIDATA_1 = "Wikidata ist ein kollaborativ gestalteter, mehrsprachiger Wissensgraf, der von der Wikimedia Foundation gehostet wird. Sie dient als Quelle für offene Daten für unzählige Projekte, beispielsweise Wikipedia." @@ -35,6 +32,11 @@ object DEInterfaceVariables { val BASE_AUTOSUGGESTIONS = listOf("ich", "die", "das") val NUMERIC_AUTOSUGGESTIONS = listOf("Prozent", "Milionen", "Meter") + // MARK: Currency Symbols + + const val CURRENCY_SYMBOL = "€" + val CURRENCY_SYMBOL_ALTERNATES = listOf("€", "$", "£", "¥", "₩", "¢") + // MARK: Suggestion Pronouns val VERBS_AFTER_PRONOUNS_ARRAY = listOf("haben", "sein", "können") diff --git a/app/src/keyboards/java/be/scri/helpers/italian/ITInterfaceVariables.kt b/app/src/keyboards/java/be/scri/helpers/italian/ITInterfaceVariables.kt index 3ceadfba..3fd3cefd 100644 --- a/app/src/keyboards/java/be/scri/helpers/italian/ITInterfaceVariables.kt +++ b/app/src/keyboards/java/be/scri/helpers/italian/ITInterfaceVariables.kt @@ -6,16 +6,13 @@ package be.scri.helpers.italian * Interface variables for Italian language keyboards. */ object ITInterfaceVariables { - // MARK: Currency Symbols - - const val CURRENCY_SYMBOL = "€" - val CURRENCY_SYMBOL_ALTERNATES = listOf("€", "$", "£", "¥", "₩", "¢") - // MARK: Keyboard Labels const val SPACE_BAR = "spazio" const val LANGUAGE = "Italiano" + const val DOWNLOAD_DATA_LBL = "Scarica i dati della lingua" + const val INVALID_COMMAND_MSG_WIKIDATA = "Non in Wikidata" const val INVALID_COMMAND_TEXT_WIKIDATA_1 = "Wikidata è un grafo della conoscenza modificabile in modo collaborativo, gestito dalla Wikimedia Foundation. Serve come fonte di dati aperti per progetti come Wikipedia e innumerevoli altri." @@ -35,6 +32,11 @@ object ITInterfaceVariables { val BASE_AUTOSUGGESTIONS = listOf("ho", "non", "ma") val NUMERIC_AUTOSUGGESTIONS = listOf("utenti", "anni", "e") + // MARK: Currency Symbols + + const val CURRENCY_SYMBOL = "€" + val CURRENCY_SYMBOL_ALTERNATES = listOf("€", "$", "£", "¥", "₩", "¢") + // MARK: Translate Command const val TRANSLATE_KEY_LBL = "Tradurre" diff --git a/app/src/keyboards/java/be/scri/helpers/portuguese/PTInterfaceVariables.kt b/app/src/keyboards/java/be/scri/helpers/portuguese/PTInterfaceVariables.kt index 14c96b9c..2d4a91a7 100644 --- a/app/src/keyboards/java/be/scri/helpers/portuguese/PTInterfaceVariables.kt +++ b/app/src/keyboards/java/be/scri/helpers/portuguese/PTInterfaceVariables.kt @@ -6,16 +6,13 @@ package be.scri.helpers.portuguese * Interface variables for Portuguese language keyboards. */ object PTInterfaceVariables { - // MARK: Currency Symbols - - const val CURRENCY_SYMBOL = "$" - val CURRENCY_SYMBOL_ALTERNATES = listOf("$", "€", "£", "¥", "₩", "¢") - // MARK: Keyboard Labels const val SPACE_BAR = "espaço" const val LANGUAGE = "Português" + const val DOWNLOAD_DATA_LBL = "Por favor, baixe os dados do idioma" + const val INVALID_COMMAND_MSG_WIKIDATA = "Não está no Wikidata" const val INVALID_COMMAND_TEXT_WIKIDATA_1 = "A Wikidata é um grafo de conhecimento editado colaborativamente e mantivo pela Fundação Wikimedia. A Wikidata é uma fonte de dados públicos para projetos como a Wikipédia e muitos outros." @@ -35,6 +32,11 @@ object PTInterfaceVariables { val BASE_AUTOSUGGESTIONS = listOf("o", "a", "eu") val NUMERIC_AUTOSUGGESTIONS = listOf("de", "que", "a") + // MARK: Currency Symbols + + const val CURRENCY_SYMBOL = "$" + val CURRENCY_SYMBOL_ALTERNATES = listOf("$", "€", "£", "¥", "₩", "¢") + // MARK: Translate Command const val TRANSLATE_KEY_LBL = "Traduzir" diff --git a/app/src/keyboards/java/be/scri/helpers/russian/RUInterfaceVariables.kt b/app/src/keyboards/java/be/scri/helpers/russian/RUInterfaceVariables.kt index 8da3af86..e503ca00 100644 --- a/app/src/keyboards/java/be/scri/helpers/russian/RUInterfaceVariables.kt +++ b/app/src/keyboards/java/be/scri/helpers/russian/RUInterfaceVariables.kt @@ -6,16 +6,13 @@ package be.scri.helpers.russian * Interface variables for Russian language keyboards. */ object RUInterfaceVariables { - // MARK: Currency Symbols - - const val CURRENCY_SYMBOL = "₽" - val CURRENCY_SYMBOL_ALTERNATES = listOf("₽", "$", "€", "£", "¥") - // MARK: Keyboard Labels const val SPACE_BAR = "Пробел" const val LANGUAGE = "Pусский" + const val DOWNLOAD_DATA_LBL = "Пожалуйста, скачайте языковые данные" + const val INVALID_COMMAND_MSG_WIKIDATA = "Нет в Викиданных" const val INVALID_COMMAND_TEXT_WIKIDATA_1 = "Викиданных — это совместно редактируемый граф знаний, поддерживаемый Фондом Викимедиа. Он служит источником открытых данных для таких проектов, как Википедия и бесчисленное множество других." @@ -35,6 +32,11 @@ object RUInterfaceVariables { val BASE_AUTOSUGGESTIONS = listOf("я", "а", "в") val NUMERIC_AUTOSUGGESTIONS = listOf("в", "и", "я") + // MARK: Currency Symbols + + const val CURRENCY_SYMBOL = "₽" + val CURRENCY_SYMBOL_ALTERNATES = listOf("₽", "$", "€", "£", "¥") + // MARK: Translate Command const val TRANSLATE_KEY_LBL = "Перевести" diff --git a/app/src/keyboards/java/be/scri/helpers/spanish/ESInterfaceVariables.kt b/app/src/keyboards/java/be/scri/helpers/spanish/ESInterfaceVariables.kt index 08731c58..ce59cfbe 100644 --- a/app/src/keyboards/java/be/scri/helpers/spanish/ESInterfaceVariables.kt +++ b/app/src/keyboards/java/be/scri/helpers/spanish/ESInterfaceVariables.kt @@ -6,16 +6,13 @@ package be.scri.helpers.spanish * Interface variables for Spanish language keyboards. */ object ESInterfaceVariables { - // MARK: Currency Symbols - - const val CURRENCY_SYMBOL = "$" - val CURRENCY_SYMBOL_ALTERNATES = listOf("₡", "S", "€", "£", "₲", "¢") - // MARK: Keyboard Labels const val SPACE_BAR = "espacio" const val LANGUAGE = "Español" + const val DOWNLOAD_DATA_LBL = "Por favor, descarga los datos del idioma" + const val INVALID_COMMAND_MSG_WIKIDATA = "No en Wikidata" const val INVALID_COMMAND_TEXT_WIKIDATA_1 = "Wikidata es un gráfico de conocimiento editado de forma colaborativa y mantenido por la Fundación Wikimedia. Sirve como fuente de datos abiertos para proyectos como Wikipedia y muchos otros." @@ -35,6 +32,11 @@ object ESInterfaceVariables { val BASE_AUTOSUGGESTIONS = listOf("el", "la", "no") val NUMERIC_AUTOSUGGESTIONS = listOf("que", "de", "en") + // MARK: Currency Symbols + + const val CURRENCY_SYMBOL = "$" + val CURRENCY_SYMBOL_ALTERNATES = listOf("₡", "S", "€", "£", "₲", "¢") + // MARK: Suggestion Pronouns val VERBS_AFTER_PRONOUNS_ARRAY = listOf("ser", "REFLEXIVE_PRONOUN", "no") diff --git a/app/src/keyboards/java/be/scri/helpers/swedish/SVInterfaceVariables.kt b/app/src/keyboards/java/be/scri/helpers/swedish/SVInterfaceVariables.kt index 1a59c4fd..e6387177 100644 --- a/app/src/keyboards/java/be/scri/helpers/swedish/SVInterfaceVariables.kt +++ b/app/src/keyboards/java/be/scri/helpers/swedish/SVInterfaceVariables.kt @@ -6,16 +6,13 @@ package be.scri.helpers.swedish * Interface variables for Swedish language keyboards. */ object SVInterfaceVariables { - // MARK: Currency Symbols - - const val CURRENCY_SYMBOL = "kr" - val CURRENCY_SYMBOL_ALTERNATES = listOf("kr", "$", "€", "£", "¥") - // MARK: Keyboard Labels const val SPACE_BAR = "mellanslag" const val LANGUAGE = "Svenska" + const val DOWNLOAD_DATA_LBL = "Var god ladda ner språkdata" + const val INVALID_COMMAND_MSG_WIKIDATA = "Inte i Wikidata" const val INVALID_COMMAND_TEXT_WIKIDATA_1 = "Wikidata är en gemensamt redigerad kunskapsgraf som underhålls av Wikimedia Foundation. Det fungerar som en källa till öppen data för projekt som Wikipedia och flera andra." @@ -35,6 +32,11 @@ object SVInterfaceVariables { val BASE_AUTOSUGGESTIONS = listOf("jag", "det", "men") val NUMERIC_AUTOSUGGESTIONS = listOf("jag", "det", "och") + // MARK: Currency Symbols + + const val CURRENCY_SYMBOL = "kr" + val CURRENCY_SYMBOL_ALTERNATES = listOf("kr", "$", "€", "£", "¥") + // MARK: Translate Command const val TRANSLATE_KEY_LBL = "Översätt" diff --git a/app/src/keyboards/java/be/scri/services/GeneralKeyboardIME.kt b/app/src/keyboards/java/be/scri/services/GeneralKeyboardIME.kt index 35a26bb3..a53ff457 100644 --- a/app/src/keyboards/java/be/scri/services/GeneralKeyboardIME.kt +++ b/app/src/keyboards/java/be/scri/services/GeneralKeyboardIME.kt @@ -6,6 +6,7 @@ import DataContract import android.R.color.white import android.content.Context import android.content.Intent +import android.content.res.ColorStateList import android.database.sqlite.SQLiteException import android.graphics.Color import android.graphics.drawable.GradientDrawable @@ -28,6 +29,7 @@ import android.view.inputmethod.EditorInfo.IME_MASK_ACTION import android.view.inputmethod.ExtractedTextRequest import android.view.inputmethod.InputConnection import android.widget.Button +import android.widget.TextView import androidx.core.content.ContextCompat import androidx.core.content.edit import androidx.core.graphics.ColorUtils @@ -45,6 +47,7 @@ import be.scri.helpers.BackspaceHandler import be.scri.helpers.DatabaseManagers import be.scri.helpers.EmojiUtils.insertEmoji import be.scri.helpers.KeyboardBase +import be.scri.helpers.KeyboardLanguageMappingConstants import be.scri.helpers.LanguageMappingConstants.getLanguageAlias import be.scri.helpers.NativeSuggestionEngine import be.scri.helpers.PreferencesHelper @@ -365,14 +368,21 @@ abstract class GeneralKeyboardIME( val languageAlias = getLanguageAlias(language) val dbFile = applicationContext.getDatabasePath("${languageAlias}LanguageData.sqlite") val hasData = dbFile.exists() - val banner = binding.root.findViewById