添加上报频率设置

This commit is contained in:
tongchenfei
2020-11-25 17:44:33 +08:00
parent 431f5f3ca9
commit 87498bf5ff
5 changed files with 88 additions and 5 deletions

1
.idea/gradle.xml generated
View File

@@ -88,6 +88,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

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" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="SuppressionsComponent">

View File

@@ -17,6 +17,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;
@@ -257,7 +258,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
}
} );
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
if (DebugConfig.isDebug()) {
mMove2CurrentLocation.setOnLongClickListener(view -> {
mApis.getSearchManagerApi().goSettings();
@@ -268,8 +269,19 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mApis.getMogoMonitorApi().showLogDebugDialog();
return true;
});
mUserHeadImg.setOnLongClickListener(view ->{
if (groupFix.getVisibility() == View.VISIBLE) {
groupFix.setVisibility(View.GONE);
}else{
groupFix.setVisibility(View.VISIBLE);
}
return true;
});
}
groupFix = findViewById(R.id.groupFix);
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
if (rootView != null) {
TopViewAnimHelper.getInstance().init(rootView);
@@ -347,8 +359,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mWeatherIcon = findViewById(R.id.module_ext_id_weather_icon);
mWeatherTemp = findViewById(R.id.module_ext_id_weather_temp);
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
mMsgContainer = findViewById(R.id.module_ext_id_msg);
mMsgContainer.setOnClickListener( new OnPreventFastClickListener() {
@@ -419,8 +429,30 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
if (mStatusManager.isVrMode()) {
enterVrMode();
}
etTimes = findViewById(R.id.etTimes);
findViewById(R.id.btnFix).setOnClickListener((view)->{
try {
String times = etTimes.getText().toString().trim();
int fixTime = Integer.parseInt(times);
Logger.d(TAG, "修改上报时间间隔: " + times + " fixTime: " + fixTime);
if(fixTime > 0) {
Intent intent = new Intent("com.mogo.launcher.action.FIX_UPLOAT_DELAY");
intent.putExtra("fixTime", fixTime);
getContext().sendBroadcast(intent);
TipToast.tip("已经发送修改广播");
}else{
TipToast.tip("fixTime为0不发送广播");
}
} catch (Exception e) {
TipToast.tip("fixTime异常");
e.printStackTrace();
}
});
}
private EditText etTimes;
private Group groupFix;
private void enterVrMode(){
tvEnterVrMode.setVisibility(View.GONE);
mMove2CurrentLocation.setVisibility(View.GONE);
@@ -444,6 +476,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
tvExitVrMode.setVisibility(View.GONE);
adasNoticeHelper.exitVrMode();
}
private void debugCrashWarn(){

View File

@@ -353,4 +353,35 @@
layout="@layout/module_ext_layout_crash_threshold_set"
android:visibility="gone" />
<EditText
android:layout_width="400px"
android:layout_height="wrap_content"
android:id="@+id/etTimes"
android:textSize="40sp"
android:background="#fff"
android:textColor="#000"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnFix"
android:text="修改"
android:textSize="40sp"
app:layout_constraintLeft_toRightOf="@id/etTimes"
app:layout_constraintTop_toTopOf="@id/etTimes"
android:layout_marginStart="10px"
android:background="#fff"
android:textColor="#000" />
<androidx.constraintlayout.widget.Group
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/groupFix"
android:visibility="gone"
app:constraint_referenced_ids="etTimes,btnFix" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,6 +1,9 @@
package com.mogo.module.service.location;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
@@ -43,7 +46,7 @@ public class MogoRTKLocation {
super.handleMessage(msg);
if (msg.what == MSG_DATA_CHANGED) {
sendLocationData();
mHandler.sendEmptyMessageDelayed(MSG_DATA_CHANGED, MSG_DATA_INTERNAL);
mHandler.sendEmptyMessageDelayed(MSG_DATA_CHANGED, uploadDelay);
}
}
};
@@ -89,6 +92,10 @@ public class MogoRTKLocation {
} else {
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
}
// 注册修改上报间隔的广播, 临时使用后面可直接干掉发送广播的地方在EntranceFragment
IntentFilter filter = new IntentFilter("com.mogo.launcher.action.FIX_UPLOAT_DELAY");
AbsMogoApplication.getApp().registerReceiver(fixUploadDelayReceiver, filter);
}
private Criteria getCriteria() {
@@ -142,4 +149,15 @@ public class MogoRTKLocation {
Logger.d(TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null");
}
}
private long uploadDelay = MSG_DATA_INTERNAL;
private FixUploadDelayReceiver fixUploadDelayReceiver = new FixUploadDelayReceiver();
private class FixUploadDelayReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
uploadDelay = intent.getIntExtra("fixTime", 0);
}
}
}