修改连拍间隔,修改拍照界面

This commit is contained in:
wangdongsheng 2021-09-09 18:33:23 +08:00
parent 6c39e1f13e
commit 30c374b2d9
13 changed files with 373 additions and 274 deletions

View File

@ -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"

View File

@ -47,7 +47,6 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.WhiteScreen" android:theme="@style/Theme.WhiteScreen"
tools:targetApi="n"> tools:targetApi="n">
<activity android:name=".activity.PoiPictureActivity"></activity>
<activity android:name=".activity.LinkActivity" /> <activity android:name=".activity.LinkActivity" />
<activity android:name=".activity.RegardMapActivity" /> <activity android:name=".activity.RegardMapActivity" />
<activity android:name=".activity.StatementActivity" /> <activity android:name=".activity.StatementActivity" />
@ -59,6 +58,8 @@
android:name=".activity.PictureActivity" 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:launchMode="singleTop" />
<activity android:name=".activity.PhotographActivity"
android:screenOrientation="portrait" />
<meta-data <meta-data
android:name="TencentMapSDK" android:name="TencentMapSDK"

View File

@ -0,0 +1,156 @@
package com.navinfo.outdoor.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Camera;
import android.graphics.Matrix;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
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.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.MyTecentLocationSource;
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.controls.Mode;
import com.tencent.map.geolocation.TencentLocation;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
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;
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
import com.vividsolutions.jts.geom.Geometry;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
/**
* 照片对应
*/
public class PhotographActivity extends BaseActivity implements View.OnClickListener {
private CameraView cameraView;
private String photo_path;
@Override
public void onClick(View v) {
if (v.getId() == R.id.capture_picture) {
cameraView.takePicture();
}
}
@Override
protected int getLayout() {
EventBus.getDefault().register(this);
return R.layout.activity_photograph;
}
@Override
protected void initData() {
super.initData();
cameraView.setMode(Mode.PICTURE);
}
@Override
protected void initView() {
super.initView();
if (getIntent()!=null){
photo_path = getIntent().getStringExtra(Constant.INTENT_PHOTO_PATH);
}
cameraView = findViewById(R.id.camera);
cameraView.setOnClickListener(this);
Button btnCapturePicture = findViewById(R.id.capture_picture);
btnCapturePicture.setOnClickListener(this);
cameraView.addCameraListener(new CameraListener() {
@Override
public void onPictureTaken(@NonNull PictureResult result) {
super.onPictureTaken(result);
File file = new File(photo_path);
result.toFile(file, new FileCallback() {
@Override
public void onFileReady(@Nullable File file) {
Intent intent = new Intent();
assert file != null;
intent.putExtra("file",file.getPath());
setResult(0x104,intent);
finish();
}
});
}
});
}
@Subscribe
public void onEvent(Message data) { }
@Override
protected void onResume() {
super.onResume();
cameraView.open();
}
@Override
protected void onPause() {
super.onPause();
cameraView.close();
}
@Override
protected void onDestroy() {
super.onDestroy();
cameraView.destroy();
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
}
}

View File

