修改 拍照功能(存在错误)添加‘其他’ 上传接口
This commit is contained in:
parent
aa777a3371
commit
d25b3e1e30
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
//ndkVersion '23.0.7123448'
|
ndkVersion '23.0.7123448'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.navinfo.outdoor"
|
applicationId "com.navinfo.outdoor"
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.navinfo.outdoor">
|
package="com.navinfo.outdoor">
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_CALENDAR"/>
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
|
<uses-permission android:name="android.permission.READ_CALENDAR" />
|
||||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
@ -26,10 +27,6 @@
|
|||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 支持A-GPS辅助定位 -->
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 支持A-GPS辅助定位 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 用于 log 日志 -->
|
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 用于 log 日志 -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.camera"
|
android:name="android.hardware.camera"
|
||||||
android:required="true" />
|
android:required="true" />
|
||||||
@ -38,20 +35,23 @@
|
|||||||
android:name=".api.UserApplication"
|
android:name=".api.UserApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:requestLegacyExternalStorage="true"
|
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.WhiteScreen">
|
android:theme="@style/Theme.WhiteScreen">
|
||||||
|
<activity android:name=".activity.PicturesActivity"
|
||||||
<activity android:name=".activity.PictureActivity"
|
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
||||||
android:launchMode="singleTop"
|
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
>
|
>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".activity.PictureActivity"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
||||||
|
android:launchMode="singleTop"></activity>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="TencentMapSDK"
|
android:name="TencentMapSDK"
|
||||||
android:value="EWWBZ-2PB62-6JXUL-CEX7G-N7UE6-XRB4V" />
|
android:value="EWWBZ-2PB62-6JXUL-CEX7G-N7UE6-XRB4V" />
|
||||||
@ -62,21 +62,28 @@
|
|||||||
android:name="design_height_in_dp"
|
android:name="design_height_in_dp"
|
||||||
android:value="800" />
|
android:value="800" />
|
||||||
|
|
||||||
<activity android:name=".activity.MainActivity">
|
<activity android:name=".activity.MainActivity"
|
||||||
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".activity.LoginActivity" />
|
<activity android:name=".activity.LoginActivity"
|
||||||
<activity android:name=".activity.HomeActivity" />
|
android:screenOrientation="portrait"/>
|
||||||
<activity android:name=".activity.WebActivity" />
|
<activity android:name=".activity.HomeActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
|
<activity android:name=".activity.WebActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.FragmentManagement"
|
android:name=".activity.FragmentManagement"
|
||||||
android:windowSoftInputMode="adjustPan" />
|
android:windowSoftInputMode="adjustPan"
|
||||||
<activity android:name=".activity.ImageShowActivity" />
|
android:screenOrientation="portrait"/>
|
||||||
<activity android:name=".activity.UserActivity" />
|
<activity android:name=".activity.ImageShowActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
|
<activity android:name=".activity.UserActivity"
|
||||||
|
android:screenOrientation="portrait"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -0,0 +1,120 @@
|
|||||||
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
|
import com.otaliastudios.cameraview.CameraListener;
|
||||||
|
import com.otaliastudios.cameraview.CameraLogger;
|
||||||
|
import com.otaliastudios.cameraview.CameraView;
|
||||||
|
import com.otaliastudios.cameraview.VideoResult;
|
||||||
|
import com.otaliastudios.cameraview.controls.Engine;
|
||||||
|
import com.otaliastudios.cameraview.controls.Mode;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayout() {
|
||||||
|
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() {
|
||||||
|
@Override
|
||||||
|
public void onVideoTaken(@NonNull @NotNull VideoResult result) {
|
||||||
|
super.onVideoTaken(result);
|
||||||
|
Toast.makeText(PicturesActivity.this, "停止摄像", Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// tencentMap = ivMap.getMap();
|
||||||
|
//获取地图UI 设置对象
|
||||||
|
// UiSettings uiSettings = tencentMap.getUiSettings();
|
||||||
|
// //设置logo的大小
|
||||||
|
// uiSettings.setLogoScale(0.7f);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
super.initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@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);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
cameraView.open();
|
||||||
|
// ivMap.onResume();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
cameraView.close();
|
||||||
|
// ivMap.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
cameraView.destroy();
|
||||||
|
// ivMap.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ import com.navinfo.outdoor.R;
|
|||||||
import com.navinfo.outdoor.bean.JobSearchBean;
|
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||||
import com.navinfo.outdoor.util.SdkFolderCreate;
|
import com.navinfo.outdoor.util.SdkFolderCreate;
|
||||||
import com.tencent.map.geolocation.TencentLocation;
|
import com.tencent.map.geolocation.TencentLocation;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||||
|
|
||||||
@ -90,6 +91,7 @@ public class Constant {
|
|||||||
|
|
||||||
|
|
||||||
public static JobSearchBean jobSearchBean;//数据
|
public static JobSearchBean jobSearchBean;//数据
|
||||||
|
public static MapView treasureMap;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setScreenRoate(true);
|
// setScreenRoate(true);
|
||||||
//初始化,默认透明状态栏和黑色导航栏
|
//初始化,默认透明状态栏和黑色导航栏
|
||||||
ImmersionBar.with(this).init();
|
ImmersionBar.with(this).init();
|
||||||
Collector.addActivity(this);
|
Collector.addActivity(this);
|
||||||
|
@ -86,12 +86,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
private PoiDao poiDao;
|
private PoiDao poiDao;
|
||||||
private PoiEntity showPoiEntity;
|
private PoiEntity showPoiEntity;
|
||||||
private LatLng latLng;
|
private LatLng latLng;
|
||||||
private int station_type=0;
|
private int station_type = 0;
|
||||||
String[] spinner = new String[]{"存在","不存在","无法验证"};
|
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||||
private RelativeLayout linearExist;
|
private RelativeLayout linearExist;
|
||||||
private Spinner spinnerExist;
|
private Spinner spinnerExist;
|
||||||
|
|
||||||
private ArrayList<Object> otheruploadList;
|
private ArrayList<File> otheruploadList;
|
||||||
private String takePhotoPath;
|
private String takePhotoPath;
|
||||||
private String takePhotoPath2;
|
private String takePhotoPath2;
|
||||||
|
|
||||||
@ -162,13 +162,13 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case 0:
|
case 0:
|
||||||
station_type=6;
|
station_type = 6;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
station_type=7;
|
station_type = 7;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
station_type=8;
|
station_type = 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
if (showPoiEntity != null) {
|
if (showPoiEntity != null) {
|
||||||
String name = showPoiEntity.getName();//名称
|
String name = showPoiEntity.getName();//名称
|
||||||
if (name != null&&!name.equals("")) {
|
if (name != null && !name.equals("")) {
|
||||||
editTaskName.setText(name + "");
|
editTaskName.setText(name + "");
|
||||||
}
|
}
|
||||||
String x = showPoiEntity.getX();
|
String x = showPoiEntity.getX();
|
||||||
@ -255,12 +255,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
latLng.setLatitude(Double.parseDouble(y));
|
latLng.setLatitude(Double.parseDouble(y));
|
||||||
}
|
}
|
||||||
String describe = showPoiEntity.getDescribe();//任务描述
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
if (describe != null &&!describe.equals("")) {
|
if (describe != null && !describe.equals("")) {
|
||||||
editOtherDescribe.setText(describe);
|
editOtherDescribe.setText(describe);
|
||||||
}
|
}
|
||||||
linearExist.setVisibility(View.VISIBLE);
|
linearExist.setVisibility(View.VISIBLE);
|
||||||
int station_type = showPoiEntity.getStation_type();
|
int station_type = showPoiEntity.getStation_type();
|
||||||
spinnerOther.setSelection(station_type,true);
|
spinnerOther.setSelection(station_type, true);
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||||
@ -338,8 +338,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
} else {
|
} else {
|
||||||
infoList.add(new Info(tagPictures));
|
infoList.add(new Info(tagPictures));
|
||||||
}
|
}
|
||||||
if (showPoiEntity!=null){
|
if (showPoiEntity != null) {
|
||||||
if (showPoiEntity.getTaskId()!=0){
|
if (showPoiEntity.getTaskId() != 0) {
|
||||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,20 +388,42 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
otheruploadList = new ArrayList<>();
|
otheruploadList = new ArrayList<>();
|
||||||
File otherUploadFile = new File(takePhotoPath);
|
File otherUploadFile = new File(takePhotoPath);
|
||||||
File otherUploadFile2 = new File(takePhotoPath2);
|
File otherUploadFile2 = new File(takePhotoPath2);
|
||||||
if (!otherUploadFile.exists() || !otherUploadFile2.exists()){
|
if (!otherUploadFile.exists() || !otherUploadFile2.exists()) {
|
||||||
Toast.makeText(getContext(), "照片不能为空", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "照片不能为空", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
otheruploadList.add(otherUploadFile);
|
otheruploadList.add(otherUploadFile);
|
||||||
otheruploadList.add(otherUploadFile2);
|
otheruploadList.add(otherUploadFile2);
|
||||||
|
OkGo
|
||||||
|
// 请求方式和请求url
|
||||||
|
.<NameAuthenticationBean>post(HttpInterface.USER_AUTH_ADD)
|
||||||
|
// 请求的 tag, 主要用于取消对应的请求
|
||||||
|
.params("userid", "1")
|
||||||
|
.addFileParams("file", otheruploadList)
|
||||||
|
.tag(this)
|
||||||
|
.execute(new DialogCallback<NameAuthenticationBean>(NameAuthenticationBean.class) {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Response<NameAuthenticationBean> response) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Response<NameAuthenticationBean> response) {
|
||||||
|
super.onError(response);
|
||||||
|
dismissLoadingDialog();
|
||||||
|
Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
|
||||||
|
Log.d("TAG", "onError: " + response.message());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void otherSaveByNetWork(PoiEntity poiEntity) {
|
private void otherSaveByNetWork(PoiEntity poiEntity) {
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("type",poiEntity.getStation_type());
|
httpParams.put("type", poiEntity.getStation_type());
|
||||||
httpParams.put("taskId", poiEntity.getTaskId());
|
httpParams.put("taskId", poiEntity.getTaskId());
|
||||||
httpParams.put("name", poiEntity.getName());
|
httpParams.put("name", poiEntity.getName());
|
||||||
httpParams.put("existence", "1");
|
httpParams.put("existence", "1");
|
||||||
@ -459,15 +481,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
String tagPicture = (String) ivPicture.getTag();
|
String tagPicture = (String) ivPicture.getTag();
|
||||||
if (tagPicture != null &&!tagPicture.equals("")) {
|
if (tagPicture != null && !tagPicture.equals("")) {
|
||||||
arrayList.add(new Info(tagPicture));
|
arrayList.add(new Info(tagPicture));
|
||||||
}
|
}
|
||||||
String tagPictures = (String) ivPictures.getTag();
|
String tagPictures = (String) ivPictures.getTag();
|
||||||
if (tagPictures != null&&!tagPictures.equals("")) {
|
if (tagPictures != null && !tagPictures.equals("")) {
|
||||||
arrayList.add(new Info(tagPictures));
|
arrayList.add(new Info(tagPictures));
|
||||||
}
|
}
|
||||||
if (showPoiEntity!=null){
|
if (showPoiEntity != null) {
|
||||||
if (showPoiEntity.getTaskId()!=0){
|
if (showPoiEntity.getTaskId() != 0) {
|
||||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,15 +40,19 @@ import com.kongzue.dialog.util.BaseDialog;
|
|||||||
import com.kongzue.dialog.util.DialogSettings;
|
import com.kongzue.dialog.util.DialogSettings;
|
||||||
import com.kongzue.dialog.v3.MessageDialog;
|
import com.kongzue.dialog.v3.MessageDialog;
|
||||||
import com.kongzue.dialog.v3.ShareDialog;
|
import com.kongzue.dialog.v3.ShareDialog;
|
||||||
|
import com.lzy.okgo.OkGo;
|
||||||
import com.lzy.okgo.model.HttpParams;
|
import com.lzy.okgo.model.HttpParams;
|
||||||
|
import com.lzy.okgo.model.Response;
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
import com.navinfo.outdoor.adapter.PoiRecycleAdapter;
|
import com.navinfo.outdoor.adapter.PoiRecycleAdapter;
|
||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||||
import com.navinfo.outdoor.bean.Info;
|
import com.navinfo.outdoor.bean.Info;
|
||||||
|
import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
||||||
import com.navinfo.outdoor.bean.PoiBean;
|
import com.navinfo.outdoor.bean.PoiBean;
|
||||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||||
import com.navinfo.outdoor.http.Callback;
|
import com.navinfo.outdoor.http.Callback;
|
||||||
|
import com.navinfo.outdoor.http.DialogCallback;
|
||||||
import com.navinfo.outdoor.http.HttpInterface;
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||||
import com.navinfo.outdoor.room.PoiDao;
|
import com.navinfo.outdoor.room.PoiDao;
|
||||||
@ -62,6 +66,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -96,6 +101,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
String[] spinner = new String[]{"存在","不存在","无法验证"};
|
String[] spinner = new String[]{"存在","不存在","无法验证"};
|
||||||
private RelativeLayout linearExist;
|
private RelativeLayout linearExist;
|
||||||
private Spinner spinnerExist;
|
private Spinner spinnerExist;
|
||||||
|
private ArrayList<File> poiUploadList;
|
||||||
|
//获取的拍照图片
|
||||||
|
private String takePhotoPath2;
|
||||||
|
private String takePhotoPath5;
|
||||||
|
private String takePhotoPath4;
|
||||||
|
private String takePhotoPath3;
|
||||||
|
private String takePhotoPath1;
|
||||||
|
|
||||||
public static PoiFragment newInstance(Bundle bundle) {
|
public static PoiFragment newInstance(Bundle bundle) {
|
||||||
PoiFragment fragment = new PoiFragment();
|
PoiFragment fragment = new PoiFragment();
|
||||||
@ -464,6 +476,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||||
obtain.obj = false;
|
obtain.obj = false;
|
||||||
EventBus.getDefault().post(obtain);
|
EventBus.getDefault().post(obtain);
|
||||||
|
poiUploadByNetWork();
|
||||||
break;
|
break;
|
||||||
case R.id.tv_examine:
|
case R.id.tv_examine:
|
||||||
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||||
@ -492,6 +505,47 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void poiUploadByNetWork() {
|
||||||
|
poiUploadList = new ArrayList<>();
|
||||||
|
File poiUploadFile1 = new File(takePhotoPath1);
|
||||||
|
File poiUploadFile2 = new File(takePhotoPath2);
|
||||||
|
File poiUploadFile3 = new File(takePhotoPath3);
|
||||||
|
File poiUploadFile4 = new File(takePhotoPath4);
|
||||||
|
File poiUploadFile5 = new File(takePhotoPath5);
|
||||||
|
if (!poiUploadFile1.exists()||!poiUploadFile2.exists()||!poiUploadFile3.exists()||!poiUploadFile4.exists()||!poiUploadFile5.exists()){
|
||||||
|
Toast.makeText(getActivity(), "照片不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
poiUploadList.add(poiUploadFile1);
|
||||||
|
poiUploadList.add(poiUploadFile2);
|
||||||
|
poiUploadList.add(poiUploadFile3);
|
||||||
|
poiUploadList.add(poiUploadFile4);
|
||||||
|
poiUploadList.add(poiUploadFile5);
|
||||||
|
OkGo
|
||||||
|
// 请求方式和请求url
|
||||||
|
.<NameAuthenticationBean>post(HttpInterface.USER_AUTH_ADD)
|
||||||
|
// 请求的 tag, 主要用于取消对应的请求
|
||||||
|
.params("auditId", "1")
|
||||||
|
.addFileParams("file",poiUploadList)
|
||||||
|
.tag(this)
|
||||||
|
.execute(new DialogCallback<NameAuthenticationBean>(NameAuthenticationBean.class) {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Response<NameAuthenticationBean> response) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Response<NameAuthenticationBean> response) {
|
||||||
|
super.onError(response);
|
||||||
|
dismissLoadingDialog();
|
||||||
|
Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
|
||||||
|
Log.d("TAG", "onError: " + response.message());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void poiSaveByNet(PoiEntity poiEntity) {
|
private void poiSaveByNet(PoiEntity poiEntity) {
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
@ -631,8 +685,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a");
|
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a");
|
||||||
ivPanorama.setTag(takePhotoPath);
|
ivPanorama.setTag(takePhotoPath1);
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,8 +706,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b");
|
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b");
|
||||||
ivName.setTag(takePhotoPath);
|
ivName.setTag(takePhotoPath2);
|
||||||
ivName.setImageBitmap(bitmap);//显示图像
|
ivName.setImageBitmap(bitmap);//显示图像
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -674,8 +728,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c");
|
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c");
|
||||||
ivInternal.setTag(takePhotoPath);
|
ivInternal.setTag(takePhotoPath3);
|
||||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||||
@ -694,8 +748,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d");
|
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d");
|
||||||
ivCard.setTag(takePhotoPath);
|
ivCard.setTag(takePhotoPath4);
|
||||||
ivCard.setImageBitmap(bitmap);//显示图像
|
ivCard.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||||
@ -714,8 +768,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e");
|
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e");
|
||||||
ivElse.setTag(takePhotoPath);
|
ivElse.setTag(takePhotoPath5);
|
||||||
ivElse.setImageBitmap(bitmap);//显示图像
|
ivElse.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ import com.hjq.permissions.Permission;
|
|||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
import com.navinfo.outdoor.activity.PictureActivity;
|
import com.navinfo.outdoor.activity.PictureActivity;
|
||||||
|
import com.navinfo.outdoor.activity.PicturesActivity;
|
||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||||
import com.navinfo.outdoor.bean.RoadExtend;
|
import com.navinfo.outdoor.bean.RoadExtend;
|
||||||
@ -286,7 +287,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.tv_pictures:
|
case R.id.tv_pictures:
|
||||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
Intent intent = new Intent(getContext(), PicturesActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import com.hjq.permissions.Permission;
|
|||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
import com.navinfo.outdoor.activity.PictureActivity;
|
import com.navinfo.outdoor.activity.PictureActivity;
|
||||||
|
import com.navinfo.outdoor.activity.PicturesActivity;
|
||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||||
import com.navinfo.outdoor.bean.PoiBean;
|
import com.navinfo.outdoor.bean.PoiBean;
|
||||||
@ -293,7 +294,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.tv_pictures:
|
case R.id.tv_pictures:
|
||||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
Intent intent = new Intent(getContext(), PicturesActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
android:id="@+id/camera"
|
android:id="@+id/camera"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:keepScreenOn="true"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
/>
|
/>
|
||||||
|
67
app/src/main/res/layout/activity_pictures.xml
Normal file
67
app/src/main/res/layout/activity_pictures.xml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?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:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#FF444444"
|
||||||
|
tools:context=".activity.PicturesActivity">
|
||||||
|
|
||||||
|
<com.otaliastudios.cameraview.CameraView
|
||||||
|
android:id="@+id/cameraView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- <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" />
|
||||||
|
|
||||||
|
<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
|
||||||
|
android:id="@+id/capuretVideo"
|
||||||
|
style="@style/user_data_style"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:text="开始采集"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toLeftOf="@id/btn_stop_video" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_stop_video"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/uploding_shape"
|
||||||
|
android:text="结束采集"
|
||||||
|
android:textColor="@color/colorBlue"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/capuretVideo"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/capuretVideo"
|
||||||
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
x
Reference in New Issue
Block a user