disabled 'send with OK in Messenger'
This commit is contained in:
parent
a82f8c783e
commit
1ee0a4485f
6 changed files with 3 additions and 36 deletions
|
|
@ -100,9 +100,7 @@ public class AppHacks {
|
|||
* it does nothing and return "false", signaling the system we have ignored the key press.
|
||||
*/
|
||||
public boolean onEnter() {
|
||||
if (settings.getFbMessengerHack() && inputType.isMessenger()) {
|
||||
return onEnterFbMessenger();
|
||||
} else if (settings.getGoogleChatHack() && inputType.isGoogleChat()) {
|
||||
if (settings.getGoogleChatHack() && inputType.isGoogleChat()) {
|
||||
return onEnterGoogleChat();
|
||||
} else if (inputType.isTermux() || inputType.isMultilineTextInNonSystemApp()) {
|
||||
// Termux supports only ENTER, so we convert DPAD_CENTER for it.
|
||||
|
|
@ -117,21 +115,6 @@ public class AppHacks {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* onEnterFbMessenger
|
||||
* Messenger responds only to ENTER, but not DPAD_CENTER, so we make sure to send the correct code,
|
||||
* no matter how the hardware key is implemented.
|
||||
*/
|
||||
private boolean onEnterFbMessenger() {
|
||||
if (inputConnection == null || textField == null || textField.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sendDownUpKeyEvents(KeyEvent.KEYCODE_ENTER);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* onEnterGoogleChat
|
||||
* Google Chat does not seem to respond consistently to ENTER. So we trick it by selecting
|
||||
|
|
|
|||
|
|
@ -56,14 +56,6 @@ public class InputType extends StandardInputType {
|
|||
}
|
||||
|
||||
|
||||
boolean isMessenger() {
|
||||
return isAppField(
|
||||
"com.facebook.orca",
|
||||
EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Third-party apps are usually designed for a touch screen, so the least we can do is convert
|
||||
* DPAD_CENTER to ENTER for typing new lines, regardless of the implementation of the OK key.
|
||||
|
|
|
|||
|
|
@ -52,10 +52,5 @@ public class SetupScreen extends BaseScreenFragment {
|
|||
if (hackGoogleChat != null) {
|
||||
hackGoogleChat.setEnabled(isEnabled);
|
||||
}
|
||||
|
||||
Preference hackFBMessenger = findPreference("pref_hack_fb_messenger");
|
||||
if (hackFBMessenger != null) {
|
||||
hackFBMessenger.setEnabled(isEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,10 +46,6 @@ class SettingsHacks extends BaseSettings {
|
|||
return prefs.getBoolean("pref_clear_insets", DeviceInfo.isSonimGen2(context));
|
||||
}
|
||||
|
||||
public boolean getFbMessengerHack() {
|
||||
return prefs.getBoolean("pref_hack_fb_messenger", false);
|
||||
}
|
||||
|
||||
public boolean getGoogleChatHack() {
|
||||
return prefs.getBoolean("pref_hack_google_chat", false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="false"
|
||||
app:enabled="false"
|
||||
app:key="pref_hack_fb_messenger"
|
||||
app:title="@string/pref_hack_fb_messenger"/>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue