Compare commits

..

No commits in common. "master" and "dev_XingePush_20231107" have entirely different histories.

31 changed files with 190 additions and 417 deletions

View File

@ -37,8 +37,8 @@ android {
applicationId "com.navinfo.outdoor"
minSdkVersion 24
targetSdkVersion 30
versionCode 120
versionName "8.231205-测试版"
versionCode 118
versionName "8.231110-通用测试版"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {

View File

@ -120,10 +120,8 @@ import org.locationtech.jts.geom.Point;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -178,7 +176,6 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
private LocationRecorderDao recorderDao;
private PoiDao poiDao;
private SimpleDateFormat picFormatter = new SimpleDateFormat("yyyyMMdd HHmmss");
private DateFormat receiverDateFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");; // 接收任务时间的格式化对象
private Button btnClearMatch, btnStopPicture;
private Point lastPositionPoint; // 最近一次的定位用来过滤距离较近的点位
private static int BRIGHTNESS=40, FRAMENESS=30;
@ -1290,7 +1287,7 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
poiListEntity.setTaskId(poiEntity.getTaskId());
poiListEntity.setName(listBean.getName());
poiListEntity.setMemo(listBean.getMemo());
poiListEntity.setCreateTime(receiverDateFormate.format(new Date()));
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
@ -1368,7 +1365,7 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
Gson gson = new Gson();
UnPolygonTaskBean response = gson.fromJson(bodyString, UnPolygonTaskBean.class);
if (response.getCode() == 200) {
PoiDatabase.getInstance(AutoTakePicture4PoiActivity.this).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(AutoTakePicture4PoiActivity.this).getPoiDao().deletePoiEntity(poiEntity);
// 不需要删除照片自动采集时照片是临时保存在tmp目录下
} else if (response.getCode() == 230) {
FlushTokenUtil.flushToken(AutoTakePicture4PoiActivity.this);

View File

@ -122,7 +122,6 @@ import org.locationtech.jts.geom.Point;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@ -181,7 +180,6 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
private LocationRecorderDao recorderDao;
private PoiDao poiDao;
private SimpleDateFormat picFormatter = new SimpleDateFormat("yyyyMMdd HHmmss");
private DateFormat receiverDateFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");; // 接收任务时间的格式化对象
private Button btnClearMatch, btnStopPicture;
private Point lastPositionPoint; // 最近一次的定位用来过滤距离较近的点位
private static int BRIGHTNESS=40, FRAMENESS=30;
@ -1148,7 +1146,7 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
poiListEntity.setTaskId(poiEntity.getTaskId());
poiListEntity.setName(listBean.getName());
poiListEntity.setMemo(listBean.getMemo());
poiListEntity.setCreateTime(receiverDateFormate.format(new Date()));
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
@ -1226,7 +1224,7 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
Gson gson = new Gson();
UnPolygonTaskBean response = gson.fromJson(bodyString, UnPolygonTaskBean.class);
if (response.getCode() == 200) {
PoiDatabase.getInstance(AutoTakePicture4PoiVideoActivity.this).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(AutoTakePicture4PoiVideoActivity.this).getPoiDao().deletePoiEntity(poiEntity);
// 不需要删除照片自动采集时照片是临时保存在tmp目录下
} else if (response.getCode() == 230) {
FlushTokenUtil.flushToken(AutoTakePicture4PoiVideoActivity.this);

View File

@ -227,7 +227,6 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
private LocationRecorderDao recorderDao;
private PoiDao poiDao;
private SimpleDateFormat picFormatter = new SimpleDateFormat("yyyyMMdd HHmmss");
private DateFormat receiverDateFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");; // 接收任务时间的格式化对象
private Button btnClearMatch, btnStopPicture;
private Point lastPositionPoint; // 最近一次的定位用来过滤距离较近的点位
private static int BRIGHTNESS=40, FRAMENESS=30;
@ -1339,7 +1338,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
poiListEntity.setTaskId(poiEntity.getTaskId());
poiListEntity.setName(listBean.getName());
poiListEntity.setMemo(listBean.getMemo());
poiListEntity.setCreateTime(receiverDateFormate.format(new Date()));
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
@ -1417,7 +1416,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
Gson gson = new Gson();
UnPolygonTaskBean response = gson.fromJson(bodyString, UnPolygonTaskBean.class);
if (response.getCode() == 200) {
PoiDatabase.getInstance(AutoTakePictureActivity.this).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(AutoTakePictureActivity.this).getPoiDao().deletePoiEntity(poiEntity);
// 不需要删除照片自动采集时照片是临时保存在tmp目录下
} else if (response.getCode() == 230) {
FlushTokenUtil.flushToken(AutoTakePictureActivity.this);

View File

@ -1,26 +1,21 @@
package com.navinfo.outdoor.activity;
import com.elvishew.xlog.XLog;
import com.github.lazylibrary.util.PreferencesUtils;
import com.github.lazylibrary.util.ShellUtils;
import com.google.gson.Gson;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.ocr.OCRManager;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.api.UserApplication;
import com.navinfo.outdoor.base.BaseActivity;
import com.navinfo.outdoor.bean.CommonRequestSend;
import com.navinfo.outdoor.bean.CommonResponse;
import com.navinfo.outdoor.bean.NotificationBean;
import com.navinfo.outdoor.fragment.FindFragment;
import com.navinfo.outdoor.fragment.MineFragment;
import com.navinfo.outdoor.fragment.RecordFragment;
import com.navinfo.outdoor.fragment.TreasureFragment;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.service.ForegroundCoreService;
@ -136,8 +131,6 @@ public class HomeActivity extends BaseActivity {
}
// 开启前台服务
startService(new Intent(getApplicationContext(), ForegroundCoreService.class));
// 使用Shared文件记录最近一次的登陆Id和推送需要的请求地址防止通过推送响应时请求地址为null的问题
PreferencesUtils.putString(HomeActivity.this, "MESSAGE_PUSH_GET_OR_CLICK_UPLOAD", HttpInterface.MESSAGE_PUSH_GET_OR_CLICK_UPLOAD);
} else {
finish();
}
@ -167,7 +160,6 @@ public class HomeActivity extends BaseActivity {
if (intent != null) {
String intentFrom = intent.getStringExtra(Constant.NOTIFYCATION_INTENT_FROM);
if (intentFrom != null){
int messageId = intent.getIntExtra(Constant.NOTIFYCATION_ID, -1);
if (intentFrom.equals("recommandTask")) {
// 从notifycation跳转过来的
// 获取要跳转的定位点位和zoom自动跳转到该位置后刷新地图界面
@ -186,7 +178,6 @@ public class HomeActivity extends BaseActivity {
msg.what = Constant.EVENT_WHAT_NOTIFYCATION_RECOMMAND_TASK;
EventBus.getDefault().post(msg);
}
uploadReceivePushMessage(HomeActivity.this, messageId+"", 1);
} else if (intentFrom.equals("normalNotification")) {
String title = intent.getStringExtra(Constant.NOTIFYCATION_TITLE);
String content = intent.getStringExtra(Constant.NOTIFYCATION_CONTENT);
@ -195,39 +186,11 @@ public class HomeActivity extends BaseActivity {
MessageDialog.show(HomeActivity.this, title, content, "确定")
.setCancelable(false);
}
uploadReceivePushMessage(HomeActivity.this, messageId+"", 1);
}
}
}
}
/**
* 上报获取到推送消息的时间给服务端
* @param messageId 推送消息对应的id
* @param type 0-获取到消息1-点击推送消息
* */
private void uploadReceivePushMessage(Context mContext, String messageId, int type) {
HttpParams httpParams = new HttpParams();
httpParams.put("messageId", messageId);
httpParams.put("type", type);
CommonRequestSend commonRequestSend = new CommonRequestSend<CommonResponse<Integer>>();
commonRequestSend.postMethodCommonSilence(mContext, PreferencesUtils.getString(mContext, "MESSAGE_PUSH_GET_OR_CLICK_UPLOAD")/*从SP文件中获取*/,
httpParams, Constant.DEFAULT_TIME_OUT, new Callback<CommonResponse<Integer>>() {
@Override
public void onSuccess(CommonResponse<Integer> response, int id) {
if (response.getCode() == 200) {
// 推送消息获取时间上报成功
XLog.d("上报推送接收成功:"+response.getMessage()+"-messageId:"+messageId);
}
}
@Override
public void onError(Throwable e, int id) {
XLog.d("上报推送接收失败:"+e.getMessage()+"-messageId:"+messageId);
}
}, new CommonResponse<Integer>().getClass());
}
private void initUM() {
//自定义点击通知时的打开动作
UmengNotificationClickHandler notificationClickHandler = new UmengNotificationClickHandler() {

View File

@ -117,7 +117,7 @@ public class HasReceiveAdapter extends RecyclerView.Adapter<HasReceiveAdapter.Vi
PoiEntity poiEntity = (PoiEntity) iterator.next();
if (poiEntity.isChecked()) {
PoiEntityDeleteUtil.getInstance().deleteUtil(context, poiEntity);
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntity(poiEntity);
iterator.remove();
}
}
@ -143,16 +143,7 @@ public class HasReceiveAdapter extends RecyclerView.Adapter<HasReceiveAdapter.Vi
public void onBindViewHolder(@NotNull ViewHolder holder, @SuppressLint("RecyclerView") int position) {
PoiEntity poiEntity = allRoad.get(position);
holder.tvName.setText(poiEntity.getName());
if (poiEntity.getCreateTime()!=null&&!poiEntity.getCreateTime().trim().isEmpty()) {
holder.tvCreateTime.setText("领取时间:"+poiEntity.getCreateTime());
} else {
holder.tvCreateTime.setVisibility(View.GONE);
}
if (poiEntity.getUnReceivedTime()!=null&&!poiEntity.getUnReceivedTime().trim().isEmpty()) {
holder.tvExpirationTime.setText("过期时间:"+poiEntity.getUnReceivedTime());
} else {
holder.tvExpirationTime.setVisibility(View.GONE);
}
holder.tvDay.setText(poiEntity.getCreateTime());
//获取checkBox点击的记录
holder.cbUnSubmit.setChecked(allRoad.get(position).isChecked());
holder.cbUnSubmit.setOnClickListener(new View.OnClickListener() {
@ -205,7 +196,7 @@ public class HasReceiveAdapter extends RecyclerView.Adapter<HasReceiveAdapter.Vi
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private TextView tvName, tvText, tvCreateTime, tvExpirationTime;
private TextView tvName, tvText, tvDay;
private CheckBox cbUnSubmit;
private ProgressBar pbUpload;
private TextView tvUploadProgress, tvUploadResult;
@ -215,8 +206,7 @@ public class HasReceiveAdapter extends RecyclerView.Adapter<HasReceiveAdapter.Vi
super(itemView);
tvName = itemView.findViewById(R.id.tv_road_name);
tvText = itemView.findViewById(R.id.tv_text);
tvCreateTime = itemView.findViewById(R.id.tv_poi_createtime);
tvExpirationTime = itemView.findViewById(R.id.tv_poi_expirationtime);
tvDay = itemView.findViewById(R.id.tv_road_day);
cbUnSubmit = itemView.findViewById(R.id.cb_unSubmit);
pbUpload = itemView.findViewById(R.id.pb_stay_upload);
tvUploadProgress = itemView.findViewById(R.id.tv_pb_stay_upload);

View File

@ -117,7 +117,7 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
PoiEntity poiEntity = (PoiEntity) iterator.next();
if (poiEntity.isChecked()) {
PoiEntityDeleteUtil.getInstance().deleteUtil(context, poiEntity);
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntity(poiEntity);
iterator.remove();
}
}
@ -143,7 +143,7 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
public void onBindViewHolder(@NotNull ViewHolder holder, @SuppressLint("RecyclerView") int position) {
PoiEntity poiEntity = allRoad.get(position);
holder.tvName.setText(poiEntity.getName());
holder.tvDay.setText("保存时间:"+poiEntity.getCreateTime());
holder.tvDay.setText(poiEntity.getCreateTime());
//获取checkBox点击的记录
holder.cbUnSubmit.setChecked(allRoad.get(position).isChecked());
holder.cbUnSubmit.setOnClickListener(new View.OnClickListener() {

View File

@ -293,5 +293,4 @@ public class Constant {
public static String NOTIFYCATION_TASK_ZOOM = "NOTIFYCATION_TASK_ZOOM";
public static String NOTIFYCATION_TITLE = "NOTIFYCATION_TITLE";
public static String NOTIFYCATION_CONTENT = "NOTIFYCATION_CONTENT";
public static String NOTIFYCATION_ID = "NOTIFYCATION_ID";
}

View File

@ -29,10 +29,6 @@ import com.tencent.map.navi.TencentNavi;
import com.tencent.navi.surport.utils.DeviceUtils;
import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.message.IUmengRegisterCallback;
import com.umeng.message.PushAgent;
import com.umeng.message.UmengMessageHandler;
import com.umeng.message.entity.UMessage;
import com.umeng.umcrash.UMCrash;
import com.umeng.umcrash.UMCrashCallback;
@ -48,7 +44,7 @@ import okhttp3.OkHttpClient;
public class UserApplication extends Application {
public static UserApplication userApplication;
public static ExecutorService fixedThreadPool;
public static PushAgent instance;
// public static PushAgent instance;
@Override
public void onCreate() {
@ -106,45 +102,45 @@ public class UserApplication extends Application {
return "注册友盟异常查看功能";
}
});
instance = PushAgent.getInstance(this);
instance.register(new IUmengRegisterCallback() {
@Override
public void onSuccess(String s) {
//注册成功会返回deviceToken deviceToken是推送消息的唯一标志
Constant.DEVICE_TOKEN = s;
Log.i("TAGEE", "Success 注册成功deviceToken--> " + Constant.DEVICE_TOKEN);
}
@Override
public void onFailure(String s, String s1) {
Log.e("TAGEE", "Failure 注册失败:--> " + "code:" + s + ", desc:" + s1);
}
});
instance.onAppStart();
UmengMessageHandler msgHandler = new UmengMessageHandler() {
//处理通知栏消息
@Override
public void dealWithNotificationMessage(Context context, UMessage msg) {
super.dealWithNotificationMessage(context, msg);
Log.i("TAGEE", "dealWithNotificationMessage:" + msg.getRaw().toString());
Constant.NOTIFICATION=msg.getRaw().toString();
}
//自定义通知样式此方法可以修改通知样式等
@Override
public Notification getNotification(Context context, UMessage msg) {
Log.i("TAGEE", "getNotification: "+msg.getRaw().toString());
return super.getNotification(context, msg);
}
//处理透传消息
@Override
public void dealWithCustomMessage(Context context, UMessage msg) {
super.dealWithCustomMessage(context, msg);
Log.i("TAGEE", "dealWithCustomMessage:" + msg.getRaw().toString());
}
};
instance.setMessageHandler(msgHandler);
// instance = PushAgent.getInstance(this);
// instance.register(new IUmengRegisterCallback() {
// @Override
// public void onSuccess(String s) {
// //注册成功会返回deviceToken deviceToken是推送消息的唯一标志
// Constant.DEVICE_TOKEN = s;
// Log.i("TAGEE", "Success 注册成功deviceToken--> " + Constant.DEVICE_TOKEN);
// }
//
// @Override
// public void onFailure(String s, String s1) {
// Log.e("TAGEE", "Failure 注册失败:--> " + "code:" + s + ", desc:" + s1);
// }
// });
// instance.onAppStart();
// UmengMessageHandler msgHandler = new UmengMessageHandler() {
// //处理通知栏消息
// @Override
// public void dealWithNotificationMessage(Context context, UMessage msg) {
// super.dealWithNotificationMessage(context, msg);
// Log.i("TAGEE", "dealWithNotificationMessage:" + msg.getRaw().toString());
// Constant.NOTIFICATION=msg.getRaw().toString();
// }
//
// //自定义通知样式此方法可以修改通知样式等
// @Override
// public Notification getNotification(Context context, UMessage msg) {
// Log.i("TAGEE", "getNotification: "+msg.getRaw().toString());
// return super.getNotification(context, msg);
// }
//
// //处理透传消息
// @Override
// public void dealWithCustomMessage(Context context, UMessage msg) {
// super.dealWithCustomMessage(context, msg);
// Log.i("TAGEE", "dealWithCustomMessage:" + msg.getRaw().toString());
// }
// };
// instance.setMessageHandler(msgHandler);
//App处于前台时不显示通知
//instance.setNotificationOnForeground(false);
//设置显示通知的数量

View File

@ -1,7 +1,6 @@
package com.navinfo.outdoor.bean;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
@ -46,40 +45,36 @@ import okhttp3.ResponseBody;
public class CommonRequestSend<T extends CommonResponseBase> {
public void getMethodCommon(Activity mContext, String url, HttpParams params, int timeOut, Callback<CommonResponse<T>> callback, Class<T> tClass) {
try {
((GetRequest<CommonResponse<T>>) obitainRequest(url, params, timeOut, 0, tClass))
Response<CommonResponse<T>> response = ((GetRequest<CommonResponse<T>>) obitainRequest(mContext, url, params, timeOut, 0, tClass))
.adapt()
.execute(new MyJsonCallback<CommonResponse<T>>() {
@Override
public void onSuccess(Response<CommonResponse<T>> response) {
if (response.code() == 200) {
if (response.body().getCode() == 200) {
callback.onSuccess(response.body(), 1);
} else if (response.body().getCode() == 230){
FlushTokenUtil.flushToken(mContext);
Toast.makeText(mContext, "token过期请重新登录后再试...", Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable("token过期请重新登录后再试...");
callback.onError(throwable, -1);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable(response.message());
callback.onError(throwable, -2);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
}
.execute();
if (response.code() == 200) {
if (response.body().getCode() == 200) {
callback.onSuccess(response.body(), 1);
} else if (response.body().getCode() == 230){
FlushTokenUtil.flushToken(mContext);
Toast.makeText(mContext, "token过期请重新登录后再试...", Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable("token过期请重新登录后再试...");
callback.onError(throwable, -1);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable(response.message());
callback.onError(throwable, -2);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
}
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
}
}
});
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
e.printStackTrace();
Throwable throwable = e;
@ -97,7 +92,7 @@ public class CommonRequestSend<T extends CommonResponseBase> {
public CommonResponse<T> getMethodCommonSync(Activity mContext, String url, HttpParams params, int timeOut, Class<T> tClass) {
try {
Response<CommonResponse<T>> response = ((GetRequest<CommonResponse<T>>) obitainRequest(url, params, timeOut, 0, tClass))
Response<CommonResponse<T>> response = ((GetRequest<CommonResponse<T>>) obitainRequest(mContext, url, params, timeOut, 0, tClass))
.adapt()
.execute();
if (response.code() == 200) {
@ -122,97 +117,38 @@ public class CommonRequestSend<T extends CommonResponseBase> {
}
}
/**
* 发送post请求但是无需重试无需检查是否成功登录
* 这个方法用于发送一些不重要的请求当用户本地token过期时有可能需要重新登录
* */
public void postMethodCommonSilence(Context mContext, String url, HttpParams params, int timeOut, Callback<CommonResponse<T>> callback, Class<T> tClass) {
try {
((PostRequest<CommonResponse<T>>) obitainRequest(url, params, timeOut, 1, tClass))
.adapt()
.execute(new MyJsonCallback<CommonResponse<T>>() {
@Override
public void onSuccess(Response<CommonResponse<T>> response) {
if (response.code() == 200) {
if (response.body().getCode() == 200) {
callback.onSuccess(response.body(), 1);
} else if (response.body().getCode() == 230){
FlushTokenUtil.flushTokenSilence(mContext);
Toast.makeText(mContext, "token过期请重新登录后再试...", Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable("token过期请重新登录后再试...");
callback.onError(throwable, -1);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable(response.message());
callback.onError(throwable, -2);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
}
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
}
}
});
} catch (Exception e) {
e.printStackTrace();
Throwable throwable = e;
if (throwable != null) {
throwable.printStackTrace();
callback.onError(throwable, -3);
}
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
}
}
public void postMethodCommon(Activity mContext, String url, HttpParams params, int timeOut, Callback<CommonResponse<T>> callback, Class<T> tClass) {
try {
((PostRequest<CommonResponse<T>>) obitainRequest(url, params, timeOut, 1, tClass))
Response<CommonResponse<T>> response = ((GetRequest<CommonResponse<T>>) obitainRequest(mContext, url, params, timeOut, 1, tClass))
.adapt()
.execute(new MyJsonCallback<CommonResponse<T>>() {
@Override
public void onSuccess(Response<CommonResponse<T>> response) {
if (response.code() == 200) {
if (response.body().getCode() == 200) {
callback.onSuccess(response.body(), 1);
} else if (response.body().getCode() == 230){
FlushTokenUtil.flushToken(mContext);
Toast.makeText(mContext, "token过期请重新登录后再试...", Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable("token过期请重新登录后再试...");
callback.onError(throwable, -1);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable(response.message());
callback.onError(throwable, -2);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
}
.execute();
if (response.code() == 200) {
if (response.body().getCode() == 200) {
callback.onSuccess(response.body(), 1);
} else if (response.body().getCode() == 230){
FlushTokenUtil.flushToken(mContext);
Toast.makeText(mContext, "token过期请重新登录后再试...", Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable("token过期请重新登录后再试...");
callback.onError(throwable, -1);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
Throwable throwable = new Throwable(response.message());
callback.onError(throwable, -2);
/*
* 友盟+
* 使用自定义错误查看时请在错误列表页面选择自定义异常
*/
UMCrash.generateCustomLog("网络请求报错-位置OKGOBuilder" + throwable, "UmengException");
}
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
}
}
});
} else {
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
e.printStackTrace();
Throwable throwable = e;
@ -230,7 +166,7 @@ public class CommonRequestSend<T extends CommonResponseBase> {
public CommonResponse<T> postMethodCommonSync(Activity mContext, String url, HttpParams params, int timeOut, List<File> files, Class<T> tClass) {
try {
PostRequest<CommonResponse<T>> postRequest = (PostRequest<CommonResponse<T>>) obitainRequest(url, params, timeOut, 1, tClass);
PostRequest<CommonResponse<T>> postRequest = (PostRequest<CommonResponse<T>>) obitainRequest(mContext, url, params, timeOut, 1, tClass);
if (files!=null) {
postRequest.addFileParams("file", files);
}
@ -263,7 +199,7 @@ public class CommonRequestSend<T extends CommonResponseBase> {
* 生成通用请求
* @param requestType 0-默认为get请求非0-post请求
* */
private Request obitainRequest(String url, HttpParams params, int timeOut, int requestType, Class<T> clazz) throws Exception{
private Request obitainRequest(Activity mContext, String url, HttpParams params, int timeOut, int requestType, Class<T> clazz) throws Exception{
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
throw new Exception("网络不可用");
}

View File

@ -115,7 +115,7 @@ public class JobSearchBean implements Serializable {
private String memo;
private String telephone;
private int publish; // 是否已发布如果是未发布的数据则用半透明形式展示0-未发布1-已发布
private int publish; // 是否已发布如果是未发布的数据则用半透明形式展示
public int getCanReceived() {
return canReceived;

View File

@ -816,7 +816,7 @@ public class AreaHubFragment extends BaseDrawerFragment implements View.OnClickL
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntity(poiEntity);
}
}).start();
if (poiEntity.getId() != null) {

View File

@ -917,7 +917,7 @@ public class BuildingInFragment extends BaseDrawerFragment implements View.OnCli
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntity(poiEntity);
}
}).start();
if (poiEntity.getId() != null) {

View File

@ -1767,7 +1767,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntity(poiEntity);
if (showPoiEntity != null) {
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(getActivity()).getChargingPileDao().getChargingPileByStationId(showPoiEntity.getId());
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {

View File

@ -75,7 +75,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
private StringBuilder gatherGetBuilder;
private TextView tvStartNav;
private TextView tvMatchTrack; // 手动匹配轨迹照片
private DateFormat receiverDateFormate; // 接收任务时间的格式化对象
public static GatherGetFragment newInstance(Bundle bundle) {
GatherGetFragment fragment = new GatherGetFragment();
@ -90,7 +89,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
@SuppressLint("SimpleDateFormat")
DateFormat formatter = new SimpleDateFormat("yyyyMMdd");
receiverDateFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String newFormat = formatter.format(new Date(System.currentTimeMillis()));
String pictures_time = sharedPreferences.getString("pictures_time", null);
if (pictures_time == null) {
@ -282,39 +280,32 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
* 根据当前数据状态重新构建领取对话框按钮的显隐
* */
private void initViewByTaskStatus(int taskStatus) {
if (poiEntity.getPublish() == 1) { // 如果是已发布的数据
switch (taskStatus) {
case 0://未领取
btnCancelGet.setVisibility(View.GONE);//取消领取
btnGetTask.setVisibility(View.VISIBLE);//领取任务
btnGather.setVisibility(View.VISIBLE);//立即采集
btnFinishGather.setVisibility(View.GONE);//结束采集
break;
case 1://已领取
btnCancelGet.setVisibility(View.VISIBLE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.GONE);
break;
case 2://已保存
case 3://已提交
btnCancelGet.setVisibility(View.VISIBLE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.VISIBLE);
break;
case 4://结束采集
btnCancelGet.setVisibility(View.GONE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.GONE);
break;
}
} else { // 未发布数据所有按钮都隐藏
btnCancelGet.setVisibility(View.GONE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.GONE);
switch (taskStatus) {
case 0://未领取
btnCancelGet.setVisibility(View.GONE);//取消领取
btnGetTask.setVisibility(View.VISIBLE);//领取任务
btnGather.setVisibility(View.VISIBLE);//立即采集
btnFinishGather.setVisibility(View.GONE);//结束采集
break;
case 1://已领取
btnCancelGet.setVisibility(View.VISIBLE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.GONE);
break;
case 2://已保存
case 3://已提交
btnCancelGet.setVisibility(View.VISIBLE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.VISIBLE);
break;
case 4://结束采集
btnCancelGet.setVisibility(View.GONE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.GONE);
break;
}
}
@ -400,7 +391,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntity(poiEntity);
requireActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
@ -471,11 +462,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
chargingStationEntity.setStation_type(stationBean.getSptype());
chargingStationEntity.setName(stationBean.getName());
chargingStationEntity.setDescribe(stationBean.getMemo());
// chargingStationEntity.setCreateTime(stationBean.getEndDate());
chargingStationEntity.setCreateTime(stationBean.getEndDate());
chargingStationEntity.setUnReceivedTime(stationBean.getUnReceivedTime());
chargingStationEntity.setPrecision(stationBean.getPrice() + "");
chargingStationEntity.setAddress(stationBean.getAddress());
chargingStationEntity.setCreateTime(receiverDateFormate.format(new Date()));
if (stationBean.getTelephone() == null || stationBean.getTelephone().equals("") || stationBean.getTelephone().equals("null")) {
chargingStationEntity.setTelPhone(null);
} else {
@ -615,7 +605,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
PoiEntity polygonEntity = new PoiEntity();
polygonEntity.setRecord_way(poiEntity.getRecord_way());
polygonEntity.setWork_type(poiEntity.getWork_type());
polygonEntity.setCreateTime(receiverDateFormate.format(new Date()));
if (listBean != null) {
polygonEntity.setTaskId(listBean.getId());
polygonEntity.setName(listBean.getName());
@ -705,7 +694,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntity(poiEntity);
if (poiEntity.getType() == 2) {
PoiDatabase.getInstance(getContext()).getChargingPileDao().deleteChargingFidPileEntity(poiEntity.getId());
}
@ -857,7 +846,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntity(poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
@ -925,14 +914,13 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setTaskId(poiEntity.getTaskId());
poiListEntity.setName(listBean.getName());
poiListEntity.setDescribe(listBean.getMemo());
// poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setUnReceivedTime(listBean.getUnReceivedTime());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setRecord_way(poiEntity.getRecord_way());
poiListEntity.setWork_type(poiEntity.getWork_type());
poiEntity.setCreateTime(receiverDateFormate.format(new Date()));
if (listBean.getType() == 1) {
if (listBean.getTelephone() == null || listBean.getTelephone().equals("") || listBean.getTelephone().equals("null")) {
poiListEntity.setTelPhone(null);
@ -1054,7 +1042,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setWork_type(poiEntity.getWork_type());
poiListEntity.setName(listBean.getName());
poiListEntity.setMemo(listBean.getMemo());
// poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setUnReceivedTime(listBean.getUnReceivedTime());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());
@ -1064,7 +1052,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setGeoWkt(listBean.getGeo());
String encodeStr = listBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
poiListEntity.setCreateTime(receiverDateFormate.format(new Date()));
// 生成对应的x和y poiEntity.setX
GeometryTools.obitainPoiEntityXY(geo, poiListEntity);
if (statusId == 1 || statusId == 5) {

View File

@ -474,7 +474,7 @@ public class HasReceiveFragment extends BaseFragment implements View.OnClickList
PoiEntity poiEntity = (PoiEntity) iterator.next();
if (poiEntity.getUnReceivedTimeStamp()<=new Date().getTime()) {
// 删除该条数据并且将此数据移除出当前列表
roadDao.deletePoiEntityById(poiEntity.getId());
roadDao.deletePoiEntity(poiEntity);
iterator.remove();
}
}
@ -498,7 +498,7 @@ public class HasReceiveFragment extends BaseFragment implements View.OnClickList
}
}
// 数据库中移除该数据
roadDao.deletePoiEntityById(poiEntity.getId());
roadDao.deletePoiEntity(poiEntity);
iteratorAgain.remove();
}
} else {

View File

@ -901,7 +901,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntity(poiEntity);
}
}).start();
initList();

View File

@ -1268,7 +1268,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntity(poiEntity);
}
}).start();
initList();

View File

@ -819,7 +819,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntity(poiEntity);
}
}).start();
if (poiEntity.getId() != null) {

View File

@ -927,7 +927,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getContext()).getPoiDao().deletePoiEntity(poiEntity);
}
}).start();
if (poiEntity.getId() != null) {

View File

@ -816,7 +816,7 @@ public class TrafficHubFragment extends BaseDrawerFragment implements View.OnCli
new Thread(new Runnable() {
@Override
public void run() {
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntityById(poiEntity.getId());
PoiDatabase.getInstance(getActivity()).getPoiDao().deletePoiEntity(poiEntity);
}
}).start();
if (poiEntity.getId() != null) {

View File

@ -44,7 +44,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.elvishew.xlog.XLog;
import com.github.lazylibrary.util.DensityUtil;
import com.github.lazylibrary.util.FileUtils;
@ -1952,7 +1951,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiListEntity.setType(listBean.getType());
poiListEntity.setRecord_way(listBean.getCanReceived());
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setPublish(listBean.getPublish());
String beanGeo = listBean.getGeo();
String geo = Geohash.getInstance().decode(beanGeo);
// 生成对应的x和y poiEntity.setX
@ -2133,7 +2131,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@Override
public void onSuccess(LatestPushMessageResponse response, int id) {
tvLatestPush.setVisibility(View.GONE); // 默认先隐藏推荐任务按钮
if (response != null&&response.getBody()!=null) {
if (response != null) {
Map<String, String> responseBody = response.getBody();
// 解析response
// 获取当前json的id如果id大于等于0则根据Content内容尝试展示提示信息
@ -2162,9 +2160,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
public void onBind(com.kongzue.dialogx.dialogs.CustomDialog dialog, View v) {
ImageView photo = v.findViewById(R.id.img_photo);
TextView tvConfirm = v.findViewById(R.id.tv_confirm);
// // Glide增加加载中图片显示
// RequestOptions options = new RequestOptions()
// .placeholder(R.mipmap.ic_launcher);
// 显示照片
Glide.with(requireContext()).load(imgUrl).into(photo);
View.OnClickListener clickListener = new View.OnClickListener() {

View File

@ -1,17 +1,13 @@
package com.navinfo.outdoor.http;
import android.content.SharedPreferences;
import com.github.lazylibrary.util.PreferencesUtils;
public class HttpInterface {
// // 开发
// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发地址
// public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-数据上传
// 开发
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发地址
public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-数据上传
// 测试
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口
public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口-数据上传
// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口
// public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口-数据上传
// 生产
// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//生产地址
@ -149,7 +145,6 @@ public class HttpInterface {
//dtxbmaps.navinfo.com/dtxb_test/m4/msgList/InfoPush/28/push?type=0
public static String MESSAGE_INFO_PUSH = null;//消息通知
public static String MESSAGE_LATEST_PUSH = null;//最新的推荐任务推送信息获取
public static String MESSAGE_PUSH_GET_OR_CLICK_UPLOAD = null;//推送消息的获取和点击时间上报
public static String UPDATE_PHONE_NUM_URL = null;//消息通知
public static String CREATE_UPLOAD_TASK = null;//创建断点续传任务
public static String UPLOAD_SPLITE_TASK = null;//执行断点续传
@ -194,7 +189,6 @@ public class HttpInterface {
EXAM_SUBMIT = IP + MSG_LIST_PATH + "findAndMessage/" + userId + "/submitExam";//发现 -能力测评提交试卷 post
MESSAGE_INFO_PUSH = IP + MSG_LIST_PATH + "InfoPush/" + userId + "/push";//寻宝-消息通知
MESSAGE_LATEST_PUSH = IP + MSG_LIST_PATH + "UserMessage/" + userId + "/getLatestMessage";//寻宝首页-获取最新推送推荐任务
MESSAGE_PUSH_GET_OR_CLICK_UPLOAD = IP + MSG_LIST_PATH + "UserMessage/" + userId + "/feedbackUserMessage";//寻宝-推送数据获取和点击的时间上报
/* 提现 金额
* Path=/m4/price/

View File

@ -1,7 +1,6 @@
package com.navinfo.outdoor.http;
import android.app.Activity;
import android.content.Context;
import android.widget.Toast;
import com.elvishew.xlog.XLog;
@ -45,7 +44,7 @@ import okhttp3.RequestBody;
*/
public class OkGoBuilder<T> {
private Context activity;
private Activity activity;
/**
* 请求网址
*/
@ -88,7 +87,7 @@ public class OkGoBuilder<T> {
return mOkGoBuilder;
}
public OkGoBuilder Builder(Context activity) {
public OkGoBuilder Builder(Activity activity) {
this.activity = activity;
return this;
}
@ -174,8 +173,7 @@ public class OkGoBuilder<T> {
if (response.code() == 200) {
callback.onSuccess(response.body(), 1);
} else {
com.github.lazylibrary.util.ToastUtils.showToast(activity, response.message());
// ToastUtils.Message(activity, response.message());
ToastUtils.Message(activity, response.message());
}
}
@ -225,8 +223,7 @@ public class OkGoBuilder<T> {
if (response.code() == 200) {
callback.onSuccess(response.body(), 1);
} else {
com.github.lazylibrary.util.ToastUtils.showToast(activity, response.message());
// ToastUtils.Message(activity, response.message());
ToastUtils.Message(activity, response.message());
}
}
@ -348,8 +345,7 @@ public class OkGoBuilder<T> {
if (response.code() == 200) {
callback.onSuccess(response.body(), 1);
} else {
com.github.lazylibrary.util.ToastUtils.showToast(activity, response.message());
// ToastUtils.Message(activity, response.message());
ToastUtils.Message(activity, response.message());
}
}
@ -402,8 +398,7 @@ public class OkGoBuilder<T> {
if (response.code() == 200) {
callback.onSuccess(response.body(), 1);
} else {
com.github.lazylibrary.util.ToastUtils.showToast(activity, response.message());
// ToastUtils.Message(activity, response.message());
ToastUtils.Message(activity, response.message());
}
}

View File

@ -19,16 +19,9 @@ import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
import com.elvishew.xlog.XLog;
import com.github.lazylibrary.util.MD5;
import com.github.lazylibrary.util.PreferencesUtils;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.HomeActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.bean.CommonRequestSend;
import com.navinfo.outdoor.bean.CommonResponse;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
import com.tencent.android.tpush.NotificationAction;
import com.tencent.android.tpush.XGPushBaseReceiver;
import com.tencent.android.tpush.XGPushClickedResult;
@ -140,7 +133,6 @@ public class MessageReceiver extends XGPushBaseReceiver {
intent.putExtra(Constant.NOTIFYCATION_INTENT_FROM, "normalNotification");
intent.putExtra(Constant.NOTIFYCATION_TITLE, contentTitle);
intent.putExtra(Constant.NOTIFYCATION_CONTENT, contentText);
intent.putExtra(Constant.NOTIFYCATION_ID, id);
PendingIntent pendingIntent = PendingIntent.getActivity(context, id, intent, PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, mNormalChannelId)
.setContentTitle(contentTitle)
@ -153,35 +145,6 @@ public class MessageReceiver extends XGPushBaseReceiver {
.addAction(R.mipmap.ic_launcher, "去看看", pendingIntent)
.setAutoCancel(true);
mManager.notify(2, mBuilder.build());
uploadReceivePushMessage(context, id+"", 0);
}
/**
* 上报获取到推送消息的时间给服务端
* @param messageId 推送消息对应的id
* @param type 0-获取到消息1-点击推送消息
* */
private void uploadReceivePushMessage(Context mContext, String messageId, int type) {
HttpParams httpParams = new HttpParams();
httpParams.put("messageId", messageId);
httpParams.put("type", type);
CommonRequestSend commonRequestSend = new CommonRequestSend<CommonResponse<Integer>>();
commonRequestSend.postMethodCommonSilence(mContext, PreferencesUtils.getString(mContext, "MESSAGE_PUSH_GET_OR_CLICK_UPLOAD")/*从SP文件中获取*/,
httpParams, Constant.DEFAULT_TIME_OUT, new Callback<CommonResponse<Integer>>() {
@Override
public void onSuccess(CommonResponse<Integer> response, int id) {
if (response.getCode() == 200) {
// 推送消息获取时间上报成功
XLog.d("上报推送接收成功:"+response.getMessage()+"-messageId:"+messageId);
}
}
@Override
public void onError(Throwable e, int id) {
XLog.d("上报推送接收失败:"+e.getMessage()+"-messageId:"+messageId);
}
}, new CommonResponse<Integer>().getClass());
}
private void createNotificationForBigImage(Context context, String contentTitle, String contentText, Bitmap bigPic,
@ -197,7 +160,6 @@ public class MessageReceiver extends XGPushBaseReceiver {
intent.putExtra(Constant.NOTIFYCATION_INTENT_FROM, "recommandTask");
intent.putExtra(Constant.NOTIFYCATION_TASK_GEOM, wkt);
intent.putExtra(Constant.NOTIFYCATION_TASK_ZOOM, zoom);
intent.putExtra(Constant.NOTIFYCATION_ID, id);
PendingIntent pendingIntent = PendingIntent.getActivity(context, id, intent, 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context, mBigImageChannelId)
.setContentTitle(contentTitle)
@ -211,7 +173,6 @@ public class MessageReceiver extends XGPushBaseReceiver {
.addAction(R.mipmap.ic_launcher, "去看看", pendingIntent);
mManager.notify(1, mBuilder.build());
// 用户点击该提醒后跳转到主界面并自动定位到指定位置
uploadReceivePushMessage(context, id+"", 0);
}
/**

View File

@ -61,10 +61,8 @@ public interface PoiDao {
/**
* 删除
*/
// @Delete
// void deletePoiEntity(PoiEntity... poiEntities);
@Query("DELETE FROM poi where id=:id")
void deletePoiEntityById(String id);
@Delete
void deletePoiEntity(PoiEntity... poiEntities);
/**
* 删除

View File

@ -61,8 +61,6 @@ public class PoiEntity implements Serializable {
private String drawLine; // 用户绘制的线型
private String uploadResult; //上传结果
private String unReceivedTime; // 任务领取后自动释放的时间
@Ignore
private int publish = 1; // 是否已发布0-未发布1-已发布默认
public int getRecord_way() {
return record_way;
@ -333,14 +331,6 @@ public class PoiEntity implements Serializable {
this.uploadResult = uploadResult;
}
public int getPublish() {
return publish;
}
public void setPublish(int publish) {
this.publish = publish;
}
/**
* 获取经过处理后的接受任务失效时间的时间戳
* */

View File

@ -3,7 +3,9 @@ package com.navinfo.outdoor.util;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@ -42,24 +44,15 @@ public class FlushTokenUtil {
});
}
/**
* 后台安静重新登录
* */
public static void flushTokenSilence(Context mContext) {
initLogin(mContext);
}
private static void initLogin(Context activity) {
private static void initLogin(Activity activity) {
SharedPreferences navInfo = activity.getSharedPreferences(Constant.SHARED_PREFERENCES, Context.MODE_PRIVATE);
navInfoEditor = navInfo.edit();
if (Constant.USHERED == null) {
com.github.lazylibrary.util.ToastUtils.showToast(activity, "token :更新失败");
// ToastUtils.Message(activity,"token :更新失败");
ToastUtils.Message(activity,"token :更新失败");
return;
} else {
if (HttpInterface.USER_LOGIN_OAUTH_TOKEN == null) {
com.github.lazylibrary.util.ToastUtils.showToast(activity, "token :更新失败");
// ToastUtils.Message(activity,"token :更新失败");
ToastUtils.Message(activity,"token :更新失败");
return;
}
}
@ -92,19 +85,16 @@ public class FlushTokenUtil {
Constant.USHERED = body.getUserId();
navInfoEditor.apply();
if (HttpInterface.USER_DETAIL_BY_USER_ID == null) {
com.github.lazylibrary.util.ToastUtils.showToast(activity, "token :更新成功");
// ToastUtils.Message(activity,"token :更新成功");
ToastUtils.Message(activity,"token :更新成功");
} else {
initGetUserInfo(activity);//获取用户信息
}
}else {
// ToastUtils.Message(activity,"获取用户id 失败");
com.github.lazylibrary.util.ToastUtils.showToast(activity, "获取用户id 失败");
ToastUtils.Message(activity,"获取用户id 失败");
}
} else {
// ToastUtils.Message(activity,response.getMessage());
com.github.lazylibrary.util.ToastUtils.showToast(activity, response.getMessage());
ToastUtils.Message(activity,response.getMessage());
}
}
@ -118,11 +108,9 @@ public class FlushTokenUtil {
String message = e.getMessage();
assert message != null;
if (message.contains("timeout") || message.contains("Read time out")) {
// ToastUtils.Message(activity,"请求超时");
com.github.lazylibrary.util.ToastUtils.showToast(activity,"请求超时");
ToastUtils.Message(activity,"请求超时");
} else {
// ToastUtils.Message(activity,message);
com.github.lazylibrary.util.ToastUtils.showToast(activity,message);
ToastUtils.Message(activity,message);
}
}
});
@ -131,7 +119,7 @@ public class FlushTokenUtil {
}
}
private static void initGetUserInfo(Context activity) {
private static void initGetUserInfo(Activity activity) {
OkGoBuilder okGoBuilder = OkGoBuilder
.getInstance()
.time(30)
@ -179,12 +167,10 @@ public class FlushTokenUtil {
Constant.AUDITING = userAuth.getAuditmsg();
}
navInfoEditor.commit();
// ToastUtils.Message(activity,"token :更新成功");
com.github.lazylibrary.util.ToastUtils.showToast(activity,"token :更新成功");
ToastUtils.Message(activity,"token :更新成功");
}
} else {
// ToastUtils.Message(activity,response.getMessage());
com.github.lazylibrary.util.ToastUtils.showToast(activity,response.getMessage());
ToastUtils.Message(activity,response.getMessage());
}
}
@ -193,11 +179,9 @@ public class FlushTokenUtil {
String message = e.getMessage();
assert message != null;
if (message.equals("timeout") || message.equals("Read time out")) {
// ToastUtils.Message(activity,"请求超时");
com.github.lazylibrary.util.ToastUtils.showToast(activity,"请求超时");
ToastUtils.Message(activity,"请求超时");
} else {
// ToastUtils.Message(activity,message);
com.github.lazylibrary.util.ToastUtils.showToast(activity,message);
ToastUtils.Message(activity,message);
}
}
});

View File

@ -188,8 +188,7 @@ public class TencentMarkerUtils {
}
// publish字段标识了当前数据是否已发布如果未发布则半透明显示且不可点击否则正常显示
float alpha = listBean.getPublish() == 0? 0.3f: 1.0f;
// boolean clickable = listBean.getPublish() == 0? false: true;
boolean clickable = true;
boolean clickable = listBean.getPublish() == 0? false: true;
switch (listBean.getType()) {
case 1://poi
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);

View File

@ -34,18 +34,10 @@
android:textSize="15sp" />
<TextView
android:id="@+id/tv_poi_createtime"
android:id="@+id/tv_road_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:text="2021-05-08 13:24:36"
android:textColor="#333"
app:layout_constraintTop_toBottomOf="@id/tv_road_name" />
<TextView
android:id="@+id/tv_poi_expirationtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:layout_margin="10dp"
android:text="2021-05-08 13:24:36"
android:textColor="#333"
app:layout_constraintTop_toBottomOf="@id/tv_road_name" />

View File

@ -37,8 +37,8 @@
android:id="@+id/tv_road_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:text="2021-05-08 13:24:36"
android:layout_margin="10dp"
android:text="2021-05-08 13:24:36"
android:textColor="#333"
app:layout_constraintTop_toBottomOf="@id/tv_road_name" />
</LinearLayout>