修改纪录中的以提交的界面刷新

This commit is contained in:
wds
2021-08-15 15:55:59 +08:00
parent 201e381d1f
commit 2420544147
11 changed files with 125 additions and 163 deletions

View File

@@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448'
// ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@@ -44,6 +44,7 @@ public abstract class BaseActivity extends AppCompatActivity {
initData();
initListener();
}
private static void setCustomDensity(Application application, Activity activity) {
final DisplayMetrics appDisplayMetrics = application.getResources().getDisplayMetrics();
// 以设计DP为360为例获得目标Density
@@ -67,8 +68,8 @@ public abstract class BaseActivity extends AppCompatActivity {
protected void initMVP() {
}
public void showLoadingDialog() {
if (NetWorkUtils.iConnected(this)) { // 当前网络可用
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
@@ -83,50 +84,8 @@ public abstract class BaseActivity extends AppCompatActivity {
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
// initTimer();
} else {
Toast.makeText(this, "网络不可用", Toast.LENGTH_SHORT).show();
}
}
public void showFileLoadingDialog() {
if (NetWorkUtils.iConnected(this)) { // 当前网络可用
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_BACK)
return true;
return false;
});
//loading样式
View view = LayoutInflater.from(this).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
} else {
Toast.makeText(this, "网络不可用", Toast.LENGTH_SHORT).show();
}
}
private void initTimer() {
Timer timer = new Timer(true);
TimerTask timerTask = new TimerTask() {
int countTime = 20;
@Override
public void run() {
if (countTime > 0) {
countTime--;
}
if (countTime == 1) {
dismissLoadingDialog();
}
}
};
timer.schedule(timerTask, 1000, 1000);
}
public void setLoadingDialogText(String s) {
//给loading 添加文字
@@ -139,6 +98,7 @@ public abstract class BaseActivity extends AppCompatActivity {
alertDialog.dismiss();
}
}
protected void initListener() {
}
@@ -158,8 +118,10 @@ public abstract class BaseActivity extends AppCompatActivity {
super.onDestroy();
Collector.removeActivity(this);
}
/**
* 设置屏幕横竖屏切换
*
* @param screenRoate true 竖屏 false 横屏
*/
private void setScreenRoate(Boolean screenRoate) {

View File

@@ -95,7 +95,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
protected abstract int getLayout();
public void showLoadingDialog() {
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
alertDialog = new AlertDialog.Builder(getActivity()).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
@@ -111,49 +111,6 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
//initTimer();
} else {
Toast.makeText(getActivity(), "网络不可用", Toast.LENGTH_SHORT).show();
}
}
public void showFileLoadingDialog() {
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
alertDialog = new AlertDialog.Builder(getActivity()).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_BACK)
return true;
return false;
});
//loading样式
View view = LayoutInflater.from(getContext()).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
} else {
Toast.makeText(getActivity(), "网络不可用", Toast.LENGTH_SHORT).show();
}
}
private void initTimer() {
Timer timer = new Timer(true);
TimerTask timerTask = new TimerTask() {
int countTime = 20;
@Override
public void run() {
if (countTime > 0) {
countTime--;
}
if (countTime == 1) {
dismissLoadingDialog();
}
}
};
timer.schedule(timerTask, 1000, 1000);
}

View File

