修改取消求助的弹窗bug

This commit is contained in:
董宏宇
2020-07-23 19:14:28 +08:00
parent dcc4191f12
commit 845e250bc7
3 changed files with 24 additions and 18 deletions

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -12,10 +12,12 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.utils.logger.Logger;
/**
@@ -77,18 +79,26 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
void onClickRight();
}
boolean isShown;
WindowManagerView windowManager;
private boolean isShown;
private WindowManagerView windowManager;
public void show() {
Logger.d(TAG, "使用windowManager实现");
if (!isShown) {
windowManager = new WindowManagerView.Builder(getContext()).contentView(R.layout.module_commons_layout_wm_dialog).build();
windowManager.show();
isShown = true;
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("确定要解除求助状态吗");
unRegisterVoiceCmd();
registerVoiceCmd();
try {
Logger.d(TAG, "使用windowManager实现");
if (!isShown) {
if (windowManager == null) {
windowManager = new WindowManagerView.Builder(
V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2).getContext()
).contentView(this).build();
}
windowManager.show();
isShown = true;
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("确定要解除求助状态吗");
unRegisterVoiceCmd();
registerVoiceCmd();
}
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -105,18 +115,15 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
public void dismiss() {
if (isShown && windowManager != null) {
windowManager.dismiss();
windowManager = null;
isShown = false;
}
}
//放弃求助
private void handleLeft() {
if (mListener != null) {
mListener.onClickLeft();
}
unRegisterVoiceCmd();
}
@@ -126,7 +133,6 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
mListener.onClickRight();
}
unRegisterVoiceCmd();
}
private void registerVoiceCmd() {

View File

@@ -22,7 +22,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_75"
android:gravity="center"
android:textColor="@color/white"
android:textColor="#FFF"
android:textSize="@dimen/dp_40"
app:layout_constraintEnd_toEndOf="@id/ivDialogBg"
app:layout_constraintStart_toStartOf="@id/ivDialogBg"
@@ -35,7 +35,7 @@
android:layout_height="@dimen/dp_130"
android:background="@drawable/v2x_dialog_left_bg"
android:gravity="center"
android:textColor="@color/white"
android:textColor="#FFF"
android:textSize="@dimen/dp_40"
app:layout_constraintBottom_toBottomOf="@id/ivDialogBg"
app:layout_constraintEnd_toStartOf="@id/tvDialogRight"
@@ -48,7 +48,7 @@
android:layout_height="@dimen/dp_130"
android:background="@drawable/v2x_dialog_right_bg"
android:gravity="center"
android:textColor="@color/white"
android:textColor="#FFF"
android:textSize="@dimen/dp_40"
app:layout_constraintBottom_toBottomOf="@id/ivDialogBg"
app:layout_constraintEnd_toEndOf="@id/ivDialogBg"