同步魔方的最新改动

This commit is contained in:
lixiaopeng
2023-02-01 16:52:24 +08:00
parent 1e7bd1c749
commit 52bc276157

View File

@@ -242,34 +242,35 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
*/
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString(MfConstants.BLUETOOTH_NAME);
if (!isPressEnd) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent ---1--- bluetoothName = " + bluetoothName);
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---1--- bluetoothName = " + bluetoothName);
}
if (bluetoothName.equals("MINI_KEYBOARD")) {
if (!isPressEnd) {
isPressEnd = true;
startPressTime = System.currentTimeMillis();
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent ---2--- bluetoothName = " + bluetoothName + "--- code = " + event.getKeyCode() + "--action = " + event.getAction());
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---2--- bluetoothName = " + bluetoothName + "--- code = " + event.getKeyCode() + "--action = " + event.getAction());
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1长按无操作AB组合-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressADownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
if ((pressADownTime - startPressTime) > 360 && (pressADownTime - startPressTime) < 1300 && pressBDownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 A 按AB组合 -2 ");
ToastUtils.showShort("方块 A 按AB组合 +1 ");
}
sendAcc(true, -2);
sendAcc(true, +1);
isCombinationKey = 3;
}
if (isCombinationKey != 3 && isCombinationKey != 1) {
if ((pressADownTime - startPressTime) > 1320) {
if (isShowToast) {
ToastUtils.showShort("方块 长按A 无 操作 ");
ToastUtils.showShort("方块 长按A -2 ");
}
sendAcc(true, -2);
isCombinationKey = 2;
}
}
@@ -299,17 +300,16 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
if ((pressBDownTime - startPressTime) > 360 && (pressBDownTime - startPressTime) < 1300 && pressADownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 B 按AB组合 ");
ToastUtils.showShort("方块 B 按AB组合 +1 ");
}
sendAcc(true, -2);
sendAcc(true, +1);
isCombinationKey = 3;
}
if (isCombinationKey != 3 && isCombinationKey != 1) {
if ((pressBDownTime - startPressTime) > 1320) {
if (isShowToast) {
ToastUtils.showShort("方块 长按B +1 ");
ToastUtils.showShort("方块 长按B 无操作 ");
}
sendAcc(true, +1);
isCombinationKey = 2;
}
}