Skip to content

Commit

Permalink
Add new APIs and change some routes
Browse files Browse the repository at this point in the history
  • Loading branch information
frknkrc44 committed Jan 26, 2024
1 parent 817aaf4 commit b805999
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
16 changes: 12 additions & 4 deletions app/src/main/java/org/blinksd/board/InputService.java
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,20 @@ public void sendDefaultKeyboardEvent(View v) {

switch (key.getNormalPressEvent().first) {
case KeyEvent.KEYCODE_HENKAN: // symbol menu
int fnIndex = findKeyboardIndex(KeyboardType.FN);
setEnabledLayout(getEnabledLayoutIndex() != fnIndex ? fnIndex : 0);
int fnIndex = findFNKeyboardIndex();
setEnabledLayout(
getEnabledLayoutIndex() != fnIndex
? fnIndex
: findNormalKeyboardIndex()
);
return;
case KeyEvent.KEYCODE_NUM: // number menu
int numIndex = findKeyboardIndex(KeyboardType.NUMBER);
setEnabledLayout(getEnabledLayoutIndex() != numIndex ? numIndex : 0);
int numIndex = findNumberKeyboardIndex();
setEnabledLayout(
getEnabledLayoutIndex() != numIndex
? numIndex
: findNormalKeyboardIndex()
);
return;
case KeyEvent.KEYCODE_EISU: // clipboard menu
showClipboardView(!clipboardView.isShown());
Expand Down
40 changes: 25 additions & 15 deletions app/src/main/java/org/blinksd/board/views/SuperBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ public class SuperBoard extends FrameLayout implements OnTouchListener {
private static Locale loc = new Locale("tr", "TR");
private final MyHandler mHandler = new MyHandler();
private final Vibrator vb;
private int keyclr = -1;
private float txtsze = -1;
protected Drawable keybg = null;
InputMethodService curr = null;
int action = 0;
private int selected = 0, shift = 0, hp = 40, wp = 100, y, shrad = 0,
shclr = -1, txtclr = Color.WHITE, txts = 0, vib = 0, mult = 1,
act = MotionEvent.ACTION_UP, iconmulti = 1, ctrl = 0, alt = 0;
act = MotionEvent.ACTION_UP, iconmulti = 1, ctrl = 0, alt = 0,
action = 0, keyclr = -1;
private boolean clear = false;
private boolean lng = false;
private boolean dpopup = false;
Expand All @@ -91,15 +90,17 @@ public SuperBoard(Context c) {
if (c instanceof InputMethodService) {
curr = (InputMethodService) c;
}
if (Build.VERSION.SDK_INT < 31)

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S)
vb = (Vibrator) c.getSystemService(Context.VIBRATOR_SERVICE);
else {
VibratorManager vm = (VibratorManager) c.getSystemService(Context.VIBRATOR_MANAGER_SERVICE);
vb = vm.getDefaultVibrator();
}

// trigSystemSuggestions();
setLayoutParams(new LayoutParams(-1, -1));
setBackgroundColor(0xFF212121);
// setBackgroundColor(0xFF212121);
createEmptyLayout();
setKeyboardHeight(hp);
}
Expand Down Expand Up @@ -723,7 +724,11 @@ private void defaultKeyboardEvent(Key v) {
setEnabledLayout((selected - 1) >= 0 ? selected - 1 : findSymbolKeyboardIndex());
break;
case Keyboard.KEYCODE_MODE_CHANGE:
setEnabledLayout(selected == 0 ? findSymbolKeyboardIndex() : findNormalKeyboardIndex());
setEnabledLayout(
selected == findNormalKeyboardIndex()
? findSymbolKeyboardIndex()
: findNormalKeyboardIndex()
);
setCtrlState(0);
setAltState(0);
break;
Expand Down Expand Up @@ -1095,23 +1100,24 @@ public void updateKeyState(InputMethodService s) {
break;
}

Key k;
switch (ei.inputType & InputType.TYPE_MASK_VARIATION) {
case InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS:
case InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS:
k = findKeyByLabel(0, ",");
case InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: {
Key k = findKeyByLabel(0, ",");
if (k != null) {
k.setText("@");
// k.setSubText("→");
}
break;
default:
k = findKeyByLabel(0, "@");
}
default: {
Key k = findKeyByLabel(0, "@");
if (k != null) {
k.setText(",");
// k.setSubText("→");
}
break;
}
}
}

Expand Down Expand Up @@ -1264,18 +1270,22 @@ public KeyboardType getCurrentKeyboardType() {
return (KeyboardType) getKeyboard(selected).getTag();
}

public int findSymbolKeyboardIndex() {
return findKeyboardIndex(KeyboardType.SYMBOL);
public int findFNKeyboardIndex() {
return findKeyboardIndex(KeyboardType.FN);
}

public int findNormalKeyboardIndex() {
return findKeyboardIndex(KeyboardType.TEXT);
public int findSymbolKeyboardIndex() {
return findKeyboardIndex(KeyboardType.SYMBOL);
}

public int findNumberKeyboardIndex() {
return findKeyboardIndex(KeyboardType.NUMBER);
}

public int findNormalKeyboardIndex() {
return findKeyboardIndex(KeyboardType.TEXT);
}

public void playSound(int event) {

}
Expand Down

0 comments on commit b805999

Please sign in to comment.