@ -68,6 +68,8 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE; import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER; import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
@ -75,8 +77,7 @@ import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_
public class PicturesActivity extends BaseActivity implements View.OnClickListener { public class PicturesActivity extends BaseActivity implements View.OnClickListener {
private static final CameraLogger LOG = CameraLogger.create("Picture"); private static final CameraLogger LOG = CameraLogger.create("Picture");
private CameraView camera; private CameraView camera;
private long captureTime = 0; private Button btnSwitch;
private android.widget.Button btnSwitch;
private TencentMap tencentMap; private TencentMap tencentMap;
private TextureMapView ivMap; private TextureMapView ivMap;
private List<Removable> removables; private List<Removable> removables;
@ -86,32 +87,36 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
private ViewGroup layerChange; // 切换地图和相机的父控件 private ViewGroup layerChange; // 切换地图和相机的父控件
private CheckBox capturePicture, cbMapType;//拍照 private CheckBox capturePicture, cbMapType;//拍照
private boolean isMapSlide = false; private boolean isMapSlide = false;
private boolean listenerPicture = false; /*
private boolean listenerPicture = false;
*/
private SimpleDateFormat formatter; private SimpleDateFormat formatter;
private File paperFile; private File paperFile;
private int type, videoIndex; private int type;
private ImageView ivZoomAdd, ivZoomDel, ivLocation; private ImageView ivZoomAdd, ivZoomDel, ivLocation;
private Handler handler = new Handler(new Handler.Callback() { private Handler handler = new Handler(new Handler.Callback() {
@Override @Override
public boolean handleMessage(@NonNull Message msg) { public boolean handleMessage(@NonNull Message msg) {
if (msg.what == 0x101 && listenerPicture) { if (msg.what == 0x101) {
camera.takePicture(); camera.takePicture();
} else if (msg.what == 0x102) { } else if (msg.what == 0x102) {
if (btnSwitch != null) { if (btnSwitch != null) {
// tencentMap.setBaseMapEnabled(true);
btnSwitch.setEnabled(true); btnSwitch.setEnabled(true);
} }
} else if (msg.what == 0x103) { } else if (msg.what == 0x103) {
listenerPicture = false;
if (type != 3) { if (type != 3) {
capturePicture.setText("开始采集"); capturePicture.setText("开始采集");
} }
capturePicture.setChecked(false); capturePicture.setChecked(false);
stopTimer();
} }
return false; return false;
} }
}); });
private Timer timer;
private TimerTask timerTask;
private int videoIndex = -1;
@Override @Override
protected int getLayout() { protected int getLayout() {
@ -136,7 +141,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
formatter = new SimpleDateFormat("yyyyMMdd HHmmss"); formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ivMap = findViewById(R.id.iv_map); ivMap = findViewById(R.id.iv_map);
ivMap.setOnClickListener(this::onClick);
btnSwitch = findViewById(R.id.btn_switch); btnSwitch = findViewById(R.id.btn_switch);
btnSwitch.setOnClickListener(this); btnSwitch.setOnClickListener(this);
//相机记录器 //相机记录器
@ -145,23 +149,24 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
ivZoomAdd.setOnClickListener(this); ivZoomAdd.setOnClickListener(this);
ivZoomDel = findViewById(R.id.iv_zoom_del); ivZoomDel = findViewById(R.id.iv_zoom_del);
ivZoomDel.setOnClickListener(this); ivZoomDel.setOnClickListener(this);
// cbMapType =findViewById(R.id.cb_map_type); /* cbMapType =findViewById(R.id.cb_map_type);
// cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER); setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
// } }
// }); });*/
ivLocation = findViewById(R.id.iv_location); ivLocation = findViewById(R.id.iv_location);
ivLocation.setOnClickListener(this); ivLocation.setOnClickListener(this);
camera = findViewById(R.id.camera); camera = findViewById(R.id.camera);
camera.setOnClickListener(this);
capturePicture = findViewById(R.id.capture_picture); capturePicture = findViewById(R.id.capture_picture);
if (type == 3) { if (type == 3) {
capturePicture.setText("拍摄"); capturePicture.setText("拍摄");
} else { } else {
capturePicture.setText("开始采集"); capturePicture.setText("开始采集");
} }
capturePicture.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { /* capturePicture.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { // 开始采集设置按钮文字内容为结束采集 if (isChecked) { // 开始采集设置按钮文字内容为结束采集
@ -177,6 +182,22 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} }
} }
} }
});*/
capturePicture.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
if (type != 3) {
capturePicture.setText("暂停采集");
}
startTimer();
} else {
if (type != 3) {
capturePicture.setText("开始采集");
}
stopTimer();
}
}
}); });
Button stopPicture = findViewById(R.id.btn_stop_picture); Button stopPicture = findViewById(R.id.btn_stop_picture);
stopPicture.setOnClickListener(this); stopPicture.setOnClickListener(this);
@ -206,29 +227,32 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} }
} }
} }
tencentMap.setOnMapClickListener(new TencentMap.OnMapClickListener() { camera.addCameraListener(new CameraListener() {
@Override @Override
public void onMapClick(LatLng latLng) { public void onPictureTaken(@NonNull PictureResult result) {
btnSwitch.setEnabled(false); super.onPictureTaken(result);
handler.sendEmptyMessageDelayed(0x102, 2000);// 利用handler延迟发送更改状态信息 File file = new File(finalVideoPath);
DisplayMetrics dm = new DisplayMetrics(); initMarkerPaper();
getWindowManager().getDefaultDisplay().getMetrics(dm); result.toFile(file, new FileCallback() {
System.out.println("width-display :" + dm.widthPixels); @Override
System.out.println("height-display :" + dm.heightPixels); public void onFileReady(@Nullable File file) {
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//地图的宽高 assert file != null;
int heightMap = ivMap.getMeasuredHeight(); if (file.exists()) {
int widthMap = ivMap.getMeasuredWidth(); initMarker();
FrameLayout.LayoutParams layoutParamsCamera = (FrameLayout.LayoutParams) camera.getLayoutParams();//相机的宽高 videoIndex = Integer.parseInt(file.getName().replace(".jpg", ""));
int heightCamera = camera.getMeasuredHeight(); finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg";
int widthCamera = camera.getMeasuredWidth(); Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex + 1), Toast.LENGTH_SHORT).show();
if (heightMap<heightCamera){ }
benSwitch(); if (type==3){
} Message message = new Message();
message.what = 0x103;
handler.sendMessage(message);
}
}
});
} }
}); });
/* camera.addCameraListener(new CameraListener() {//相机预览监听
camera.addCameraListener(new CameraListener() {//相机预览监听
@Override @Override
public void onPictureTaken(@NonNull @NotNull PictureResult result) { public void onPictureTaken(@NonNull @NotNull PictureResult result) {
if (listenerPicture) { if (listenerPicture) {
@ -249,10 +273,10 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
if (type == 3) { if (type == 3) {
message.what = 0x103; message.what = 0x103;
handler.sendMessageDelayed(message, 0); handler.sendMessageDelayed(message, 0);
Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex + 1), Toast.LENGTH_SHORT).show(); Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex+1), Toast.LENGTH_SHORT).show();
} else { } else {
message.what = 0x101; message.what = 0x101;
Toast.makeText(PicturesActivity.this, "保存成功" + (videoIndex + 1), Toast.LENGTH_SHORT).show(); Toast.makeText(PicturesActivity.this, "保存成功" + (videoIndex+1), Toast.LENGTH_SHORT).show();
handler.sendMessageDelayed(message, 1500); handler.sendMessageDelayed(message, 1500);
} }
} }
@ -266,7 +290,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
Log.d("captureTime", captureTime + ""); Log.d("captureTime", captureTime + "");
} }
} }
//录像监听 //录像监听
@Override @Override
public void onVideoTaken(@NonNull @NotNull VideoResult result) { public void onVideoTaken(@NonNull @NotNull VideoResult result) {
@ -284,37 +307,13 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
public void onVideoRecordingStart() { public void onVideoRecordingStart() {
super.onVideoRecordingStart(); super.onVideoRecordingStart();
} }
}); });*/
DisplayMetrics dm = new DisplayMetrics(); DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm); getWindowManager().getDefaultDisplay().getMetrics(dm);
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高 FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
layoutParamsMap.height = dm.widthPixels / 3; layoutParamsMap.height = dm.widthPixels / 3;
layoutParamsMap.width = dm.heightPixels / 3; layoutParamsMap.width = dm.heightPixels / 3;
ivMap.setLayoutParams(layoutParamsMap); ivMap.setLayoutParams(layoutParamsMap);
//相机监听
camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
benSwitch();
Toast.makeText(PicturesActivity.this, "dianjile1", Toast.LENGTH_SHORT).show();
// btnSwitch.setEnabled(false);
// handler.sendEmptyMessageDelayed(0x102, 2000);// 利用handler延迟发送更改状态信息
// DisplayMetrics dm = new DisplayMetrics();
// getWindowManager().getDefaultDisplay().getMetrics(dm);
// System.out.println("width-display :" + dm.widthPixels);
// System.out.println("height-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();
// if (heightMap>heightCamera){
// benSwitch();
// }
}
});
} }
private void message(String content) { private void message(String content) {
@ -363,7 +362,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.btn_stop_picture: case R.id.btn_stop_picture:
/*
listenerPicture = false; listenerPicture = false;
*/
Intent intent = new Intent(); Intent intent = new Intent();
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".jpg"; finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".jpg";
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath); intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
@ -372,9 +373,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
finish(); finish();
break; break;
case R.id.btn_switch: case R.id.btn_switch:
// v.setEnabled(false); v.setEnabled(false);
// handler.sendEmptyMessageDelayed(0x102, 2000);// 利用handler延迟发送更改状态信息 handler.sendEmptyMessageDelayed(0x102, 2000);// 利用handler延迟发送更改状态信息
// benSwitch(); benSwitch();
break; break;
case R.id.iv_zoom_add://放大 case R.id.iv_zoom_add://放大
CameraUpdate cameraUpdateIn = CameraUpdateFactory.zoomIn(); CameraUpdate cameraUpdateIn = CameraUpdateFactory.zoomIn();
@ -395,8 +396,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
tencentMap.animateCamera(cameraSigma); tencentMap.animateCamera(cameraSigma);
} }
break; break;
} }
} }
@ -473,7 +472,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
isMapSlide = false; isMapSlide = false;
ivZoomAdd.setVisibility(View.GONE); ivZoomAdd.setVisibility(View.GONE);
ivZoomDel.setVisibility(View.GONE); ivZoomDel.setVisibility(View.GONE);
ivLocation.setVisibility(View.GONE); ivLocation.setVisibility(View.GONE);
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE); setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE);
@ -517,19 +515,20 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
camera.close(); camera.close();
if (type != 3) { stopTimer();
listenerPicture = false;
}
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
camera.destroy(); camera.destroy();
stopTimer();
if (polyline != null) { if (polyline != null) {
polyline.remove(); polyline.remove();
} }
/*
listenerPicture = false; listenerPicture = false;
*/
for (int i = 0; i < removables.size(); i++) { for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove(); removables.get(i).remove();
} }
@ -559,7 +558,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(formatter.format(new Date())); // 记录当前时 sb.append(formatter.format(new Date())); // 记录当前时
sb.append(","); sb.append(",");
sb.append(videoIndex);//個數 sb.append(videoIndex == -1 ? 0 : (videoIndex + 1));//個數
sb.append(","); sb.append(",");
sb.append(Constant.currentLocation.getLatitude()); sb.append(Constant.currentLocation.getLatitude());
sb.append(","); sb.append(",");
@ -571,13 +570,51 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
sb.append(Constant.currentLocation.getDirection()); sb.append(Constant.currentLocation.getDirection());
} }
sb.append("\r\n"); sb.append("\r\n");
FileUtils.writeFile(paperFile.getAbsolutePath(), sb.toString(), true);
}
public void initMarker() {
LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.circle); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.circle);
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f) Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
removables.add(marker); removables.add(marker);
FileUtils.writeFile(paperFile.getAbsolutePath(), sb.toString(), true); }
private void startTimer() {
if (timer == null) {
timer = new Timer();
}
timerTask = new TimerTask() {
@Override
public void run() {
if (type == 3) {
camera.takePicture();
} else {
Message message = new Message();
message.what = 0x101;
handler.sendMessage(message);
}
}
};
if (type==3){
timer.schedule(timerTask, 0);
}else {
timer.schedule(timerTask, 0, 2000);
}
}
private void stopTimer() {
if (timer != null) {
timer.cancel();
timer = null;
}
if (timerTask != null) {
timerTask.cancel();
timerTask = null;
}
} }
} }

View File

@ -1,103 +0,0 @@
package com.navinfo.outdoor.activity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.Toast;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.base.BaseActivity;
import com.otaliastudios.cameraview.CameraException;
import com.otaliastudios.cameraview.CameraListener;
import com.otaliastudios.cameraview.CameraView;
import com.otaliastudios.cameraview.FileCallback;
import com.otaliastudios.cameraview.PictureResult;
import com.otaliastudios.cameraview.VideoResult;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.Objects;
public class PoiPictureActivity extends BaseActivity implements View.OnClickListener {
private CameraView poiPictureCamera;
private android.widget.CheckBox capturePoiPicture;
private android.widget.Button btnStopPoiPicture;
@Override
protected int getLayout() {
return R.layout.activity_poi_picture;
}
@Override
protected void initView() {
super.initView();
poiPictureCamera = (CameraView) findViewById(R.id.poi_picture_camera);
capturePoiPicture = (CheckBox) findViewById(R.id.capture_poi_picture);
capturePoiPicture.setOnClickListener(this::onClick);
btnStopPoiPicture = (Button) findViewById(R.id.btn_stop_poi_picture);
btnStopPoiPicture.setOnClickListener(this::onClick);
poiPictureCamera.setLifecycleOwner(this);
poiPictureCamera.addCameraListener(new CameraListener() {//相机预览监听
@Override
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
}
@Override
public void onCameraError(@NonNull @NotNull CameraException exception) {
super.onCameraError(exception);
Toast.makeText(PoiPictureActivity.this, exception.toString(), Toast.LENGTH_SHORT).show();
}
});
}
@Override
protected void initData() {
super.initData();
poiPictureCamera.takePicture();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.capture_poi_picture:
break;
case R.id.btn_stop_poi_picture:
break;
}
}
@Override
protected void onResume() {
super.onResume();
poiPictureCamera.open();
}
@Override
protected void onPause() {
super.onPause();
poiPictureCamera.close();
}
@Override
protected void onDestroy() {
super.onDestroy();
poiPictureCamera.destroy();
}
}

View File

@ -176,7 +176,8 @@ public class Constant {
public static MapView treasureMap; public static MapView treasureMap;
public static final String INTENT_VIDEO_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置 public static final String INTENT_VIDEO_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置
public static final String INTENT_JPG_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的图片保存位置 public static final String INTENT_JPG_PATH = "INTENT_JPG_PATH"; // 拍照界面指定的图片保存位置
public static final String INTENT_PHOTO_PATH = "INTENT_PHOTO_PATH"; // 拍照界面指定的图片保存位置
public static final String INTENT_PICTURES_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置 public static final String INTENT_PICTURES_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置
public static final String INTENT_VIDEO_OBLATION = "INTENT_VIDEO_OBLATION"; // 视频拍摄时屏幕方向 0-强制横屏 其他-任意 public static final String INTENT_VIDEO_OBLATION = "INTENT_VIDEO_OBLATION"; // 视频拍摄时屏幕方向 0-强制横屏 其他-任意

View File

@ -43,6 +43,7 @@ import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response; import com.lzy.okgo.model.Response;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement; import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.activity.PhotographActivity;
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;
@ -59,6 +60,7 @@ import com.navinfo.outdoor.room.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao; import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase; import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity; import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.PhotoUtils; import com.navinfo.outdoor.util.PhotoUtils;
import com.tencent.tencentmap.mapsdk.maps.TencentMap; import com.tencent.tencentmap.mapsdk.maps.TencentMap;
@ -102,7 +104,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
private int station_type = 5; private int station_type = 5;
private ArrayList<File> otherUploadList; private ArrayList<File> otherUploadList;
private CheckBox checkPot; private CheckBox checkPot;
private File file;
private Marker markerOther; private Marker markerOther;
private Point screenOtherPositions; private Point screenOtherPositions;
@ -192,7 +193,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
checkPot.setOnClickListener(new View.OnClickListener() { checkPot.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if(checkPot.isChecked()){ if (checkPot.isChecked()) {
moveLatlng(latLng, new TencentMap.CancelableCallback() { moveLatlng(latLng, new TencentMap.CancelableCallback() {
@Override @Override
public void onFinish() { public void onFinish() {
@ -217,7 +218,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
checkPot.setChecked(false); checkPot.setChecked(false);
} }
}); });
}else { } else {
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag); BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag);
markerOther.setIcon(otherDescriptor); markerOther.setIcon(otherDescriptor);
checkPot.setText("编辑"); checkPot.setText("编辑");
@ -326,7 +327,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
latLng.setLongitude(Double.parseDouble(x)); latLng.setLongitude(Double.parseDouble(x));
latLng.setLatitude(Double.parseDouble(y)); latLng.setLatitude(Double.parseDouble(y));
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag); BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag);
markerOther = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor) .anchor(0.5f,1.0f)); markerOther = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).anchor(0.5f, 1.0f));
markerOther.setZIndex(4); markerOther.setZIndex(4);
moveLatlng(latLng, null); moveLatlng(latLng, null);
} }
@ -367,15 +368,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.rl_picture: case R.id.rl_picture:
Intent intentPicture = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentPicture = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("a", latLng); File file = PhotoUtils.showPhotoFile("a", latLng);
intentPicture.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentPicture.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
startActivityForResult(intentPicture, 101); startActivityForResult(intentPicture, 101);
break; break;
case R.id.rl_pictures: case R.id.rl_pictures:
Intent intentPictures = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentPictures = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("b", latLng); File files = PhotoUtils.showPhotoFile("b", latLng);
intentPictures.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentPictures.putExtra(Constant.INTENT_PHOTO_PATH, files.getPath());
startActivityForResult(intentPictures, 102); startActivityForResult(intentPictures, 102);
break; break;
case R.id.btn_other_local: case R.id.btn_other_local:
@ -467,7 +468,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
} }
} }
@Override @Override
public void onDenied(List<String> permissions, boolean never) { public void onDenied(List<String> permissions, boolean never) {
if (never) { if (never) {
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
@ -587,8 +588,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
} else { } else {
Toast.makeText(getActivity(), "" + poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "" + poiSaveBean.getMessage(), Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
@ -614,7 +613,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
//表示文件名系统将会在/dada/dada/包名/shared_prefs目录下生成 //表示文件名系统将会在/dada/dada/包名/shared_prefs目录下生成
//一个以该参数命名的.xml文件第二个mode表示创建的模式通过查看 //一个以该参数命名的.xml文件第二个mode表示创建的模式通过查看
//方法注释得知建议以0或者MODE_PRIVATE为默认值 //方法注释得知建议以0或者MODE_PRIVATE为默认值
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0); SharedPreferences poi = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.DATA_FILE, 0);
//获取Editor对象 //获取Editor对象
SharedPreferences.Editor edit = poi.edit(); SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法, //根据要保存的数据的类型调用对应的put方法,
@ -623,14 +622,37 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
//以键值对的形式添加新值 //以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity); edit.putString("poiEntity", newPoiEntity);
//提交新值必须执行否则前面的操作都无效 //提交新值必须执行否则前面的操作都无效
edit.commit(); edit.apply();
Log.d("TAG", "initPoiSharePre: " + newPoiEntity); Log.d("TAG", "initPoiSharePre: " + newPoiEntity);
} }
@Override @Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 101 && resultCode == RESULT_OK) { if (resultCode == 0x104) {
if (requestCode == 101) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPicture, 500);
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPicture);
tvPicture.setTag(andGetPath);
}
} else if (requestCode == 102) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPictures, 500);
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPictures);
tvPictures.setTag(andGetPath);
}
}
}
/* if (requestCode == 101 && resultCode == RESULT_OK) {
if (file == null || !file.exists()) { if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return; return;
@ -650,23 +672,24 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
tvPictures.setTag(s); tvPictures.setTag(s);
} }
file = null; file = null;
} }*/
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
if (showPoiEntity != null) { if (showPoiEntity != null) {
if (showPoiEntity.getTaskStatus() == 5) { if (showPoiEntity.getTaskStatus() == 5) {
initEndReceiveTask(HttpInterface.UNRECEIVED_POLYGON_TASK, showPoiEntity); initEndReceiveTask(HttpInterface.UNRECEIVED_POLYGON_TASK, showPoiEntity);
}else { } else {
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR; obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true; obtain.obj = true;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
} }
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断 if (EventBus.getDefault().isRegistered(this))//加上判断
@ -676,7 +699,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
markerOther.remove(); markerOther.remove();
} }
} }
private void initEndReceiveTask(String url,PoiEntity poiEntity) {
private void initEndReceiveTask(String url, PoiEntity poiEntity) {
if (poiEntity.getTaskId() == 0) { if (poiEntity.getTaskId() == 0) {
Toast.makeText(getActivity(), "无此任务", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "无此任务", Toast.LENGTH_SHORT).show();
return; return;

View File

@ -73,6 +73,7 @@ import java.util.Objects;
*/ */
public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClickListener { public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClickListener {
private TextView tvPictures; private TextView tvPictures;
private EditText etRoadName; private EditText etRoadName;
private ImageView ivPoiVideoPicture; private ImageView ivPoiVideoPicture;
@ -147,39 +148,37 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
super.initView(); super.initView();
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext()); PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao(); poiDao = poiDatabase.getPoiDao();
tvPictures = (TextView) findViewById(R.id.tv_pictures);//拍照 tvPictures = findViewById(R.id.tv_pictures);//拍照
tvPictures.setOnClickListener(this); tvPictures.setOnClickListener(this);
tvPicture = (TextView) findViewById(R.id.tv_picture);//录像 tvPicture = findViewById(R.id.tv_picture);//录像
tvPicture.setOnClickListener(this); tvPicture.setOnClickListener(this);
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT); setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view); NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view);
if (slidingPaneLayout != null) { if (slidingPaneLayout != null) {
slidingPaneLayout.setScrollableView(nestedScrollView); slidingPaneLayout.setScrollableView(nestedScrollView);
} }
etRoadName = (EditText) findViewById(R.id.et_poi_video_name); etRoadName = findViewById(R.id.et_poi_video_name);
ivPoiVideoPicture = (ImageView) findViewById(R.id.iv_poi_video_picture); ivPoiVideoPicture = findViewById(R.id.iv_poi_video_picture);
etDesc = findViewById(R.id.et_desc);
etDesc = (EditText) findViewById(R.id.et_desc);
fmPoiVideoPic = findViewById(R.id.fm_poi_video_picture); fmPoiVideoPic = findViewById(R.id.fm_poi_video_picture);
btnRoadSave = (Button) findViewById(R.id.btn_poi_video_save); btnRoadSave = findViewById(R.id.btn_poi_video_save);
btnRoadSave.setOnClickListener(this); btnRoadSave.setOnClickListener(this);
Button btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload); Button btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
btnPoiVideoUpload.setOnClickListener(this); btnPoiVideoUpload.setOnClickListener(this);
rgType = (RadioGroup) findViewById(R.id.rg_type); rgType = findViewById(R.id.rg_type);
rbCar = findViewById(R.id.rb_car); rbCar = findViewById(R.id.rb_car);
rbBicycle = findViewById(R.id.rb_bicycle); rbBicycle = findViewById(R.id.rb_bicycle);
rbWalking = findViewById(R.id.rb_walking); rbWalking = findViewById(R.id.rb_walking);
rbManual = findViewById(R.id.rb_manual); rbManual = findViewById(R.id.rb_manual);
tvPhotoAlbum = findViewById(R.id.tv_photo_album); tvPhotoAlbum = findViewById(R.id.tv_photo_album);
tvPhotoAlbum.setOnClickListener(this); tvPhotoAlbum.setOnClickListener(this);
/*fmRoadPic.setOnClickListener(new View.OnClickListener() { /*fmRoadPic.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) { if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
return; return;
} }
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath()); File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
Intent intent = new Intent(getContext(), PictureActivity.class); Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath()); intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
@ -188,11 +187,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
startActivityForResult(intent, 0x101); startActivityForResult(intent, 0x101);
} }
});*/ });*/
rgType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { rgType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(RadioGroup group, int checkedId) { public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) { switch (checkedId) {
case R.id.rb_car: case R.id.rb_car:
case R.id.rb_bicycle: case R.id.rb_bicycle:
@ -515,7 +512,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onDenied(List<String> permissions, boolean never) { public void onDenied(List<String> permissions, boolean never) {
if (never) { if (never) {
@ -668,13 +664,11 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
} else if (requestCode == 0x102 && resultCode == 0x102) { } else if (requestCode == 0x102 && resultCode == 0x102) {
tvPicture.setEnabled(false); tvPicture.setEnabled(false);
isRequest = 0x102; isRequest = 0x102;
if (data != null && data.hasExtra(Constant.INTENT_PICTURES_PATH)) { if (data != null && data.hasExtra(Constant.INTENT_PICTURES_PATH)) {
int type = data.getIntExtra("type", 0); int type = data.getIntExtra("type", 0);
if (type == 3) { if (type == 3) {
showWorkType(type); showWorkType(type);
} }
String videoPath = data.getStringExtra(Constant.INTENT_PICTURES_PATH); String videoPath = data.getStringExtra(Constant.INTENT_PICTURES_PATH);
assert videoPath != null; assert videoPath != null;
File pictureFile = new File(videoPath); File pictureFile = new File(videoPath);
@ -692,7 +686,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
initPoiVideoSharePre(); initPoiVideoSharePre();
} }
/** /**
* 防止程序崩溃后数据丢失 * 防止程序崩溃后数据丢失
*/ */
@ -714,7 +707,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Log.d("TAG", "initRoadSharePre: " + newPoiEntity); Log.d("TAG", "initRoadSharePre: " + newPoiEntity);
} }
//获取拍照类型 //获取拍照类型
private int getPictureType() { private int getPictureType() {
if (rbCar != null && rbCar.isChecked()) { if (rbCar != null && rbCar.isChecked()) {
@ -743,7 +735,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
case 3: case 3:
rbManual.setChecked(true); rbManual.setChecked(true);
break; break;
} }
} }

View File

@ -3,9 +3,9 @@ package com.navinfo.outdoor.http;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
public class HttpInterface { public class HttpInterface {
public static final String IP_TEST = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口 public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口 public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口 public static final String IP_TASK = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口 public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
public static final String APKIP = "http://172.23.139.4:8001/"; public static final String APKIP = "http://172.23.139.4:8001/";

View File

@ -0,0 +1,38 @@
<?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"
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="match_parent"
android:keepScreenOn="true"
app:cameraPictureSizeAspectRatio="1920:1080"
app:cameraVideoSizeMaxArea="3686400"
app:cameraVideoSizeMaxHeight="1920"
app:cameraVideoSizeMaxWidth="1920"
app:cameraVideoSizeMinArea="1166400"
app:cameraVideoSizeMinHeight="1080"
app:cameraVideoSizeMinWidth="1080"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/capture_picture"
style="@style/user_data_style"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:background="@drawable/user_style"
android:gravity="center"
android:padding="@dimen/fab_margin"
android:text="拍照"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -16,11 +16,12 @@
android:id="@+id/camera" android:id="@+id/camera"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:cameraPictureSizeMaxArea="3200000" app:cameraVideoSizeMaxArea="3686400"
app:cameraPictureSizeMaxHeight="2000" app:cameraVideoSizeMinArea="1166400"
app:cameraPictureSizeMinHeight="1000" app:cameraVideoSizeMaxHeight="1920"
app:cameraPictureSizeMaxWidth="2000" app:cameraVideoSizeMinHeight="1080"
app:cameraPictureSizeMinWidth="1000" app:cameraVideoSizeMaxWidth="1920"
app:cameraVideoSizeMinWidth="1080"
app:cameraPictureSizeAspectRatio="1920:1080" app:cameraPictureSizeAspectRatio="1920:1080"
android:keepScreenOn="true" android:keepScreenOn="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -90,7 +91,6 @@
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginEnd="25dp" android:layout_marginEnd="25dp"
android:text="切换" android:text="切换"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />

View File

@ -1,46 +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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.PoiPictureActivity">
<com.otaliastudios.cameraview.CameraView
android:id="@+id/poi_picture_camera"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cameraPictureSizeMaxArea="3200000"
app:cameraPictureSizeMaxHeight="2000"
app:cameraPictureSizeMinHeight="1000"
app:cameraPictureSizeMaxWidth="2000"
app:cameraPictureSizeMinWidth="1000"
app:cameraPictureSizeAspectRatio="1920:1080"
android:keepScreenOn="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/capture_poi_picture"
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"
app:layout_constraintRight_toLeftOf="@id/btn_stop_poi_picture" />
<Button
android:id="@+id/btn_stop_poi_picture"
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/capture_poi_picture"
app:layout_constraintLeft_toRightOf="@id/capture_poi_picture"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -29,8 +29,8 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
google()
jcenter() jcenter()
google()
mavenCentral() mavenCentral()
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}