添加故障求助通知提示

This commit is contained in:
tongchenfei
2020-11-02 17:49:17 +08:00
parent 788644b944
commit 7d7688b793
11 changed files with 155 additions and 2 deletions

View File

@@ -1,8 +1,10 @@
package com.mogo.module.extensions.entrance;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater;
@@ -16,6 +18,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.Group;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bumptech.glide.request.RequestOptions;
@@ -26,7 +29,6 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.navi.IMogoAimlessModeListener;
import com.mogo.map.navi.IMogoNavi;
@@ -51,6 +53,7 @@ import com.mogo.module.extensions.utils.TopViewAnimHelper;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.fragmentmanager.IFragmentProvider;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
@@ -174,10 +177,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
};
private Group seekHelpGroup;
private UploadButtonAnimatorController mUploadButtonAnimatorController;
private IFragmentProvider mMessageHistoryPanelProvider;
private TextView seekHelpNum;
@Override
protected int getLayoutId() {
return R.layout.module_ext_layout_entrance;
@@ -193,6 +200,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mStatusManager = mApis.getStatusManagerApi();
seekHelpGroup = findViewById(R.id.module_ext_id_seek_help_notice_group);
seekHelpNum = findViewById(R.id.module_ext_id_seek_help_notice_number);
mUploadRoadCondition = findViewById(R.id.module_entrance_id_upload_road_condition);
mUpload = findViewById(R.id.module_entrance_id_upload);
mUploading = findViewById(R.id.module_entrance_id_uploading);
@@ -381,6 +391,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
dealWeatherContainer();
listenSeekNumber();
debugTopView();
isShowGuide = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false);
@@ -741,6 +753,10 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mCameraMode.setVisibility(View.VISIBLE);
}
}
} else if (descriptor == StatusDescriptor.SEEK_HELPING) {
if (!isTrue) {
handler.post(() -> seekHelpGroup.setVisibility(View.GONE));
}
}
}
@@ -880,6 +896,36 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
}
private static int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
private IMogoOnMessageListener<String> seekHelpNoticeListener =
new IMogoOnMessageListener<String>() {
@Override
public Class target() {
return String.class;
}
@Override
public void onMsgReceived(String obj) {
if(mStatusManager.isSeekHelping()) {
int seekNum = SharedPrefsMgr.getInstance(getContext()).getInt("seek_help_num", 0);
final int finalSeekNum = seekNum++;
SharedPrefsMgr.getInstance(getContext()).putInt("seek_help_num", seekNum);
handler.post(() -> {
seekHelpGroup.setVisibility(View.VISIBLE);
seekHelpNum.setText("" + finalSeekNum);
});
}
}
};
private Handler handler = new Handler();
private void listenSeekNumber(){
mApis.getSocketManagerApi(getContext()).registerOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
mStatusManager.registerStatusChangedListener(TAG,StatusDescriptor.SEEK_HELPING,this);
}
@Override
public void onDestroy() {
super.onDestroy();
@@ -892,11 +938,13 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mStatusManager.unregisterStatusChangedListener(TAG, StatusDescriptor.UPLOADING, this);
mStatusManager.unregisterStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW
, this);
mStatusManager.unregisterStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this);
}
if (mApis != null) {
if (mApis.getIntentManagerApi() != null) {
mApis.getIntentManagerApi().unregisterIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
}
mApis.getSocketManagerApi(getContext()).unregisterOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/module_ext_seek_help_notice_bg_corner" />
<gradient
android:startColor="#E51E57A4"
android:endColor="#E51F7EFF"
android:angle="0" />
</shape>

View File

@@ -2,7 +2,8 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
>
<View
android:id="@+id/module_map_id_navi_bg"
android:layout_width="match_parent"

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<View
android:id="@+id/module_ext_id_seek_help_notice_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/module_ext_seek_help_notice_bg_height"
android:layout_marginLeft="@dimen/module_common_shadow_width_pos"
android:layout_marginTop="@dimen/module_common_shadow_width_pos"
android:layout_marginRight="@dimen/module_common_shadow_width_pos"
android:background="@drawable/module_ext_drawable_seek_help_notice_bg" />
<ImageView
android:id="@+id/module_ext_id_seek_help_notice_icon"
android:layout_width="@dimen/module_ext_seek_help_notice_icon_width"
android:layout_height="@dimen/module_ext_seek_help_notice_icon_width"
android:src="@drawable/module_ext_icon_seek_help_notice_icon"
app:layout_constraintBottom_toBottomOf="@id/module_ext_id_seek_help_notice_bg"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_seek_help_notice_bg"
app:layout_constraintRight_toLeftOf="@id/module_ext_id_seek_help_notice_left"
app:layout_constraintTop_toTopOf="@id/module_ext_id_seek_help_notice_bg" />
<TextView
android:id="@+id/module_ext_id_seek_help_notice_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_ext_seek_help_notice_text_margin_start"
android:text="故障求助中,已通知周边"
android:textColor="#fff"
android:textSize="@dimen/module_ext_seek_help_notice_text_size"
app:layout_constraintBottom_toBottomOf="@id/module_ext_id_seek_help_notice_bg"
app:layout_constraintLeft_toRightOf="@id/module_ext_id_seek_help_notice_icon"
app:layout_constraintRight_toLeftOf="@id/module_ext_id_seek_help_notice_number"
app:layout_constraintTop_toTopOf="@id/module_ext_id_seek_help_notice_bg" />
<TextView
android:id="@+id/module_ext_id_seek_help_notice_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:textColor="#fff"
android:textSize="@dimen/module_ext_seek_help_notice_number_text_size"
app:layout_constraintBottom_toBottomOf="@id/module_ext_id_seek_help_notice_bg"
app:layout_constraintLeft_toRightOf="@id/module_ext_id_seek_help_notice_left"
app:layout_constraintRight_toLeftOf="@id/module_ext_id_seek_help_notice_right"
app:layout_constraintTop_toTopOf="@id/module_ext_id_seek_help_notice_bg" />
<TextView
android:id="@+id/module_ext_id_seek_help_notice_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="位车主!"
android:textColor="#fff"
android:textSize="@dimen/module_ext_seek_help_notice_text_size"
app:layout_constraintBottom_toBottomOf="@id/module_ext_id_seek_help_notice_bg"
app:layout_constraintLeft_toRightOf="@id/module_ext_id_seek_help_notice_number"
app:layout_constraintRight_toRightOf="@id/module_ext_id_seek_help_notice_bg"
app:layout_constraintTop_toTopOf="@id/module_ext_id_seek_help_notice_bg" />
<androidx.constraintlayout.widget.Group
android:id="@+id/module_ext_id_seek_help_notice_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="module_ext_id_seek_help_notice_bg,module_ext_id_seek_help_notice_icon,module_ext_id_seek_help_notice_left,module_ext_id_seek_help_notice_number,module_ext_id_seek_help_notice_right" />
</merge>

View File

@@ -9,6 +9,11 @@
<include
layout="@layout/module_ext_layout_extensions"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<include
layout="@layout/module_ext_include_seeking_help_notice"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<include

View File

@@ -157,4 +157,12 @@
<dimen name="module_ext_destination_online_car_paddingRight">31px</dimen>
<dimen name="module_common_shadow_width_pos">10px</dimen>
<dimen name="module_ext_seek_help_notice_icon_width">44px</dimen>
<dimen name="module_ext_seek_help_notice_bg_width">1060px</dimen>
<dimen name="module_ext_seek_help_notice_bg_height">100px</dimen>
<dimen name="module_ext_seek_help_notice_bg_corner">30px</dimen>
<dimen name="module_ext_seek_help_notice_text_size">34px</dimen>
<dimen name="module_ext_seek_help_notice_text_margin_start">20px</dimen>
<dimen name="module_ext_seek_help_notice_number_text_size">40px</dimen>
</resources>

View File

@@ -162,4 +162,12 @@
<dimen name="module_ext_destination_online_car_paddingRight">14px</dimen>
<dimen name="module_common_shadow_width_pos">8px</dimen>
<dimen name="module_ext_seek_help_notice_icon_width">25px</dimen>
<dimen name="module_ext_seek_help_notice_bg_width">25px</dimen>
<dimen name="module_ext_seek_help_notice_bg_corner">16px</dimen>
<dimen name="module_ext_seek_help_notice_bg_height">56px</dimen>
<dimen name="module_ext_seek_help_notice_text_size">18px</dimen>
<dimen name="module_ext_seek_help_notice_text_margin_start">10px</dimen>
<dimen name="module_ext_seek_help_notice_number_text_size">22px</dimen>
</resources>

View File

@@ -170,6 +170,8 @@ object SeekHelpManager {
// 接口请求成功内部同步v2x状态通知adas改变自车图标
ServiceApisManager.serviceApis.statusManagerApi.setSeekHelping("ShareDialog", true)
SharedPrefsMgr.getInstance(context!!).putLong("seek_help_time", System.currentTimeMillis())
SharedPrefsMgr.getInstance(context!!).putInt("seek_help_num", 0)
isSeekHelp = true
aiAssist?.speakTTSVoice("已发布求助信息,将为你通知其他车主")
toast("已发布求助信息,将为你通知其他车主")