make it compile (again, why did it work before?)

This commit is contained in:
Helium314 2023-09-14 19:21:54 +02:00
parent 04430fdb21
commit eee94f2924
3 changed files with 8 additions and 8 deletions

View file

@ -17,7 +17,7 @@ interface Combiner {
* @param event the event to combine with the existing state.
* @return the resulting event.
*/
fun processEvent(previousEvents: ArrayList<Event>?, event: Event?): Event
fun processEvent(previousEvents: ArrayList<Event>?, event: Event): Event
/**
* Get the feedback that should be shown to the user for the current state of this combiner.

View file

@ -188,18 +188,18 @@ class DeadKeyCombiner : Combiner {
// TODO: make this a list of events instead
val mDeadSequence = StringBuilder()
override fun processEvent(previousEvents: ArrayList<Event>?, event: Event?): Event {
override fun processEvent(previousEvents: ArrayList<Event>?, event: Event): Event {
if (TextUtils.isEmpty(mDeadSequence)) { // No dead char is currently being tracked: this is the most common case.
if (event!!.isDead) { // The event was a dead key. Start tracking it.
if (event.isDead) { // The event was a dead key. Start tracking it.
mDeadSequence.appendCodePoint(event.mCodePoint)
return Event.createConsumedEvent(event)
}
// Regular keystroke when not keeping track of a dead key. Simply said, there are
// no dead keys at all in the current input, so this combiner has nothing to do and
// simply returns the event as is. The majority of events will go through this path.
// no dead keys at all in the current input, so this combiner has nothing to do and
// simply returns the event as is. The majority of events will go through this path.
return event
}
if (Character.isWhitespace(event!!.mCodePoint)
if (Character.isWhitespace(event.mCodePoint)
|| event.mCodePoint == mDeadSequence.codePointBefore(mDeadSequence.length)) { // When whitespace or twice the same dead key, we should output the dead sequence as is.
val resultEvent = createEventChainFromSequence(mDeadSequence.toString(), event)
mDeadSequence.setLength(0)

View file

@ -11,8 +11,8 @@ class HangulCombiner : Combiner {
val history: MutableList<HangulSyllable> = mutableListOf()
val syllable: HangulSyllable? get() = history.lastOrNull()
override fun processEvent(previousEvents: ArrayList<Event>?, event: Event?): Event? {
if(event == null || event.mKeyCode == Constants.CODE_SHIFT) return event
override fun processEvent(previousEvents: ArrayList<Event>?, event: Event): Event {
if(event.mKeyCode == Constants.CODE_SHIFT) return event
if(Character.isWhitespace(event.mCodePoint)) {
val text = combiningStateFeedback
reset()