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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ 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 ([#165](https://github.com/scribe-org/Scribe-Android/issues/165), [#640](https://github.com/scribe-org/Scribe-Android/issues/640)).
- The keyboard UI has been rewritten in Jetpack Compose, replacing the legacy XML view hierarchy ([#657](https://github.com/scribe-org/Scribe-Android/issues/657)).
- Emojis can be searched by keyword from a dedicated suggestion row after typing a standalone colon ([#590](https://github.com/scribe-org/Scribe-Android/issues/590)).
- An autocompletion that unambiguously matches what the user has typed is highlighted and can be accepted with the space key ([#648](https://github.com/scribe-org/Scribe-Android/pull/648)).

### 🗃️ Data

Expand All @@ -67,6 +70,7 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/).
- The return key is colored Scribe blue when commands are being triggered to let the user know that that is what they need to press to finish the command ([#160](https://github.com/scribe-org/Scribe-Android/issues/160)).
- Dark mode compatibility through a responsive color scheme ([#25](https://github.com/scribe-org/Scribe-Android/issues/25), [#51](https://github.com/scribe-org/Scribe-Android/issues/51), [#116](https://github.com/scribe-org/Scribe-Android/issues/116), [#121](https://github.com/scribe-org/Scribe-Android/issues/121), [#155](https://github.com/scribe-org/Scribe-Android/issues/155), [#161](https://github.com/scribe-org/Scribe-Android/issues/161), [#543](https://github.com/scribe-org/Scribe-Android/issues/543)).
- The application menu follows modern Android styling ([#114](https://github.com/scribe-org/Scribe-Android/issues/114), [#150](https://github.com/scribe-org/Scribe-Android/issues/150), [#217](https://github.com/scribe-org/Scribe-Android/issues/217), [#246](https://github.com/scribe-org/Scribe-Android/issues/246), [#247](https://github.com/scribe-org/Scribe-Android/issues/247), [248](https://github.com/scribe-org/Scribe-Android/issues/248), [#256](https://github.com/scribe-org/Scribe-Android/issues/256)).
- The floating keyboard can be dragged around the screen and resized from its corner handles ([#261](https://github.com/scribe-org/Scribe-Android/issues/261)).

### 🌐 Localization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ class KeyboardTest {
translateBtn = mockk(relaxed = true)
conjugateBtn = mockk(relaxed = true)
pluralBtn = mockk(relaxed = true)
every { mockIME.binding.translateBtn } returns translateBtn
every { mockIME.binding.conjugateBtn } returns conjugateBtn
every { mockIME.binding.pluralBtn } returns pluralBtn
}

@Test
Expand Down
5 changes: 0 additions & 5 deletions app/src/keyboards/java/be/scri/activities/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.navigation.compose.rememberNavController
import be.scri.ScribeApp
import be.scri.helpers.PreferencesHelper
import be.scri.helpers.PreferencesHelper.setLightDarkModePreference
import be.scri.services.EnglishKeyboardIME
import be.scri.ui.common.bottombar.BottomBarScreen
import be.scri.ui.theme.ScribeTheme

Expand All @@ -34,8 +33,6 @@ import be.scri.ui.theme.ScribeTheme
* Initializes theme settings, navigation, and sets up the main UI using Jetpack Compose.
*/
class MainActivity : ComponentActivity() {
private var englishKeyboardIME: EnglishKeyboardIME? = null

/**
* Initializes the app on launch. Sets the theme based on user preferences, sets up edge-to-edge
* layout, and builds the UI using Compose.
Expand All @@ -48,8 +45,6 @@ class MainActivity : ComponentActivity() {

applyNavigationBarStyle(isDark)

englishKeyboardIME = EnglishKeyboardIME()

setContent {
val context = LocalContext.current

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class AutocompletionHandler(
return@Runnable
}

val completions = ime.getAutocompletions(currentWord, limit = 5)
val result = ime.getAutocompletions(currentWord, limit = 5)

if (completions.isNotEmpty()) {
ime.updateAutocompleteSuggestions(completions)
if (result.completions.isNotEmpty()) {
ime.updateAutocompleteSuggestions(result.completions, result.highlightedSuggestion)
} else {
ime.clearAutocomplete()
}
Expand Down
16 changes: 7 additions & 9 deletions app/src/keyboards/java/be/scri/helpers/BackspaceHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ class BackspaceHandler(
isLongPress: Boolean = false,
) {
val keyboard = ime.keyboard ?: return
val keyboardView = ime.keyboardView ?: return

if (keyboard.mShiftState == SHIFT_ON_ONE_CHAR) {
keyboard.mShiftState = SHIFT_OFF
ime.setShifted(SHIFT_OFF)
}

if (isCommandBar) {
Expand All @@ -60,8 +59,7 @@ class BackspaceHandler(

// Auto-shift if text is empty
if (inputConnection.getTextBeforeCursor(1, 0)?.isEmpty() != false) {
keyboard.mShiftState = SHIFT_ON_ONE_CHAR
keyboardView.invalidateAllKeys()
ime.setShifted(SHIFT_ON_ONE_CHAR)
}
}
}
Expand All @@ -72,16 +70,16 @@ class BackspaceHandler(
private fun handleCommandBarDelete() {
val currentTextWithoutCursor = ime.getCommandBarTextWithoutCursor()
// If we're already showing the hint, do nothing on delete.
if (currentTextWithoutCursor == ime.currentCommandBarHint) {
if (currentTextWithoutCursor == ime.commandBarHint) {
return
}

if (currentTextWithoutCursor.isNotEmpty()) {
val newText = currentTextWithoutCursor.dropLast(1)
if (newText.isEmpty()) {
// All real text has been deleted, so restore the hint.
ime.setCommandBarTextWithCursor(ime.currentCommandBarHint, cursorAtStart = true)
ime.binding.commandBar.setTextColor(ime.commandBarHintColor)
ime.setCommandBarTextWithCursor(ime.commandBarHint, cursorAtStart = true)
// Color update is handled by the ViewModel when text is empty/hint is shown.
} else {
// There's still text left, so just update it.
ime.setCommandBarTextWithCursor(newText)
Expand All @@ -90,12 +88,12 @@ class BackspaceHandler(

// Handle German plural mode shift state.
val finalCommandBarText = ime.getCommandBarTextWithoutCursor()
val isEmptyOrAHint = finalCommandBarText.isEmpty() || finalCommandBarText == ime.currentCommandBarHint
val isEmptyOrAHint = finalCommandBarText.isEmpty() || finalCommandBarText == ime.commandBarHint
val isGerman = ime.language == "German"
val isPluralState = ime.currentState == ScribeState.PLURAL

if (isEmptyOrAHint && isGerman && isPluralState) {
ime.keyboard?.mShiftState = SHIFT_ON_ONE_CHAR
ime.setShifted(SHIFT_ON_ONE_CHAR)
}
}

Expand Down
Loading
Loading