restored the Clear filter key on the on-screen keyboard and fixed the Filter key not acting properly when being repeatedly pressed
This commit is contained in:
parent
29339fc01e
commit
a1235e95ac
2 changed files with 18 additions and 8 deletions
|
|
@ -174,10 +174,13 @@
|
||||||
android:id="@+id/separator_2_2"
|
android:id="@+id/separator_2_2"
|
||||||
style="@style/numSeparator" />
|
style="@style/numSeparator" />
|
||||||
|
|
||||||
<View
|
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||||
|
android:id="@+id/soft_key_filter_suggestions"
|
||||||
|
style="@android:style/Widget.Holo.Button.Borderless"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="@dimen/numpad_control_key_layout_weight" />
|
android:layout_weight="@dimen/numpad_control_key_layout_weight"
|
||||||
|
android:text="Fltr" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
@ -228,12 +231,13 @@
|
||||||
style="@style/numSeparator" />
|
style="@style/numSeparator" />
|
||||||
|
|
||||||
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||||
android:id="@+id/soft_key_filter_suggestions"
|
android:id="@+id/soft_key_clear_filter"
|
||||||
style="@android:style/Widget.Holo.Button.Borderless"
|
style="@android:style/Widget.Holo.Button.Borderless"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="@dimen/numpad_control_key_layout_weight"
|
android:layout_weight="@dimen/numpad_control_key_layout_weight"
|
||||||
android:text="Fltr" />
|
android:text="Clr" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
||||||
private boolean hold = false;
|
private boolean hold = false;
|
||||||
private boolean repeat = false;
|
private boolean repeat = false;
|
||||||
private final Handler repeatHandler = new Handler(Looper.getMainLooper());
|
private final Handler repeatHandler = new Handler(Looper.getMainLooper());
|
||||||
|
private static int lastPressedKey = -1;
|
||||||
|
|
||||||
|
|
||||||
public SoftKey(Context context) {
|
public SoftKey(Context context) {
|
||||||
|
|
@ -73,7 +74,9 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
||||||
} else if (action == MotionEvent.ACTION_UP) {
|
} else if (action == MotionEvent.ACTION_UP) {
|
||||||
preventRepeat();
|
preventRepeat();
|
||||||
if (!repeat) {
|
if (!repeat) {
|
||||||
return handleRelease();
|
boolean result = handleRelease();
|
||||||
|
lastPressedKey = getId();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
repeat = false;
|
repeat = false;
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +108,7 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
||||||
if (hold) {
|
if (hold) {
|
||||||
repeat = true;
|
repeat = true;
|
||||||
handleHold();
|
handleHold();
|
||||||
|
lastPressedKey = getId();
|
||||||
repeatHandler.removeCallbacks(this::repeatOnLongPress);
|
repeatHandler.removeCallbacks(this::repeatOnLongPress);
|
||||||
repeatHandler.postDelayed(this::repeatOnLongPress, tt9.getSettings().getSoftKeyRepeatDelay());
|
repeatHandler.postDelayed(this::repeatOnLongPress, tt9.getSettings().getSoftKeyRepeatDelay());
|
||||||
}
|
}
|
||||||
|
|
@ -134,9 +138,11 @@ public class SoftKey extends androidx.appcompat.widget.AppCompatButton implement
|
||||||
}
|
}
|
||||||
|
|
||||||
int keyId = getId();
|
int keyId = getId();
|
||||||
|
boolean multiplePress = lastPressedKey == keyId;
|
||||||
|
|
||||||
if (keyId == R.id.soft_key_add_word) return tt9.onKeyAddWord(false);
|
if (keyId == R.id.soft_key_add_word) return tt9.onKeyAddWord(false);
|
||||||
if (keyId == R.id.soft_key_filter_suggestions) return tt9.onKeyFilterSuggestions(false, repeat);
|
if (keyId == R.id.soft_key_filter_suggestions) return tt9.onKeyFilterSuggestions(false, multiplePress);
|
||||||
|
if (keyId == R.id.soft_key_clear_filter) return tt9.onKeyFilterClear(false);
|
||||||
if (keyId == R.id.soft_key_left_arrow) return tt9.onKeyScrollSuggestion(false, true);
|
if (keyId == R.id.soft_key_left_arrow) return tt9.onKeyScrollSuggestion(false, true);
|
||||||
if (keyId == R.id.soft_key_right_arrow) return tt9.onKeyScrollSuggestion(false, false);
|
if (keyId == R.id.soft_key_right_arrow) return tt9.onKeyScrollSuggestion(false, false);
|
||||||
if (keyId == R.id.soft_key_input_mode) return tt9.onKeyNextInputMode(false);
|
if (keyId == R.id.soft_key_input_mode) return tt9.onKeyNextInputMode(false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue