code cleanup
This commit is contained in:
parent
c55a83b5d3
commit
8fc51d5f56
5 changed files with 15 additions and 8 deletions
|
|
@ -85,6 +85,12 @@ public class AppHacks {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simulate the behavior of the Sonim native keyboard. In search fields with integrated lists,
|
||||
* ENTER is used to select an item from the list. But some of them have actionId = NEXT, instead of NONE,
|
||||
* which normally means "navigate to the next button or field". This hack correctly allows selection
|
||||
* of the item, instead of performing navigation.
|
||||
*/
|
||||
private boolean isSonimSearchField(int action) {
|
||||
return
|
||||
DeviceInfo.isSonim() &&
|
||||
|
|
@ -92,7 +98,7 @@ public class AppHacks {
|
|||
&& (editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION) == action
|
||||
&& (
|
||||
inputType.isText()
|
||||
// in some apps, they forgot to set the TEXT type, but fortunately, they did set the multiline flag.
|
||||
// in some apps, they forgot to set the TEXT type, but fortunately, they did set the NO_SUGGESTIONS flag.
|
||||
|| ((editorInfo.inputType & EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS) == EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS)
|
||||
);
|
||||
}
|
||||
|
|
@ -139,6 +145,11 @@ public class AppHacks {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* onAction
|
||||
* Runs non-standard actions for certain apps and fields. Use instead of inputConnection.performEditorAction(action).
|
||||
* Returns "true" if the action was handled, "false" otherwise.
|
||||
*/
|
||||
public boolean onAction(int action) {
|
||||
if (isSonimSearchField(action)) {
|
||||
return sendDownUpKeyEvents(KeyEvent.KEYCODE_ENTER);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ package io.github.sspanak.tt9.ime.modes;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.github.sspanak.tt9.R;
|
||||
|
||||
// see: InputType.isSpecialNumeric()
|
||||
public class ModePassthrough extends InputMode {
|
||||
ModePassthrough() {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import io.github.sspanak.tt9.preferences.PreferencesActivity;
|
|||
import io.github.sspanak.tt9.ui.UI;
|
||||
|
||||
public class ItemText extends ItemClickable {
|
||||
private PreferencesActivity activity;
|
||||
private final PreferencesActivity activity;
|
||||
public ItemText(PreferencesActivity activity, Preference preference) {
|
||||
super(preference);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
|||
public class ItemStatusIcon {
|
||||
public static final String NAME = "pref_status_icon";
|
||||
|
||||
private SwitchPreferenceCompat item;
|
||||
private SettingsStore settings;
|
||||
private final SwitchPreferenceCompat item;
|
||||
private final SettingsStore settings;
|
||||
|
||||
public ItemStatusIcon(SwitchPreferenceCompat item, SettingsStore settings) {
|
||||
this.item = item;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ import androidx.annotation.NonNull;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import io.github.sspanak.tt9.R;
|
||||
import io.github.sspanak.tt9.languages.Language;
|
||||
import io.github.sspanak.tt9.preferences.PreferencesActivity;
|
||||
|
||||
public class UI {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue