新增注册,忘记密码的接口
This commit is contained in:
commit
9a4917d3ec
@ -51,8 +51,6 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.WhiteScreen">
|
||||
<activity android:name=".activity.PicturesActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
||||
android:screenOrientation="portrait"
|
||||
>
|
||||
|
||||
</activity>
|
||||
@ -103,8 +101,7 @@
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.navinfo.outdoor.fileprovider"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false"
|
||||
>
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
|
@ -471,8 +471,6 @@ public class FragmentManagement extends BaseActivity {
|
||||
fragmentTransaction.show(messageFragment);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
@ -12,8 +12,10 @@ import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.location.Location;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -21,9 +23,11 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Chronometer;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.lazylibrary.util.DensityUtil;
|
||||
@ -56,10 +60,13 @@ import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
||||
|
||||
|
||||
@ -96,20 +103,26 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
private TextureMapView ivMap;
|
||||
private CheckBox captureVideo; // 拍摄视频
|
||||
private Button btnVideo, stopVideo;
|
||||
private ImageView ivPic;
|
||||
|
||||
private String finalVideoPath; // 摄像后最终保存的文件名
|
||||
private File tmpFile; // 合并文件的临时文件路径
|
||||
// private File tmpFile; // 合并文件的临时文件路径
|
||||
private Timer timer;
|
||||
private CsvTimerTask timerTask; // 执行定时写入csv文件的task
|
||||
private DateFormat formatter;
|
||||
private final long period = 1; // 记录csv文件的间隔时间,单位为秒
|
||||
private ViewGroup layerChange; // 切换地图和相机的父控件
|
||||
private boolean isFinishActivity = false; // 是否需要关闭当前activity
|
||||
private TextView videoChronometer;
|
||||
private long recordingTime = 0;// 记录下来的总时间
|
||||
private int oratation = -1; // 是否强制横屏拍摄,默认不强制,0-强制横屏 其他-任意
|
||||
private List<Removable> removables;
|
||||
private String uuId;
|
||||
private ImageView ivPic;
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
EventBus.getDefault().register(this);
|
||||
tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
|
||||
// tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
|
||||
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
||||
return R.layout.activity_picture;
|
||||
}
|
||||
@ -118,26 +131,30 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
|
||||
if (getIntent()!=null) {
|
||||
if (getIntent() != null) {
|
||||
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
uuId = getIntent().getStringExtra("uuId");
|
||||
oratation = getIntent().getIntExtra(Constant.INTENT_VIDEO_ORATATION, -1);
|
||||
}
|
||||
if (finalVideoPath == null) {
|
||||
finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
|
||||
}
|
||||
videoChronometer = findViewById(R.id.video_chronometer);
|
||||
// if (finalVideoPath == null) {
|
||||
// finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
|
||||
// }
|
||||
|
||||
|
||||
layerChange = findViewById(R.id.layer_change);
|
||||
|
||||
|
||||
timer = new Timer();
|
||||
|
||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
ivMap = (TextureMapView) findViewById(R.id.iv_map);
|
||||
ivPic = findViewById(R.id.iv_pic);
|
||||
btnVideo = findViewById(R.id.btn_video);
|
||||
btnVideo.setOnClickListener(this::onClick);
|
||||
|
||||
btnSwitch = (Button) findViewById(R.id.btn_switch);
|
||||
btnSwitch.setOnClickListener(this::onClick);
|
||||
// capturePicture = (ImageButton) findViewById(R.id.capturePicture);
|
||||
// capturePicture.setOnClickListener(this::onClick);
|
||||
ivPic = findViewById(R.id.iv_pic);
|
||||
//相机记录器
|
||||
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
|
||||
camera = findViewById(R.id.camera);
|
||||
@ -147,12 +164,21 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) { // 开始采集,设置按钮文字内容为“结束采集”
|
||||
if (oratation == 0) { // oratation为0时,拍摄视频必须为横屏
|
||||
// 如果当前手机是竖向,则不允许拍摄
|
||||
if (camera.getVideoSize().getWidth() < camera.getVideoSize().getHeight()) {
|
||||
Toast.makeText(PictureActivity.this, "不允许竖向拍摄...", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
captureVideo.setText("暂停采集");
|
||||
// stopVideo.setEnabled(false);// 开始采集视频后,禁用停止采集的按钮,必须暂停采集后才可点击停止采集
|
||||
startTakenVideo(); // 开始采集视频
|
||||
} else {
|
||||
stopTakenVideo();
|
||||
captureVideo.setText("开始采集");
|
||||
// stopVideoAndFinish();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -172,10 +198,10 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
SizeSelector dimensions = SizeSelectors.and(width, height); // Matches sizes bigger than 1000x2000.
|
||||
// 获取屏幕信息
|
||||
int[] density = DensityUtil.getDeviceInfo(this);
|
||||
int x=1920, y=1440;
|
||||
if (density!=null&&density.length>1) {
|
||||
x = (density[0]>=density[1]?density[0]:density[1]);
|
||||
y = (density[0]>=density[1]?density[1]:density[0]);
|
||||
int x = 1920, y = 1440;
|
||||
if (density != null && density.length > 1) {
|
||||
x = (density[0] >= density[1] ? density[0] : density[1]);
|
||||
y = (density[0] >= density[1] ? density[1] : density[0]);
|
||||
}
|
||||
SizeSelector ratio = SizeSelectors.aspectRatio(AspectRatio.of(x, y), 0); // Matches 1:1 sizes.
|
||||
|
||||
@ -185,7 +211,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
SizeSelectors.biggest() // If none is found, take the biggest
|
||||
);
|
||||
camera.setVideoSize(result);
|
||||
camera.setVideoBitRate(1920*1440);
|
||||
camera.setVideoBitRate(1920 * 1440);
|
||||
// camera.setAudioBitRate();
|
||||
|
||||
//获取地图
|
||||
@ -205,7 +231,23 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
// Log.e("PictureActivity", frame.getTime()+"");
|
||||
// }
|
||||
// });
|
||||
|
||||
removables = new ArrayList<>();//存储轨迹的marker
|
||||
if (uuId!=null){
|
||||
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(uuId);
|
||||
if (videoFileListByUUID!=null){
|
||||
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList(videoFileListByUUID);
|
||||
for (int i = 0; i < lineStringByVideoFileList.size(); i++) {
|
||||
LatLng latLng = lineStringByVideoFileList.get(i);
|
||||
if (latLng!=null){
|
||||
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(ic_baseline);
|
||||
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
removables.add(marker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//相机预览监听
|
||||
camera.addCameraListener(new CameraListener() {
|
||||
@Override
|
||||
@ -236,45 +278,49 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
super.onVideoTaken(result);
|
||||
Toast.makeText(PictureActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
|
||||
showLoadingDialog();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (result!=null) {
|
||||
File currentFile = result.getFile();
|
||||
if (finalVideoPath!=null) { // 有指定的视频文件名称,合并文件
|
||||
if (new File(finalVideoPath).exists()) {
|
||||
List<String> spliteFileList = new ArrayList<>();
|
||||
spliteFileList.add(finalVideoPath);
|
||||
spliteFileList.add(currentFile.getAbsolutePath());
|
||||
try {
|
||||
AWMp4ParserHelper.getInstance().mergeVideos(spliteFileList, tmpFile.getAbsolutePath());
|
||||
if (tmpFile.exists()) {
|
||||
File finalVideoFile = new File(finalVideoPath);
|
||||
finalVideoFile.delete();
|
||||
currentFile.delete();
|
||||
tmpFile.renameTo(finalVideoFile);
|
||||
} else {
|
||||
Toast.makeText(PictureActivity.this, "视频合并失败!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("PictureActivity", e.getMessage());
|
||||
}
|
||||
} else {
|
||||
currentFile.renameTo(new File(finalVideoPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismissLoadingDialog();
|
||||
if (isFinishActivity) {
|
||||
PictureActivity.this.finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
dismissLoadingDialog();
|
||||
if (isFinishActivity) {
|
||||
PictureActivity.this.finish();
|
||||
}
|
||||
// new Thread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// if (result!=null) {
|
||||
// File currentFile = result.getFile();
|
||||
// if (finalVideoPath!=null) { // 有指定的视频文件名称,合并文件
|
||||
// if (new File(finalVideoPath).exists()) {
|
||||
// List<String> spliteFileList = new ArrayList<>();
|
||||
// spliteFileList.add(finalVideoPath);
|
||||
// spliteFileList.add(currentFile.getAbsolutePath());
|
||||
// try {
|
||||
// AWMp4ParserHelper.getInstance().mergeVideos(spliteFileList, tmpFile.getAbsolutePath());
|
||||
// if (tmpFile.exists()) {
|
||||
// File finalVideoFile = new File(finalVideoPath);
|
||||
// finalVideoFile.delete();
|
||||
// currentFile.delete();
|
||||
// tmpFile.renameTo(finalVideoFile);
|
||||
// } else {
|
||||
// Toast.makeText(PictureActivity.this, "视频合并失败!", Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// Log.e("PictureActivity", e.getMessage());
|
||||
// }
|
||||
// } else {
|
||||
// currentFile.renameTo(new File(finalVideoPath));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// dismissLoadingDialog();
|
||||
// if (isFinishActivity) {
|
||||
// PictureActivity.this.finish();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -289,27 +335,33 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
/**
|
||||
* 获取当前视频的时间,记录csv文件时使用
|
||||
* */
|
||||
long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
|
||||
timerTask = new CsvTimerTask(new File(finalVideoPath+".txt"));
|
||||
|
||||
// 开始采集,每隔2秒实时记录位置信息、视频时间以及设备时间
|
||||
if (currentTime == 0) {
|
||||
timer.schedule(timerTask, 0, period*1000);
|
||||
} else {
|
||||
timerTask.setCurrentVideoTime(currentTime/1000+1);
|
||||
timer.schedule(timerTask, 1, period*1000);
|
||||
}
|
||||
// long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
|
||||
timerTask = new CsvTimerTask(new File(finalVideoPath + ".txt"));
|
||||
timer.schedule(timerTask, 0, period * 1000);
|
||||
// // 开始采集,每隔2秒实时记录位置信息、视频时间以及设备时间
|
||||
// if (currentTime == 0) {
|
||||
// timer.schedule(timerTask, 0, period*1000);
|
||||
// } else {
|
||||
// timerTask.setCurrentVideoTime(currentTime/1000+1);
|
||||
// timer.schedule(timerTask, 1, period*1000);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoRecordingEnd() {
|
||||
super.onVideoRecordingEnd();
|
||||
if (timerTask!=null){
|
||||
if (timerTask != null) {
|
||||
timerTask.cancel();
|
||||
}else {
|
||||
} else {
|
||||
// Toast.makeText(PictureActivity.this, "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
// 一段视频拍摄完成自动将当前拍摄路径加1
|
||||
File finalVideoFile = new File(finalVideoPath);
|
||||
if (finalVideoFile.exists()) {
|
||||
int videoIndex = Integer.parseInt(finalVideoFile.getName().replace(".mp4", ""));
|
||||
finalVideoPath = finalVideoFile.getParentFile().getAbsolutePath() + "/" + (videoIndex + 1) + ".mp4";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -317,12 +369,20 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
|
||||
layoutParamsMap.height = dm.widthPixels/3;
|
||||
layoutParamsMap.width = dm.heightPixels/3;
|
||||
layoutParamsMap.height = dm.widthPixels / 3;
|
||||
layoutParamsMap.width = dm.heightPixels / 3;
|
||||
ivMap.setLayoutParams(layoutParamsMap);
|
||||
}
|
||||
|
||||
|
||||
// 将秒转化成小时分钟秒
|
||||
private String formatMiss(long miss) {
|
||||
String hh = miss / 3600 > 9 ? miss / 3600 + "" : "0" + miss / 3600;
|
||||
String mm = (miss % 3600) / 60 > 9 ? (miss % 3600) / 60 + "" : "0" + (miss % 3600) / 60;
|
||||
String ss = (miss % 3600) % 60 > 9 ? (miss % 3600) % 60 + "" : "0" + (miss % 3600) % 60;
|
||||
return hh + ":" + mm + ":" + ss;
|
||||
}
|
||||
|
||||
private void message(String content, Boolean important) {
|
||||
if (important) {
|
||||
LOG.w(content);
|
||||
@ -359,51 +419,62 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
// startTakenVideo(); // 开始拍摄视频
|
||||
// break;
|
||||
case R.id.btn_stop_video:
|
||||
if (timerTask!=null){
|
||||
timerTask.cancel();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalVideoPath);
|
||||
setResult(0x101, intent);
|
||||
}else {
|
||||
Toast.makeText(this, "本段视频没有计时!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (camera.isTakingVideo()) {
|
||||
isFinishActivity = true;
|
||||
camera.stopVideo();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
stopVideoAndFinish();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void stopVideoAndFinish() {
|
||||
if (timerTask != null) {
|
||||
timerTask.cancel();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalVideoPath);
|
||||
setResult(0x101, intent);
|
||||
} else {
|
||||
Toast.makeText(this, "本段视频没有计时!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (camera.isTakingVideo()) {
|
||||
showLoadingDialog();
|
||||
isFinishActivity = true;
|
||||
camera.stopVideo();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void startTakenVideo() {
|
||||
if (camera.isTakingVideo()) {
|
||||
Toast.makeText(this, "已经在拍摄中...", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String formatVideoName = formatter.format(calendar.getTime());
|
||||
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
// String formatVideoName = formatter.format(calendar.getTime());
|
||||
//文件
|
||||
File file = new File(Constant.PICTURE_FOLDER, formatVideoName + ".mp4");
|
||||
if (file.exists()) {
|
||||
try {
|
||||
FileOutputStream fo = new FileOutputStream(file);
|
||||
FileDescriptor fileDescriptor = fo.getFD();
|
||||
camera.takeVideo(fileDescriptor);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// String path = finalVideoPath.substring(finalVideoPath.length()-20);
|
||||
if (finalVideoPath != null) {
|
||||
File file = new File(finalVideoPath);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
FileOutputStream fo = new FileOutputStream(file);
|
||||
FileDescriptor fileDescriptor = fo.getFD();
|
||||
camera.takeVideo(fileDescriptor);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
camera.takeVideo(file);
|
||||
}
|
||||
} else {
|
||||
camera.takeVideo(file);
|
||||
Toast.makeText(this, "请录像", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void stopTakenVideo() {
|
||||
@ -445,7 +516,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
}
|
||||
|
||||
public void btnSwich() {
|
||||
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
System.out.println("width-display :" + dm.widthPixels);
|
||||
@ -459,7 +529,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
|
||||
layerChange.removeAllViews();
|
||||
if (widthMap > widthCamera) {
|
||||
ivPic.setVisibility(View.VISIBLE);
|
||||
|
||||
layoutParamsCamera.width = dm.widthPixels;
|
||||
layoutParamsCamera.height = dm.heightPixels;
|
||||
layoutParamsMap.height = heightCamera;
|
||||
@ -469,7 +539,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
layerChange.addView(camera);
|
||||
layerChange.addView(ivMap);
|
||||
} else {
|
||||
ivPic.setVisibility(View.GONE);
|
||||
|
||||
layoutParamsMap.height = dm.heightPixels;
|
||||
layoutParamsMap.width = dm.widthPixels;
|
||||
layoutParamsCamera.height = heightMap;
|
||||
@ -497,6 +567,10 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
super.onDestroy();
|
||||
stopTakenVideo();
|
||||
camera.destroy();
|
||||
for (int i = 0; i < removables.size(); i++) {
|
||||
removables.get(i).remove();
|
||||
}
|
||||
removables.clear();
|
||||
timer.cancel();
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
@ -549,11 +623,31 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
sb.append(Constant.currentLocation.getLatitude());
|
||||
sb.append(",");
|
||||
sb.append(Constant.currentLocation.getLongitude());
|
||||
sb.append(",");
|
||||
if (Constant.currentLocation.getBearing()!=0) {
|
||||
sb.append(Constant.currentLocation.getBearing());
|
||||
} else {
|
||||
sb.append(Constant.currentLocation.getDirection());
|
||||
}
|
||||
sb.append("\r\n");
|
||||
LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
|
||||
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(ic_baseline);
|
||||
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
removables.add(marker);
|
||||
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
|
||||
currentVideoTime = currentVideoTime+period; //
|
||||
currentVideoTime = currentVideoTime + period; //
|
||||
recordingTime += period;
|
||||
runOnUiThread(updateTimeRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
private Runnable updateTimeRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
videoChronometer.setText(formatMiss(recordingTime));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -5,116 +5,541 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.lazylibrary.util.DensityUtil;
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseActivity;
|
||||
import com.navinfo.outdoor.util.AWMp4ParserHelper;
|
||||
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
||||
import com.otaliastudios.cameraview.CameraException;
|
||||
import com.otaliastudios.cameraview.CameraListener;
|
||||
import com.otaliastudios.cameraview.CameraLogger;
|
||||
import com.otaliastudios.cameraview.CameraView;
|
||||
import com.otaliastudios.cameraview.FileCallback;
|
||||
import com.otaliastudios.cameraview.PictureResult;
|
||||
import com.otaliastudios.cameraview.VideoResult;
|
||||
import com.otaliastudios.cameraview.controls.Engine;
|
||||
import com.otaliastudios.cameraview.controls.Mode;
|
||||
import com.otaliastudios.cameraview.size.AspectRatio;
|
||||
import com.otaliastudios.cameraview.size.SizeSelector;
|
||||
import com.otaliastudios.cameraview.size.SizeSelectors;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import static com.navinfo.outdoor.R.drawable.location;
|
||||
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
|
||||
|
||||
public class PicturesActivity extends BaseActivity implements View.OnClickListener {
|
||||
private static final CameraLogger LOG = CameraLogger.create("Picture");
|
||||
private com.otaliastudios.cameraview.CameraView cameraView;
|
||||
private android.widget.Button capuretVideo;
|
||||
private android.widget.Button btnStopVideo;
|
||||
// private MapView ivMap;
|
||||
// private TencentMap tencentMap;
|
||||
private CameraView camera;
|
||||
private long captureTime = 0;
|
||||
private android.widget.Button btnSwitch;
|
||||
private TencentMap tencentMap;
|
||||
private MyLocationStyle locationStyle;
|
||||
private TextureMapView ivMap;
|
||||
private CheckBox captureVideo; // 拍摄视频
|
||||
private Button btnVideo, stopVideo;
|
||||
|
||||
private String finalVideoPath; // 摄像后最终保存的文件名
|
||||
private File tmpFile; // 合并文件的临时文件路径
|
||||
private Timer timer;
|
||||
private CsvTimerTask timerTask; // 执行定时写入csv文件的task
|
||||
private DateFormat formatter;
|
||||
private final long period = 1; // 记录csv文件的间隔时间,单位为秒
|
||||
private ViewGroup layerChange; // 切换地图和相机的父控件
|
||||
private boolean isFinishActivity = false; // 是否需要关闭当前activity
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
EventBus.getDefault().register(this);
|
||||
tmpFile = new File(Constant.PICTURE_FOLDER, "temp.mp4");
|
||||
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
||||
return R.layout.activity_pictures;
|
||||
}
|
||||
//
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
cameraView = (CameraView) findViewById(R.id.cameraView);
|
||||
capuretVideo = (Button) findViewById(R.id.capuretVideo);
|
||||
capuretVideo.setOnClickListener(this::onClick);
|
||||
btnStopVideo = (Button) findViewById(R.id.btn_stop_video);
|
||||
btnStopVideo.setOnClickListener(this::onClick);
|
||||
// ivMap = findViewById(R.id.iv_map);
|
||||
cameraView.setLifecycleOwner(this);
|
||||
cameraView.setEngine(Engine.CAMERA1);
|
||||
cameraView.setMode(Mode.VIDEO);
|
||||
cameraView.addCameraListener(new CameraListener() {
|
||||
|
||||
if (getIntent()!=null) {
|
||||
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
}
|
||||
if (finalVideoPath == null) {
|
||||
finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
|
||||
}
|
||||
|
||||
layerChange = findViewById(R.id.layer_change);
|
||||
|
||||
timer = new Timer();
|
||||
|
||||
// this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
ivMap = (TextureMapView) findViewById(R.id.iv_map);
|
||||
btnSwitch = (Button) findViewById(R.id.btn_switch);
|
||||
btnSwitch.setOnClickListener(this::onClick);
|
||||
// capturePicture = (ImageButton) findViewById(R.id.capturePicture);
|
||||
// capturePicture.setOnClickListener(this::onClick);
|
||||
//相机记录器
|
||||
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
|
||||
camera = findViewById(R.id.camera);
|
||||
camera.setOnClickListener(this::onClick);
|
||||
captureVideo = findViewById(R.id.capuretVideo);
|
||||
captureVideo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) { // 开始采集,设置按钮文字内容为“结束采集”
|
||||
captureVideo.setText("暂停采集");
|
||||
// stopVideo.setEnabled(false);// 开始采集视频后,禁用停止采集的按钮,必须暂停采集后才可点击停止采集
|
||||
startTakenVideo(); // 开始采集视频
|
||||
} else {
|
||||
stopTakenVideo();
|
||||
captureVideo.setText("开始采集");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
stopVideo = findViewById(R.id.btn_stop_video);
|
||||
stopVideo.setOnClickListener(this::onClick);
|
||||
//拍照权限
|
||||
camera.setLifecycleOwner(this);
|
||||
camera.setEngine(Engine.CAMERA1);
|
||||
// camera.setVideoBitRate(5);
|
||||
camera.setPreviewFrameRate(5); // 设置预览视频的帧率
|
||||
|
||||
|
||||
// 设置视频可用的宽高size
|
||||
SizeSelector width = SizeSelectors.maxWidth(1920);
|
||||
SizeSelector height = SizeSelectors.maxHeight(1440);
|
||||
SizeSelector dimensions = SizeSelectors.and(width, height); // Matches sizes bigger than 1000x2000.
|
||||
// 获取屏幕信息
|
||||
int[] density = DensityUtil.getDeviceInfo(this);
|
||||
int x=1920, y=1440;
|
||||
if (density!=null&&density.length>1) {
|
||||
x = (density[0]>=density[1]?density[0]:density[1]);
|
||||
y = (density[0]>=density[1]?density[1]:density[0]);
|
||||
}
|
||||
SizeSelector ratio = SizeSelectors.aspectRatio(AspectRatio.of(x, y), 0); // Matches 1:1 sizes.
|
||||
|
||||
SizeSelector result = SizeSelectors.or(
|
||||
SizeSelectors.and(ratio, dimensions), // Try to match both constraints
|
||||
ratio, // If none is found, at least try to match the aspect ratio
|
||||
SizeSelectors.biggest() // If none is found, take the biggest
|
||||
);
|
||||
camera.setVideoSize(result);
|
||||
camera.setVideoBitRate(1920*1440);
|
||||
// camera.setAudioBitRate();
|
||||
|
||||
//获取地图
|
||||
tencentMap = ivMap.getMap();
|
||||
//获取地图UI 设置对象
|
||||
UiSettings uiSettings = tencentMap.getUiSettings();
|
||||
//设置logo的大小
|
||||
uiSettings.setLogoScale(0.7f);
|
||||
// uiSettings.setAllGesturesEnabled(false);
|
||||
setLocMarkerStyle(); // 设置当前位置显示样式
|
||||
|
||||
// camera.addFrameProcessor(new FrameProcessor() {
|
||||
// @Override
|
||||
// public void process(@NonNull Frame frame) {
|
||||
// Log.e("PictureActivity", frame.getTime()+"");
|
||||
// }
|
||||
// });
|
||||
|
||||
//相机预览监听
|
||||
camera.addCameraListener(new CameraListener() {
|
||||
@Override
|
||||
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
|
||||
super.onPictureTaken(result);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
//文件
|
||||
File file = new File(Constant.PICTURE_FOLDER, format + ".jpg");
|
||||
result.toFile(file, new FileCallback() {
|
||||
@Override
|
||||
public void onFileReady(@Nullable @org.jetbrains.annotations.Nullable File file) {
|
||||
Toast.makeText(PicturesActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
if (camera.isTakingVideo()) {
|
||||
message("Captured while taking video. Size=" + result.getSize(), false);
|
||||
}
|
||||
long callbackTime = System.currentTimeMillis();
|
||||
captureTime = callbackTime - 300;
|
||||
Log.d("captureTime", captureTime + "");
|
||||
}
|
||||
|
||||
//录像监听
|
||||
@Override
|
||||
public void onVideoTaken(@NonNull @NotNull VideoResult result) {
|
||||
super.onVideoTaken(result);
|
||||
Toast.makeText(PicturesActivity.this, "停止摄像", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
Toast.makeText(PicturesActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
|
||||
showLoadingDialog();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (result!=null) {
|
||||
File currentFile = result.getFile();
|
||||
if (finalVideoPath!=null) { // 有指定的视频文件名称,合并文件
|
||||
if (new File(finalVideoPath).exists()) {
|
||||
List<String> spliteFileList = new ArrayList<>();
|
||||
spliteFileList.add(finalVideoPath);
|
||||
spliteFileList.add(currentFile.getAbsolutePath());
|
||||
try {
|
||||
AWMp4ParserHelper.getInstance().mergeVideos(spliteFileList, tmpFile.getAbsolutePath());
|
||||
if (tmpFile.exists()) {
|
||||
File finalVideoFile = new File(finalVideoPath);
|
||||
finalVideoFile.delete();
|
||||
currentFile.delete();
|
||||
tmpFile.renameTo(finalVideoFile);
|
||||
} else {
|
||||
Toast.makeText(PicturesActivity.this, "视频合并失败!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("PictureActivity", e.getMessage());
|
||||
}
|
||||
} else {
|
||||
currentFile.renameTo(new File(finalVideoPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismissLoadingDialog();
|
||||
if (isFinishActivity) {
|
||||
PicturesActivity.this.finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraError(@NonNull @NotNull CameraException exception) {
|
||||
super.onCameraError(exception);
|
||||
Toast.makeText(PicturesActivity.this, exception.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoRecordingStart() {
|
||||
super.onVideoRecordingStart();
|
||||
/**
|
||||
* 获取当前视频的时间,记录csv文件时使用
|
||||
* */
|
||||
long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
|
||||
timerTask = new CsvTimerTask(new File(finalVideoPath+".txt"));
|
||||
|
||||
// 开始采集,每隔2秒实时记录位置信息、视频时间以及设备时间
|
||||
if (currentTime == 0) {
|
||||
timer.schedule(timerTask, 0, period*1000);
|
||||
} else {
|
||||
timerTask.setCurrentVideoTime(currentTime/1000+1);
|
||||
timer.schedule(timerTask, 1, period*1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoRecordingEnd() {
|
||||
super.onVideoRecordingEnd();
|
||||
if (timerTask!=null){
|
||||
timerTask.cancel();
|
||||
}else {
|
||||
// Toast.makeText(PictureActivity.this, "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
// tencentMap = ivMap.getMap();
|
||||
//获取地图UI 设置对象
|
||||
// UiSettings uiSettings = tencentMap.getUiSettings();
|
||||
// //设置logo的大小
|
||||
// uiSettings.setLogoScale(0.7f);
|
||||
|
||||
// 修改相机的宽高为屏幕宽高的1/3
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
|
||||
layoutParamsMap.height = dm.heightPixels/3;
|
||||
layoutParamsMap.width = dm.widthPixels/3;
|
||||
ivMap.setLayoutParams(layoutParamsMap);
|
||||
|
||||
}
|
||||
|
||||
private void message(String content, Boolean important) {
|
||||
if (important) {
|
||||
LOG.w(content);
|
||||
Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
LOG.i(content);
|
||||
Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
camera.setMode(Mode.VIDEO);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.capuretVideo:
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
//文件
|
||||
File file = new File(Constant.PICTURE_FOLDER, format + ".mp4");
|
||||
cameraView.takeVideo(file, 15000);
|
||||
// case R.id.capuretVideo:
|
||||
// DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
// String format = formatter.format(calendar.getTime());
|
||||
// //文件
|
||||
// File file = new File(Constant.PICTURE_FOLDER, format + ".mp4");
|
||||
// cameraView.takeVideo(file, 15000);
|
||||
// break;
|
||||
case R.id.btn_stop_video:
|
||||
if (timerTask!=null){
|
||||
timerTask.cancel();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalVideoPath);
|
||||
setResult(0x101, intent);
|
||||
}else {
|
||||
Toast.makeText(this, "本段视频没有计时!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (camera.isTakingVideo()) {
|
||||
isFinishActivity = true;
|
||||
camera.stopVideo();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case R.id.btn_switch:
|
||||
btnSwich();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 开始采集
|
||||
*/
|
||||
private void startTakenVideo() {
|
||||
if (camera.isTakingVideo()) {
|
||||
Toast.makeText(this, "已经在拍摄中...", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String formatVideoName = formatter.format(calendar.getTime());
|
||||
//文件
|
||||
File file = new File(Constant.PICTURE_FOLDER, formatVideoName + ".mp4");
|
||||
if (file.exists()) {
|
||||
try {
|
||||
FileOutputStream fo = new FileOutputStream(file);
|
||||
FileDescriptor fileDescriptor = fo.getFD();
|
||||
camera.takeVideo(fileDescriptor);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
camera.takeVideo(file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void stopTakenVideo() {
|
||||
if (camera.isTakingVideo()) {
|
||||
camera.stopVideo();
|
||||
}
|
||||
}
|
||||
private Bitmap getBitMap(int resourceId) {
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
int newWidth = 55;
|
||||
int newHeight = 55;
|
||||
float widthScale = ((float) newWidth) / width;
|
||||
float heightScale = ((float) newHeight) / height;
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(widthScale, heightScale);
|
||||
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setLocMarkerStyle() {
|
||||
tencentMap.setLocationSource(new MyTecentLocationSource(this));
|
||||
tencentMap.setMyLocationEnabled(true);
|
||||
|
||||
locationStyle = new MyLocationStyle();
|
||||
locationStyle = locationStyle.myLocationType(LOCATION_TYPE_LOCATION_ROTATE);
|
||||
//创建图标
|
||||
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(location));
|
||||
locationStyle.icon(bitmapDescriptor);
|
||||
//设置定位圆形区域的边框宽度;
|
||||
locationStyle.fillColor(getResources().getColor(android.R.color.transparent));
|
||||
locationStyle.strokeWidth(1);
|
||||
tencentMap.setMyLocationStyle(locationStyle);
|
||||
}
|
||||
|
||||
|
||||
public void btnSwich() {
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
System.out.println("width-display :" + dm.widthPixels);
|
||||
System.out.println("heigth-display :" + dm.heightPixels);
|
||||
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//地图的宽高
|
||||
int heightMap = ivMap.getMeasuredHeight();
|
||||
int widthMap = ivMap.getMeasuredWidth();
|
||||
FrameLayout.LayoutParams layoutParamsCamera = (FrameLayout.LayoutParams) camera.getLayoutParams();//相机的宽高
|
||||
int heightCamera = camera.getMeasuredHeight();
|
||||
int widthCamera = camera.getMeasuredWidth();
|
||||
|
||||
layerChange.removeAllViews();
|
||||
if (widthMap > widthCamera) {
|
||||
|
||||
layoutParamsCamera.width = dm.widthPixels;
|
||||
layoutParamsCamera.height = dm.heightPixels;
|
||||
layoutParamsMap.height = heightCamera;
|
||||
layoutParamsMap.width = widthCamera;
|
||||
camera.setLayoutParams(layoutParamsCamera);
|
||||
ivMap.setLayoutParams(layoutParamsMap);
|
||||
layerChange.addView(camera);
|
||||
layerChange.addView(ivMap);
|
||||
} else {
|
||||
|
||||
layoutParamsMap.height = dm.heightPixels;
|
||||
layoutParamsMap.width = dm.widthPixels;
|
||||
layoutParamsCamera.height = heightMap;
|
||||
layoutParamsCamera.width = widthMap;
|
||||
camera.setLayoutParams(layoutParamsCamera);
|
||||
ivMap.setLayoutParams(layoutParamsMap);
|
||||
layerChange.addView(ivMap);
|
||||
layerChange.addView(camera);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
cameraView.open();
|
||||
// ivMap.onResume();
|
||||
camera.open();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
cameraView.close();
|
||||
// ivMap.onPause();
|
||||
camera.close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
cameraView.destroy();
|
||||
// ivMap.onDestroy();
|
||||
stopTakenVideo();
|
||||
camera.destroy();
|
||||
timer.cancel();
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMessageMainThread(Message msg) {
|
||||
switch (msg.what) {
|
||||
case Constant.EVENT_WHAT_LOCATION_CHANGE: // 用户位置更新
|
||||
if (tencentMap!=null) {
|
||||
CameraUpdate cameraSigma =
|
||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
new LatLng(Constant.currentLocation.getLatitude(),Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||
16, //目标缩放级别
|
||||
0, //目标倾斜角
|
||||
0)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录视频拍摄的时间及经纬度
|
||||
*/
|
||||
private class CsvTimerTask extends TimerTask {
|
||||
private File csvFile;
|
||||
private long currentVideoTime; // 记录当前的视频时间
|
||||
|
||||
public CsvTimerTask(File csvFile) {
|
||||
this.csvFile = csvFile;
|
||||
if (!csvFile.exists()) {
|
||||
csvFile.getParentFile().mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentVideoTime(long currentVideoTime) {
|
||||
this.currentVideoTime = currentVideoTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// 记录当前时间、视频时间、以及当前经纬度信息
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(formatter.format(new Date())); // 记录当前时间
|
||||
sb.append(",");
|
||||
sb.append(currentVideoTime) ;// 记录视频时间
|
||||
sb.append(",");
|
||||
sb.append(Constant.currentLocation.getLatitude());
|
||||
sb.append(",");
|
||||
sb.append(Constant.currentLocation.getLongitude());
|
||||
sb.append("\r\n");
|
||||
FileUtils.writeFile(csvFile.getAbsolutePath(), sb.toString(), true);
|
||||
currentVideoTime = currentVideoTime+period; //
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.navinfo.outdoor.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@ -41,6 +43,8 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.tencent.mapsdk.internal.aaa.getContext;
|
||||
|
||||
/**
|
||||
* 用户资料
|
||||
*/
|
||||
@ -59,6 +63,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
private String userphone;
|
||||
private String usermailbox;
|
||||
private String region_id;
|
||||
private SharedPreferences navInfo;
|
||||
|
||||
|
||||
@Override
|
||||
@ -76,6 +81,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
initJsonData();
|
||||
navInfo = getSharedPreferences("navInfo", Context.MODE_PRIVATE);
|
||||
ivUser = findViewById(R.id.iv_user);
|
||||
ivUser.setOnClickListener(this::onClick);
|
||||
btnAttestation = findViewById(R.id.btn_attestation);
|
||||
@ -103,6 +109,11 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
finish();
|
||||
break;
|
||||
case R.id.btn_gathering:
|
||||
String attestationName = navInfo.getString("attestationName", null);
|
||||
if (attestationName == null || attestationName.equals("")) {
|
||||
Toast.makeText(this, "请先实名认证", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
Intent gatheringIntent = new Intent(this, FragmentManagement.class);
|
||||
gatheringIntent.putExtra("tag", 24);
|
||||
startActivity(gatheringIntent);
|
||||
@ -153,6 +164,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
netWork();
|
||||
break;
|
||||
}
|
||||
@ -173,11 +185,12 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
public void onSuccess(Response<UserBean> response) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
|
||||
if (response.body().equals("0")) {
|
||||
MessageDialog.show(UserActivity.this, "是否保存", "取消", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@ -185,7 +198,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
MessageDialog.show(UserActivity.this, "是否保存", "确定", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), "点击了取消", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -22,9 +22,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.ViewHolder> {
|
||||
private List<PoiEntity> allRoad = new ArrayList<>();
|
||||
private Vector<PoiEntity> allRoad = new Vector<>();
|
||||
private Context context;
|
||||
|
||||
public StaySubmitAdapter(Context context) {
|
||||
@ -55,15 +56,17 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Iterator iterator = allRoad.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
PoiEntity poiEntity = (PoiEntity) iterator.next();
|
||||
if (poiEntity.isChecked()) {
|
||||
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntity(poiEntity);
|
||||
iterator.remove();
|
||||
synchronized (allRoad) {
|
||||
Iterator iterator = allRoad.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
PoiEntity poiEntity = (PoiEntity) iterator.next();
|
||||
if (poiEntity.isChecked()) {
|
||||
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntity(poiEntity);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
handler.sendEmptyMessage(0x105);
|
||||
}
|
||||
handler.sendEmptyMessage(0x105);
|
||||
|
||||
}
|
||||
}).start();
|
||||
@ -84,10 +87,11 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
holder.tvDay.setText(poiEntity.getCreateTime());
|
||||
//获取checkBox点击的记录
|
||||
holder.cbUnSubmit.setChecked(allRoad.get(position).isChecked());
|
||||
holder.cbUnSubmit.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
holder.cbUnSubmit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
allRoad.get(position).setChecked(isChecked);
|
||||
public void onClick(View v) {
|
||||
holder.cbUnSubmit.setChecked(!poiEntity.isChecked());
|
||||
poiEntity.setChecked(!poiEntity.isChecked());
|
||||
}
|
||||
});
|
||||
if (poiEntity.getIsLocalData() == 1){
|
||||
|
@ -66,7 +66,6 @@ public class Constant {
|
||||
public static final int TREASURE_CHECKED_WORD = 40;//poi 对地图页面marker 的一个展示 确定
|
||||
public static final int CAPACITY_EVALUATION_PAGE = 1;//能力测评的页数
|
||||
public static final int POI_WORD = 2;//地图页面marker 的经纬都回传
|
||||
public static final int FILTER_LIST = 4;//筛选列表所有数据地图显示
|
||||
public static final int FILTER_LIST_ITEM = 5;//点击筛选的item
|
||||
public static final int GATHER_GET = 6;//点击开始采集
|
||||
public static final int TREASURE_GATHER_GET_WORD = 7;//领取采集页面其他marker 的回传
|
||||
@ -103,8 +102,8 @@ public class Constant {
|
||||
public static final int EVENT_STAY_REFRESH = 44; // 刷新记录页面
|
||||
|
||||
public static final int EVENT_WORK_HOME = 45; //切换到寻宝
|
||||
public static final int EVENT_WORK_UNPOLYGON = 46; //面妆任务点立即采集
|
||||
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
|
||||
public static final int PICTURE_VIDEO_WORD = 48; //视频页面崩溃后发给poi录像和道路
|
||||
|
||||
public static int NUMBER = 200; //任务个数
|
||||
public static int LIMIT_TTPE = -1; //权限类型,普通任务-0,专属任务-1
|
||||
public static int TASK_TYPE = -1; // 任务类型
|
||||
@ -127,6 +126,7 @@ public class Constant {
|
||||
public static MapView treasureMap;
|
||||
|
||||
public static final String INTENT_VIDEO_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置
|
||||
public static final String INTENT_VIDEO_ORATATION = "INTENT_VIDEO_ORATATION"; // 视频拍摄时屏幕方向 0-强制横屏 其他-任意
|
||||
|
||||
public static boolean IS_FILTER_LIST_ITEM =true;//poi页面的查重
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.navinfo.outdoor.api;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.StrictMode;
|
||||
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.cache.CacheEntity;
|
||||
@ -79,11 +80,12 @@ public class UserApplication extends Application {
|
||||
//builder.cookieJar(new CookieJarImpl(new MemoryCookieStore()));
|
||||
//超时时间设置,默认60秒
|
||||
//全局的读取超时时间
|
||||
builder.readTimeout(50000, TimeUnit.MILLISECONDS);
|
||||
|
||||
builder.readTimeout(0, TimeUnit.MILLISECONDS);
|
||||
//全局的写入超时时间
|
||||
builder.writeTimeout(50000, TimeUnit.MILLISECONDS);
|
||||
builder.writeTimeout(0, TimeUnit.MILLISECONDS);
|
||||
//全局的连接超时时间
|
||||
builder.connectTimeout(50000, TimeUnit.MILLISECONDS);
|
||||
builder.connectTimeout(0, TimeUnit.MILLISECONDS);
|
||||
OkGo.getInstance().init(this)
|
||||
.setOkHttpClient(builder.build())
|
||||
//全局统一缓存模式,默认不使用缓存,可以不传
|
||||
@ -95,6 +97,10 @@ public class UserApplication extends Application {
|
||||
//全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0;
|
||||
.setRetryCount(0);
|
||||
|
||||
StrictMode.VmPolicy.Builder picBuilder = new StrictMode.VmPolicy.Builder();
|
||||
StrictMode.setVmPolicy(picBuilder.build());
|
||||
picBuilder.detectFileUriExposure();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,10 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.UserApplication;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
public abstract class BaseActivity extends AppCompatActivity {
|
||||
@ -64,19 +68,64 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
protected void initMVP() {
|
||||
}
|
||||
public void showLoadingDialog() {
|
||||
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();
|
||||
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();
|
||||
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) {
|
||||
|
@ -9,11 +9,14 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.FragmentBackHandler;
|
||||
import com.navinfo.outdoor.util.GPSUtils;
|
||||
|
||||
@ -103,4 +106,28 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
}
|
||||
|
||||
|
||||
protected abstract PoiEntity initPoiEntityByUI( PoiEntity entity);
|
||||
protected abstract PoiCheckResult checkPoiEntity(PoiEntity entity);
|
||||
protected abstract ChargingPileEntity initChargingPileEntityByUI( ChargingPileEntity entity);
|
||||
protected abstract PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity);
|
||||
public class PoiCheckResult {
|
||||
private int code; // 0 检查成功,1:失败
|
||||
private String msg;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -27,6 +29,9 @@ import com.navinfo.outdoor.util.BackHandlerHelper;
|
||||
import com.navinfo.outdoor.util.FragmentBackHandler;
|
||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
public abstract class BaseFragment extends Fragment implements FragmentBackHandler {
|
||||
|
||||
@ -57,8 +62,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
return false;
|
||||
}
|
||||
|
||||
public void initEvent() {
|
||||
}
|
||||
public void initEvent() {}
|
||||
|
||||
protected <T extends View> T findViewById(@IdRes int id) {
|
||||
return getView().findViewById(id);
|
||||
@ -81,7 +85,27 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
//loading样式
|
||||
View view = LayoutInflater.from(getContext()).inflate(R.layout.loading, null);
|
||||
alertDialog.setView(view);
|
||||
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 {
|
||||
@ -89,6 +113,26 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
}
|
||||
}
|
||||
|
||||
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 添加文字
|
||||
TextView view = alertDialog.findViewById(R.id.progressBar_tx);
|
||||
@ -108,18 +152,14 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
}
|
||||
}
|
||||
|
||||
protected void initMvp() {
|
||||
}
|
||||
protected void initMvp() {}
|
||||
|
||||
protected void initData() {
|
||||
}
|
||||
protected void initData() {}
|
||||
|
||||
protected void initView() {
|
||||
}
|
||||
protected void initView() {}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.navinfo.outdoor.bean;
|
||||
|
||||
public class GetPriceBean {
|
||||
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
private BodyBean body;
|
||||
@ -38,6 +39,8 @@ public class GetPriceBean {
|
||||
private Double rewardPrice;
|
||||
private Double poiPushPrice;
|
||||
private Double poiNonepushPrice;
|
||||
private Double poivideoPushPrice;
|
||||
private Double poivideoNonepushPrice;
|
||||
private Double roadPushPrice;
|
||||
private Double roadNonepushPrice;
|
||||
private Double csPushPrice;
|
||||
@ -102,6 +105,22 @@ public class GetPriceBean {
|
||||
this.poiNonepushPrice = poiNonepushPrice;
|
||||
}
|
||||
|
||||
public Double getPoivideoPushPrice() {
|
||||
return poivideoPushPrice;
|
||||
}
|
||||
|
||||
public void setPoivideoPushPrice(Double poivideoPushPrice) {
|
||||
this.poivideoPushPrice = poivideoPushPrice;
|
||||
}
|
||||
|
||||
public Double getPoivideoNonepushPrice() {
|
||||
return poivideoNonepushPrice;
|
||||
}
|
||||
|
||||
public void setPoivideoNonepushPrice(Double poivideoNonepushPrice) {
|
||||
this.poivideoNonepushPrice = poivideoNonepushPrice;
|
||||
}
|
||||
|
||||
public Double getRoadPushPrice() {
|
||||
return roadPushPrice;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,10 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -62,6 +64,8 @@ import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.ui.view.ContactView;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.navinfo.outdoor.util.PhotoUtils;
|
||||
import com.navinfo.outdoor.util.ToastUtil;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -91,6 +95,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private RelativeLayout rlPanorama, rlName, rlInternalPhotos, rlElse, rlScutcheon, rlNull;
|
||||
private ImageView ivPanorama, ivName, ivInternal, ivElse, ivScutcheon;
|
||||
private TextView tvExamine;
|
||||
private TextView tvPanorama, tvName, tvInternal, tvElse, tvScutcheon;
|
||||
private EditText editNameContent, editSiteContent;
|
||||
private ArrayList<PhoneBean> poiBeans;
|
||||
private Button btnSaveLocal;
|
||||
@ -118,6 +123,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private ContactView contactView;
|
||||
private ArrayList<File> chargingStationList;
|
||||
|
||||
// private ArrayList<File> fileList;
|
||||
private File photoFile; // 拍照保存的路径
|
||||
|
||||
public static ChargingStationFragment newInstance(Bundle bundle) {
|
||||
ChargingStationFragment fragment = new ChargingStationFragment();
|
||||
fragment.setArguments(bundle);
|
||||
@ -216,7 +224,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
rlElse.setOnClickListener(this::onClick);
|
||||
rlScutcheon = findViewById(R.id.rl_scutcheon);
|
||||
rlScutcheon.setOnClickListener(this::onClick);
|
||||
|
||||
tvPanorama = findViewById(R.id.tv_panorama);
|
||||
tvElse = findViewById(R.id.tv_else);
|
||||
tvInternal = findViewById(R.id.tv_internal);
|
||||
tvName = findViewById(R.id.tv_name);
|
||||
tvScutcheon = findViewById(R.id.tv_scutcheon);
|
||||
/* recyclerPhone = findViewById(R.id.recycler_phone);
|
||||
recyclerPhone.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||
@ -408,9 +420,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private void initShowPoi() {
|
||||
// 添加信息:
|
||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||
if (showPoiEntity.getTaskStatus()==1||showPoiEntity.getTaskStatus()==5){
|
||||
if (showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 5) {
|
||||
tvExamine.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
tvExamine.setVisibility(View.VISIBLE);
|
||||
}
|
||||
String name = showPoiEntity.getName();//名称
|
||||
@ -436,7 +448,16 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
editDescribe.setText(describe);
|
||||
}
|
||||
int station_type = showPoiEntity.getStation_type();
|
||||
spinnerType.setSelection(station_type, true);
|
||||
if (station_type==1){
|
||||
spinnerType.setSelection(0, true);
|
||||
}else if (station_type==2){
|
||||
spinnerType.setSelection(1, true);
|
||||
}else if (station_type==3){
|
||||
spinnerType.setSelection(2, true);
|
||||
}else if (station_type==4){
|
||||
spinnerType.setSelection(3, true);
|
||||
}
|
||||
|
||||
String telPhone = showPoiEntity.getTelPhone();
|
||||
if (telPhone != null && !telPhone.equals("")) {
|
||||
String[] phones = telPhone.split("\\|");
|
||||
@ -499,19 +520,19 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||
ivPanorama.setTag(photo);
|
||||
tvPanorama.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivName);
|
||||
ivName.setTag(photo);
|
||||
tvName.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("c")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||
ivInternal.setTag(photo);
|
||||
tvInternal.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("d")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||
ivElse.setTag(photo);
|
||||
tvElse.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("e")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivScutcheon);
|
||||
ivScutcheon.setTag(photo);
|
||||
tvScutcheon.setTag(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -549,7 +570,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
obtain.what = Constant.CHARGING_STATION;
|
||||
obtain.obj = showStation;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}else {
|
||||
} else {
|
||||
Message obtains = Message.obtain();
|
||||
obtains.what = Constant.CHARGING_STATION_PILE;
|
||||
obtains.obj = null;
|
||||
@ -676,14 +697,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
return;
|
||||
}
|
||||
chargingStationList = new ArrayList<>();
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
String tagPanorama = (String) tvPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
chargingStationList.add(new File(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
String tagName = (String) tvName.getTag();
|
||||
if (tagName == null) {
|
||||
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@ -691,21 +712,21 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
chargingStationList.add(new File(tagName));
|
||||
}
|
||||
if (existence == 0) {
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
String tagInternal = (String) tvInternal.getTag();
|
||||
if (tagInternal == null) {
|
||||
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
chargingStationList.add(new File(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
String tagElse = (String) tvElse.getTag();
|
||||
if (tagElse == null) {
|
||||
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
chargingStationList.add(new File(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||
String tagScutcheon = (String) tvScutcheon.getTag();
|
||||
if (tagScutcheon == null) {
|
||||
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@ -737,22 +758,32 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
break;
|
||||
case R.id.rl_panorama:
|
||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
photoFile = PhotoUtils.showPhotoFile("a", latLng);
|
||||
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
|
||||
startActivityForResult(intentPanorama, 101);
|
||||
break;
|
||||
case R.id.rl_name:
|
||||
Intent intentName = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
photoFile = PhotoUtils.showPhotoFile("b", latLng);
|
||||
intentName.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
|
||||
startActivityForResult(intentName, 102);
|
||||
break;
|
||||
case R.id.rl_internal_photos:
|
||||
Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
photoFile = PhotoUtils.showPhotoFile("c", latLng);
|
||||
intentInternal.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
|
||||
startActivityForResult(intentInternal, 103);
|
||||
break;
|
||||
case R.id.rl_else:
|
||||
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
photoFile = PhotoUtils.showPhotoFile("d", latLng);
|
||||
intentElse.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
|
||||
startActivityForResult(intentElse, 104);
|
||||
break;
|
||||
case R.id.rl_scutcheon:
|
||||
Intent intentScutcheon = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
photoFile = PhotoUtils.showPhotoFile("e", latLng);
|
||||
intentScutcheon.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
|
||||
startActivityForResult(intentScutcheon, 105);
|
||||
break;
|
||||
case R.id.linear_charging_pile:
|
||||
@ -853,85 +884,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入充电站 名称", Toast.LENGTH_SHORT).show();
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
|
||||
if (poiCheckResult.getCode() == 1) {
|
||||
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean) {
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 名称照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
if (existence == 0) {
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 服务说明", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 充电站指引牌", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||
if (tagScutcheon == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 收费标牌", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
}
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
poiEntity.setStation_type(station_type);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(2);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -962,7 +920,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
|
||||
private void stationUploadByNetWork(PoiEntity poiEntity, ArrayList<File> chargingStationList) {
|
||||
showLoadingDialog();
|
||||
showFileLoadingDialog();
|
||||
if (poiEntity == null || poiEntity.getBodyId() == 0) {
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
Log.e("TAG", "poiUploadByNetWork: " + poiEntity.getBodyId() + chargingStationList);
|
||||
@ -1106,30 +1064,38 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
@Override
|
||||
public void onSuccess(ChargingStationBean chargingStationBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
bodyId = chargingStationBean.getBody();
|
||||
poiEntity.setBodyId(bodyId);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
// 充电站数据已经保存在服务上,批量保存充电桩数据
|
||||
saveChargingPileByChargingStation(poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
if (chargingStationBean.getCode() == 200) {
|
||||
bodyId = chargingStationBean.getBody();
|
||||
if (bodyId != null && bodyId != 0) {
|
||||
poiEntity.setBodyId(bodyId);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal) {
|
||||
stationUploadByNetWork(poiEntity, chargingStationList);
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
// 充电站数据已经保存在服务上,批量保存充电桩数据
|
||||
saveChargingPileByChargingStation(poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal) {
|
||||
stationUploadByNetWork(poiEntity, chargingStationList);
|
||||
// chargingPileUploadNetWork(chargingPileBody, fileList);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
}
|
||||
Log.d("TAG", "onSuccess: " + chargingStationBean.getBody());
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
}
|
||||
Log.d("TAG", "onSuccess: " + chargingStationBean.getBody());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}).start();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "" + chargingStationBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "" + chargingStationBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1143,60 +1109,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
|
||||
private String initShowStation() {
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng != null) {
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean) {
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName != null && !tagName.equals("")) {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null && !tagInternal.equals("")) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null && !tagElse.equals("")) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
poiEntity.setStation_type(station_type);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(2);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||
return newPoiEntity;
|
||||
}
|
||||
@ -1220,61 +1133,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
//获取Editor对象
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng != null) {
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean) {
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName != null && !tagName.equals("")) {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null && !tagInternal.equals("")) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null && !tagElse.equals("")) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
poiEntity.setStation_type(station_type);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(2);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||
//以键值对的形式添加新值。
|
||||
edit.putString("poiEntity", newPoiEntity);
|
||||
@ -1287,11 +1146,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 101 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivPanorama.setTag(takePhotoPath);
|
||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||
if (photoFile == null || !photoFile.exists()) {
|
||||
ToastUtil.showShort(getActivity(), "取消拍照");
|
||||
return;
|
||||
}
|
||||
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivPanorama);
|
||||
tvPanorama.setTag(photoPath);
|
||||
photoFile = null;
|
||||
/* int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -1308,11 +1169,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
|
||||
}*/
|
||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivName.setTag(takePhotoPath);
|
||||
ivName.setImageBitmap(bitmap);//显示图像
|
||||
if (photoFile == null || !photoFile.exists()) {
|
||||
ToastUtil.showShort(getActivity(), "取消拍照");
|
||||
return;
|
||||
}
|
||||
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivName);
|
||||
tvName.setTag(photoPath);
|
||||
photoFile = null;
|
||||
/*int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -1329,11 +1192,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
|
||||
}*/
|
||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivInternal.setTag(takePhotoPath);
|
||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||
if (photoFile == null || !photoFile.exists()) {
|
||||
ToastUtil.showShort(getActivity(), "取消拍照");
|
||||
return;
|
||||
}
|
||||
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivInternal);
|
||||
tvInternal.setTag(photoPath);
|
||||
photoFile = null;
|
||||
/*int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -1350,11 +1215,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
|
||||
}*/
|
||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivElse.setTag(takePhotoPath);
|
||||
ivElse.setImageBitmap(bitmap);//显示图像
|
||||
if (photoFile == null || !photoFile.exists()) {
|
||||
ToastUtil.showShort(getActivity(), "取消拍照");
|
||||
return;
|
||||
}
|
||||
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivElse);
|
||||
tvElse.setTag(photoPath);
|
||||
photoFile = null;
|
||||
/* int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -1371,11 +1238,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
|
||||
}*/
|
||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivScutcheon.setTag(takePhotoPath);
|
||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||
if (photoFile == null || !photoFile.exists()) {
|
||||
ToastUtil.showShort(getActivity(), "取消拍照");
|
||||
return;
|
||||
}
|
||||
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivScutcheon);
|
||||
tvScutcheon.setTag(photoPath);
|
||||
photoFile = null;
|
||||
/* int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -1465,11 +1334,129 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity != null) {
|
||||
if (poiDaoPoiEntity.getTaskStatus()==5){
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
}
|
||||
if (poiDaoPoiEntity.getTaskStatus() == 5) {
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
|
||||
List<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng != null) {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean) {
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
String tagPanorama = (String) tvPanorama.getTag();
|
||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) tvName.getTag();
|
||||
if (tagName != null && !tagName.equals("")) {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
String tagInternal = (String) tvInternal.getTag();
|
||||
if (tagInternal != null && !tagInternal.equals("")) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) tvElse.getTag();
|
||||
if (tagElse != null && !tagElse.equals("")) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) tvScutcheon.getTag();
|
||||
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
poiEntity.setStation_type(station_type);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(2);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
return poiEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
||||
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
||||
if (entity.getName()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请输入 名称");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (tvPanorama.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请拍照 全景图");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (tvName.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请拍照 名称照片");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (entity.getExistence()==0){
|
||||
if (tvInternal.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请拍照 服务说明");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (tvElse.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请拍照 充电站指引牌");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (tvScutcheon.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请拍照 收费标牌");
|
||||
return poiCheckResult;
|
||||
}
|
||||
}
|
||||
if (entity.getX()==null&&entity.getY()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请确定 点位");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (entity.getTelPhone()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请输入 手机号");
|
||||
return poiCheckResult;
|
||||
}
|
||||
return poiCheckResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import com.navinfo.outdoor.adapter.FilterAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
@ -293,14 +294,17 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
|
||||
case R.id.btn_filter:
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.FILTER_LIST;
|
||||
obtain.obj = poiEntities;
|
||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
break;
|
||||
|
||||
Message mainButtonVisiableMsg = Message.obtain();
|
||||
mainButtonVisiableMsg.what = Constant.MAIN_BUTTON_VISIABLE;
|
||||
mainButtonVisiableMsg.obj = View.VISIBLE;
|
||||
EventBus.getDefault().post(mainButtonVisiableMsg);
|
||||
break;
|
||||
case R.id.cl_number:
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"200", "500", "1000"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
@ -435,4 +439,23 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiEntity initPoiEntityByUI(PoiEntity entity) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,21 +2,30 @@ package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.UserBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
|
||||
/**
|
||||
* 忘记密码页面
|
||||
*/
|
||||
public class ForgetPawFragment extends BaseFragment implements View.OnClickListener{
|
||||
public class ForgetPawFragment extends BaseFragment implements View.OnClickListener {
|
||||
private ImageView ivFinish;
|
||||
private TextView title,tvForgetPaw, forgetPawGetNote;
|
||||
private TextView forgetPawGetNote;
|
||||
private EditText etForgetPawPhone, etForgetPawNote, etForgetPawPaw, etForgetPawConfirmPaw;
|
||||
private Button btnForgetPaw;
|
||||
private String sessionId;
|
||||
|
||||
public static ForgetPawFragment newInstance(Bundle bundle) {
|
||||
ForgetPawFragment fragment = new ForgetPawFragment();
|
||||
@ -33,30 +42,129 @@ public class ForgetPawFragment extends BaseFragment implements View.OnClickListe
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
ivFinish = findViewById(R.id.iv_forgePaw_finish);
|
||||
ivFinish.setOnClickListener(this);
|
||||
etForgetPawPhone = findViewById(R.id.et_forgetPaw_phone);
|
||||
etForgetPawNote = findViewById(R.id.et_forgetPaw_note);
|
||||
etForgetPawPaw = findViewById(R.id.et_forgetPaw_paw);
|
||||
etForgetPawConfirmPaw = findViewById(R.id.et_forgetPaw_confirm_paw);
|
||||
forgetPawGetNote = findViewById(R.id.forgetPaw_get_note);
|
||||
tvForgetPaw = findViewById(R.id.tv_forgetPaw);
|
||||
ivFinish.setOnClickListener(this);
|
||||
forgetPawGetNote.setOnClickListener(this);
|
||||
btnForgetPaw = findViewById(R.id.btn_forgetPaw);
|
||||
btnForgetPaw.setOnClickListener(this::onClick);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()){
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_forgePaw_finish:
|
||||
getActivity().finish();
|
||||
break;
|
||||
case R.id.forgetPaw_get_note:
|
||||
Toast.makeText(getActivity(), "忘记密码获取验证码", Toast.LENGTH_SHORT).show();
|
||||
initGetNote();
|
||||
break;
|
||||
case R.id.btn_forgetPaw:
|
||||
initForgetPaw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void initForgetPaw() {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
String mobile = etForgetPawPhone.getText().toString().trim();
|
||||
if (mobile == null || mobile.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("mobile", mobile);
|
||||
}
|
||||
String code = etForgetPawNote.getText().toString().trim();
|
||||
if (code == null || code.equals("")) {
|
||||
Toast.makeText(getContext(), "请获取短信验证码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("code", code);
|
||||
}
|
||||
String password = etForgetPawPaw.getText().toString().trim();
|
||||
if (password == null || password.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入密码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("password", password);
|
||||
}
|
||||
String conFirmPaw = etForgetPawConfirmPaw.getText().toString().trim();
|
||||
if (conFirmPaw == null || conFirmPaw.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入确认密码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!conFirmPaw.equals(password)) {
|
||||
Toast.makeText(getContext(), "密码和确认密码请保持一致", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (sessionId == null || sessionId.equals("")) {
|
||||
Toast.makeText(getContext(), "请短信获取验证码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("sessionId", sessionId);
|
||||
}
|
||||
long time=System.currentTimeMillis();
|
||||
httpParams.put("datetime",time);
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.USER_FORGET_PASSWORD)
|
||||
.token(null)
|
||||
.params(httpParams)
|
||||
.cls(UserBean.class)
|
||||
.postRequest(new Callback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initGetNote() {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
String mobile = etForgetPawPhone.getText().toString().trim();
|
||||
if (mobile == null || mobile.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("telephone", mobile);
|
||||
}
|
||||
httpParams.put("type", 2);
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.USER_MESSAGE)
|
||||
.cls(UserBean.class)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(httpParams)
|
||||
.getRequest(new Callback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
sessionId = String.valueOf(response.getBody());
|
||||
}
|
||||
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
@ -131,22 +132,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
if (poiEntity.getDist() != null) {
|
||||
tvDistance.setText("距离:" + format5(Double.valueOf(poiEntity.getDist()) / 1000) + "km");
|
||||
}
|
||||
|
||||
if (poiEntity.getTaskStatus() < 2) {
|
||||
double latitude = Constant.currentLocation.getLatitude();
|
||||
double longitude = Constant.currentLocation.getLongitude();
|
||||
LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置
|
||||
LatLng endLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
double v = GeometryTools.distanceToDouble(startLatLng, endLatLng);
|
||||
if (v > 5000) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
int taskStatus = poiEntity.getTaskStatus();
|
||||
initViewByTaskStatus(taskStatus);
|
||||
@ -190,33 +175,26 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_cancel_get://结束领取
|
||||
if (poiEntity != null) {
|
||||
int type = poiEntity.getType();
|
||||
if (type == 6) {
|
||||
initUnPolygonTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity.getTaskId(), poiEntity);
|
||||
} else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
btnGetTask.setVisibility(View.VISIBLE);
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
initEndReceiveTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity.getTaskId(), poiEntity);
|
||||
}
|
||||
break;
|
||||
case R.id.btn_get_task://领取任务
|
||||
/* if (poiEntity.getTaskStatus() < 2) {
|
||||
double latitude = Constant.currentLocation.getLatitude();
|
||||
double longitude = Constant.currentLocation.getLongitude();
|
||||
LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置
|
||||
LatLng endLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);
|
||||
if (geometry > 5000) {
|
||||
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (poiEntity != null) {
|
||||
int type = poiEntity.getType();
|
||||
if (type == 6) {//面状任务的领取类型
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false, poiEntity);
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false);
|
||||
} else if (type == 1) {//poi的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), false, poiEntity, 1);
|
||||
} else if (type == 2) {//充电站的领取类型
|
||||
@ -231,13 +209,24 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
break;
|
||||
case R.id.btn_gather://立即采集
|
||||
if (poiEntity.getTaskStatus() < 2) {
|
||||
double latitude = Constant.currentLocation.getLatitude();
|
||||
double longitude = Constant.currentLocation.getLongitude();
|
||||
LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置
|
||||
LatLng endLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);
|
||||
if (geometry > 5000) {
|
||||
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (poiEntity != null) {
|
||||
int type = poiEntity.getType();
|
||||
if (type == 6) {
|
||||
int taskStatus = poiEntity.getTaskStatus();
|
||||
if (taskStatus != 1) {
|
||||
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), true, poiEntity);
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), true);
|
||||
} else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
@ -327,7 +316,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
chargingStationEntity.setType(Integer.valueOf(stationBean.getType()));
|
||||
chargingStationEntity.setTaskStatus(statusId);
|
||||
chargingStationEntity.setIsLocalData(1);
|
||||
String geo = stationBean.getGeo();
|
||||
|
||||
String encodeStr = stationBean.getGeo();
|
||||
String geo = Geohash.getInstance().decode(encodeStr);
|
||||
chargingStationEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
@ -358,9 +349,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
|
||||
}
|
||||
|
||||
//获取当前位置的marker
|
||||
senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(),chargingStationEntity);
|
||||
// senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
|
||||
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(),chargingStationEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -405,9 +397,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
|
||||
/**
|
||||
* @param url 面妆任务领取任务
|
||||
* @param poiEntity
|
||||
* @param
|
||||
*/
|
||||
private void initPolygonTask(String url, int taskId, boolean aBoolean, PoiEntity poiEntity) {
|
||||
private void initPolygonTask(String url, int taskId, boolean aBoolean) {
|
||||
if (taskId == 0) {
|
||||
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@ -430,7 +422,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
polygonEntity.setTaskId(listBean.getId());
|
||||
polygonEntity.setName(listBean.getName());
|
||||
polygonEntity.setType(Integer.valueOf(listBean.getType()));
|
||||
String geo = listBean.getGeo();
|
||||
String encodeStr = listBean.getGeo();
|
||||
String geo = Geohash.getInstance().decode(encodeStr);
|
||||
polygonEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
@ -460,10 +453,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
if (aBoolean) {
|
||||
initCompleteTask(HttpInterface.COMPLETE, GatherGetFragment.this.poiEntity.getTaskId(), true, polygonEntity);
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
|
||||
obtain.obj = false;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -482,21 +471,24 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url 面妆任务结束领取
|
||||
* @param url 所以类型的结束领取
|
||||
* @param poiEntity
|
||||
*/
|
||||
private void initUnPolygonTask(String url, int taskId, PoiEntity poiEntity) {
|
||||
private void initEndReceiveTask(String url, int taskId, PoiEntity poiEntity) {
|
||||
if (taskId == 0) {
|
||||
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("taskIds",taskId);
|
||||
httpParams.put("auditIds","");
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.url(url)
|
||||
.params(httpParams)
|
||||
.cls(UnPolygonTaskBean.class)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(new HttpParams())
|
||||
.getRequest(new Callback<UnPolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(UnPolygonTaskBean response, int id) {
|
||||
@ -509,11 +501,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d("TAG", "run: "+response.getMessage());
|
||||
initViewByTaskStatus(0);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
|
||||
obtain.obj = false;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -558,16 +547,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initViewByTaskStatus(1);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
@ -607,16 +586,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.deleteFormTaskID(taskId);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initViewByTaskStatus(0);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
@ -669,7 +638,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
poiListEntity.setIsExclusive(listBean.getIsExclusive());
|
||||
poiListEntity.setTaskStatus(statusId);
|
||||
poiListEntity.setIsLocalData(1);
|
||||
String geo = listBean.getGeo();
|
||||
String encodeStr = listBean.getGeo();
|
||||
String geo = Geohash.getInstance().decode(encodeStr);
|
||||
poiListEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
@ -685,9 +655,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
poiListEntity.setX(latPolygon.get(0).longitude + "");
|
||||
poiListEntity.setY(latPolygon.get(0).latitude + "");
|
||||
}
|
||||
// 通知地图界面显示当前编辑数据的marker
|
||||
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
|
||||
if (poiListEntity.getTaskStatus()!=1){
|
||||
// 通知地图界面显示当前编辑数据的marker
|
||||
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
|
||||
}
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -779,7 +752,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
poiListEntity.setIsExclusive(listBean.getIsExclusive());
|
||||
poiListEntity.setTaskStatus(statusId);
|
||||
poiListEntity.setIsLocalData(1);
|
||||
String geo = listBean.getGeo();
|
||||
String encodeStr = listBean.getGeo();
|
||||
String geo = Geohash.getInstance().decode(encodeStr);
|
||||
poiListEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
@ -795,9 +769,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
poiListEntity.setX(latPolygon.get(0).longitude + "");
|
||||
poiListEntity.setY(latPolygon.get(0).latitude + "");
|
||||
}
|
||||
// 通知地图界面显示当前编辑数据的marker
|
||||
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
|
||||
if (poiListEntity.getTaskStatus()!=1){
|
||||
// 通知地图界面显示当前编辑数据的marker
|
||||
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
|
||||
}
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -1,9 +1,13 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@ -36,8 +40,10 @@ import com.navinfo.outdoor.bean.BankPathBean;
|
||||
import com.navinfo.outdoor.bean.BankPhoneBean;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GetJsonDataUtil;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.navinfo.outdoor.util.PhotoUtils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
||||
@ -61,6 +67,10 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
private ArrayList<File> gatheringList;
|
||||
private ArrayList<BankPathBean> jsonBean;
|
||||
private String value;
|
||||
private SharedPreferences navInfo;
|
||||
private SharedPreferences.Editor navInfoEditor;
|
||||
private File gatherFile;
|
||||
private String file;
|
||||
|
||||
|
||||
public static GatheringFragment newInstance(Bundle bundle) {
|
||||
@ -78,6 +88,8 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
navInfoEditor = getActivity().getSharedPreferences("navInfo", Context.MODE_PRIVATE).edit();
|
||||
navInfo = getActivity().getSharedPreferences("navInfo", Context.MODE_PRIVATE);
|
||||
ivGathering = findViewById(R.id.iv_gathering);
|
||||
ivGathering.setOnClickListener(this::onClick);
|
||||
imageBank = findViewById(R.id.iv_bank);
|
||||
@ -87,8 +99,9 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
btnBank = findViewById(R.id.btn_bank);
|
||||
btnBank.setOnClickListener(this::onClick);
|
||||
tvName = (TextView) findViewById(R.id.tv_name);
|
||||
if (Constant.USER_ATTESTATION_NAME != null) {
|
||||
tvName.setText(Constant.USER_ATTESTATION_NAME);
|
||||
String attestationName = navInfo.getString("attestationName", null);
|
||||
if (attestationName!= null&&!attestationName.equals("")) {
|
||||
tvName.setText(attestationName);
|
||||
}
|
||||
etBankNum = (EditText) findViewById(R.id.et_bank_num);
|
||||
gatheringCamera = (ImageView) findViewById(R.id.gathering_camera);
|
||||
@ -153,7 +166,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
|
||||
private void gatheringNetWork() {
|
||||
showLoadingDialog();
|
||||
|
||||
gatheringList = new ArrayList<>();
|
||||
File gatheringFile = new File(gatheringPath);
|
||||
if (!gatheringFile.exists()) {
|
||||
@ -166,7 +179,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
Toast.makeText(getContext(), "银行卡号不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
showLoadingDialog();
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<BankPhoneBean>post(HttpInterface.USER_BANKCARD_UP_DATA)
|
||||
@ -181,16 +194,17 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
public void onSuccess(Response<BankPhoneBean> response) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
if (response.body().equals("0")) {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "是否绑定银行卡", "取消", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
if (response.code() == 200) {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "绑定成功", "确定", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
navInfoEditor.putString("bankAccount",value);
|
||||
navInfoEditor.commit();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "是否绑定银行卡", "确定", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "绑定失败", "取消", "取消", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
@ -225,12 +239,15 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
gatherFile = new File(Constant.PICTURE_FOLDER+"/aaaaaa.jpg");
|
||||
PhotoUtils.showPhotoFile("a", null);
|
||||
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(gatherFile));
|
||||
startActivityForResult(intentPanorama, 400);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
gatheringPath = PhotoPathUtil.getTakePhotoPath(data, "", "");
|
||||
file = PhotoPathUtil.getTakePhotoPath(data, "", "");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), "请求失败", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), e.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -4,8 +4,10 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -18,8 +20,10 @@ import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
@ -46,12 +50,14 @@ import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.navinfo.outdoor.util.PhotoUtils;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -77,8 +83,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
private EditText editTaskName, editOtherDescribe;
|
||||
private RelativeLayout rlPicture;
|
||||
private ImageView ivPicture;
|
||||
private TextView tvPicture;
|
||||
private RelativeLayout rlPictures;
|
||||
private ImageView ivPictures;
|
||||
private TextView tvPictures;
|
||||
private Button btnOtherLocal;
|
||||
private Button btnOtherUploading;
|
||||
private PoiDatabase poiDatabase;
|
||||
@ -88,6 +96,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
private int station_type = 5;
|
||||
private ArrayList<File> otherUploadList;
|
||||
private CheckBox checkPot;
|
||||
private File file;
|
||||
|
||||
public static OtherFragment newInstance(Bundle bundle) {
|
||||
OtherFragment fragment = new OtherFragment();
|
||||
@ -187,6 +196,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
rlPicture = findViewById(R.id.rl_picture);
|
||||
rlPicture.setOnClickListener(this::onClick);
|
||||
ivPicture = findViewById(R.id.iv_picture);
|
||||
tvPicture = findViewById(R.id.tv_picture);
|
||||
tvPictures = findViewById(R.id.tv_pictures);
|
||||
rlPictures = findViewById(R.id.rl_pictures);
|
||||
rlPictures.setOnClickListener(this::onClick);
|
||||
ivPictures = findViewById(R.id.iv_pictures);
|
||||
@ -285,17 +296,16 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
}else if (station_type==7){
|
||||
spinnerOther.setSelection(2, true);
|
||||
}
|
||||
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPicture);
|
||||
ivPicture.setTag(photo);
|
||||
tvPicture.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPictures);
|
||||
ivPictures.setTag(photo);
|
||||
tvPictures.setTag(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -311,13 +321,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
switch (v.getId()) {
|
||||
case R.id.rl_picture:
|
||||
Intent intentPicture = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file = PhotoUtils.showPhotoFile("a", latLng);
|
||||
intentPicture.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(intentPicture, 101);
|
||||
initOtherSharePre();
|
||||
break;
|
||||
case R.id.rl_pictures:
|
||||
Intent intentPictures = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file = PhotoUtils.showPhotoFile("b",latLng);
|
||||
intentPictures.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(intentPictures, 102);
|
||||
initOtherSharePre();
|
||||
break;
|
||||
case R.id.btn_other_local:
|
||||
initPoiSaveLocal(false);
|
||||
@ -340,7 +352,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
} else {
|
||||
otherUploadList.add(new File(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) ivPictures.getTag();
|
||||
String tagPictures = (String) tvPictures.getTag();
|
||||
if (tagPictures == null) {
|
||||
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@ -376,53 +388,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoList = new ArrayList<>();
|
||||
String name = editTaskName.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
|
||||
if (poiCheckResult.getCode() == 1) {
|
||||
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editOtherDescribe.getText().toString().trim();
|
||||
if (describe != null&&!describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
String tagPicture = (String) ivPicture.getTag();
|
||||
if (tagPicture == null) {
|
||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoList.add(new Info(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) ivPictures.getTag();
|
||||
if (tagPictures == null) {
|
||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoList.add(new Info(tagPictures));
|
||||
}
|
||||
poiEntity.setStation_type(station_type);
|
||||
poiEntity.setPhotoInfo(infoList);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(5);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -452,7 +423,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void otherUploadByNet(int body, List<File> otherUploadList) {
|
||||
if (body == 0) {
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
@ -518,26 +488,37 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
@Override
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
Integer body = poiSaveBean.getBody();
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
if (poiSaveBean.getCode()==200){
|
||||
Integer body = poiSaveBean.getBody();
|
||||
if (body!=null&&body!=0){
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal){
|
||||
otherUploadByNet(body,otherUploadList);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
}
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal){
|
||||
otherUploadByNet(body,otherUploadList);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}).start();
|
||||
}else {
|
||||
Toast.makeText(getActivity(), ""+poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
}).start();
|
||||
}else {
|
||||
Toast.makeText(getActivity(), ""+poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -550,6 +531,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
initOtherSharePre();
|
||||
}
|
||||
/**
|
||||
* 防止当页面崩溃后出现数据丢失
|
||||
*/
|
||||
@ -562,39 +548,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
//获取Editor对象
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
ArrayList<Info> arrayList = new ArrayList<>();
|
||||
String name = editTaskName.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
|
||||
if (latLng != null) {
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editOtherDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
String tagPicture = (String) ivPicture.getTag();
|
||||
if (tagPicture != null && !tagPicture.equals("")) {
|
||||
arrayList.add(new Info(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) ivPictures.getTag();
|
||||
if (tagPictures != null && !tagPictures.equals("")) {
|
||||
arrayList.add(new Info(tagPictures));
|
||||
}
|
||||
poiEntity.setPhotoInfo(arrayList);
|
||||
poiEntity.setStation_type(station_type);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(5);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||
//以键值对的形式添加新值。
|
||||
edit.putString("poiEntity", newPoiEntity);
|
||||
@ -607,50 +561,25 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 101 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
//照片路径
|
||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivPicture.setTag(takePhotoPath);
|
||||
ivPicture.setImageBitmap(bitmap);//显示图像
|
||||
/* int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(intent, 101);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
|
||||
}*/
|
||||
if (file == null || !file.exists()) {
|
||||
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivPicture);
|
||||
tvPicture.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
//照片路径
|
||||
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivPictures.setTag(takePhotoPath2);
|
||||
ivPictures.setImageBitmap(bitmap);//显示图像
|
||||
/*int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(intent, 102);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (file == null || !file.exists()) {
|
||||
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
}*/
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivPictures);
|
||||
tvPictures.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -672,4 +601,78 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
|
||||
ArrayList<Info> arrayList = new ArrayList<>();
|
||||
String name = editTaskName.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
if (latLng != null) {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editOtherDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
String tagPicture = (String) tvPicture.getTag();
|
||||
if (tagPicture != null && !tagPicture.equals("")) {
|
||||
arrayList.add(new Info(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) tvPictures.getTag();
|
||||
if (tagPictures != null && !tagPictures.equals("")) {
|
||||
arrayList.add(new Info(tagPictures));
|
||||
}
|
||||
poiEntity.setPhotoInfo(arrayList);
|
||||
poiEntity.setStation_type(station_type);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(5);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
return poiEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
||||
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
||||
if (entity.getName()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请输入 名称");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (tvPicture.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请 拍照");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if ( tvPictures.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请 拍照");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (entity.getX()==null&&entity.getY()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请确定点位");
|
||||
return poiCheckResult;
|
||||
}
|
||||
return poiCheckResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -4,8 +4,10 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -51,6 +53,7 @@ import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
@ -59,6 +62,7 @@ import com.navinfo.outdoor.ui.view.ContactView;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.navinfo.outdoor.util.PhotoUtils;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -82,6 +86,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private EditText editDescribe;
|
||||
private RelativeLayout rlPanorama, rlName, rlInternalPhotos, rlCard, rlElse;
|
||||
private ImageView ivPanorama, ivName, ivInternal, ivCard, ivElse;
|
||||
private TextView tvPanorama, tvName, tvInternal, tvCard, tvElse;
|
||||
public TextView tvExamine;
|
||||
private EditText editNameContent, editSiteContent;
|
||||
private ArrayList<PhoneBean> poiBeans;
|
||||
@ -105,6 +110,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private ContactView contactView;
|
||||
private ArrayList<File> poiPicList;
|
||||
private String tagPanorama;
|
||||
private File file;
|
||||
|
||||
public static PoiFragment newInstance(Bundle bundle) {
|
||||
PoiFragment fragment = new PoiFragment();
|
||||
@ -190,11 +196,18 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
tvExamine.setOnClickListener(this::onClick);
|
||||
editDescribe = findViewById(R.id.edit_describe);
|
||||
ivPanorama = findViewById(R.id.iv_panorama);
|
||||
tvPanorama = findViewById(R.id.tv_panorama);
|
||||
ivName = findViewById(R.id.iv_name);
|
||||
tvName = findViewById(R.id.tv_name);
|
||||
ivInternal = findViewById(R.id.iv_internal);
|
||||
linearContact = findViewById(R.id.linear_contact);
|
||||
tvInternal = findViewById(R.id.tv_internal);
|
||||
|
||||
ivCard = findViewById(R.id.iv_card);
|
||||
tvCard = findViewById(R.id.tv_card);
|
||||
|
||||
ivElse = findViewById(R.id.iv_else);
|
||||
tvElse = findViewById(R.id.tv_else);
|
||||
linearContact = findViewById(R.id.linear_contact);
|
||||
rlPanorama = findViewById(R.id.rl_panorama);
|
||||
rlPanorama.setOnClickListener(this::onClick);
|
||||
rlName = findViewById(R.id.rl_name);
|
||||
@ -403,19 +416,19 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||
ivPanorama.setTag(photo);
|
||||
tvPanorama.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivName);
|
||||
ivName.setTag(photo);
|
||||
tvName.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("c")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||
ivInternal.setTag(photo);
|
||||
tvInternal.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("d")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivCard);
|
||||
ivCard.setTag(photo);
|
||||
tvCard.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("e")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||
ivElse.setTag(photo);
|
||||
tvElse.setTag(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -509,7 +522,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
break;
|
||||
case R.id.btn_uploading:
|
||||
poiPicList = new ArrayList<>();
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
@ -519,13 +532,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
String tagPanorama = (String) tvPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiPicList.add(new File(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
String tagName = (String)tvName.getTag();
|
||||
if (tagName == null) {
|
||||
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@ -533,15 +547,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
poiPicList.add(new File(tagName));
|
||||
}
|
||||
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
String tagInternal = (String) tvInternal.getTag();
|
||||
if (tagInternal != null) {
|
||||
poiPicList.add(new File(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
String tagElse = (String) tvElse.getTag();
|
||||
if (tagElse != null) {
|
||||
poiPicList.add(new File(tagElse));
|
||||
}
|
||||
String tagCard = (String) ivCard.getTag();
|
||||
String tagCard = (String) tvCard.getTag();
|
||||
if (tagCard != null) {
|
||||
poiPicList.add(new File(tagCard));
|
||||
}
|
||||
@ -568,22 +582,32 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
break;
|
||||
case R.id.rl_panorama:
|
||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file = PhotoUtils.showPhotoFile("a", latLng);;
|
||||
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(intentPanorama, 101);
|
||||
break;
|
||||
case R.id.rl_name:
|
||||
Intent intentName = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file =PhotoUtils.showPhotoFile("b", latLng);
|
||||
intentName.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(intentName, 102);
|
||||
break;
|
||||
case R.id.rl_internal_photos:
|
||||
Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file =PhotoUtils.showPhotoFile("c", latLng);
|
||||
intentInternal.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(intentInternal, 103);
|
||||
break;
|
||||
case R.id.rl_card:
|
||||
Intent intentCard = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file =PhotoUtils.showPhotoFile("d", latLng);
|
||||
intentCard.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(intentCard, 104);
|
||||
break;
|
||||
case R.id.rl_else:
|
||||
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file =PhotoUtils.showPhotoFile("e",latLng);
|
||||
intentElse.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(intentElse, 105);
|
||||
break;
|
||||
}
|
||||
@ -627,75 +651,12 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
|
||||
if (poiCheckResult.getCode() == 1) {
|
||||
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean) {
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 名称", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagCard = (String) ivCard.getTag();
|
||||
if (tagCard != null) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(1);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -790,29 +751,36 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
@Override
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
Integer body = poiSaveBean.getBody();
|
||||
if (body!=null){
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal) {
|
||||
poiUploadByNetWork(body, poiPicList);//上传
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
if (poiSaveBean.getCode()==200){
|
||||
Integer body = poiSaveBean.getBody();
|
||||
if (body!=null&&body!=0){
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal) {
|
||||
poiUploadByNetWork(body, poiPicList);//上传
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}else {
|
||||
Toast.makeText(getActivity(), ""+poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}else {
|
||||
Toast.makeText(getActivity(), ""+poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -837,64 +805,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
//获取Editor对象
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng != null) {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean) {
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName != null && !tagName.equals("")) {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null && !tagInternal.equals("")) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null && !tagElse.equals("")) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagCard = (String) ivCard.getTag();
|
||||
if (tagCard != null && !tagCard.equals("")) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(1);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||
//以键值对的形式添加新值。
|
||||
edit.putString("poiEntity", newPoiEntity);
|
||||
@ -908,11 +819,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 101 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivPanorama.setTag(takePhotoPath1);
|
||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||
if (file==null||!file.exists()){
|
||||
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivPanorama);
|
||||
tvPanorama.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
/* int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -929,11 +843,16 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
|
||||
}*/
|
||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivName.setTag(takePhotoPath2);
|
||||
ivName.setImageBitmap(bitmap);//显示图像
|
||||
|
||||
if (file==null||!file.exists()){
|
||||
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivName);
|
||||
tvName.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
|
||||
/* int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -950,11 +869,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
|
||||
}*/
|
||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivInternal.setTag(takePhotoPath3);
|
||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||
if (file==null||!file.exists()){
|
||||
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivInternal);
|
||||
tvInternal.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
/*int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -971,11 +893,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
|
||||
}*/
|
||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivCard.setTag(takePhotoPath4);
|
||||
ivCard.setImageBitmap(bitmap);//显示图像
|
||||
if (file==null||!file.exists()){
|
||||
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivCard);
|
||||
tvCard.setTag(s);
|
||||
}
|
||||
file = null;
|
||||
/* int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -992,11 +917,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
|
||||
}*/
|
||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
String takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||
ivElse.setTag(takePhotoPath5);
|
||||
ivElse.setImageBitmap(bitmap);//显示图像
|
||||
if (file==null||!file.exists()){
|
||||
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivElse);
|
||||
tvElse.setTag(s);
|
||||
}
|
||||
file = null;
|
||||
/* int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
@ -1040,5 +968,106 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
|
||||
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng != null) {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setMemo(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean) {
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
|
||||
}
|
||||
String tagPanorama = (String) tvPanorama.getTag();
|
||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) tvName.getTag();
|
||||
if (tagName != null && !tagName.equals("")) {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
String tagInternal = (String) tvInternal.getTag();
|
||||
if (tagInternal != null && !tagInternal.equals("")) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) tvElse.getTag();
|
||||
if (tagElse != null && !tagElse.equals("")) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagCard = (String) tvCard.getTag();
|
||||
if (tagCard != null && !tagCard.equals("")) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(1);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
return poiEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
||||
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
||||
if (entity.getName()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请输入 名称");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (tvPanorama.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请 拍照");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (tvName.getTag()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请 拍照");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (entity.getX()==null&&entity.getY()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请确定 点位");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (entity.getTelPhone()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请输入 手机号");
|
||||
return poiCheckResult;
|
||||
}
|
||||
return poiCheckResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
@ -27,6 +28,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.github.lazylibrary.util.StringUtils;
|
||||
import com.github.lazylibrary.util.ZipUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
@ -52,6 +54,7 @@ import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
@ -61,6 +64,7 @@ import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
@ -81,7 +85,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
private RadioButton rbCar;
|
||||
private RadioButton rbBicycle;
|
||||
private RadioButton rbWalking;
|
||||
private RadioButton rbManual;
|
||||
private EditText etDesc;
|
||||
private Button btnRoadSave;
|
||||
private RadioGroup rgType;
|
||||
@ -91,6 +94,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
private Button btnPoiVideoUpload;
|
||||
private String videoPath;
|
||||
private File fileZip;
|
||||
private FrameLayout fmPoiVideoPic;
|
||||
|
||||
public static PoiVideoFragment newInstance(Bundle bundle) {
|
||||
PoiVideoFragment fragment = new PoiVideoFragment();
|
||||
@ -102,7 +106,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
protected int getLayout() {
|
||||
return R.layout.poi_video_fragment;
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@ -140,41 +151,45 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
rbCar = (RadioButton) findViewById(R.id.rb_car);
|
||||
rbBicycle = (RadioButton) findViewById(R.id.rb_bicycle);
|
||||
rbWalking = (RadioButton) findViewById(R.id.rb_walking);
|
||||
rbManual = (RadioButton) findViewById(R.id.rb_manual);
|
||||
etDesc = (EditText) findViewById(R.id.et_desc);
|
||||
fmPoiVideoPic = findViewById(R.id.fm_poi_video_picture);
|
||||
btnRoadSave = (Button) findViewById(R.id.btn_poi_video_save);
|
||||
btnRoadSave.setOnClickListener(this::onClick);
|
||||
btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
|
||||
btnPoiVideoUpload.setOnClickListener(this::onClick);
|
||||
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
||||
ivPoiVideoPicture.setOnClickListener(new View.OnClickListener() {
|
||||
fmPoiVideoPic.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getTag() == null) {
|
||||
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
|
||||
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
File videoFile = (File) v.getTag();
|
||||
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, videoFile.getAbsolutePath());
|
||||
intent.putExtra("uuId", showPoiEntity.getId());
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||
startActivityForResult(intent, 0x101);
|
||||
}
|
||||
});
|
||||
ivPoiVideoPicture.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
fmPoiVideoPic.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "对否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
File videoFile = (File) ivPoiVideoPicture.getTag();
|
||||
if (videoFile != null) {
|
||||
videoFile.delete();
|
||||
//获取文件名
|
||||
String csvFileName = videoFile.getName() + ".txt";
|
||||
File cavFile = new File(videoFile.getParent(), csvFileName);
|
||||
cavFile.delete();
|
||||
ivPoiVideoPicture.setImageDrawable(null);
|
||||
List<File> videoFiles = (List<File>) fmPoiVideoPic.getTag();
|
||||
if (videoFiles!=null){
|
||||
for (int i = 0; i < videoFiles.size(); i++) {
|
||||
//获取文件名
|
||||
String csvFileName = videoFiles.get(i).getName() + ".txt";
|
||||
File cavFile = new File(videoFiles.get(i).getParent(), csvFileName);
|
||||
videoFiles.clear();
|
||||
cavFile.delete();
|
||||
ivPoiVideoPicture.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -198,15 +213,30 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
showPictureType(work_type);
|
||||
String describe = showPoiEntity.getMemo();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
etDesc.setText(describe+"");
|
||||
etDesc.setText(describe + "");
|
||||
}
|
||||
String photo = showPoiEntity.getPhoto();
|
||||
if (photo != null) {
|
||||
File videoFile = new File(photo);
|
||||
if (videoFile.exists()) {
|
||||
// 使用glide加载视频的第一帧
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
||||
ivPoiVideoPicture.setTag(videoFile);
|
||||
String photoList = showPoiEntity.getPhoto();
|
||||
if (!StringUtils.isEmpty(photoList)) {
|
||||
String[] photos = photoList.split(",");
|
||||
List<File> videoFileList = new ArrayList<>();
|
||||
boolean isImageLoad = false;
|
||||
if (photos != null && photos.length > 0) {
|
||||
for (int i = 0; i < photos.length; i++) {
|
||||
String photo = photos[i];
|
||||
if (!StringUtils.isEmpty(photo)) {
|
||||
File videoFile = new File(photo);
|
||||
videoFileList.add(new File(photo));
|
||||
if (videoFile.getPath().contains("0.mp4")&&!videoFile.getPath().contains("0.mp4.txt")){
|
||||
if (videoFile.exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
||||
isImageLoad = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
fmPoiVideoPic.setTag(videoFileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -225,33 +255,20 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
btnRoadSave.setEnabled(false);
|
||||
rbCar.setEnabled(false);
|
||||
rbWalking.setEnabled(false);
|
||||
rbManual.setEnabled(false);
|
||||
rbBicycle.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取本地视频的第一帧
|
||||
*
|
||||
* @param localPath
|
||||
* @return
|
||||
*/
|
||||
public Bitmap getLocalVideoBitmap(String localPath) {
|
||||
Bitmap bitmap = null;
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
try {
|
||||
//根据文件路径获取缩略图
|
||||
retriever.setDataSource(localPath);
|
||||
//获得第一帧图片
|
||||
bitmap = retriever.getFrameAtTime();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
retriever.release();
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.PICTURE_VIDEO_WORD) {
|
||||
if ((boolean)data.obj){
|
||||
initPoiVideoSharePre();
|
||||
}
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
@ -260,35 +277,39 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
break;
|
||||
case R.id.tv_pictures:
|
||||
// 根据用户点击的时间为视频名称赋值
|
||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String videoFormatName = formatter.format(new Date());
|
||||
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
// String videoFormatName = formatter.format(new Date());
|
||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||
intent.putExtra("uuId", showPoiEntity.getId());
|
||||
startActivityForResult(intent, 0x101);
|
||||
|
||||
break;
|
||||
|
||||
case R.id.btn_poi_video_upload:
|
||||
ArrayList<File> videoFileList = new ArrayList<>();
|
||||
if (ivPoiVideoPicture.getTag() != null) {
|
||||
showLoadingDialog();
|
||||
File videoFile = (File) ivPoiVideoPicture.getTag();
|
||||
videoFileList.add(videoFile);
|
||||
File file = new File(videoFile.getPath()+".txt");
|
||||
videoFileList.add(file);
|
||||
showFileLoadingDialog();
|
||||
setLoadingDialogText("压缩中...");
|
||||
if (fmPoiVideoPic.getTag() != null) {
|
||||
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
|
||||
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
|
||||
dismissLoadingDialog();
|
||||
initPoiSaveLocal(true);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismissLoadingDialog();
|
||||
initPoiSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismissLoadingDialog();
|
||||
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
|
||||
}
|
||||
});
|
||||
@ -296,7 +317,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
|
||||
}
|
||||
}).start();
|
||||
}else {
|
||||
} else {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
@ -305,97 +327,21 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
}
|
||||
|
||||
public void initPoiSaveLocal(boolean isLocal) {
|
||||
|
||||
XXPermissions.with(getContext())
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null && !roadName.equals("")) {
|
||||
poiEntity.setName(roadName + "");
|
||||
} else {
|
||||
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
||||
Calendar calendars = Calendar.getInstance();
|
||||
calendars.setTimeInMillis(System.currentTimeMillis());
|
||||
String formats = formatters.format(calendars.getTime());
|
||||
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
|
||||
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
|
||||
StringBuilder sb = new StringBuilder("poi录像上报");
|
||||
if (city != null && !"".equals(city)) {
|
||||
sb.append("-");
|
||||
sb.append(city);
|
||||
}
|
||||
if (district != null && !"".equals(district)) {
|
||||
sb.append(district);
|
||||
}
|
||||
sb.append("-").append(formats);
|
||||
poiEntity.setName(sb.toString());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
etRoadName.setText(sb);
|
||||
etRoadName.setEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
int pictureType = getPictureType();
|
||||
if (pictureType == -1) {
|
||||
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
|
||||
if (poiCheckResult.getCode() == 1) {
|
||||
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setWork_type(pictureType);
|
||||
}
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setMemo(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
File videoFile = (File) ivPoiVideoPicture.getTag();
|
||||
if (videoFile == null ) {
|
||||
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
|
||||
String path = videoFile.getPath() + ".txt";
|
||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||
ArrayList<LatLng> latLngs = new ArrayList<>();
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
latLng.setLatitude(Double.valueOf(split[2]));
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size() == 1) {
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
String lineString = GeometryTools.getLineString(latLngs);
|
||||
Log.d("TAG", "onGranted: " + lineString);
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
|
||||
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(3);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -423,6 +369,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void poiVideoUpload(int poiVideoBody, File fileZip) {
|
||||
if (poiVideoBody == 0) {
|
||||
Toast.makeText(getActivity(), "请先保存本地在上传", Toast.LENGTH_SHORT).show();
|
||||
@ -491,31 +438,34 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
@Override
|
||||
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
Integer poiVideoBody = poiVideoBean.getBody();
|
||||
if (poiVideoBody != null && poiVideoBody != 0) {
|
||||
poiEntity.setBodyId(poiVideoBody);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal) {
|
||||
poiVideoUpload(poiVideoBody, fileZip);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
if (poiVideoBean.getCode() == 200) {
|
||||
Integer poiVideoBody = poiVideoBean.getBody();
|
||||
if (poiVideoBody != null && poiVideoBody != 0) {
|
||||
poiEntity.setBodyId(poiVideoBody);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal) {
|
||||
poiVideoUpload(poiVideoBody, fileZip);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "" + poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(getActivity(), ""+poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getActivity(), "" + poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -534,11 +484,12 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
|
||||
if (requestCode == 0x101 && resultCode == 0x101) {
|
||||
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
||||
videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
File videoFile = new File(videoPath);
|
||||
if (videoFile.exists()) {
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
|
||||
ivPoiVideoPicture.setTag(videoFile);
|
||||
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
||||
fmPoiVideoPic.setTag(videoFileListByUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -562,28 +513,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
//获取Editor对象
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null && !roadName.equals("")) {
|
||||
poiEntity.setName(roadName);
|
||||
}
|
||||
int pictureType = getPictureType();
|
||||
if (pictureType != -1) {
|
||||
poiEntity.setWork_type(pictureType);
|
||||
}
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setMemo(desc);
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(3);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||
//以键值对的形式添加新值。
|
||||
edit.putString("poiEntity", newPoiEntity);
|
||||
@ -601,8 +531,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
return 1;
|
||||
} else if (rbWalking != null && rbWalking.isChecked()) {
|
||||
return 2;
|
||||
} else if (rbManual != null && rbManual.isChecked()) {
|
||||
return 3;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -618,9 +546,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
case 2:
|
||||
rbWalking.setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
rbManual.setChecked(true);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -633,12 +559,97 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity!=null) {
|
||||
if (poiDaoPoiEntity.getTaskStatus()==5){
|
||||
if (poiDaoPoiEntity != null) {
|
||||
if (poiDaoPoiEntity.getTaskStatus() == 5) {
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null && !roadName.equals("")) {
|
||||
poiEntity.setName(roadName + "");
|
||||
} else {
|
||||
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
||||
Calendar calendars = Calendar.getInstance();
|
||||
calendars.setTimeInMillis(System.currentTimeMillis());
|
||||
String formats = formatters.format(calendars.getTime());
|
||||
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
|
||||
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
|
||||
StringBuilder sb = new StringBuilder("poi录像上报");
|
||||
if (city != null && !"".equals(city)) {
|
||||
sb.append("-");
|
||||
sb.append(city);
|
||||
}
|
||||
if (district != null && !"".equals(district)) {
|
||||
sb.append(district);
|
||||
}
|
||||
sb.append("-").append(formats);
|
||||
poiEntity.setName(sb.toString());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
etRoadName.setText(sb);
|
||||
etRoadName.setEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
int pictureType = getPictureType();
|
||||
if (pictureType != -1) {
|
||||
poiEntity.setWork_type(pictureType);
|
||||
}
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(3);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
if (fmPoiVideoPic.getTag() != null &&!((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
|
||||
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmPoiVideoPic.getTag());
|
||||
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
|
||||
Log.d("TAG", "onGranted: " + lineString);
|
||||
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
|
||||
poiEntity.setPhoto(photoStr);
|
||||
if (lineString != null) {
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
}
|
||||
return poiEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
||||
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
||||
if (entity.getPhoto()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请录像");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (entity.getWork_type()==-1){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请选择录像方式");
|
||||
return poiCheckResult;
|
||||
}
|
||||
return poiCheckResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -3,23 +3,33 @@ package com.navinfo.outdoor.fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.LoginActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.UserBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
|
||||
/**
|
||||
* 注册页面
|
||||
*/
|
||||
public class RegisterFragment extends BaseFragment implements View.OnClickListener{
|
||||
public class RegisterFragment extends BaseFragment implements View.OnClickListener {
|
||||
|
||||
|
||||
private EditText etRegisterPhone, etRegisterNote, etRegisterReferrer, etRegisterPaw, etRegisterConfirmPaw;
|
||||
private ImageView ivRegisterCheck,ivFinish;
|
||||
private TextView haveGoLogin, tvRegister,registerGetNote;
|
||||
private ImageView ivRegisterCheck, ivFinish;
|
||||
private TextView haveGoLogin, registerGetNote;
|
||||
private Button btnRegister;
|
||||
private String sessionId;
|
||||
|
||||
public static RegisterFragment newInstance(Bundle bundle) {
|
||||
RegisterFragment fragment = new RegisterFragment();
|
||||
@ -35,18 +45,21 @@ public class RegisterFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
ivFinish =findViewById(R.id.iv_register_finish);
|
||||
etRegisterPhone =findViewById(R.id.et_register_phone);
|
||||
ivFinish = findViewById(R.id.iv_register_finish);
|
||||
ivFinish.setOnClickListener(this::onClick);
|
||||
etRegisterPhone = findViewById(R.id.et_register_phone);
|
||||
etRegisterNote = findViewById(R.id.et_register_note);
|
||||
registerGetNote = findViewById(R.id.register_get_note);
|
||||
registerGetNote.setOnClickListener(this::onClick);
|
||||
etRegisterReferrer = findViewById(R.id.et_register_referrer);
|
||||
etRegisterPaw =findViewById(R.id.et_register_paw);
|
||||
etRegisterPaw = findViewById(R.id.et_register_paw);
|
||||
etRegisterConfirmPaw = findViewById(R.id.et_register_confirm_paw);
|
||||
ivRegisterCheck = findViewById(R.id.iv_register_check);
|
||||
haveGoLogin = findViewById(R.id.have_go_login);
|
||||
tvRegister =findViewById(R.id.tv_register);
|
||||
ivFinish.setOnClickListener(this::onClick);
|
||||
haveGoLogin.setOnClickListener(this::onClick);
|
||||
btnRegister = findViewById(R.id.btn_register);
|
||||
btnRegister.setOnClickListener(this::onClick);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +70,7 @@ public class RegisterFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()){
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_register_finish:
|
||||
getActivity().finish();
|
||||
break;
|
||||
@ -65,6 +78,113 @@ public class RegisterFragment extends BaseFragment implements View.OnClickListen
|
||||
Intent registerLogin = new Intent(getActivity(), LoginActivity.class);
|
||||
startActivity(registerLogin);
|
||||
break;
|
||||
case R.id.btn_register:
|
||||
initRegister();
|
||||
case R.id.register_get_note:
|
||||
initGetNote();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void initGetNote() {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
String mobile = etRegisterPhone.getText().toString().trim();
|
||||
if (mobile == null || mobile.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("telephone", mobile);
|
||||
}
|
||||
httpParams.put("type", 1);
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.USER_MESSAGE)
|
||||
.cls(UserBean.class)
|
||||
.token(null)
|
||||
.params(httpParams)
|
||||
.getRequest(new Callback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
sessionId = String.valueOf(response.getBody());
|
||||
}
|
||||
Toast.makeText(getActivity(), response.getMessage()+ "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initRegister() {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
String mobile = etRegisterPhone.getText().toString().trim();
|
||||
if (mobile == null || mobile.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("mobile", mobile);
|
||||
}
|
||||
String code = etRegisterNote.getText().toString().trim();
|
||||
if (code == null || code.equals("")) {
|
||||
Toast.makeText(getContext(), "请获取短信验证码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("code", code);
|
||||
}
|
||||
String password = etRegisterPaw.getText().toString().trim();
|
||||
if (password == null || password.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入密码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("password", password);
|
||||
}
|
||||
String conFirmPaw = etRegisterConfirmPaw.getText().toString().trim();
|
||||
if (conFirmPaw == null || conFirmPaw.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入确认密码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!conFirmPaw.equals(password)) {
|
||||
Toast.makeText(getContext(), "密码和确认密码请保持一致", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (sessionId == null||sessionId.equals("")) {
|
||||
Toast.makeText(getContext(), "请短信获取验证码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
httpParams.put("sessionId", sessionId);
|
||||
}
|
||||
long time=System.currentTimeMillis();
|
||||
httpParams.put("datetime",time);
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.USER_REGISTER)
|
||||
.token(null)
|
||||
.params(httpParams)
|
||||
.cls(UserBean.class)
|
||||
.postRequest(new Callback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
@ -24,13 +25,19 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.github.lazylibrary.util.StringUtils;
|
||||
import com.github.lazylibrary.util.ZipUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
import com.hjq.permissions.Permission;
|
||||
import com.hjq.permissions.XXPermissions;
|
||||
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.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
@ -46,6 +53,7 @@ import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
@ -55,6 +63,7 @@ import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.io.File;
|
||||
@ -65,6 +74,8 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
/**
|
||||
* 寻宝-点击上传弹窗-道路
|
||||
*/
|
||||
@ -76,7 +87,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
private RadioButton rbCar;
|
||||
private RadioButton rbBicycle;
|
||||
private RadioButton rbWalking;
|
||||
private RadioButton rbManual;
|
||||
private EditText etDesc;
|
||||
private Button btnRoadSave;
|
||||
private RadioGroup rgType;
|
||||
@ -84,8 +94,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
private PoiDao poiDao;
|
||||
private PoiEntity showPoiEntity;
|
||||
private Button roadUpload;
|
||||
private String videoPath;
|
||||
private File fileZip;
|
||||
private FrameLayout fmRoadPic;
|
||||
|
||||
public static RoadFragment newInstance(Bundle bundle) {
|
||||
RoadFragment fragment = new RoadFragment();
|
||||
@ -98,6 +108,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
return R.layout.fragment_road;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@ -134,26 +152,62 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
rbCar = (RadioButton) findViewById(R.id.rb_car);
|
||||
rbBicycle = (RadioButton) findViewById(R.id.rb_bicycle);
|
||||
rbWalking = (RadioButton) findViewById(R.id.rb_walking);
|
||||
rbManual = (RadioButton) findViewById(R.id.rb_manual);
|
||||
etDesc = (EditText) findViewById(R.id.et_desc);
|
||||
fmRoadPic = findViewById(R.id.fm_road_picture);
|
||||
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
|
||||
btnRoadSave.setOnClickListener(this::onClick);
|
||||
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
||||
roadUpload = findViewById(R.id.road_upload);
|
||||
roadUpload.setOnClickListener(this::onClick);
|
||||
ivRoadPicture.setOnClickListener(new View.OnClickListener() {
|
||||
showPictureType(1);
|
||||
fmRoadPic.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getTag() == null) {
|
||||
if (v.getTag() == null || ((List<File>)v.getTag()).size()==0) {
|
||||
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
File videoFile = (File) v.getTag();
|
||||
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, videoFile.getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_VIDEO_ORATATION, 0);
|
||||
intent.putExtra("uuId", showPoiEntity.getId());
|
||||
startActivityForResult(intent, 0x101);
|
||||
}
|
||||
});
|
||||
fmRoadPic.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "对否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
List<File> videoFiles = (List<File>) fmRoadPic.getTag();
|
||||
if (videoFiles!=null){
|
||||
for (int i = 0; i < videoFiles.size(); i++) {
|
||||
String csvFileName = videoFiles.get(i).getName() + ".txt";
|
||||
File cavFile = new File(videoFiles.get(i).getParent(), csvFileName);
|
||||
videoFiles.clear();
|
||||
cavFile.delete();
|
||||
ivRoadPicture.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
// File videoFile = (File) fmRoadPic.getTag();
|
||||
// if (videoFile != null) {
|
||||
// videoFile.delete();
|
||||
// //获取文件名
|
||||
// String csvFileName = videoFile.getName() + ".txt";
|
||||
// File cavFile = new File(videoFile.getParent(), csvFileName);
|
||||
// cavFile.delete();
|
||||
// ivRoadPicture.setImageDrawable(null);
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
//数据展示
|
||||
initShowPoi();
|
||||
//禁用可操作性控件
|
||||
@ -175,13 +229,28 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
if (describe != null && !describe.equals("")) {
|
||||
etDesc.setText(describe);
|
||||
}
|
||||
String photo = showPoiEntity.getPhoto();
|
||||
if (photo != null) {
|
||||
File videoFile = new File(photo);
|
||||
if (videoFile.exists()) {
|
||||
// 使用glide加载视频的第一帧
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||
ivRoadPicture.setTag(videoFile);
|
||||
String photoList = showPoiEntity.getPhoto();
|
||||
if (!StringUtils.isEmpty(photoList)) {
|
||||
String[] photos = photoList.split(",");
|
||||
List<File> videoFileList = new ArrayList<>();
|
||||
boolean isImageLoad = false;
|
||||
if (photos!=null&&photos.length>0) {
|
||||
for (int i = 0; i < photos.length; i++) {
|
||||
String photo = photos[i];
|
||||
if (!StringUtils.isEmpty(photo)) {
|
||||
File videoFile = new File(photo);
|
||||
videoFileList.add(new File(photo));
|
||||
if (videoFile.getPath().contains("0.mp4")&&!videoFile.getPath().contains("0.mp4.txt")){
|
||||
if (videoFile.exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||
isImageLoad = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fmRoadPic.setTag(videoFileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,36 +271,16 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
btnRoadSave.setEnabled(false);
|
||||
rbCar.setEnabled(false);
|
||||
rbBicycle.setEnabled(false);
|
||||
rbManual.setEnabled(false);
|
||||
rbWalking.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
// infos = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地视频的第一帧
|
||||
*
|
||||
* @param localPath
|
||||
* @return
|
||||
*/
|
||||
public Bitmap getLocalVideoBitmap(String localPath) {
|
||||
Bitmap bitmap = null;
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
try {
|
||||
//根据文件路径获取缩略图
|
||||
retriever.setDataSource(localPath);
|
||||
//获得第一帧图片
|
||||
bitmap = retriever.getFrameAtTime();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
retriever.release();
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.PICTURE_VIDEO_WORD) {
|
||||
if ((boolean)data.obj){
|
||||
initRoadSharePre();
|
||||
}
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -243,25 +292,25 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
case R.id.tv_pictures:
|
||||
|
||||
// 根据用户点击的时间为视频名称赋值
|
||||
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String videoFormatName = formatter.format(new Date());
|
||||
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
// String videoFormatName = formatter.format(new Date());
|
||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_VIDEO_ORATATION, 0);
|
||||
intent.putExtra("uuId", showPoiEntity.getId());
|
||||
startActivityForResult(intent, 0x101);
|
||||
break;
|
||||
case R.id.road_upload:
|
||||
ArrayList<File> videoFileList = new ArrayList<>();
|
||||
if (ivRoadPicture.getTag() != null) {
|
||||
showLoadingDialog();
|
||||
File videoFile = (File) ivRoadPicture.getTag();
|
||||
videoFileList.add(videoFile);
|
||||
File file = new File(videoFile.getPath() + ".txt");
|
||||
videoFileList.add(file);
|
||||
showFileLoadingDialog();
|
||||
setLoadingDialogText("压缩中...");
|
||||
if (fmRoadPic.getTag() != null) {
|
||||
List<File> videoFileList = (List<File>) fmRoadPic.getTag();
|
||||
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
|
||||
dismissLoadingDialog();
|
||||
@ -270,6 +319,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismissLoadingDialog();
|
||||
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
|
||||
}
|
||||
});
|
||||
@ -278,10 +328,10 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
}
|
||||
}).start();
|
||||
}else {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@ -294,83 +344,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null && !roadName.equals("")) {
|
||||
poiEntity.setName(roadName);
|
||||
} else {
|
||||
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
||||
Calendar calendars = Calendar.getInstance();
|
||||
calendars.setTimeInMillis(System.currentTimeMillis());
|
||||
String formats = formatters.format(calendars.getTime());
|
||||
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
|
||||
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
|
||||
StringBuffer sb = new StringBuffer("道路录像上报");
|
||||
if (city != null && !"".equals(city)) {
|
||||
sb.append("-");
|
||||
sb.append(city);
|
||||
}
|
||||
if (district != null && !"".equals(district)) {
|
||||
sb.append(district);
|
||||
}
|
||||
sb.append("-").append(formats);
|
||||
poiEntity.setName(sb.toString());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
etRoadName.setText(sb);
|
||||
etRoadName.setEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
if (ivRoadPicture.getTag() == null) {
|
||||
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
|
||||
if (poiCheckResult.getCode() == 1) {
|
||||
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
File videoFile = (File) ivRoadPicture.getTag();
|
||||
String path = videoFile.getPath() + ".txt";
|
||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||
ArrayList<LatLng> latLngs = new ArrayList<>();
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
latLng.setLatitude(Double.valueOf(split[2]));
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size() == 1) {
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
String lineString = GeometryTools.getLineString(latLngs);
|
||||
Log.d("TAG", "onGranted: " + lineString);
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
int pictureType = getPictureType();
|
||||
if (pictureType == -1) {
|
||||
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}else {
|
||||
poiEntity.setWork_type(pictureType);
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(4);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -401,6 +380,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void poiVideoUpload(int body, File fileZip) {
|
||||
if (body == 0) {
|
||||
Toast.makeText(getContext(), "请先保存本地在上传", Toast.LENGTH_SHORT).show();
|
||||
@ -469,30 +451,35 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
@Override
|
||||
public void onSuccess(RoadSaveBean roadSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
Integer roadBody = roadSaveBean.getBody();
|
||||
if (roadBody!=null&&roadBody!=0){
|
||||
poiEntity.setBodyId(roadBody);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal) {
|
||||
poiVideoUpload(roadBody, fileZip);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}else {
|
||||
Toast.makeText(getContext(), ""+roadSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (roadSaveBean.getCode()==200){
|
||||
Integer roadBody = roadSaveBean.getBody();
|
||||
if (roadBody!=null&&roadBody!=0){
|
||||
poiEntity.setBodyId(roadBody);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocal) {
|
||||
poiVideoUpload(roadBody, fileZip);
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
onBackPressed();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}else {
|
||||
Toast.makeText(getContext(), ""+roadSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}else {
|
||||
Toast.makeText(getContext(), ""+roadSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -513,17 +500,43 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
if (requestCode == 0x101) {
|
||||
if (resultCode == 0x101) {
|
||||
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
|
||||
videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
// 扫描照片目录中当前视频的所有视频文件
|
||||
|
||||
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
|
||||
File videoFile = new File(videoPath);
|
||||
if (videoFile.exists()) {
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||
ivRoadPicture.setTag(videoFile);
|
||||
Bitmap bitmap = AWMp4ParserHelper.getInstance().getLocalVideoBitmap(videoPath);
|
||||
int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height>width){
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新录像,要求横屏录像", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Intent intentPanorama = new Intent(getActivity(),PictureActivity.class);
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intentPanorama.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
|
||||
intentPanorama.putExtra(Constant.INTENT_VIDEO_ORATATION, 0);
|
||||
startActivityForResult(intentPanorama, 0x101);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}else {
|
||||
if (videoFile.exists()) {
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
|
||||
fmRoadPic.setTag(videoFileListByUUID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
@ -542,33 +555,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
//获取Editor对象
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null && !roadName.equals("")) {
|
||||
poiEntity.setName(roadName);
|
||||
}
|
||||
int pictureType = getPictureType();
|
||||
if (pictureType != -1) {
|
||||
poiEntity.setWork_type(pictureType);
|
||||
}
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(4);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||
//以键值对的形式添加新值。
|
||||
edit.putString("poiEntity", newPoiEntity);
|
||||
@ -585,8 +572,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
return 1;
|
||||
} else if (rbWalking != null && rbWalking.isChecked()) {
|
||||
return 2;
|
||||
} else if (rbManual != null && rbManual.isChecked()) {
|
||||
return 3;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -602,9 +587,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
case 2:
|
||||
rbWalking.setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
rbManual.setChecked(true);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -625,4 +608,90 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null && !roadName.equals("")) {
|
||||
poiEntity.setName(roadName);
|
||||
} else {
|
||||
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
||||
Calendar calendars = Calendar.getInstance();
|
||||
calendars.setTimeInMillis(System.currentTimeMillis());
|
||||
String formats = formatters.format(calendars.getTime());
|
||||
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
|
||||
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
|
||||
StringBuffer sb = new StringBuffer("道路录像上报");
|
||||
if (city != null && !"".equals(city)) {
|
||||
sb.append("-");
|
||||
sb.append(city);
|
||||
}
|
||||
if (district != null && !"".equals(district)) {
|
||||
sb.append(district);
|
||||
}
|
||||
sb.append("-").append(formats);
|
||||
poiEntity.setName(sb.toString());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
etRoadName.setText(sb);
|
||||
etRoadName.setEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
int pictureType = getPictureType();
|
||||
if (pictureType != -1) {
|
||||
poiEntity.setWork_type(pictureType);
|
||||
}
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(4);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
if (fmRoadPic.getTag() != null &&!((List<File>) fmRoadPic.getTag()).isEmpty()) {
|
||||
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmRoadPic.getTag());
|
||||
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
|
||||
Log.d("TAG", "onGranted: " + lineString);
|
||||
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmRoadPic.getTag());
|
||||
poiEntity.setPhoto(photoStr);
|
||||
if (lineString != null) {
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
}
|
||||
return poiEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
|
||||
PoiCheckResult poiCheckResult = new PoiCheckResult();
|
||||
if (entity.getPhoto()==null){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请录像");
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (entity.getWork_type()==-1){
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("请选择录像方式");
|
||||
return poiCheckResult;
|
||||
}
|
||||
|
||||
return poiCheckResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -23,11 +23,16 @@ import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.BottomMenu;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.adapter.StaySubmitAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.UnPolygonTaskBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
@ -38,6 +43,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -62,6 +68,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@ -72,7 +79,6 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.fragment_stay_submit;
|
||||
@ -122,18 +128,13 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
});
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.EVENT_STAY_REFRESH) {
|
||||
if ((boolean)data.obj){
|
||||
Toast.makeText(getContext(), "提交成功", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
Toast.makeText(getContext(), "提交失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Toast.makeText(getContext(), (String) data.obj, Toast.LENGTH_SHORT).show();
|
||||
dismissLoadingDialog();
|
||||
refreshData();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,27 +203,26 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
staySubmitAdapter.setAllCheckedDelete();
|
||||
refreshData();
|
||||
initRequest(staySubmitAdapter.getAllRoad());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case R.id.btn_stay_submit://提交
|
||||
if (poiEntities==null){
|
||||
if (poiEntities == null) {
|
||||
poiEntities = new ArrayList<>();
|
||||
}
|
||||
poiEntities.clear();
|
||||
List<PoiEntity> allRoad = staySubmitAdapter.getAllRoad();
|
||||
for (int i = 0; i < allRoad.size(); i++) {
|
||||
if (allRoad.get(i).isChecked()){
|
||||
if (allRoad.get(i).isChecked()) {
|
||||
poiEntities.add(allRoad.get(i));
|
||||
}
|
||||
}
|
||||
if (poiEntities.size()>0){
|
||||
showLoadingDialog();
|
||||
if (poiEntities.size() > 0) {
|
||||
showFileLoadingDialog();
|
||||
PoiSaveUtils.getInstance(getActivity()).uploadPoiEntityBatch(poiEntities);
|
||||
}else {
|
||||
} else {
|
||||
Toast.makeText(getContext(), "请选择要删除的条目数据", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@ -230,32 +230,99 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
}
|
||||
}
|
||||
|
||||
private void initRequest(List<PoiEntity> allRoad) {
|
||||
showLoadingDialog();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArrayList<PoiEntity> poiEntities = new ArrayList<>();
|
||||
synchronized (allRoad) {
|
||||
Iterator iterator = allRoad.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
PoiEntity poiEntity = (PoiEntity) iterator.next();
|
||||
if (poiEntity.isChecked()) {
|
||||
poiEntities.add(poiEntity);
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String taskIds = "";
|
||||
String auditIds = "";
|
||||
for (int i = 0; i < poiEntities.size(); i++) {
|
||||
if (poiEntities.get(i).getTaskStatus() == 2) {
|
||||
taskIds += poiEntities.get(i).getTaskId()+",";
|
||||
} else if (poiEntities.get(i).getTaskStatus() == 3) {
|
||||
auditIds += poiEntities.get(i).getBodyId()+",";
|
||||
}
|
||||
}
|
||||
if (taskIds!=null&&!taskIds.equals("")){
|
||||
taskIds = taskIds.substring(0,taskIds.length() - 1);
|
||||
}
|
||||
if (auditIds!=null&&!auditIds.equals("")){
|
||||
auditIds = auditIds.substring(0,auditIds.length() - 1);
|
||||
}
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("taskIds", taskIds);
|
||||
httpParams.put("auditIds", auditIds);
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.UNRECEIVED_POLYGON_TASK)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.cls(UnPolygonTaskBean.class)
|
||||
.getRequest(new Callback<UnPolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(UnPolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode()==200){
|
||||
staySubmitAdapter.setAllCheckedDelete();
|
||||
}
|
||||
Toast.makeText(getContext(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void refreshData() {
|
||||
|
||||
if (roadEntities == null) {
|
||||
roadEntities = new ArrayList<>();
|
||||
}else {
|
||||
} else {
|
||||
roadEntities.clear();
|
||||
}
|
||||
if (newEntities == null) {
|
||||
newEntities = new ArrayList<>();
|
||||
}else {
|
||||
newEntities.clear();
|
||||
} else {
|
||||
newEntities.clear();
|
||||
}
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> roadAll = roadDao.getAllPoi();
|
||||
List<PoiEntity> roadAll = roadDao.getAllPoiByRecoder();
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
roadEntities.clear();
|
||||
for (int i = 0; i < roadAll.size(); i++) {
|
||||
if (roadAll.get(i).getType()!=6){
|
||||
roadEntities.add(roadAll.get(i));
|
||||
}
|
||||
}
|
||||
roadEntities.addAll(roadAll);
|
||||
// for (int i = 0; i < roadAll.size(); i++) {
|
||||
// if (roadAll.get(i).getType()!=6){
|
||||
// roadEntities.add(roadAll.get(i));
|
||||
// }
|
||||
// }
|
||||
Log.d("TAG", "run: " + roadEntities.toString());
|
||||
staySubmitAdapter.setAllRoad(roadEntities);
|
||||
staySubmitAdapter.notifyDataSetChanged();
|
||||
|
@ -160,7 +160,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
bitmapDescriptor3 = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
|
||||
bitmapDescriptor4 = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
|
||||
bitmapDescriptor5 = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
//fragment 管理器
|
||||
supportFragmentManager = getActivity().getSupportFragmentManager();
|
||||
@ -243,7 +242,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
dismissLoadingDialog();
|
||||
refreshFilterData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
}
|
||||
@ -334,14 +332,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "数据为空", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 设置地图宽高为屏幕的宽高
|
||||
int[] widtHeight = DensityUtil.getDeviceInfo(getActivity());
|
||||
treasureMap.getLayoutParams().width = widtHeight[0];
|
||||
@ -384,7 +380,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private void initList (TencentLocation tencentLocation){
|
||||
private void initList(TencentLocation tencentLocation) {
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
int limit_type = Constant.LIMIT_TTPE;
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
@ -433,7 +429,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
|
||||
String geo = list.get(i).getGeo();
|
||||
String encodeStr = list.get(i).getGeo();
|
||||
// 解密geo
|
||||
String geo = Geohash.getInstance().decode(encodeStr);
|
||||
listBean.setGeo(geo);
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
LatLng latLng = null;
|
||||
@ -564,384 +563,393 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public void initMarker (PoiEntity poiEntity){
|
||||
sliding_layout.setPanelHeight(0);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||
for (int i = 0; i < removablesMarker.size(); i++) {
|
||||
removablesMarker.get(i).remove();
|
||||
public void initMarker(PoiEntity poiEntity) {
|
||||
sliding_layout.setPanelHeight(0);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||
for (int i = 0; i < removablesMarker.size(); i++) {
|
||||
removablesMarker.get(i).remove();
|
||||
}
|
||||
removablesMarker.clear();
|
||||
String geo = poiEntity.getGeoWkt();
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
LatLng latLng = null;
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
// 构造 PolylineOpitons
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
// 折线的颜色为绿色
|
||||
.color(0xff00ff00)
|
||||
// 折线宽度为5像素
|
||||
.width(25)
|
||||
// 还可以添加描边颜色
|
||||
.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
.borderWidth(1);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
polyline.setZIndex(3);
|
||||
removablesMarker.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为浅蓝色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff000000).
|
||||
//边线宽度15像素
|
||||
strokeWidth(25));
|
||||
|
||||
polygon.setZIndex(1);
|
||||
removablesMarker.add(polygon);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
if (centroid != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
removablesMarker.clear();
|
||||
String geo = poiEntity.getGeoWkt();
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
LatLng latLng = null;
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
// 构造 PolylineOpitons
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
// 折线的颜色为绿色
|
||||
.color(0xff00ff00)
|
||||
// 折线宽度为5像素
|
||||
.width(25)
|
||||
// 还可以添加描边颜色
|
||||
.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
.borderWidth(1);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
polyline.setZIndex(3);
|
||||
removablesMarker.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为红色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff000000).
|
||||
//边线宽度15像素
|
||||
strokeWidth(25));
|
||||
polygon.setZIndex(1);
|
||||
removablesMarker.add(polygon);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
if (centroid != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
/* if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
}*/
|
||||
}
|
||||
BitmapDescriptor descriptor = null;
|
||||
if (poiEntity.getType() == 1) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bags);
|
||||
} else if (poiEntity.getType() == 2) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bags);
|
||||
} else if (poiEntity.getType() == 3) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bag);
|
||||
} else if (poiEntity.getType() == 4) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag);
|
||||
} else if (poiEntity.getType() == 5) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag);
|
||||
} else if (poiEntity.getType() == 6) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bag);
|
||||
}
|
||||
if (bigMarker == null) {
|
||||
bigMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(descriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
} else {
|
||||
bigMarker.setPosition(latLng);
|
||||
bigMarker.setIcon(descriptor);
|
||||
}
|
||||
bigMarker.setVisible(true);
|
||||
bigMarker.setClickable(false);
|
||||
bigMarker.setZIndex(4);
|
||||
frameLayout.setVisibility(View.VISIBLE);
|
||||
setMainButtonVisiable(View.GONE);
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
gatherGetFragment = GatherGetFragment.newInstance(bundle);
|
||||
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
BitmapDescriptor descriptor = null;
|
||||
if (poiEntity.getType()==1){
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bags);
|
||||
}else if (poiEntity.getType()==2){
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bags);
|
||||
}else if (poiEntity.getType()==3){
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bag);
|
||||
}else if (poiEntity.getType()==4){
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag);
|
||||
}else if (poiEntity.getType()==5){
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag);
|
||||
}else if (poiEntity.getType()==6){
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bag);
|
||||
}
|
||||
if (bigMarker == null) {
|
||||
bigMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(descriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
} else {
|
||||
bigMarker.setPosition(latLng);
|
||||
bigMarker.setIcon(descriptor);
|
||||
}
|
||||
bigMarker.setVisible(true);
|
||||
bigMarker.setClickable(false);
|
||||
bigMarker.setZIndex(4);
|
||||
frameLayout.setVisibility(View.VISIBLE);
|
||||
setMainButtonVisiable(View.GONE);
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
gatherGetFragment = GatherGetFragment.newInstance(bundle);
|
||||
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
|
||||
private void initThread () {
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
int type = Constant.TASK_TYPE;
|
||||
int limit = Constant.LIMIT_TTPE;
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allTaskStatus = poiDao.getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
|
||||
//List<PoiEntity> allTaskStatus = poiDao.getAllPoi();
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < removablesLocality.size(); i++) {
|
||||
removablesLocality.get(i).remove();
|
||||
}
|
||||
removablesLocality.clear();
|
||||
for (int i = 0; i < allTaskStatus.size(); i++) {
|
||||
PoiEntity poiEntity = allTaskStatus.get(i);
|
||||
String geo = allTaskStatus.get(i).getGeoWkt();
|
||||
LatLng latLng = null;
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry != null) {
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
// 构造 PolylineOpitons
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
.color(0xffff0000)
|
||||
// 折线宽度为5像素
|
||||
.width(5)
|
||||
// 还可以添加描边颜色
|
||||
.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
.borderWidth(1);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
polyline.setZIndex(3);
|
||||
removablesLocality.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为红色
|
||||
fillColor(Color.parseColor("#97E0E74C")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff00ff00).
|
||||
//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
polygon.setZIndex(1);
|
||||
removablesLocality.add(polygon);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
if (centroid != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
private void initThread() {
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
int type = Constant.TASK_TYPE;
|
||||
int limit = Constant.LIMIT_TTPE;
|
||||
if (taskStatus == 0) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = null;
|
||||
EventBus.getDefault().post(obtain);
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allTaskStatus = poiDao.getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
|
||||
//List<PoiEntity> allTaskStatus = poiDao.getAllPoi();
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < removablesLocality.size(); i++) {
|
||||
removablesLocality.get(i).remove();
|
||||
}
|
||||
removablesLocality.clear();
|
||||
for (int i = 0; i < allTaskStatus.size(); i++) {
|
||||
PoiEntity poiEntity = allTaskStatus.get(i);
|
||||
String geo = allTaskStatus.get(i).getGeoWkt();
|
||||
LatLng latLng = null;
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry != null) {
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
// 构造 PolylineOpitons
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.alpha(0.5f)
|
||||
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
.color(0xffff0000)
|
||||
// 折线宽度为5像素
|
||||
.width(5)
|
||||
// 还可以添加描边颜色
|
||||
.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
.borderWidth(1);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
polyline.setZIndex(3);
|
||||
removablesLocality.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为浅蓝色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff00ff00).
|
||||
//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
polygon.setZIndex(1);
|
||||
removablesLocality.add(polygon);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
if (centroid != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
/* if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
}*/
|
||||
}
|
||||
} else {
|
||||
if (allTaskStatus.get(i).getX() != null && allTaskStatus.get(i).getY() != null) {
|
||||
latLng = new LatLng(Double.valueOf(allTaskStatus.get(i).getY()), Double.valueOf(allTaskStatus.get(i).getX()));
|
||||
}
|
||||
}
|
||||
switch (Integer.valueOf(poiEntity.getType())) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
|
||||
} else {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
||||
}
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiMarker.setClickable(true);
|
||||
poiMarker.setZIndex(2);
|
||||
poiMarker.setTitle(poiEntity.getName() + "");
|
||||
poiMarker.setTag(poiEntity);
|
||||
removablesLocality.add(poiMarker);
|
||||
|
||||
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
|
||||
} else {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
||||
}
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
stationMarker.setClickable(true);
|
||||
stationMarker.setZIndex(2);
|
||||
stationMarker.setTitle(poiEntity.getName() + "");
|
||||
stationMarker.setTag(poiEntity);
|
||||
removablesLocality.add(stationMarker);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
|
||||
} else {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
}
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiVideoMarker.setClickable(true);
|
||||
poiVideoMarker.setZIndex(2);
|
||||
poiVideoMarker.setTitle(poiEntity.getName() + "");
|
||||
poiVideoMarker.setTag(poiEntity);
|
||||
removablesLocality.add(poiVideoMarker);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
|
||||
} else {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
||||
}
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
roadMarker.setClickable(true);
|
||||
roadMarker.setZIndex(2);
|
||||
roadMarker.setTitle(poiEntity.getName() + "");
|
||||
roadMarker.setTag(poiEntity);
|
||||
removablesLocality.add(roadMarker);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
|
||||
} else {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
||||
}
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
otherMarker.setClickable(true);
|
||||
otherMarker.setZIndex(2);
|
||||
otherMarker.setTitle(poiEntity.getName() + "");
|
||||
otherMarker.setTag(poiEntity);
|
||||
removablesLocality.add(otherMarker);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
|
||||
} else {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bag);
|
||||
}
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||
.clockwise(false)
|
||||
.flat(true));
|
||||
planarMarker.setClickable(true);
|
||||
planarMarker.setZIndex(2);
|
||||
planarMarker.setTitle(poiEntity.getName() + "");
|
||||
planarMarker.setTag(poiEntity);
|
||||
removablesLocality.add(planarMarker);
|
||||
break;
|
||||
} else {
|
||||
if (allTaskStatus.get(i).getX() != null && allTaskStatus.get(i).getY() != null) {
|
||||
latLng = new LatLng(Double.valueOf(allTaskStatus.get(i).getY()), Double.valueOf(allTaskStatus.get(i).getX()));
|
||||
}
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = allTaskStatus;
|
||||
EventBus.getDefault().post(obtain);
|
||||
switch (Integer.valueOf(poiEntity.getType())) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor=null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
poiDescriptor= BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
|
||||
}else {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
||||
}
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiMarker.setClickable(true);
|
||||
poiMarker.setZIndex(2);
|
||||
poiMarker.setTitle(poiEntity.getName() + "");
|
||||
poiMarker.setTag(poiEntity);
|
||||
removablesLocality.add(poiMarker);
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
|
||||
}else {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
||||
}
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
stationMarker.setClickable(true);
|
||||
stationMarker.setZIndex(2);
|
||||
stationMarker.setTitle(poiEntity.getName() + "");
|
||||
stationMarker.setTag(poiEntity);
|
||||
removablesLocality.add(stationMarker);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
|
||||
}else {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
}
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiVideoMarker.setClickable(true);
|
||||
poiVideoMarker.setZIndex(2);
|
||||
poiVideoMarker.setTitle(poiEntity.getName() + "");
|
||||
poiVideoMarker.setTag(poiEntity);
|
||||
removablesLocality.add(poiVideoMarker);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor =null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
|
||||
}else {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
||||
}
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
roadMarker.setClickable(true);
|
||||
roadMarker.setZIndex(2);
|
||||
roadMarker.setTitle(poiEntity.getName() + "");
|
||||
roadMarker.setTag(poiEntity);
|
||||
removablesLocality.add(roadMarker);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
|
||||
}else {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
||||
}
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
otherMarker.setClickable(true);
|
||||
otherMarker.setZIndex(2);
|
||||
otherMarker.setTitle(poiEntity.getName() + "");
|
||||
otherMarker.setTag(poiEntity);
|
||||
removablesLocality.add(otherMarker);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor =null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
|
||||
}else {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bag);
|
||||
}
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||
.clockwise(false)
|
||||
.flat(true));
|
||||
planarMarker.setClickable(true);
|
||||
planarMarker.setZIndex(2);
|
||||
planarMarker.setTitle(poiEntity.getName() + "");
|
||||
planarMarker.setTag(poiEntity);
|
||||
removablesLocality.add(planarMarker);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = allTaskStatus;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
private void initSharePre () {
|
||||
//根据保存时所用的name属性,获取SharedPreferences对象
|
||||
SharedPreferences dataFile = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
||||
String dataFileString = dataFile.getString("poiEntity", null);
|
||||
if (dataFileString != null) {
|
||||
PoiEntity poiEntity = new Gson().fromJson(dataFileString, PoiEntity.class);
|
||||
switch (poiEntity.getType()) {
|
||||
case 1:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你poi页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(1, newPoiLatLng);
|
||||
showSlidingFragment(poiFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你充电站页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(4, newPoiLatLng);
|
||||
showSlidingFragment(chargingStationFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你poi录像页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(2, newPoiLatLng);
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你道路页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(3, newPoiLatLng);
|
||||
showSlidingFragment(roadFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
private void initSharePre () {
|
||||
//根据保存时所用的name属性,获取SharedPreferences对象
|
||||
SharedPreferences dataFile = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
||||
String dataFileString = dataFile.getString("poiEntity", null);
|
||||
if (dataFileString != null) {
|
||||
PoiEntity poiEntity = new Gson().fromJson(dataFileString, PoiEntity.class);
|
||||
switch (poiEntity.getType()) {
|
||||
case 1:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你poi页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(1, newPoiLatLng);
|
||||
showSlidingFragment(poiFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你充电站页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(4, newPoiLatLng);
|
||||
showSlidingFragment(chargingStationFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你poi录像页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(2, newPoiLatLng);
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你道路页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(3, newPoiLatLng);
|
||||
showSlidingFragment(roadFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 5:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你其他页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(5, newPoiLatLng);
|
||||
showSlidingFragment(otherFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 5:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你其他页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(5, newPoiLatLng);
|
||||
showSlidingFragment(otherFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initRemovePoiSharePre () {
|
||||
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||
@ -1487,36 +1495,26 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* header 头部布局
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
public void initHeader (View view){
|
||||
dragView.removeAllViews();
|
||||
dragView.addView(view);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将fragment显示到抽屉内
|
||||
*/
|
||||
private void showSlidingFragment (BaseDrawerFragment fragment){
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
|
||||
sliding_layout.setPanelHeight(deviceInfo[1] / 2);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
fragmentTransaction.add(R.id.scroll_view, fragment, fragment.getClass().getName());
|
||||
if (!(fragment instanceof FilterFragment)) {
|
||||
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
|
||||
if (filterFragment != null) {
|
||||
fragmentTransaction.hide(filterFragment);
|
||||
}
|
||||
/**
|
||||
* 将fragment显示到抽屉内
|
||||
*/
|
||||
private void showSlidingFragment(BaseDrawerFragment fragment) {
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
|
||||
sliding_layout.setPanelHeight(deviceInfo[1] / 2);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
fragmentTransaction.add(R.id.scroll_view, fragment, fragment.getClass().getName());
|
||||
if (!(fragment instanceof FilterFragment)) {
|
||||
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
|
||||
if (filterFragment != null) {
|
||||
fragmentTransaction.hide(filterFragment);
|
||||
}
|
||||
if (!(fragment instanceof ChargingStationFragment)) {
|
||||
ChargingStationFragment chargingStationFragment = (ChargingStationFragment) supportFragmentManager.findFragmentByTag(ChargingStationFragment.class.getName());
|
||||
if (chargingStationFragment != null) {
|
||||
fragmentTransaction.hide(chargingStationFragment);
|
||||
}
|
||||
}
|
||||
if (!(fragment instanceof ChargingStationFragment)) {
|
||||
ChargingStationFragment chargingStationFragment = (ChargingStationFragment) supportFragmentManager.findFragmentByTag(ChargingStationFragment.class.getName());
|
||||
if (chargingStationFragment != null) {
|
||||
fragmentTransaction.hide(chargingStationFragment);
|
||||
}
|
||||
if (!(fragment instanceof PoiFragment)) {
|
||||
PoiFragment poiFragment = (PoiFragment) supportFragmentManager.findFragmentByTag(PoiFragment.class.getName());
|
||||
@ -1540,56 +1538,54 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
fragmentTransaction.addToBackStack(null);
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查网络状态
|
||||
*/
|
||||
private void checkNetWork () {
|
||||
/**
|
||||
* 检查网络状态
|
||||
*/
|
||||
private void checkNetWork() {
|
||||
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
|
||||
checkMyLocation();
|
||||
} else { // 当前网络不可用
|
||||
dismissLoadingDialog();
|
||||
ToastUtil.showShort(getContext(), Constant.NETWORK_UNAVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查所需权限
|
||||
*/
|
||||
private void checkMyLocation () {
|
||||
|
||||
// 1.判断是否拥有定位的权限
|
||||
// 1.1 拥有权限进行相应操作
|
||||
// 1.2 没有权限申请权限
|
||||
// 1.2.1 Android 6.0 动态申请权限
|
||||
// 1.2.1.1 用户给予权限进行相应操作
|
||||
// 1.2.1.2 用户没有给予权限 作出相应提示
|
||||
// 1.2.2 某些5.0权限的手机执行相应操作
|
||||
|
||||
XXPermissions.with(this)
|
||||
.permission(Permission.ACCESS_COARSE_LOCATION)
|
||||
.request(new OnPermissionCallback() {
|
||||
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//建立定位
|
||||
initLocation();
|
||||
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "申请权限失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
/**
|
||||
* 检查所需权限
|
||||
*/
|
||||
private void checkMyLocation() {
|
||||
// 1.判断是否拥有定位的权限
|
||||
// 1.1 拥有权限进行相应操作
|
||||
// 1.2 没有权限申请权限
|
||||
// 1.2.1 Android 6.0 动态申请权限
|
||||
// 1.2.1.1 用户给予权限进行相应操作
|
||||
// 1.2.1.2 用户没有给予权限 作出相应提示
|
||||
// 1.2.2 某些5.0权限的手机执行相应操作
|
||||
XXPermissions.with(this)
|
||||
.permission(Permission.ACCESS_COARSE_LOCATION)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//建立定位
|
||||
initLocation();
|
||||
} else {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "申请权限失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予定位权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予定位权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -1,8 +1,12 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@ -26,7 +30,9 @@ import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.navinfo.outdoor.util.PhotoUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@ -54,6 +60,8 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
private TextView tvCard2;
|
||||
private ImageView ivHera3;
|
||||
private TextView tvCard3;
|
||||
private SharedPreferences.Editor navInfoEditor;
|
||||
private File file;
|
||||
|
||||
|
||||
public static UserAttestationFragment newInstance(Bundle bundle) {
|
||||
@ -79,6 +87,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
navInfoEditor = getActivity().getSharedPreferences("navInfo", Context.MODE_PRIVATE).edit();
|
||||
ivAttestation = findViewById(R.id.iv_attestation);
|
||||
ivAttestation.setOnClickListener(this);
|
||||
ivAttestation1 = findViewById(R.id.iv_attestation1);
|
||||
@ -107,22 +116,42 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
break;
|
||||
case R.id.iv_attestation1:
|
||||
Intent ivAttestation1 = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file = PhotoUtils.showPhotoFile("a", null);
|
||||
ivAttestation1.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(ivAttestation1, 100);
|
||||
break;
|
||||
case R.id.iv_attestation2:
|
||||
Intent ivAttestation2 = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file = PhotoUtils.showPhotoFile("a", null);
|
||||
ivAttestation2.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(ivAttestation2, 200);
|
||||
break;
|
||||
case R.id.iv_attestation3:
|
||||
Intent ivAttestation3 = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file = PhotoUtils.showPhotoFile("a", null);
|
||||
ivAttestation3.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(ivAttestation3, 300);
|
||||
break;
|
||||
case R.id.btn_attestation:
|
||||
if (etAttestationName.getText().toString() == null || etAttestationName.getText().toString().equals("")) {
|
||||
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!chineseNameTest(etAttestationName.getText().toString())){
|
||||
Toast.makeText(getActivity(), "请输入中文名字", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!checkNum(etNamePhone.getText().toString().trim())) {
|
||||
Toast.makeText(getContext(), "身份证号错误,请重新输入", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
nameAuthentication();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
*/
|
||||
public boolean checkNum(String text) {
|
||||
Pattern patternSfzhm1 = Pattern
|
||||
.compile("^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$");
|
||||
@ -135,7 +164,16 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
else return true;
|
||||
|
||||
}
|
||||
/**
|
||||
* 中文效验
|
||||
*/
|
||||
|
||||
static boolean chineseNameTest(String name) {
|
||||
if (!name.matches("[\u4e00-\u9fa5]{2,4}")) {
|
||||
System.out.println("只能输入2到4个汉字");
|
||||
return false;
|
||||
}else return true;
|
||||
}
|
||||
private void nameAuthentication() {
|
||||
if (etAttestationName.getText().toString() == null || etAttestationName.getText().toString().equals("")) {
|
||||
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
|
||||
@ -181,24 +219,23 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
@Override
|
||||
public void onSuccess(Response<NameAuthenticationBean> response) {
|
||||
dismissLoadingDialog();
|
||||
|
||||
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
if (response.body().equals("0")) {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
if (response.code()==200) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
|
||||
//传值给持卡人
|
||||
Constant.USER_ATTESTATION_NAME = attestationName;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Constant.USER_ATTESTATION_NAME = attestationName;
|
||||
navInfoEditor.putString("attestationName",attestationName);
|
||||
navInfoEditor.commit();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@ -221,74 +258,84 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 100 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(intentPanorama, 100);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (file == null || !file.exists()) {
|
||||
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
String takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
|
||||
ivAttestation1.setTag(takePhotoPath1);
|
||||
ivAttestation1.setImageBitmap(bitmap);//显示图像
|
||||
ivHera1.setVisibility(View.GONE);
|
||||
tvCard1.setVisibility(View.GONE);
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation1);
|
||||
ivAttestation1.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
ivHera1.setVisibility(View.GONE);
|
||||
tvCard1.setVisibility(View.GONE);
|
||||
// int height = bitmap.getHeight();
|
||||
// int width = bitmap.getWidth();
|
||||
// if (height > width) {
|
||||
// DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
// MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
// @Override
|
||||
// public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
// startActivityForResult(intentPanorama, 100);
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
if (requestCode == 200 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(intentPanorama, 200);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
|
||||
ivAttestation2.setTag(takePhotoPath2);
|
||||
ivAttestation2.setImageBitmap(bitmap);//显示图像
|
||||
ivHera2.setVisibility(View.GONE);
|
||||
tvCard2.setVisibility(View.GONE);
|
||||
if (file == null || !file.exists()) {
|
||||
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation2);
|
||||
ivAttestation2.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
ivHera2.setVisibility(View.GONE);
|
||||
tvCard2.setVisibility(View.GONE);
|
||||
// int height = bitmap.getHeight();
|
||||
// int width = bitmap.getWidth();
|
||||
// if (height > width) {
|
||||
// DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
// MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
// @Override
|
||||
// public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
// startActivityForResult(intentPanorama, 200);
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
if (requestCode == 300 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
int height = bitmap.getHeight();
|
||||
int width = bitmap.getWidth();
|
||||
if (height > width) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(intentPanorama, 300);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "a", "");
|
||||
ivAttestation3.setTag(takePhotoPath3);
|
||||
ivAttestation3.setImageBitmap(bitmap);//显示图像
|
||||
ivHera3.setVisibility(View.GONE);
|
||||
tvCard3.setVisibility(View.GONE);
|
||||
if (file == null || !file.exists()) {
|
||||
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
}else {
|
||||
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation3);
|
||||
ivAttestation3.setTag(s);
|
||||
}
|
||||
file=null;
|
||||
ivHera3.setVisibility(View.GONE);
|
||||
tvCard3.setVisibility(View.GONE);
|
||||
// int height = bitmap.getHeight();
|
||||
// int width = bitmap.getWidth();
|
||||
// if (height > width) {
|
||||
// DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
// MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
// @Override
|
||||
// public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
// startActivityForResult(intentPanorama, 300);
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,25 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
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.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
@ -34,12 +44,17 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
private EditText etAllPrice;
|
||||
private TextView poiPushMoney;
|
||||
private TextView poiReportMoney;
|
||||
private TextView poiVideoPushMoney;
|
||||
private TextView poiVideoReportMoney;
|
||||
private TextView roadPushMoney;
|
||||
private TextView roadReportMoney;
|
||||
private TextView chargingPushMoney;
|
||||
private TextView chargingReportMoney;
|
||||
private TextView otherPushMoney;
|
||||
private TextView otherReportMoney;
|
||||
private SharedPreferences navInfo;
|
||||
private CheckBox checkBox;
|
||||
private String bankAccount;
|
||||
|
||||
public static WithdrawFragment newInstance(Bundle bundle) {
|
||||
WithdrawFragment fragment = new WithdrawFragment();
|
||||
@ -61,7 +76,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
tvUnit = findViewById(R.id.tv_unit);//可提现
|
||||
tvAlready = findViewById(R.id.tv_already);//以提现
|
||||
tvAlready = findViewById(R.id.tv_already);//已提现
|
||||
tvTotal = findViewById(R.id.tv_total);//总资产
|
||||
tvAll = findViewById(R.id.tv_all);
|
||||
tvAll.setOnClickListener(this::onClick);
|
||||
@ -70,10 +85,37 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
ivWithDraw.setOnClickListener(this);
|
||||
tvText = findViewById(R.id.tv_text);
|
||||
tvText.setOnClickListener(this::onClick);
|
||||
checkBox = findViewById(R.id.checkBox);
|
||||
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked){
|
||||
checkBox.setChecked(true);
|
||||
navInfo = getActivity().getSharedPreferences("navInfo", Context.MODE_PRIVATE);
|
||||
bankAccount = navInfo.getString("bankAccount", null);
|
||||
if (bankAccount ==null|| bankAccount.equals("")){
|
||||
String attestationName = navInfo.getString("attestationName", null);
|
||||
if (attestationName == null || attestationName.equals("")) {
|
||||
Intent attestationIntent = new Intent(getContext(), FragmentManagement.class);
|
||||
attestationIntent.putExtra("tag", 25);
|
||||
startActivity(attestationIntent);
|
||||
Toast.makeText(getContext(), "未实名认证,不能绑定银行卡", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
Intent gatheringIntent = new Intent(getContext(), FragmentManagement.class);
|
||||
gatheringIntent.putExtra("tag", 24);
|
||||
startActivity(gatheringIntent);
|
||||
Toast.makeText(getContext(), "以实名认证,请绑定银行卡", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
btWithdraw = findViewById(R.id.button);
|
||||
btWithdraw.setOnClickListener(this::onClick);
|
||||
poiPushMoney = (TextView) findViewById(R.id.poi_push_money);
|
||||
poiReportMoney = (TextView) findViewById(R.id.poi_report_money);
|
||||
poiVideoPushMoney = (TextView) findViewById(R.id.poiVideo_push_money);
|
||||
poiVideoReportMoney = (TextView) findViewById(R.id.poiVideo_report_money);
|
||||
roadPushMoney = (TextView) findViewById(R.id.road_push_money);
|
||||
roadReportMoney = (TextView) findViewById(R.id.road_report_money);
|
||||
chargingPushMoney = (TextView) findViewById(R.id.charging_push_money);
|
||||
@ -105,6 +147,8 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
tvAlready.setText(response.getBody().getHaveExchangePrice() + "");
|
||||
poiPushMoney.setText(response.getBody().getPoiPushPrice() + "元");
|
||||
poiReportMoney.setText(response.getBody().getPoiNonepushPrice() + "元");
|
||||
poiVideoPushMoney.setText(response.getBody().getPoivideoPushPrice() + "元");
|
||||
poiVideoReportMoney.setText(response.getBody().getPoivideoNonepushPrice() + "元");
|
||||
roadPushMoney.setText(response.getBody().getRoadPushPrice() + "元");
|
||||
roadReportMoney.setText(response.getBody().getRoadNonepushPrice() + "元");
|
||||
chargingPushMoney.setText(response.getBody().getCsPushPrice() + "元");
|
||||
@ -144,7 +188,30 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
if (etAllPrice.getText().toString().equals("")) {
|
||||
Toast.makeText(getContext(), "提现金额不能为空", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
immediatelyPrice();
|
||||
String price = etAllPrice.getText().toString().trim();
|
||||
Integer integer = Integer.valueOf(price);
|
||||
if (integer!=null&&integer<10){
|
||||
Toast.makeText(getContext(), "提现金额不能低于10元", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!checkBox.isChecked()){
|
||||
Toast.makeText(getContext(), "请勾选银行卡", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (bankAccount!=null){
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "是否提取到"+bankAccount.substring(bankAccount.length()-4)+"的银行卡", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
immediatelyPrice();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}else {
|
||||
Toast.makeText(getContext(), "请先绑定银行卡", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case R.id.tv_all:
|
||||
etAllPrice.setText(canExchangePrice + "");
|
||||
@ -155,6 +222,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
private void immediatelyPrice() {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
|
||||
httpParams.put("exchangeMoney", etAllPrice.getText().toString());
|
||||
httpParams.put("payType", "1");
|
||||
OkGoBuilder.getInstance()
|
||||
@ -167,7 +235,16 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public void onSuccess(UserPriceExchangeBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), response.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), response.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
if (response.getCode()==200){
|
||||
String unit = tvUnit.getText().toString();
|
||||
String price = etAllPrice.getText().toString();
|
||||
double v = Double.valueOf(unit) - Double.valueOf(price);
|
||||
String s = String.format("%.2f", v).toString();
|
||||
tvUnit.setText(s);
|
||||
}
|
||||
etAllPrice.getText().clear();
|
||||
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "tttttttt");
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,15 @@ public class HttpInterface {
|
||||
*/
|
||||
//http://172.23.139.4:9999/m4/userlogin/oauth/token
|
||||
public static final String USER_LOGIN_OAUTH_TOKEN = IP +USER_LOGIN_PATH+ "oauth/token"; //登录接口
|
||||
///m4/user/m4/user/register
|
||||
public static final String USER_REGISTER=IP+USER_PATH+"m4/user/register";//注册接口
|
||||
///m4/user/ phone/message
|
||||
public static final String USER_MESSAGE=IP+USER_PATH+"phone/message ";//获取验证码 type 1:注册获取 2:更新
|
||||
///m4/user/m4/user/forgetPassword
|
||||
public static final String USER_FORGET_PASSWORD=IP +USER_PATH+"m4/user/forgetPassword";//忘记密码
|
||||
//Flat.:
|
||||
//dtxbmaps.navinfo.com/dtxb/m4/user/phone/message?mobile=18811794839&type=2
|
||||
|
||||
/**
|
||||
* 提现 金额
|
||||
* Path=/m4/price/**
|
||||
@ -106,14 +115,25 @@ public class HttpInterface {
|
||||
//172.23.139.4:8003/m4/task/1/taskName?geo=1rn7exd5uhxy&name=四维
|
||||
public static final String TASK_NAME = IP+TASK_PATH +"m4/task/"+USERID+"/taskName";//poi-查重
|
||||
//172.23.139.4:8003/m4/task/1/getCommitList?type=2&pageSize=10&pageNum=1
|
||||
public static final String GET_COMMIT_LIST = IP+TASK_PATH +"m4/task/"+USERID+"/getCommitList";
|
||||
public static final String GET_COMMIT_LIST = IP+TASK_PATH +"m4/task/"+USERID+"/getCommitList";//紀錄——已提交
|
||||
public static final String RECEIVED_POLYGON_TASK = IP+TASK_PATH + "polygonTask/"+USERID+"/receivedPolygontask"; //面状任务任务领取
|
||||
//172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278 取消领取的接口
|
||||
public static final String UNRECEIVED_POLYGON_TASK = IP+TASK_PATH + "m4/task/"+USERID+"/unReceivedTask";//面状任务结束领取
|
||||
public static final String UNRECEIVED_POLYGON_TASK = IP+TASK_PATH + "m4/task/"+USERID+"/unReceivedTask";//所有類型结束领取
|
||||
public static final String COMPLETE = IP+TASK_PATH + "polygonTask/"+USERID+"/complete";//面状任务任务采集
|
||||
public static final String SUBMIT_POLYGON_TASK = IP+TASK_PATH + "polygonTask/"+USERID+"/submitPolygontask";//面状任务结束采集
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* public static final String IPm8 = "http://172.23.139.4:8003/m4/";
|
||||
//http://172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278
|
||||
、、public static final String UN_RECEIVED_TASK = + "task/1/unReceivedTask";//所以类型的结束领取
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
//http://172.21.91.160:8000/api/user/list
|
||||
@ -310,10 +330,11 @@ public class HttpInterface {
|
||||
public static final String COMPLETE = IPm6 + "polygonTask/1/complete";//任务采集
|
||||
public static final String SUBMIT_POLYGON_TASK = IPm6 + "polygonTask/1/submitPolygontask";//结束采集
|
||||
public static final String RECEIVED_POLYGON_TASK = IPm6 + "polygonTask/1/receivedPolygontask"; //任务领取
|
||||
public static final String UNRECEIVED_POLYGON_TASK = IPm6 + "polygonTask/1/unReceivedPolygontask";//结束领取
|
||||
public static final String COMPLETE = IPm6 + "polygonTask/1/complete";//任务采集
|
||||
public static final String SUBMIT_POLYGON_TASK = IPm6 + "polygonTask/1/submitPolygontask";//结束采集
|
||||
|
||||
|
||||
* */
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,10 @@ package com.navinfo.outdoor.http;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.github.lazylibrary.util.DES;
|
||||
import com.github.lazylibrary.util.MD5;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpHeaders;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
|
@ -22,6 +22,9 @@ public interface PoiDao {
|
||||
@Query("SELECT * FROM poi")
|
||||
List<PoiEntity> getAllPoi();
|
||||
|
||||
@Query("SELECT * FROM poi where taskStatus > 1 and type!=6")
|
||||
List<PoiEntity> getAllPoiByRecoder();
|
||||
|
||||
@Query("SELECT * FROM poi where type=:type")
|
||||
List<PoiEntity> getAllPoiType(int type);
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class PoiEntity implements Serializable {
|
||||
private int isLocalData;//是否是本地数据 0,服务 1,本地
|
||||
private int isExclusive;//任务类型 0.普通任务,1.专属任务
|
||||
private int bodyId;//保存本地的bodyId
|
||||
private int work_type;//0."车行" 1."自行车" 2."步行" 3."手动"
|
||||
private int work_type;//0."车行" 1."自行车" 2."步行"
|
||||
|
||||
public int getWork_type() {
|
||||
return work_type;
|
||||
@ -266,7 +266,6 @@ public class PoiEntity implements Serializable {
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PoiEntity{" +
|
||||
|
@ -66,7 +66,12 @@ public class ContactView {
|
||||
// rootView.removeViewAt(i);
|
||||
}
|
||||
});
|
||||
holder.editPhoneNumber.setText(poiBean.getPhone()+"");
|
||||
if (poiBean.getPhone()==null){
|
||||
holder.editPhoneNumber.setText("");
|
||||
}else {
|
||||
holder.editPhoneNumber.setText(poiBean.getPhone()+"");
|
||||
}
|
||||
|
||||
holder.editPhoneNumber.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
|
@ -14,17 +14,23 @@ import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||
import com.bumptech.glide.load.resource.bitmap.VideoDecoder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.coremedia.iso.boxes.Container;
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.github.lazylibrary.util.StringUtils;
|
||||
import com.googlecode.mp4parser.authoring.Movie;
|
||||
import com.googlecode.mp4parser.authoring.Track;
|
||||
import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
|
||||
import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
|
||||
import com.googlecode.mp4parser.authoring.tracks.AppendTrack;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
@ -38,10 +44,12 @@ import java.util.Map;
|
||||
*/
|
||||
public class AWMp4ParserHelper {
|
||||
private static AWMp4ParserHelper instance;
|
||||
private static SimpleDateFormat simpleDateFormat;
|
||||
|
||||
public static AWMp4ParserHelper getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new AWMp4ParserHelper();
|
||||
simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
@ -182,4 +190,133 @@ public class AWMp4ParserHelper {
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成mp4文件拍摄的生成路径
|
||||
* */
|
||||
public File obtainMp4FilePath(String uuid, Object tag) {
|
||||
if (tag == null) {
|
||||
return new File(Constant.PICTURE_FOLDER+"/"+uuid+"-0.mp4");
|
||||
}
|
||||
List<File> fileList = (List<File>) tag;
|
||||
if (fileList == null || fileList.isEmpty()) {
|
||||
return new File(Constant.PICTURE_FOLDER+"/"+uuid+"-0.mp4");
|
||||
}
|
||||
int maxIndex = 0;
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
File file = fileList.get(i);
|
||||
if (file!=null) {
|
||||
String[] fileSplite = file.getName().replace(".mp4", "").split("-");
|
||||
if (fileSplite!=null&&fileSplite.length>0&&fileSplite[fileSplite.length-1]!=null) {
|
||||
int index = Integer.parseInt(fileSplite[fileSplite.length-1]);
|
||||
if (index>=maxIndex) {
|
||||
maxIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new File(Constant.PICTURE_FOLDER+"/"+uuid+"-"+(maxIndex+1)+".mp4");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件夹路径生成最新的视频文件路径
|
||||
* */
|
||||
public File obtainMp4FilePath(String folderPath) {
|
||||
if (folderPath == null) {
|
||||
return null;
|
||||
}
|
||||
File folderFile = new File(folderPath);
|
||||
if (!folderFile.exists()) {
|
||||
folderFile.mkdirs();
|
||||
}
|
||||
File[] fileList = folderFile.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if (pathname.getName().endsWith(".mp4")){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (fileList == null || fileList.length==0) {
|
||||
return new File(folderPath+"/0.mp4");
|
||||
}
|
||||
int maxIndex = 0;
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
File file = fileList[i];
|
||||
if (file!=null) {
|
||||
int index = Integer.parseInt(file.getName().replace(".mp4", ""));
|
||||
if (index>=maxIndex) {
|
||||
maxIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new File(folderPath+"/"+(maxIndex+1)+".mp4");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据提供的uuid,获取指定目录下所有的视频文件
|
||||
* */
|
||||
public List<File> getVideoFileListByUUID(String uuid) {
|
||||
List<File> videoFileList = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(uuid)) {
|
||||
return videoFileList;
|
||||
}
|
||||
File folderFile = new File(Constant.PICTURE_FOLDER+"/"+uuid+"/");
|
||||
if (!folderFile.exists()) {
|
||||
folderFile.mkdirs();
|
||||
return videoFileList;
|
||||
}
|
||||
for (File videoFile: folderFile.listFiles()) {
|
||||
videoFileList.add(videoFile);
|
||||
}
|
||||
return videoFileList;
|
||||
}
|
||||
|
||||
public String getVideoFileListStr(List<File> videoFileList) {
|
||||
StringBuilder resultStrBuilder = new StringBuilder("");
|
||||
if (videoFileList == null || videoFileList.size()<=0){
|
||||
return resultStrBuilder.toString();
|
||||
}
|
||||
|
||||
for (int i = 0; i < videoFileList.size(); i++) {
|
||||
File f = videoFileList.get(i);
|
||||
resultStrBuilder.append(f.getAbsolutePath());
|
||||
if (i < videoFileList.size() -1) {
|
||||
resultStrBuilder.append(",");
|
||||
}
|
||||
}
|
||||
return resultStrBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据视频文件列表,获取到对应的轨迹数据
|
||||
* */
|
||||
public List<LatLng> getLineStringByVideoFileList(List<File> videoFileList) {
|
||||
List<LatLng> latLngs = new ArrayList<>();
|
||||
if (videoFileList == null || videoFileList.isEmpty()) {
|
||||
return latLngs;
|
||||
}
|
||||
|
||||
for (int m = 0; m < videoFileList.size(); m++) {
|
||||
File videoFile = videoFileList.get(m);
|
||||
|
||||
String path = videoFile.getPath() + ".txt";
|
||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||
if (strings!=null) {
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
latLng.setLatitude(Double.valueOf(split[2]));
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size() == 1) {
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
}
|
||||
}
|
||||
return latLngs;
|
||||
}
|
||||
}
|
||||
|
@ -261,15 +261,15 @@ public class Base64 {
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv);
|
||||
return encode_(cipher.doFinal(message.getBytes("UTF-8")));
|
||||
}
|
||||
public static String desEncrypt1(String message) throws Exception {
|
||||
// SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
|
||||
// SecretKey secretKey = keyFactory.generateSecret(new DESKeySpec(keyValue.getBytes("UTF-8")));
|
||||
SecretKeySpec secretKey = new SecretKeySpec(keyValue.getBytes(), "DES");
|
||||
IvParameterSpec iv = new IvParameterSpec(keyVector.getBytes("UTF-8"));
|
||||
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv);
|
||||
return encode_(cipher.doFinal(message.getBytes("UTF-8")));
|
||||
}
|
||||
// public static String desEncrypt1(String message) throws Exception {
|
||||
//// SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
|
||||
//// SecretKey secretKey = keyFactory.generateSecret(new DESKeySpec(keyValue.getBytes("UTF-8")));
|
||||
// SecretKeySpec secretKey = new SecretKeySpec(keyValue.getBytes(), "DES");
|
||||
// IvParameterSpec iv = new IvParameterSpec(keyVector.getBytes("UTF-8"));
|
||||
// Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
// cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv);
|
||||
// return encode_(cipher.doFinal(message.getBytes("UTF-8")));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 解密
|
||||
|
@ -1,8 +1,19 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
|
||||
public class Geohash {
|
||||
|
||||
private Geohash(){}
|
||||
@ -33,61 +44,79 @@ public class Geohash {
|
||||
lookup.put(c, i++);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String s = "1rn7exd5uhxy";
|
||||
System.out.println(s);
|
||||
System.out.println(new Geohash().decode(s)[0]);
|
||||
System.out.println(new Geohash().decode(s)[1]);
|
||||
System.out.println(new Geohash().encode(40.073556024581194, 116.24643344432116));
|
||||
}
|
||||
// public static void main(String[] args) {
|
||||
// String s = "1rn7exd5uhxy";
|
||||
// System.out.println(s);
|
||||
// System.out.println(new Geohash().decode(s)[0]);
|
||||
// System.out.println(new Geohash().decode(s)[1]);
|
||||
// System.out.println(new Geohash().encode(40.073556024581194, 116.24643344432116));
|
||||
// }
|
||||
|
||||
//数据解密
|
||||
/**
|
||||
* @param geohash 需要被解密的字符串
|
||||
* @return double[] 经纬度double数组,纬度(latitude)在前,经度在后(longitude)
|
||||
* */
|
||||
public double[] decode(String geohash) {
|
||||
public String decode(String geohash) {
|
||||
// try {
|
||||
// StringBuilder buffer = new StringBuilder();
|
||||
// for (char c : geohash.toCharArray()) {
|
||||
//
|
||||
// int i = lookup.get(c) + 32;
|
||||
// buffer.append(Integer.toString(i, 2).substring(1));
|
||||
// }
|
||||
//
|
||||
// long a = Long.parseLong(buffer.toString(), 2);
|
||||
// buffer.setLength(0);
|
||||
// buffer.append(Long.toBinaryString(a));
|
||||
//
|
||||
// BitSet lonset = new BitSet();
|
||||
// BitSet latset = new BitSet();
|
||||
//
|
||||
// // even bits
|
||||
// int j = 0;
|
||||
// for (int i = 0; i < numbits * 2; i += 2) {
|
||||
// boolean isSet = false;
|
||||
// if (i < buffer.length())
|
||||
// isSet = buffer.charAt(i) == '1';
|
||||
// lonset.set(j++, isSet);
|
||||
// }
|
||||
//
|
||||
// // odd bits
|
||||
// j = 0;
|
||||
// for (int i = 1; i < numbits * 2; i += 2) {
|
||||
// boolean isSet = false;
|
||||
// if (i < buffer.length())
|
||||
// isSet = buffer.charAt(i) == '1';
|
||||
// latset.set(j++, isSet);
|
||||
// }
|
||||
//
|
||||
// double lon = decode(lonset, -180, 180);
|
||||
// double lat = decode(latset, -90, 90);
|
||||
//
|
||||
// return new double[] { lat, lon };
|
||||
// } catch (RuntimeException re) {
|
||||
// re.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
try {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for (char c : geohash.toCharArray()) {
|
||||
|
||||
int i = lookup.get(c) + 32;
|
||||
buffer.append(Integer.toString(i, 2).substring(1));
|
||||
}
|
||||
|
||||
long a = Long.parseLong(buffer.toString(), 2);
|
||||
buffer.setLength(0);
|
||||
buffer.append(Long.toBinaryString(a));
|
||||
|
||||
BitSet lonset = new BitSet();
|
||||
BitSet latset = new BitSet();
|
||||
|
||||
// even bits
|
||||
int j = 0;
|
||||
for (int i = 0; i < numbits * 2; i += 2) {
|
||||
boolean isSet = false;
|
||||
if (i < buffer.length())
|
||||
isSet = buffer.charAt(i) == '1';
|
||||
lonset.set(j++, isSet);
|
||||
}
|
||||
|
||||
// odd bits
|
||||
j = 0;
|
||||
for (int i = 1; i < numbits * 2; i += 2) {
|
||||
boolean isSet = false;
|
||||
if (i < buffer.length())
|
||||
isSet = buffer.charAt(i) == '1';
|
||||
latset.set(j++, isSet);
|
||||
}
|
||||
|
||||
double lon = decode(lonset, -180, 180);
|
||||
double lat = decode(latset, -90, 90);
|
||||
|
||||
return new double[] { lat, lon };
|
||||
} catch (RuntimeException re) {
|
||||
re.printStackTrace();
|
||||
return null;
|
||||
return Base64.desDecrypt(geohash);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidAlgorithmParameterException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
e.printStackTrace();
|
||||
} catch (BadPaddingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private double decode(BitSet bs, double floor, double ceiling) {
|
||||
@ -107,14 +136,20 @@ public class Geohash {
|
||||
* @param lat,lon 需要被加密的double 值
|
||||
* */
|
||||
public String encode(double lat, double lon) {
|
||||
BitSet latbits = getBits(lat, -90, 90);
|
||||
BitSet lonbits = getBits(lon, -180, 180);
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for (int i = 0; i < numbits; i++) {
|
||||
buffer.append((lonbits.get(i)) ? '1' : '0');
|
||||
buffer.append((latbits.get(i)) ? '1' : '0');
|
||||
// BitSet latbits = getBits(lat, -90, 90);
|
||||
// BitSet lonbits = getBits(lon, -180, 180);
|
||||
// StringBuilder buffer = new StringBuilder();
|
||||
// for (int i = 0; i < numbits; i++) {
|
||||
// buffer.append((lonbits.get(i)) ? '1' : '0');
|
||||
// buffer.append((latbits.get(i)) ? '1' : '0');
|
||||
// }
|
||||
Geometry geometry = GeometryTools.createGeometry(new LatLng(lat, lon));
|
||||
try {
|
||||
return Base64.desEncrypt(geometry.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return base32(Long.parseLong(buffer.toString(), 2));
|
||||
return null;
|
||||
}
|
||||
|
||||
private BitSet getBits(double lat, double floor, double ceiling) {
|
||||
|
@ -54,7 +54,7 @@ public class PhotoPathUtil {
|
||||
if (angle==0){
|
||||
angle=90;
|
||||
}
|
||||
File file = new File(Constant.PICTURE_FOLDER, d+time+"_p"+coord+"_a"+angle+".jpg");
|
||||
File file = new File(Constant.PICTURE_FOLDER+d+time+"_p"+coord+"_a"+angle+".jpg");
|
||||
/***打开文件输出流*/
|
||||
fileOutputStream = new FileOutputStream(file);
|
||||
// 生成图片文件
|
||||
|
116
app/src/main/java/com/navinfo/outdoor/util/PhotoUtils.java
Normal file
116
app/src/main/java/com/navinfo/outdoor/util/PhotoUtils.java
Normal file
@ -0,0 +1,116 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.exifinterface.media.ExifInterface;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.BitSet;
|
||||
|
||||
import static org.greenrobot.eventbus.EventBus.TAG;
|
||||
|
||||
public class PhotoUtils {
|
||||
private static int numbits = 6 * 5;
|
||||
// 为了加密,所以改了base32编码代码表
|
||||
final static char[] digits = { 'd', 'f', 'g', 'y', 'n', 't', 'u', 'v', 'q',
|
||||
'b', '9', 's', 'z', '7', 'i', '2', 'h', '5', '0', 'p', '4', 'm',
|
||||
'8', 'x', 'c', 'j', '6', 'e', '1', 'r', '3', 'k' };
|
||||
|
||||
public static String showPhotoAndGetPath(File file, ImageView imageView) {
|
||||
Glide.with(imageView.getContext()).load(file).into(imageView);
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
public static File showPhotoFile(String d, LatLng latLng) {
|
||||
String lat="";
|
||||
if (latLng!=null){
|
||||
lat= initEncode(latLng);
|
||||
}
|
||||
long time = System.currentTimeMillis();
|
||||
File file = new File(Constant.PICTURE_FOLDER, d + time + "_p" + lat + "_a" + 0 + ".jpg");
|
||||
return file;
|
||||
}
|
||||
|
||||
public static String initEncode(LatLng latLng) {
|
||||
BitSet latbits = getBits(latLng.latitude, -90, 90);
|
||||
BitSet lonbits = getBits(latLng.longitude, -180, 180);
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for (int i = 0; i < numbits; i++) {
|
||||
buffer.append((lonbits.get(i)) ? '1' : '0');
|
||||
buffer.append((latbits.get(i)) ? '1' : '0');
|
||||
}
|
||||
return base32(Long.parseLong(buffer.toString(), 2));
|
||||
}
|
||||
|
||||
private static BitSet getBits(double lat, double floor, double ceiling) {
|
||||
BitSet buffer = new BitSet(numbits);
|
||||
for (int i = 0; i < numbits; i++) {
|
||||
double mid = (floor + ceiling) / 2;
|
||||
if (lat >= mid) {
|
||||
buffer.set(i);
|
||||
floor = mid;
|
||||
} else {
|
||||
ceiling = mid;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static String base32(long i) {
|
||||
char[] buf = new char[65];
|
||||
int charPos = 64;
|
||||
boolean negative = (i < 0);
|
||||
if (!negative)
|
||||
i = -i;
|
||||
while (i <= -32) {
|
||||
buf[charPos--] = digits[(int) (-(i % 32))];
|
||||
i /= 32;
|
||||
}
|
||||
buf[charPos] = digits[(int) (-i)];
|
||||
|
||||
if (negative)
|
||||
buf[--charPos] = '-';
|
||||
return new String(buf, charPos, (65 - charPos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片旋转角度
|
||||
*
|
||||
* @param filepath
|
||||
* @return
|
||||
*/
|
||||
public static int getExifOrientation(String filepath) {
|
||||
int degree = 0;
|
||||
ExifInterface exif = null;
|
||||
try {
|
||||
exif = new ExifInterface(filepath);
|
||||
} catch (IOException ex) {
|
||||
Log.d(TAG, "cannot read exif" + ex);
|
||||
}
|
||||
if (exif != null) {
|
||||
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
|
||||
if (orientation != -1) {
|
||||
switch (orientation) {
|
||||
case ExifInterface.ORIENTATION_ROTATE_90:
|
||||
degree = 90;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_180:
|
||||
degree = 180;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_270:
|
||||
degree = 270;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return degree;
|
||||
}
|
||||
|
||||
}
|
@ -38,7 +38,8 @@ public class PoiSaveUtils {
|
||||
private Activity mContext;
|
||||
private Gson gson;
|
||||
private static PoiSaveUtils instance;
|
||||
private boolean isBoolean;
|
||||
private int anInt=0;
|
||||
private int bInt=0;
|
||||
|
||||
public static PoiSaveUtils getInstance(Activity mContext) {
|
||||
if (instance == null) {
|
||||
@ -88,7 +89,7 @@ public class PoiSaveUtils {
|
||||
public void run() {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.EVENT_STAY_REFRESH;
|
||||
obtain.obj = isBoolean;
|
||||
obtain.obj = "提交成功"+anInt+",提交失败"+bInt;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
@ -287,10 +288,10 @@ public class PoiSaveUtils {
|
||||
if (otherUploadPicBean.getCode() == 200) {
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().deletePoiEntity(poiEntity);
|
||||
Log.d("TAGss", "uploadPoiNet: 成功");
|
||||
isBoolean = true;
|
||||
anInt++;
|
||||
} else {
|
||||
Log.d("TAGss", "uploadPoiNet: 失败");
|
||||
isBoolean = false;
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
5
app/src/main/res/drawable/ic_baseline.xml
Normal file
5
app/src/main/res/drawable/ic_baseline.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:alpha="0.91" android:height="16dp"
|
||||
android:tint="#91230A" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2z"/>
|
||||
</vector>
|
@ -1,195 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FF444444">
|
||||
<com.otaliastudios.cameraview.CameraView
|
||||
android:id="@+id/camera"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:keepScreenOn="true"
|
||||
app:cameraAudio="on"
|
||||
app:cameraAutoFocusMarker="@string/cameraview_default_autofocus_marker"
|
||||
app:cameraEngine="camera2"
|
||||
app:cameraExperimental="true"
|
||||
app:cameraFacing="back"
|
||||
app:cameraFlash="auto"
|
||||
app:cameraGestureLongTap="none"
|
||||
app:cameraGesturePinch="zoom"
|
||||
app:cameraGestureScrollHorizontal="filterControl1"
|
||||
app:cameraGestureScrollVertical="exposureCorrection"
|
||||
app:cameraGestureTap="autoFocus"
|
||||
app:cameraGrid="off"
|
||||
app:cameraMode="picture"
|
||||
app:cameraPlaySounds="true"
|
||||
app:cameraPreview="glSurface"
|
||||
app:layout_constraintBottom_toTopOf="@id/ll_caiji"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:layout_editor_absoluteX="-76dp">
|
||||
|
||||
</com.otaliastudios.cameraview.CameraView>
|
||||
|
||||
<com.tencent.tencentmap.mapsdk.maps.MapView
|
||||
android:id="@+id/iv_map"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="183dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="切换"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<Button
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_switch"
|
||||
app:layout_constraintRight_toRightOf="@id/btn_switch"
|
||||
android:id="@+id/btn_video"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="停止" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@mipmap/take_pic_arrow"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/ll_iv"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_gravity="bottom"-->
|
||||
<!-- android:orientation="horizontal"-->
|
||||
<!-- android:padding="16dp"-->
|
||||
<!-- android:weightSum="4"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent">-->
|
||||
|
||||
|
||||
|
||||
<!-- <Space-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="1dp"-->
|
||||
<!-- android:layout_weight="1" />-->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_caiji"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
<Button
|
||||
android:id="@+id/capuretVideo"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始采集"
|
||||
android:layout_marginRight="10dp"
|
||||
style="@style/user_data_style"/>
|
||||
<Button
|
||||
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束采集"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@drawable/uploding_shape"
|
||||
android:textColor="@color/colorBlue"/>
|
||||
<ImageButton
|
||||
android:id="@+id/capturePicture"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:visibility="gone"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
app:srcCompat="@drawable/ic_photo" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- <Space-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="1dp"-->
|
||||
<!-- android:layout_weight="1" />-->
|
||||
<!-- <Space-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="1dp"-->
|
||||
<!-- android:layout_weight="1" />-->
|
||||
|
||||
<!-- <Space-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="1dp"-->
|
||||
<!-- android:layout_weight="1" />-->
|
||||
<!-- <Space-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="1dp"-->
|
||||
<!-- android:layout_weight="1" />-->
|
||||
|
||||
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/capturePictureSnapshot"-->
|
||||
<!-- android:layout_width="56dp"-->
|
||||
<!-- android:layout_height="56dp"-->
|
||||
<!-- android:background="?attr/selectableItemBackgroundBorderless"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:orientation="vertical"-->
|
||||
<!-- android:visibility="gone">-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:srcCompat="@drawable/ic_photo" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="SNAP"-->
|
||||
<!-- android:textColor="@android:color/white"-->
|
||||
<!-- android:textSize="10sp"-->
|
||||
<!-- android:textStyle="bold" />-->
|
||||
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
<!-- <ImageButton-->
|
||||
<!-- android:id="@+id/capuretVideo"-->
|
||||
<!-- android:layout_width="56dp"-->
|
||||
<!-- android:layout_height="56dp"-->
|
||||
<!-- android:background="?attr/selectableItemBackgroundBorderless"-->
|
||||
<!-- app:srcCompat="@drawable/ic_video" />-->
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/captureVideoSnapshot"-->
|
||||
<!-- android:layout_width="56dp"-->
|
||||
<!-- android:layout_height="56dp"-->
|
||||
<!-- android:orientation="vertical"-->
|
||||
<!-- android:background="?attr/selectableItemBackgroundBorderless"-->
|
||||
<!-- android:gravity="center" >-->
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:srcCompat="@drawable/ic_video"/>-->
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:textColor="@android:color/white"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- android:textSize="10sp"-->
|
||||
<!-- android:text="SNAP"/>-->
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -40,15 +40,6 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_video"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="停止"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="@id/btn_switch"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_switch" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="wrap_content"
|
||||
@ -85,5 +76,17 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/capuretVideo"
|
||||
app:layout_constraintLeft_toRightOf="@id/capuretVideo"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_chronometer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:background="@color/whiteAlpha50"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
android:format="00:00:00"
|
||||
android:layout_marginTop="@dimen/default_widget_padding"></TextView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@ -6,21 +6,30 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FF444444"
|
||||
tools:context=".activity.PicturesActivity">
|
||||
|
||||
<com.otaliastudios.cameraview.CameraView
|
||||
android:id="@+id/cameraView"
|
||||
<FrameLayout
|
||||
android:id="@+id/layer_change"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
/>
|
||||
android:layout_height="match_parent">
|
||||
<com.otaliastudios.cameraview.CameraView
|
||||
android:id="@+id/camera"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:keepScreenOn="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
|
||||
android:id="@+id/iv_map"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="157dp"
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.3"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_default="percent"
|
||||
app:layout_constraintWidth_percent="0.3" />
|
||||
</FrameLayout>
|
||||
|
||||
<!-- <com.tencent.tencentmap.mapsdk.maps.MapView-->
|
||||
<!-- android:id="@+id/iv_map"-->
|
||||
<!-- android:layout_width="300dp"-->
|
||||
<!-- android:layout_height="183dp"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_switch"
|
||||
@ -32,23 +41,18 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@mipmap/take_pic_arrow"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<Button
|
||||
<CheckBox
|
||||
android:id="@+id/capuretVideo"
|
||||
style="@style/user_data_style"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/user_style"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:text="开始采集"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
@ -72,8 +72,8 @@
|
||||
<Button
|
||||
android:id="@+id/btn_attestation"
|
||||
style="@style/user_style"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="去认证"
|
||||
@ -102,8 +102,8 @@
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/btn_gathering"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="去绑定"
|
||||
@ -168,8 +168,10 @@
|
||||
<EditText
|
||||
android:id="@+id/et_phone"
|
||||
android:layout_toRightOf="@id/tv_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
style="@style/user_hint_style"
|
||||
android:digits="1234567890"
|
||||
android:maxLength="11"
|
||||
android:layout_centerVertical="true"
|
||||
android:hint="请输入手机号码"
|
||||
android:layout_height="wrap_content"
|
||||
@ -258,8 +260,8 @@
|
||||
style="@style/user_text_style"
|
||||
/>
|
||||
<Button
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="去绑定"
|
||||
|
@ -335,6 +335,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_panorama"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -370,6 +371,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_coding"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -397,7 +399,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
<TextView
|
||||
android:id="@+id/tv_scutcheon"
|
||||
android:id="@+id/tv_scutcheon1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="设备标牌"
|
||||
@ -415,10 +417,10 @@
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_toRightOf="@id/tv_scutcheon"
|
||||
android:layout_toRightOf="@id/tv_scutcheon1"
|
||||
android:background="@color/white"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_toEndOf="@id/tv_scutcheon"
|
||||
android:layout_toEndOf="@id/tv_scutcheon1"
|
||||
android:textSize="15sp"
|
||||
android:textColor="#333" />
|
||||
<ImageView
|
||||
@ -451,6 +453,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_equipment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -486,6 +489,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_facility"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -523,6 +527,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_scutcheon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -560,6 +565,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_device"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -639,6 +645,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_usable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -670,6 +677,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_available"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -702,6 +710,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_parking"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -738,6 +747,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
|
@ -318,6 +318,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_panorama"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -353,6 +354,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -388,6 +390,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_internal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -429,6 +432,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_else"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -464,6 +468,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_scutcheon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
|
@ -201,8 +201,8 @@
|
||||
app:layout_constraintLeft_toLeftOf="@id/et_forgetPaw_confirm_paw"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_forgetPaw_confirm_paw" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_forgetPaw"
|
||||
<Button
|
||||
android:id="@+id/btn_forgetPaw"
|
||||
style="@style/login_style"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
|
@ -134,7 +134,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="POIVIDEO任务列表"
|
||||
android:text="POI录像任务列表"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintLeft_toRightOf="@id/iv_poiVideo"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_poiVideo" />
|
||||
|
@ -202,6 +202,7 @@
|
||||
android:background="@drawable/plus" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_picture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/image_picture"
|
||||
@ -236,6 +237,7 @@
|
||||
android:background="@drawable/plus" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pictures"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/image_pictures"
|
||||
|
@ -102,15 +102,17 @@
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_register_note"
|
||||
style="@style/register_hint_style"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:hint="6为短信验证"
|
||||
style="@style/register_hint_style"
|
||||
android:textColorHint="@color/colorTransparent"
|
||||
android:textCursorDrawable="@drawable/text_color"
|
||||
android:theme="@style/MyEditText"
|
||||
app:layout_constraintLeft_toLeftOf="@id/register_note"
|
||||
app:layout_constraintTop_toBottomOf="@id/register_note" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view3"
|
||||
android:layout_width="300dp"
|
||||
@ -239,8 +241,8 @@
|
||||
app:layout_constraintTop_toTopOf="@id/iv_register_check"
|
||||
app:layout_constraintRight_toRightOf="@id/et_register_confirm_paw"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_register_check"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_register"
|
||||
<Button
|
||||
android:id="@+id/btn_register"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
|
@ -36,11 +36,11 @@
|
||||
android:id="@+id/ll_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/road_shape"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_message"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_message">
|
||||
|
||||
@ -56,12 +56,12 @@
|
||||
<EditText
|
||||
android:id="@+id/et_road_name"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="14sp"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:background="@null" />
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
@ -79,8 +79,8 @@
|
||||
android:id="@+id/ll_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_mode">
|
||||
|
||||
@ -96,32 +96,32 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:text="车行" />
|
||||
android:text="车行"
|
||||
android:textColor="@color/test_color_selector" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_bicycle"
|
||||
android:layout_width="0dp"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="自行车" />
|
||||
android:text="自行车"
|
||||
android:textColor="@color/test_color_selector" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_walking"
|
||||
android:layout_width="0dp"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="步行" />
|
||||
android:text="步行"
|
||||
android:textColor="@color/test_color_selector" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_manual"
|
||||
android:layout_width="0dp"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="手动" />
|
||||
<!-- <RadioButton-->
|
||||
<!-- android:id="@+id/rb_manual"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_weight="1"-->
|
||||
<!-- android:text="手动"-->
|
||||
<!-- android:textColor="@color/test_color_selector" />-->
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
@ -139,46 +139,61 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="03.拍照 "
|
||||
android:text="03.录像 "
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pictures"
|
||||
style="@style/user_style"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:gravity="center"
|
||||
android:text="拍照"
|
||||
android:text="录像"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_road_picture"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="100dp"
|
||||
<FrameLayout
|
||||
android:id="@+id/fm_road_picture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
app:layout_constraintLeft_toLeftOf="@id/ll_pictures"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_pictures" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_pictures">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_road_picture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="140dp"
|
||||
android:minHeight="70dp"
|
||||
android:maxHeight="100dp"
|
||||
android:maxWidth="200dp"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_road_picture"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_road_picture">
|
||||
app:layout_constraintLeft_toLeftOf="@id/fm_road_picture"
|
||||
app:layout_constraintTop_toBottomOf="@id/fm_road_picture">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="03.描述"
|
||||
android:text="04.描述"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_describe"
|
||||
android:layout_width="match_parent"
|
||||
@ -187,24 +202,25 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/underline"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_03"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_03">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="30dp"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="top"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:background="@color/white"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:background="@color/white"
|
||||
android:gravity="top"
|
||||
android:hint="任务描述"
|
||||
android:textSize="15sp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:textSize="15sp"
|
||||
|
||||
|
||||
/>
|
||||
|
@ -125,14 +125,17 @@
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_bank_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:hint="银行卡号 "
|
||||
android:hint="银行卡号"
|
||||
|
||||
android:digits="1234567890"
|
||||
android:maxLength="19"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="100dp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
|
@ -17,7 +17,8 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progressBar_tx"
|
||||
android:layout_width="50dp"
|
||||
android:layout_width="100dp"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/progressBar1"
|
||||
android:layout_centerHorizontal="true"
|
||||
|
@ -279,6 +279,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_panorama"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -315,6 +316,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -351,6 +353,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_internal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -393,6 +396,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_card"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@ -429,6 +433,7 @@
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_else"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
@ -36,11 +36,11 @@
|
||||
android:id="@+id/ll_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/road_shape"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_message"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_message">
|
||||
|
||||
@ -56,114 +56,133 @@
|
||||
<EditText
|
||||
android:id="@+id/et_poi_video_name"
|
||||
android:layout_width="match_parent"
|
||||
android:textSize="14sp"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@null" />
|
||||
android:background="@null"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_mode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="02.拍照方式"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_name"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ll_name"
|
||||
android:layout_marginTop="10dp"/>
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_name" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_mode">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_type"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_car"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:text="车行"/>
|
||||
android:text="车行"
|
||||
android:textColor="@color/test_color_selector" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_bicycle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="自行车"/>
|
||||
android:layout_weight="1"
|
||||
android:text="骑行"
|
||||
android:textColor="@color/test_color_selector" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_walking"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:text="步行"/>
|
||||
<RadioButton
|
||||
android:id="@+id/rb_manual"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="手动"/>
|
||||
android:text="步行"
|
||||
android:textColor="@color/test_color_selector" />
|
||||
<!-- <RadioButton-->
|
||||
<!-- android:id="@+id/rb_manual"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_weight="1"-->
|
||||
<!-- android:textColor="@color/test_color_selector"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="手动"/>-->
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_pictures"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="10dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ll_mode"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_mode">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="03.拍照 "
|
||||
android:text="03.录像 "
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pictures"
|
||||
style="@style/user_style"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:gravity="center"
|
||||
android:text="拍照"
|
||||
android:text="录像"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_poi_video_picture"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="100dp"
|
||||
<FrameLayout
|
||||
android:id="@+id/fm_poi_video_picture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
app:layout_constraintLeft_toLeftOf="@id/ll_pictures"
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_pictures" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ll_pictures">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_poi_video_picture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="200dp"
|
||||
android:maxHeight="100dp"
|
||||
android:minWidth="140dp"
|
||||
android:minHeight="70dp"
|
||||
android:scaleType="fitXY" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_poi_video_picture"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_poi_video_picture">
|
||||
app:layout_constraintLeft_toLeftOf="@id/fm_poi_video_picture"
|
||||
app:layout_constraintTop_toBottomOf="@id/fm_poi_video_picture">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/linear_exist"
|
||||
android:layout_width="match_parent"
|
||||
@ -217,6 +236,7 @@
|
||||
android:text="04.描述"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_describe"
|
||||
android:layout_width="match_parent"
|
||||
@ -225,29 +245,31 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/underline"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_03"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_03">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="30dp"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="top"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:background="@color/white"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:background="@color/white"
|
||||
android:gravity="top"
|
||||
android:hint="任务描述"
|
||||
android:textSize="15sp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:textColor="@color/test_color_selector"
|
||||
android:textSize="15sp"
|
||||
|
||||
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -34,14 +34,6 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_video2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="停止"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="@id/btn_switch2"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_switch2" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/capuretVideo2"
|
||||
|
@ -104,144 +104,134 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#2196F3" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_photograph"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_attestation1"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_height="140dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_02"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_panorama"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="fitXY"
|
||||
android:background="@color/colorPrimaryBlue"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_attestation1"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_attestation1"
|
||||
app:layout_constraintRight_toRightOf="@id/iv_attestation1"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_attestation1">
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/selector_red_bg"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="10dp">
|
||||
<ImageView
|
||||
android:id="@+id/iv_hera1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/card_zhengmian" />
|
||||
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/card_zhengmian"
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_card1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="*身份证人像面"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_attestation2"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="10dp"
|
||||
android:textSize="12sp"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_below="@id/iv_hera1"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_attestation1"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="fitXY"
|
||||
android:background="@color/colorPrimaryBlue"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_attestation2"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_attestation2"
|
||||
app:layout_constraintRight_toRightOf="@id/iv_attestation2"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_attestation2">
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/selector_red_bg"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="10dp">
|
||||
<ImageView
|
||||
android:id="@+id/iv_hera2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/card_fanmian" />
|
||||
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/card_fanmian"
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_card2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="*身份证国徽面"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/iv_attestation3"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="10dp"
|
||||
android:textSize="12sp"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_below="@id/iv_hera2"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_attestation2"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_internal_photos"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="fitXY"
|
||||
android:background="@color/colorPrimaryBlue"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_attestation3"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_attestation3"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_attestation3"
|
||||
app:layout_constraintRight_toRightOf="@id/iv_attestation3"
|
||||
android:orientation="vertical">
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/selector_red_bg"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="10dp">
|
||||
<ImageView
|
||||
android:id="@+id/iv_hera3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/card_shouchi" />
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/card_shouchi"
|
||||
android:layout_height="20dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_card3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="*手持身份证"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/white"/>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
android:textSize="12sp"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_below="@id/iv_hera3"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_attestation3"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
|
@ -85,7 +85,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableRight="@drawable/ic_baseline_navigate"
|
||||
android:text="提现纪录"
|
||||
android:text="提现记录"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_unit"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_unit" />
|
||||
@ -312,6 +312,86 @@
|
||||
android:textColor="#333"
|
||||
android:textSize="18sp" />
|
||||
</RelativeLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#F1F0F0" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="65dp"
|
||||
android:padding="5dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_poiVideo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="2dp"
|
||||
android:background="@drawable/poi_square" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_toRightOf="@id/image_poiVideo"
|
||||
android:text="POIVIDEO推送积分"
|
||||
android:textColor="#333"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/poiVideo_push_money"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_vertical"
|
||||
android:text="+¥0.0"
|
||||
android:textColor="#333"
|
||||
android:textSize="18sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#F1F0F0" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="65dp"
|
||||
android:padding="5dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_poiVideo_report"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="2dp"
|
||||
android:background="@drawable/poi_square" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_toRightOf="@id/image_poiVideo_report"
|
||||
android:text="POIVIDEO上报任务积分"
|
||||
android:textColor="#333"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/poiVideo_report_money"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_vertical"
|
||||
android:text="+¥0.0"
|
||||
android:textColor="#333"
|
||||
android:textSize="18sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
|
@ -2,4 +2,5 @@
|
||||
<!--状态栏-->
|
||||
<dimen name="top_pind_sp">20dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="default_widget_padding">6dp</dimen>
|
||||
</resources>
|
@ -82,6 +82,7 @@
|
||||
<!-- ‘我的-用户资料’方框设置-->
|
||||
<style name="user_style">
|
||||
<item name="android:background">@drawable/selector_red_bg</item>
|
||||
<item name="android:padding">@dimen/default_widget_padding</item>
|
||||
</style>
|
||||
<!-- ‘我的-用户资料’字体设置-->
|
||||
<style name="user_text_style">
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path path="Android/data/com.navinfo.outdoor/" name="files_root" />
|
||||
<external-path path="." name="external_storage_root" />
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<external-files-path
|
||||
name="my_images"
|
||||
path="Android/data/com.navinfo.outdoor/files/Pictures" />
|
||||
</paths>
|
Loading…
x
Reference in New Issue
Block a user