Skip to content

Commit

Permalink
Added enable/disable input compsing property.
Browse files Browse the repository at this point in the history
  • Loading branch information
maoabc committed Oct 12, 2023
1 parent 88e9dd9 commit c939020
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.media.AudioManager;
import android.os.Environment;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

import com.termux.R;
import com.termux.app.TermuxActivity;
Expand Down Expand Up @@ -216,6 +212,11 @@ public boolean shouldEnforceCharBasedInput() {
return mActivity.getProperties().isEnforcingCharBasedInput();
}

@Override
public boolean isInputComposingDisabled() {
return mActivity.getProperties().isInputComposingDisabled();
}

@Override
public boolean shouldUseCtrlSpaceWorkaround() {
return mActivity.getProperties().isUsingCtrlSpaceWorkaround();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public final class TerminalView extends View {
private static final String LOG_TAG = "TerminalView";

private final SpannableStringBuilder imeBuffer = new SpannableStringBuilder("");
boolean composing=true;
public TerminalView(Context context, AttributeSet attributes) { // NO_UCD (unused code)
super(context, attributes);
mGestureRecognizer = new GestureAndScaleRecognizer(context, new GestureAndScaleRecognizer.Listener() {
Expand Down Expand Up @@ -282,7 +281,7 @@ public Editable getImeBuffer() {

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
if(composing){
if(!mClient.isInputComposingDisabled()){
outAttrs.imeOptions =
EditorInfo.IME_FLAG_NO_EXTRACT_UI |
EditorInfo.IME_FLAG_NO_FULLSCREEN |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface TerminalViewClient {

boolean isTerminalViewSelected();


boolean isInputComposingDisabled();

void copyModeChanged(boolean copyMode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
import com.google.common.collect.ImmutableBiMap;
import com.termux.shared.termux.shell.am.TermuxAmSocketServer;
import com.termux.shared.theme.NightMode;
import com.termux.shared.file.FileUtils;
import com.termux.shared.file.filesystem.FileType;
import com.termux.shared.settings.properties.SharedProperties;
import com.termux.shared.termux.TermuxConstants;
import com.termux.shared.logger.Logger;
import com.termux.terminal.TerminalEmulator;
import com.termux.view.TerminalView;

import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/*
Expand Down Expand Up @@ -121,6 +116,8 @@ public final class TermuxPropertyConstants {
public static final String KEY_ENFORCE_CHAR_BASED_INPUT = "enforce-char-based-input"; // Default: "enforce-char-based-input"


public static final String KEY_DISABLE_INPUT_COMPOSING = "disable-input-composing";


/** Defines the key for whether text for the extra keys buttons should be all capitalized automatically */
public static final String KEY_EXTRA_KEYS_TEXT_ALL_CAPS = "extra-keys-text-all-caps"; // Default: "extra-keys-text-all-caps"
Expand Down Expand Up @@ -396,6 +393,7 @@ public final class TermuxPropertyConstants {
KEY_DISABLE_HARDWARE_KEYBOARD_SHORTCUTS,
KEY_DISABLE_TERMINAL_SESSION_CHANGE_TOAST,
KEY_ENFORCE_CHAR_BASED_INPUT,
KEY_DISABLE_INPUT_COMPOSING,
KEY_EXTRA_KEYS_TEXT_ALL_CAPS,
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
KEY_RUN_TERMUX_AM_SOCKET_SERVER,
Expand Down Expand Up @@ -459,7 +457,8 @@ public final class TermuxPropertyConstants {
*/
public static final Set<String> TERMUX_DEFAULT_TRUE_BOOLEAN_BEHAVIOUR_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
KEY_EXTRA_KEYS_TEXT_ALL_CAPS,
KEY_RUN_TERMUX_AM_SOCKET_SERVER
KEY_RUN_TERMUX_AM_SOCKET_SERVER,
KEY_DISABLE_INPUT_COMPOSING
));

/** Defines the set for keys loaded by termux that have default inverted boolean behaviour with false as default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ public boolean isEnforcingCharBasedInput() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_ENFORCE_CHAR_BASED_INPUT, true);
}

public boolean isInputComposingDisabled(){
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_DISABLE_INPUT_COMPOSING, true);
}

public boolean shouldExtraKeysTextBeAllCaps() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_EXTRA_KEYS_TEXT_ALL_CAPS, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public boolean shouldEnforceCharBasedInput() {
return false;
}

@Override
public boolean isInputComposingDisabled() {
return true;
}

public boolean shouldUseCtrlSpaceWorkaround() {
return false;
}
Expand Down

0 comments on commit c939020

Please sign in to comment.