@@ -514,11 +514,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
String telPhone = showPoiEntity.getTelPhone();
if (telPhone != null && !telPhone.equals("")) {
if (telPhone != null && !telPhone.equals("")&&!telPhone.equals("null")) {
String[] phones = telPhone.split("\\|");
for (int i = 0; i < phones.length; i++) {
if (i == 0) {
if (!StringUtils.isEmpty(phones[i])) if (!StringUtils.isEmpty(phones[i])) {
if (!StringUtils.isEmpty(phones[i])) {
if (phones[i].contains("-")) { // 包含区号数据的电话
String[] split = phones[i].split("-");
if (split != null && split.length > 1) {
@@ -644,7 +644,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
.url(HttpInterface.GET_PHONES)
.params(new HttpParams("geo", encode))
.cls(GetPhoneBean.class)
.params(new HttpParams())
.token(Constant.ACCESS_TOKEN)
.getRequest(new Callback<GetPhoneBean>() {
@Override
@@ -941,6 +940,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
.fileList(chargingPileFileList).postFileSynchronization();
if(execute!=null){
String pileUpLoadResultStr = execute.body().string();
PoiUploadBean uploadBeanResult = new Gson().fromJson(pileUpLoadResultStr, PoiUploadBean.class);
if (uploadBeanResult != null) {
@@ -948,6 +948,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
PoiDatabase.getInstance(getActivity()).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
@@ -1454,6 +1455,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Response execute = OkGoBuilder.getInstance().url(HttpInterface.SUBMIT_CSTASK)
.token(Constant.ACCESS_TOKEN)
.params(httpParams).getSynchronization();
if(execute!=null){
String responseBodyStr = execute.body().string();
if (responseBodyStr != null) {
Gson gson = new Gson();
@@ -1464,6 +1466,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
chargingPileEntity.setBodyId(chargingPileSaveBean.getBody());
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntity); // 更新当前充电桩的bodyId
}
}
} catch (IOException e) {
e.printStackTrace();
}

View File

@@ -326,7 +326,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
chargingStationEntity.setCreateTime(stationBean.getEndDate());
chargingStationEntity.setPrecision(stationBean.getPrice() + "");
chargingStationEntity.setAddress(stationBean.getAddress());
chargingStationEntity.setTelPhone(stationBean.getTelephone() + "");
if(stationBean.getTelephone()==null||stationBean.getTelephone().equals("")||stationBean.getTelephone().equals("null")){
chargingStationEntity.setTelPhone(null);
}else {
chargingStationEntity.setTelPhone(stationBean.getTelephone());
}
chargingStationEntity.setType(Integer.valueOf(stationBean.getType()));
chargingStationEntity.setTaskStatus(statusId);
chargingStationEntity.setIsLocalData(1);

View File

@@ -93,12 +93,15 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
poiVideoAuditProcess = (TextView) findViewById(R.id.poiVideo_audit_process);
poiVideoAuditThrough = (TextView) findViewById(R.id.poiVideo_audit_through);
poiVideoAuditProcessauditNotThrough = (TextView) findViewById(R.id.poiVideo_audit_processaudit_not_through);
initRequest();
}
public void initRequest() {
initPoiSubMitWork();//poi
initPoiVideoSubMitWork();//poi录像
initRoadSubMitWork();//道路录像
initChaningSubMitWork();//充电站录像
initOtherSubMitWork();//其他录像
}
private void initOtherSubMitWork() {

View File

@@ -389,7 +389,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
editDescribe.setText(memo + "");
}
String telPhone = showPoiEntity.getTelPhone();
if (telPhone != null && !telPhone.equals("")) {
if (telPhone != null && !telPhone.equals("")&&!telPhone.equals("null")) {
String[] phones = telPhone.split("\\|");
for (int i = 0; i < phones.length; i++) {
if (i == 0) {

View File

@@ -92,8 +92,8 @@ public class RecordFragment extends BaseFragment implements View.OnClickListener
if (staySubmitFragment!=null) {
staySubmitFragment.refreshData();
}
// if (hasSubmitFragment!=null) {
// hasSubmitFragment.refreshData();
// }
if (hasSubmitFragment!=null) {
hasSubmitFragment.initRequest();
}
}
}

View File

@@ -12,8 +12,10 @@ import com.lzy.okgo.model.HttpHeaders;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.request.PostRequest;
import com.navinfo.outdoor.api.UserApplication;
import com.navinfo.outdoor.bean.PoiUploadBean;
import com.navinfo.outdoor.util.Md5Util;
import com.navinfo.outdoor.util.NetWorkUtils;
import com.umeng.umcrash.UMCrash;
import java.io.File;
@@ -125,6 +127,10 @@ public class OkGoBuilder<T> {
* post异步请求
*/
public void postRequest(Callback<T> callback) {
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
callback.onError(new Throwable("网络不可用"),2);
return;
}
OkGo
// 请求方式和请求url
.<T>post(url)
@@ -164,7 +170,6 @@ public class OkGoBuilder<T> {
}
}
});
}
public HttpHeaders getHeader() {
@@ -201,6 +206,9 @@ public class OkGoBuilder<T> {
* @return
*/
public okhttp3.Response postFileSynchronization() {
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
return null;
}
long time = System.currentTimeMillis();
params.put("datetime", time);
try {
@@ -230,6 +238,10 @@ public class OkGoBuilder<T> {
* @return
*/
public void postFileAsynchronous(Callback callback) {
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
callback.onError(new Throwable("网络不可用"),2);
return;
}
long time = System.currentTimeMillis();
params.put("datetime", time);
OkGo
@@ -277,6 +289,10 @@ public class OkGoBuilder<T> {
* get异步请求
*/
public void getRequest(Callback<T> callback) {
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
callback.onError(new Throwable("网络不可用"),2);
return;
}
long time = System.currentTimeMillis();
params.put("datetime", time);
OkGo
@@ -320,6 +336,10 @@ public class OkGoBuilder<T> {
* @return
*/
public okhttp3.Response getSynchronization() {
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
Toast.makeText(activity, "网络不可用,请检查网络", Toast.LENGTH_SHORT).show();
return null;
}
long time = System.currentTimeMillis();
params.put("datetime", time);
try {

View File

@@ -178,6 +178,9 @@ public class PoiSaveUtils {
Response execute = OkGoBuilder.getInstance().url(url)
.Builder(mContext)
.token(Constant.ACCESS_TOKEN).params(httpParams).getSynchronization();
if (execute==null){
return -1;
}
if (execute.code() != 200) {
return execute.code();
}
@@ -292,6 +295,9 @@ public class PoiSaveUtils {
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
.fileList(photoFile).postFileSynchronization();
if(execute==null){
return;
}
if (execute.code() != 200) {
return;
}
@@ -384,6 +390,9 @@ public class PoiSaveUtils {
.url(HttpInterface.SUBMIT_CSTASK)
.token(Constant.ACCESS_TOKEN)
.params(httpParams).getSynchronization();
if (execute==null){
return -1;
}
if (execute.code() != 200) {
return execute.code();
}
@@ -463,6 +472,9 @@ public class PoiSaveUtils {
.token(Constant.ACCESS_TOKEN)
.params(httpParams)
.fileList(chargingPileFileList).postFileSynchronization();
if (execute==null){
return -1;
}
if (execute.code() != 200) {
return execute.code();
}

View File

@@ -1,5 +1,5 @@
<resources>
<string name="app_name">地图寻宝</string>
<string name="app_name">地图寻宝3.0</string>
<string name="title_activity_home">HomeActivity</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>