添加故障求助通知提示
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user