[dev_robotaxi-d-app-module_2132_221223_2.13.2] 优化魔方的按键
This commit is contained in:
@@ -10,10 +10,8 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
@@ -25,7 +23,6 @@ import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
|||||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
|
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
|
||||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
|
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
|
||||||
import com.mogo.eagle.core.function.hmi.R;
|
import com.mogo.eagle.core.function.hmi.R;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||||
@@ -76,6 +73,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
private long pressEDownTime = 0;
|
private long pressEDownTime = 0;
|
||||||
private long pressEUpTime = 0;
|
private long pressEUpTime = 0;
|
||||||
|
|
||||||
|
private int clickTime = 300; //单击
|
||||||
|
private int clickTimeInterval = 330;
|
||||||
|
private int longPressTime = 670;
|
||||||
|
private int longPressTimeInterval = 700;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
@@ -219,7 +221,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
pressADownTime = System.currentTimeMillis();
|
pressADownTime = System.currentTimeMillis();
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
|
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 ((pressADownTime - startPressTime) > clickTimeInterval && (pressADownTime - startPressTime) < longPressTime && pressBDownTime > 0) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 A 按AB组合 +1 ");
|
ToastUtils.showShort("方块 A 按AB组合 +1 ");
|
||||||
}
|
}
|
||||||
@@ -228,7 +230,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||||
if ((pressADownTime - startPressTime) > 1320) {
|
if ((pressADownTime - startPressTime) > longPressTimeInterval) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 长按A -2 ");
|
ToastUtils.showShort("方块 长按A -2 ");
|
||||||
}
|
}
|
||||||
@@ -239,7 +241,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||||
pressAUpTime = System.currentTimeMillis();
|
pressAUpTime = System.currentTimeMillis();
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
|
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
|
||||||
if ((pressAUpTime - startPressTime) < 350 && isCombinationKey != 3) {
|
if ((pressAUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
|
||||||
isCombinationKey = 1;
|
isCombinationKey = 1;
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 单击A -1 ");
|
ToastUtils.showShort("方块 单击A -1 ");
|
||||||
@@ -260,7 +262,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
pressBDownTime = System.currentTimeMillis();
|
pressBDownTime = System.currentTimeMillis();
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
|
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 ((pressBDownTime - startPressTime) > clickTimeInterval && (pressBDownTime - startPressTime) < longPressTime && pressADownTime > 0) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 B 按AB组合 +1 ");
|
ToastUtils.showShort("方块 B 按AB组合 +1 ");
|
||||||
}
|
}
|
||||||
@@ -268,7 +270,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
isCombinationKey = 3;
|
isCombinationKey = 3;
|
||||||
}
|
}
|
||||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||||
if ((pressBDownTime - startPressTime) > 1320) {
|
if ((pressBDownTime - startPressTime) > longPressTimeInterval) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 长按B 无操作 ");
|
ToastUtils.showShort("方块 长按B 无操作 ");
|
||||||
}
|
}
|
||||||
@@ -278,7 +280,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||||
pressBUpTime = System.currentTimeMillis();
|
pressBUpTime = System.currentTimeMillis();
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
|
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
|
||||||
if ((pressBUpTime - startPressTime) < 350 && isCombinationKey != 3) {
|
if ((pressBUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 单击B 0 ");
|
ToastUtils.showShort("方块 单击B 0 ");
|
||||||
}
|
}
|
||||||
@@ -300,7 +302,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
pressCDownTime = System.currentTimeMillis();
|
pressCDownTime = System.currentTimeMillis();
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime));
|
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime));
|
||||||
if ((pressCDownTime - startPressTime) > 1320) {
|
if ((pressCDownTime - startPressTime) > longPressTimeInterval) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 长按C 无操作 ");
|
ToastUtils.showShort("方块 长按C 无操作 ");
|
||||||
}
|
}
|
||||||
@@ -309,7 +311,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
pressCUpTime = System.currentTimeMillis();
|
pressCUpTime = System.currentTimeMillis();
|
||||||
isPressEnd = false;
|
isPressEnd = false;
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime));
|
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime));
|
||||||
if ((pressCUpTime - startPressTime) < 350) {
|
if ((pressCUpTime - startPressTime) < clickTime) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 单击C ← 向左变道 ");
|
ToastUtils.showShort("方块 单击C ← 向左变道 ");
|
||||||
}
|
}
|
||||||
@@ -321,7 +323,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
pressDDownTime = System.currentTimeMillis();
|
pressDDownTime = System.currentTimeMillis();
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime));
|
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime));
|
||||||
if ((pressDDownTime - startPressTime) > 1320) {
|
if ((pressDDownTime - startPressTime) > longPressTimeInterval) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 长按D 无操作 ");
|
ToastUtils.showShort("方块 长按D 无操作 ");
|
||||||
}
|
}
|
||||||
@@ -330,7 +332,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
pressDUpTime = System.currentTimeMillis();
|
pressDUpTime = System.currentTimeMillis();
|
||||||
isPressEnd = false;
|
isPressEnd = false;
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime));
|
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime));
|
||||||
if ((pressDUpTime - startPressTime) < 350) {
|
if ((pressDUpTime - startPressTime) < clickTime) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 单击D → 向右变道 ");
|
ToastUtils.showShort("方块 单击D → 向右变道 ");
|
||||||
}
|
}
|
||||||
@@ -342,7 +344,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
pressEDownTime = System.currentTimeMillis();
|
pressEDownTime = System.currentTimeMillis();
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime));
|
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime));
|
||||||
if ((pressEDownTime - startPressTime) > 1320) {
|
if ((pressEDownTime - startPressTime) > longPressTimeInterval) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 长按E 鸣笛 ");
|
ToastUtils.showShort("方块 长按E 鸣笛 ");
|
||||||
}
|
}
|
||||||
@@ -362,7 +364,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
pressEUpTime = System.currentTimeMillis();
|
pressEUpTime = System.currentTimeMillis();
|
||||||
isPressEnd = false;
|
isPressEnd = false;
|
||||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime));
|
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime));
|
||||||
if ((pressEUpTime - startPressTime) < 350) {
|
if ((pressEUpTime - startPressTime) < clickTime) {
|
||||||
if (isShowToast) {
|
if (isShowToast) {
|
||||||
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
|
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user