将webp 转为jpg, 点击地图切换,延时 ,进入程序 userID 获取失败
This commit is contained in:
parent
5809a81438
commit
a94e410d61
@ -10,7 +10,7 @@ android {
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 30
|
||||
versionCode 5
|
||||
versionName "5.0"
|
||||
versionName "5.1"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
lintOptions {
|
||||
|
@ -57,14 +57,14 @@ public class MainActivity extends BaseActivity {
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
if (msg.what==0){
|
||||
if (msg.what == 0) {
|
||||
Toast.makeText(MainActivity.this, "下载完成", Toast.LENGTH_SHORT).show();
|
||||
//将下载进度对话框取消
|
||||
pBar.cancel();
|
||||
//调用系统安装程序
|
||||
//安装apk,也可以进行静默安装
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
File file = new File(Constant.NABISCO_APk +"DTXB.apk");
|
||||
File file = new File(Constant.NABISCO_APk + "DTXB.apk");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
Uri contentUri = FileProvider.getUriForFile(MainActivity.this, "com.navinfo.outdoor.fileprovider", file);
|
||||
@ -73,8 +73,8 @@ public class MainActivity extends BaseActivity {
|
||||
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
startActivity(intent);
|
||||
}else if (msg.what==1){
|
||||
startActivity(intent);
|
||||
} else if (msg.what == 1) {
|
||||
pBar.setProgress(progress);
|
||||
}
|
||||
return false;
|
||||
@ -99,7 +99,6 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initPermission() {
|
||||
XXPermissions.with(this)
|
||||
// 申请安装包权限
|
||||
@ -130,9 +129,12 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
if (Constant.USHERED!=null){
|
||||
if (Constant.USHERED != null) {
|
||||
HttpInterface.initAppPath(Constant.USHERED);
|
||||
Constant.initRootFolder(Constant.USHERED);
|
||||
HttpInterface.initHttpInter(Constant.USHERED);
|
||||
initCheckVersion();
|
||||
}else {
|
||||
} else {
|
||||
initTime();
|
||||
}
|
||||
//initTime();
|
||||
@ -140,11 +142,12 @@ public class MainActivity extends BaseActivity {
|
||||
initPermission();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||
DialogSettings.cancelable=false;
|
||||
DialogSettings.cancelable = false;
|
||||
MessageDialog.show(MainActivity.this, "提示", permissions.toString() + " 被永久拒绝授权请手动授权,", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
@ -176,7 +179,7 @@ public class MainActivity extends BaseActivity {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
int version = response.getBody().getVersion();
|
||||
if (versionCode <version) {//TODO 改成
|
||||
if (versionCode < version) {//TODO 改成
|
||||
//升级
|
||||
ApkVersionBean.bodyBean body = response.getBody();
|
||||
showUpdateDialog(body);
|
||||
@ -191,7 +194,7 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(MainActivity.this, e.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(MainActivity.this, e.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
initTime();
|
||||
}
|
||||
});
|
||||
@ -205,7 +208,7 @@ public class MainActivity extends BaseActivity {
|
||||
builder.setIcon(android.R.drawable.ic_dialog_info);
|
||||
builder.setMessage("请升级APP版本至" + bodyBean.getVersion());
|
||||
builder.setCancelable(false);
|
||||
if (bodyBean.getUpdateState()==0){//非必须更新
|
||||
if (bodyBean.getUpdateState() == 0) {//非必须更新
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@ -223,7 +226,7 @@ public class MainActivity extends BaseActivity {
|
||||
initTime();
|
||||
}
|
||||
});
|
||||
}else{//强制更新
|
||||
} else {//强制更新
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@ -240,12 +243,21 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
public void initTime() {
|
||||
if (Constant.ACCESS_TOKEN==null){
|
||||
if (Constant.USHERED != null) {
|
||||
HttpInterface.initAppPath(Constant.USHERED);
|
||||
Constant.initRootFolder(Constant.USHERED);
|
||||
HttpInterface.initHttpInter(Constant.USHERED);
|
||||
if (Constant.ACCESS_TOKEN != null) {
|
||||
initGetUserInfo();
|
||||
} else {
|
||||
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else {
|
||||
initGetUserInfo();
|
||||
}
|
||||
/*
|
||||
new CountDownTimer(3000, 1000) {
|
||||
@ -257,6 +269,7 @@ public class MainActivity extends BaseActivity {
|
||||
}.start();
|
||||
*/
|
||||
}
|
||||
|
||||
private void initGetUserInfo() {
|
||||
OkGoBuilder.getInstance().Builder(this)
|
||||
.url(HttpInterface.USER_DETAIL_BY_USER_ID)
|
||||
@ -314,9 +327,17 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
initLogIn();
|
||||
if (Constant.REFRESH_TOKEN!=null){
|
||||
initLogIn();
|
||||
}else {
|
||||
Intent intent = new Intent(MainActivity.this, HomeActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -357,7 +378,7 @@ public class MainActivity extends BaseActivity {
|
||||
navInfoEditor.commit();
|
||||
initGetUserInfo();//获取用户信息
|
||||
} else {
|
||||
Intent intent = new Intent( MainActivity.this, LoginActivity.class);
|
||||
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
@ -400,7 +421,7 @@ public class MainActivity extends BaseActivity {
|
||||
con.connect();
|
||||
if (con.getResponseCode() == 200) {
|
||||
File files = new File(Constant.NABISCO_APk);
|
||||
if (!files.exists()){
|
||||
if (!files.exists()) {
|
||||
files.mkdir();
|
||||
}
|
||||
int length = con.getContentLength();// 获取文件大小
|
||||
@ -409,7 +430,7 @@ public class MainActivity extends BaseActivity {
|
||||
FileOutputStream fileOutputStream = null;
|
||||
if (is != null) {
|
||||
//对apk进行保存
|
||||
File file = new File(Constant.NABISCO_APk +"DTXB.apk");
|
||||
File file = new File(Constant.NABISCO_APk + "DTXB.apk");
|
||||
fileOutputStream = new FileOutputStream(file);
|
||||
byte[] buf = new byte[1024];
|
||||
int ch;
|
||||
@ -442,12 +463,9 @@ public class MainActivity extends BaseActivity {
|
||||
navInfoEditor = navInfo.edit();
|
||||
Constant.USHERED = navInfo.getString("user_id", null);
|
||||
Constant.REFRESH_TOKEN = navInfo.getString("refresh_token", null);
|
||||
Constant.ACCESS_TOKEN= navInfo.getString("access_token", null);
|
||||
if (Constant.USHERED!=null){
|
||||
HttpInterface.initAppPath(Constant.USHERED);
|
||||
Constant.initRootFolder(Constant.USHERED);
|
||||
HttpInterface.initHttpInter(Constant.USHERED);
|
||||
}
|
||||
Constant.ACCESS_TOKEN = navInfo.getString("access_token", null);
|
||||
initPermission();
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -135,6 +135,12 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
|
||||
result.toFile(file, new FileCallback() {
|
||||
@Override
|
||||
public void onFileReady(@Nullable File file) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("file", file.getAbsolutePath());
|
||||
setResult(0x104, intent);
|
||||
SystemTTS.getInstance(PhotographActivity.this).stopSpeak();
|
||||
PhotographActivity.this.finish();
|
||||
/*
|
||||
if (file.exists()) {
|
||||
WebPNative webPNative = new WebPNative();
|
||||
new Thread(new Runnable() {
|
||||
@ -153,11 +159,7 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
|
||||
PhotographActivity.this.finish();
|
||||
}
|
||||
});
|
||||
/* long start = System.currentTimeMillis();
|
||||
long useTime = System.currentTimeMillis() - start;
|
||||
Log.e("WebpUtil:", String.valueOf(useTime));
|
||||
File file = new File(output.substring(0, output.length() - 5) + ".webp");
|
||||
new File(output).renameTo(file);*/
|
||||
|
||||
if (!bitmap.isRecycled()) {
|
||||
bitmap.recycle();
|
||||
}
|
||||
@ -170,6 +172,7 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
|
||||
} else {
|
||||
Toast.makeText(PhotographActivity.this, "源文件不存在", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
*/
|
||||
/* CompressImageTask.get().compressImage(ImageConfig.getDefaultConfig(file.getAbsolutePath(), file.getAbsolutePath()), new AsyncImageTask.OnImageResult(){
|
||||
@Override
|
||||
public void startCompress() {
|
||||
@ -190,8 +193,19 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.PICTURE_VIDEO_WORD;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) { }
|
||||
public void onEvent(Message data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
|
@ -270,6 +270,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
public void onFileReady(@Nullable File file) {
|
||||
if (file.exists()) {
|
||||
initMarker();
|
||||
videoIndex = Integer.parseInt(file.getName().replace(".jpg", ""));
|
||||
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg";
|
||||
Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex + 1), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (poi_video_type == 2) {
|
||||
Message message = new Message();
|
||||
message.what = 0x103;
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
/* if (file.exists()) {
|
||||
WebPNative webPNative = new WebPNative();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
@ -293,23 +304,18 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
});
|
||||
/* long start = System.currentTimeMillis();
|
||||
long useTime = System.currentTimeMillis() - start;
|
||||
Log.e("WebpUtil:", String.valueOf(useTime));
|
||||
File file = new File(output.substring(0, output.length() - 5) + ".webp");
|
||||
new File(output).renameTo(file);*/
|
||||
|
||||
if (!bitmap.isRecycled()) {
|
||||
bitmap.recycle();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("output:", e.toString());
|
||||
Toast.makeText(PicturesActivity.this, "文件转换失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Toast.makeText(PicturesActivity.this, "源文件不存在", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -397,13 +403,15 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
}
|
||||
picturesBuilder.append("onClick 点击了结束采集 ,");
|
||||
Intent intent = new Intent();
|
||||
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".webp";
|
||||
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".jpg";
|
||||
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
|
||||
intent.putExtra("type", poi_video_type);
|
||||
setResult(0x111, intent);
|
||||
this.finish();
|
||||
break;
|
||||
case R.id.image_view:
|
||||
picturesBuilder.append("onClick 点击了切换的窗口 ,");
|
||||
benSwitch();
|
||||
break;
|
||||
case R.id.btn_switch:
|
||||
picturesBuilder.append("onClick 点击了切换按钮 ,");
|
||||
|
@ -92,7 +92,7 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
if (fileListByUUID.size()>=2){
|
||||
File parentFile = fileListByUUID.get(0).getParentFile();
|
||||
for (int i = 0; i < fileListByUUID.size()-1; i++) {
|
||||
File file = new File(parentFile+"/" + i + ".webp");
|
||||
File file = new File(parentFile+"/" + i + ".jpg");
|
||||
fileBeans.add(new FileBean(file, false));
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -117,6 +118,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private StringBuilder poiBuilder;
|
||||
private RelativeLayout relativePhone;
|
||||
|
||||
|
||||
|
||||
|
||||
public static PoiFragment newInstance(Bundle bundle) {
|
||||
PoiFragment fragment = new PoiFragment();
|
||||
fragment.setArguments(bundle);
|
||||
@ -562,11 +566,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Constant.CODE = code;
|
||||
Constant.TelLength = telLength;
|
||||
/* for (int i = 0; i < poiBeans.size(); i++) {
|
||||
poiBeans.get(i).setArea(Constant.CODE);
|
||||
}
|
||||
contactView = new ContactView(getActivity(), linearContact, poiBeans);
|
||||
contactView.resetView();*/
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -272,7 +272,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
boolean isImageLoad = false;
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (fileListByUUID.get(i).getPath().contains(".webp") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
||||
if (fileListByUUID.get(i).getPath().contains(".jpg") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
||||
if (fileListByUUID.get(i).exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivPoiVideoPicture);
|
||||
@ -319,7 +319,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
boolean isImageLoad = false;
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
File videoFile = fileListByUUID.get(i);
|
||||
if (videoFile.getPath().contains(".webp") && !videoFile.getPath().contains("paper.txt")) {
|
||||
if (videoFile.getPath().contains(".jpg") && !videoFile.getPath().contains("paper.txt")) {
|
||||
if (videoFile.exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
||||
@ -362,7 +362,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
return;
|
||||
} else {
|
||||
Intent intents = new Intent(getActivity(), PicturesActivity.class);
|
||||
File filePath = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
File filePath = AWMp4ParserHelper.getInstance().obtainJpgFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intents.putExtra(Constant.INTENT_JPG_PATH, filePath.getAbsolutePath());
|
||||
intents.putExtra("poiEntity", showPoiEntity);
|
||||
intents.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
|
||||
@ -380,7 +380,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
return;
|
||||
} else {
|
||||
Intent intent = new Intent(getActivity(), PicturesActivity.class);
|
||||
File fileJpgPath = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
File fileJpgPath = AWMp4ParserHelper.getInstance().obtainJpgFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_JPG_PATH, fileJpgPath.getAbsolutePath());
|
||||
intent.putExtra("poiEntity", showPoiEntity);
|
||||
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
|
||||
|
@ -268,7 +268,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
boolean isImageLoad = false;
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (fileListByUUID.get(i).getPath().contains(".webp") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
||||
if (fileListByUUID.get(i).getPath().contains(".jpg") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
||||
if (fileListByUUID.get(i).exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivRoadPicture);
|
||||
@ -328,7 +328,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
boolean isImageLoad = false;
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
File videoFile = fileListByUUID.get(i);
|
||||
if (videoFile.getPath().contains(".webp") && !videoFile.getPath().contains("paper.txt")) {
|
||||
if (videoFile.getPath().contains(".jpg") && !videoFile.getPath().contains("paper.txt")) {
|
||||
if (videoFile.exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||
@ -371,7 +371,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
return;
|
||||
} else {
|
||||
Intent intent = new Intent(getContext(), PicturesActivity.class);
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainJpgFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
|
||||
intent.putExtra(Constant.INTENT_POI_VIDEO_TYPE, 3);
|
||||
@ -544,7 +544,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_WORD_MONITOR;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
EventBus.getDefault().post(obtain);
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
@ -157,6 +158,20 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private File logFile;
|
||||
private StringBuilder treasureBuilder;
|
||||
private Marker gatherMarker;
|
||||
private boolean isHandler=false;
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
if (msg.what == 0x101) {
|
||||
if (!isHandler){
|
||||
dismissLoadingDialog();
|
||||
OkGo.getInstance().cancelAll();
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
public static TreasureFragment newInstance(Bundle bundle) {
|
||||
TreasureFragment fragment = new TreasureFragment();
|
||||
@ -204,6 +219,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
initThread(); // 刷新筛选的本地数据
|
||||
}
|
||||
if (Constant.currentLocation != null) {
|
||||
//延时60秒
|
||||
Message message = new Message();
|
||||
message.what=0x101;
|
||||
handler.sendMessageDelayed(message,60000);
|
||||
initList(Constant.currentLocation); // 刷新筛选的网络数据
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "未开启定位服务", Toast.LENGTH_SHORT).show();
|
||||
@ -522,17 +541,19 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
httpParams.put("pageNum", treasurePage);
|
||||
httpParams.put("type", task_type);
|
||||
httpParams.put("isExclusive", limit_type);
|
||||
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.TASK_LIST)
|
||||
.cls(JobSearchBean.class)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.getRequest(new Callback<JobSearchBean>() {
|
||||
.token(Constant.ACCESS_TOKEN);
|
||||
okGoBuilder.getRequest(new Callback<JobSearchBean>() {
|
||||
@Override
|
||||
public void onSuccess(JobSearchBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
isHandler=true;
|
||||
if (response.getCode() == 200) {
|
||||
JobSearchBean.BodyBean body = response.getBody();
|
||||
if (body != null) {
|
||||
|
@ -336,6 +336,7 @@ public class OkGoBuilder<T> {
|
||||
}
|
||||
long time = System.currentTimeMillis();
|
||||
params.put("datetime", time);
|
||||
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<T>get(url)
|
||||
|
@ -33,7 +33,7 @@ public class PhotoUtils {
|
||||
lat= initEncode(latLng);
|
||||
}
|
||||
long time = System.currentTimeMillis();
|
||||
return new File(Constant.PICTURE_FOLDER, d + time + "_p" + lat + "_a" + 0 + ".webp");
|
||||
return new File(Constant.PICTURE_FOLDER, d + time + "_p" + lat + "_a" + 0 + ".jpg");
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,6 @@
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="157dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.4"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
Loading…
x
Reference in New Issue
Block a user