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. * @param event the event to combine with the existing state.
* @return the resulting event. * @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. * Get the feedback that should be shown to the user for the current state of this combiner.

View file

@ -188,9 +188,9 @@ class DeadKeyCombiner : Combiner {
// TODO: make this a list of events instead // TODO: make this a list of events instead
val mDeadSequence = StringBuilder() 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 (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) mDeadSequence.appendCodePoint(event.mCodePoint)
return Event.createConsumedEvent(event) return Event.createConsumedEvent(event)
} }
@ -199,7 +199,7 @@ class DeadKeyCombiner : Combiner {
// simply returns the event as is. The majority of events will go through this path. // simply returns the event as is. The majority of events will go through this path.
return event 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. || 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) val resultEvent = createEventChainFromSequence(mDeadSequence.toString(), event)
mDeadSequence.setLength(0) mDeadSequence.setLength(0)

View file

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