Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/).
- Vibrate on keypress and key click functionalities are included ([#405](https://github.com/scribe-org/Scribe-Android/issues/405), [#406](https://github.com/scribe-org/Scribe-Android/issues/406)).
- An in-app tutorial is provided to detail functionalities of the application ([#602](https://github.com/scribe-org/Scribe-Android/issues/602), [#615](https://github.com/scribe-org/Scribe-Android/issues/615), [#616](https://github.com/scribe-org/Scribe-Android/issues/616)).
- The user is able to easily rate the application, with installer-aware routing to the appropriate store ([#165](https://github.com/scribe-org/Scribe-Android/issues/165), [#640](https://github.com/scribe-org/Scribe-Android/issues/640)).

- Declension of words within an interactive UI for Russian and German keyboards. ([#276](https://github.com/scribe-org/Scribe-Android/issues/276))
### 🗃️ Data

- SQLite databases have been set up for all data needed for the keyboards ([#87](https://github.com/scribe-org/Scribe-Android/issues/87)).
Expand Down
113 changes: 0 additions & 113 deletions app/src/androidTestKeyboards/kotlin/be/scri/helpers/KeyboardTest.kt

This file was deleted.

7 changes: 4 additions & 3 deletions app/src/keyboards/java/be/scri/helpers/KeyHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -330,18 +330,19 @@ class KeyHandler(
) {
val sharedPreferences = context.getSharedPreferences("keyboard_preferences", Context.MODE_PRIVATE)
val editor = sharedPreferences.edit()
var currentValue = sharedPreferences.getInt("conjugate_index", 0)
val preferenceKey = if (ime.currentState == ScribeState.SELECT_DECLENSION) "declension_index" else "conjugate_index"
var currentValue = sharedPreferences.getInt(preferenceKey, 0)
if (code == KeyboardBase.DISPLAY_RIGHT) {
currentValue--
} else if (code == KeyboardBase.DISPLAY_LEFT) {
currentValue++
}

editor.putInt("conjugate_index", currentValue)
editor.putInt(preferenceKey, currentValue)
editor.apply()

ime.updateUI()
Log.d(TAG, "New conjugate_index: $currentValue")
Log.d(TAG, "New $preferenceKey: $currentValue")
}

/**
Expand Down
6 changes: 6 additions & 0 deletions app/src/keyboards/java/be/scri/helpers/KeyboardDataHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package be.scri.helpers

import DataContract
import DeclensionNode
import android.content.Context
import android.database.sqlite.SQLiteException
import android.util.Log
Expand Down Expand Up @@ -52,6 +53,9 @@ class KeyboardDataHandler {
var conjugateLabels: Set<String> = emptySet()
internal set

var declensions: LinkedHashMap<String, List<DeclensionNode>>? = null
internal set

val isInitialized: Boolean
get() = this::dbManagers.isInitialized

Expand Down Expand Up @@ -92,6 +96,8 @@ class KeyboardDataHandler {
val tempConjugateOutput = dbManagers.conjugateDataManager.getStructuredConjugations(languageAlias, dataContract, "describe")
conjugateOutput = if (tempConjugateOutput?.isEmpty() == true) null else tempConjugateOutput
conjugateLabels = dbManagers.conjugateDataManager.extractConjugateHeadings(dataContract, "coacha")

declensions = dbManagers.declensionManager.getDeclensions(languageAlias, dataContract)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import be.scri.models.ScribeState
*/
class SuggestionHandler(
private val ime: KeyboardIMEContext,
private val handler: Handler = Handler(Looper.getMainLooper()),
) {
private val handler = Handler(Looper.getMainLooper())
private var emojiSuggestionRunnable: Runnable? = null
private var linguisticSuggestionRunnable: Runnable? = null
private var wordSuggestionRunnable: Runnable? = null
Expand Down
16 changes: 16 additions & 0 deletions app/src/keyboards/java/be/scri/helpers/ui/HintUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ object HintUtils {
currentState: ScribeState,
language: String,
word: String?,
declensionSectionTitle: String?,
): String =
when (currentState) {
ScribeState.SELECT_VERB_CONJUNCTION -> word ?: ""
ScribeState.SELECT_DECLENSION -> declensionSectionTitle ?: ""
else -> getHintForState(currentState)[language] ?: ""
}

Expand Down Expand Up @@ -351,9 +353,23 @@ object HintUtils {
ScribeState.CONJUGATE -> getConjugationPrompt(language)
ScribeState.PLURAL -> getPluralPrompt(language)
ScribeState.SELECT_VERB_CONJUNCTION -> text ?: ""
ScribeState.SELECT_DECLENSION -> getDeclensionPrompt(language)
else -> ""
}

private fun getDeclensionPrompt(language: String): String =
when (language) {
"English" -> "Decline: "
"French" -> "Décliner: "
"German" -> "Deklinieren: "
"Italian" -> "Declinare: "
"Portuguese" -> "Declinar: "
"Russian" -> "Склонение: "
"Spanish" -> "Declinar: "
"Swedish" -> "Deklinera: "
else -> "Decline: "
}

/**
* Retrieves the translation prompt text for the given language.
*
Expand Down
25 changes: 21 additions & 4 deletions app/src/keyboards/java/be/scri/helpers/ui/KeyboardThemeManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,39 @@ class KeyboardThemeManager {
colorRes: Int,
buttonText: String,
textSizeSp: Float? = null,
type: String?,
) {
button.visibility = View.VISIBLE
button.text = buttonText
if (textSizeSp != null) {
button.textSize = textSizeSp
}
button.isClickable = false
button.setOnClickListener(null)
when (type) {
"preposition" -> {
button.isClickable = true
}
else -> {
button.isClickable = false
button.setOnClickListener(null)
}
}

val isUserDarkMode = getIsDarkModeOrNot(context)
if (colorRes != R.color.transparent) {
button.background = ContextCompat.getDrawable(context, R.drawable.button_background_rounded)
button.backgroundTintList = ContextCompat.getColorStateList(context, colorRes)
button.setTextColor(ContextCompat.getColor(context, R.color.white))
button.setTextColor(
ContextCompat.getColor(
context,
if (colorRes == R.color.annotateDeclension && isUserDarkMode) {
android.R.color.black
} else {
R.color.white
},
),
)
} else {
button.background = null
val isUserDarkMode = getIsDarkModeOrNot(context)
button.backgroundTintList = ContextCompat.getColorStateList(context, R.color.transparent)
button.setTextColor(ContextCompat.getColor(context, if (isUserDarkMode) R.color.white else android.R.color.black))
}
Expand Down
Loading
Loading