fix: 修改视频拍摄定位问题-未完成
This commit is contained in:
parent
647dd87934
commit
50d6fa5398
@ -66,20 +66,19 @@ public class AuthService {
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String result = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
result.append(line);
|
||||
}
|
||||
/**
|
||||
/*
|
||||
* 返回结果示例
|
||||
*/
|
||||
System.err.println("result:" + result);
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
String access_token = jsonObject.getString("access_token");
|
||||
return access_token;
|
||||
JSONObject jsonObject = new JSONObject(result.toString());
|
||||
return jsonObject.getString("access_token");
|
||||
} catch (Exception e) {
|
||||
System.err.printf("获取token失败!");
|
||||
System.err.print("获取token失败!");
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
return null;
|
||||
|
@ -36,9 +36,7 @@ public class BankCard {
|
||||
|
||||
// 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
|
||||
String accessToken =AuthService.getAuth("iafhTwf6LnOMoYTiZQDlrKTu","0d3yoIsrsrAspUMoyNkWeeqDTvxvg9QB");
|
||||
|
||||
String result = HttpUtil.post(url, accessToken, param);
|
||||
return result;
|
||||
return HttpUtil.post(url, accessToken, param);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class IdCard {
|
||||
* https://ai.baidu.com/file/470B3ACCA3FE43788B5A963BF0B625F3
|
||||
* 下载
|
||||
*/
|
||||
public static String idcard() {
|
||||
public static String icarus() {
|
||||
// 请求url
|
||||
String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/idcard";
|
||||
try {
|
||||
@ -28,15 +28,10 @@ public class IdCard {
|
||||
byte[] imgData = FileUtil.readFileByBytes(filePath);
|
||||
String imgStr = Base64Util.encode(imgData);
|
||||
String imgParam = URLEncoder.encode(imgStr, "UTF-8");
|
||||
|
||||
String param = "id_card_side=" + "front" + "&image=" + imgParam;
|
||||
|
||||
// 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
|
||||
String accessToken = AuthService.getAuth("iafhTwf6LnOMoYTiZQDlrKTu","0d3yoIsrsrAspUMoyNkWeeqDTvxvg9QB");
|
||||
|
||||
String result = HttpUtil.post(url, accessToken, param);
|
||||
System.out.println(result);
|
||||
return result;
|
||||
return HttpUtil.post(url, accessToken, param);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -44,6 +39,6 @@ public class IdCard {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
IdCard.idcard();
|
||||
IdCard.icarus();
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
}
|
||||
navInfoEditor.commit();
|
||||
}
|
||||
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
|
||||
Intent intent = new Intent(LoginActivity.this, GuidanceActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else {
|
||||
|
@ -82,6 +82,7 @@ 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 PictureActivity extends BaseActivity implements View.OnClickListener {
|
||||
@ -110,6 +111,12 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
private ImageView ivPic;
|
||||
private PoiEntity poiEntity;
|
||||
private Polyline polyline;
|
||||
private ImageView ivZoomAdd;
|
||||
private ImageView ivZoomDel;
|
||||
private ImageView ivLocation;
|
||||
private CheckBox cbMapType;
|
||||
private boolean isMapSlide = false;
|
||||
|
||||
private Handler handler=new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
@ -141,6 +148,24 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
// if (finalVideoPath == null) {
|
||||
// finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
|
||||
// }
|
||||
|
||||
ivZoomAdd = findViewById(R.id.iv_zoom_add);
|
||||
ivZoomAdd.setOnClickListener(this);
|
||||
ivZoomDel = findViewById(R.id.iv_zoom_del);
|
||||
ivZoomDel.setOnClickListener(this);
|
||||
cbMapType = findViewById(R.id.cb_map_type);
|
||||
cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE);
|
||||
} else {
|
||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
|
||||
}
|
||||
}
|
||||
});
|
||||
ivLocation = findViewById(R.id.iv_location);
|
||||
ivLocation.setOnClickListener(this);
|
||||
layerChange = findViewById(R.id.layer_change);
|
||||
timer = new Timer();
|
||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
@ -198,7 +223,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
//设置logo的大小
|
||||
uiSettings.setLogoScale(0.7f);
|
||||
// uiSettings.setAllGesturesEnabled(false);
|
||||
setLocMarkerStyle(); // 设置当前位置显示样式
|
||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);// 设置当前位置显示样式
|
||||
initLine();
|
||||
|
||||
// camera.addFrameProcessor(new FrameProcessor() {
|
||||
@ -442,6 +467,25 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
case R.id.btn_stop_video:
|
||||
stopVideoAndFinish();
|
||||
break;
|
||||
case R.id.iv_zoom_add://放大
|
||||
CameraUpdate cameraUpdateIn = CameraUpdateFactory.zoomIn();
|
||||
tencentMap.animateCamera(cameraUpdateIn);
|
||||
break;
|
||||
case R.id.iv_zoom_del://缩小
|
||||
CameraUpdate cameraUpdateOut = CameraUpdateFactory.zoomOut();
|
||||
tencentMap.animateCamera(cameraUpdateOut);
|
||||
break;
|
||||
case R.id.iv_location://定位:
|
||||
if (Constant.currentLocation != null) {
|
||||
CameraUpdate cameraSigma =
|
||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
0)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
@ -519,12 +563,12 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
/**
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setLocMarkerStyle() {
|
||||
private void setLocMarkerStyle(int type) {
|
||||
tencentMap.setLocationSource(new MyTecentLocationSource(this));
|
||||
tencentMap.setMyLocationEnabled(true);
|
||||
|
||||
locationStyle = new MyLocationStyle();
|
||||
locationStyle = locationStyle.myLocationType(LOCATION_TYPE_LOCATION_ROTATE);
|
||||
locationStyle = locationStyle.myLocationType(type);
|
||||
//创建图标
|
||||
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap());
|
||||
locationStyle.icon(bitmapDescriptor);
|
||||
@ -557,6 +601,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
ivMap.setLayoutParams(layoutParamsMap);
|
||||
layerChange.addView(camera);
|
||||
layerChange.addView(ivMap);
|
||||
initMapBig();
|
||||
} else {
|
||||
ivPic.setVisibility(View.GONE);
|
||||
layoutParamsMap.height = dm.heightPixels;
|
||||
@ -567,9 +612,29 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
ivMap.setLayoutParams(layoutParamsMap);
|
||||
layerChange.addView(ivMap);
|
||||
layerChange.addView(camera);
|
||||
initMapShort();
|
||||
}
|
||||
}
|
||||
|
||||
//小图
|
||||
private void initMapBig() {
|
||||
isMapSlide = false;
|
||||
ivZoomAdd.setVisibility(View.GONE);
|
||||
ivZoomDel.setVisibility(View.GONE);
|
||||
cbMapType.setVisibility(View.GONE);
|
||||
ivLocation.setVisibility(View.GONE);
|
||||
cbMapType.setChecked(false);
|
||||
}
|
||||
|
||||
//大图
|
||||
private void initMapShort() {
|
||||
isMapSlide = true;
|
||||
ivZoomAdd.setVisibility(View.VISIBLE);
|
||||
ivZoomDel.setVisibility(View.VISIBLE);
|
||||
cbMapType.setVisibility(View.VISIBLE);
|
||||
ivLocation.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@ -613,7 +678,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMessageMainThread(Message msg) {
|
||||
if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
|
||||
if (tencentMap != null) {
|
||||
if (tencentMap != null&& !isMapSlide) {
|
||||
CameraUpdate cameraSigma =
|
||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||
|
@ -18,6 +18,7 @@ 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 com.github.lazylibrary.util.FileUtils;
|
||||
@ -35,6 +36,7 @@ import com.otaliastudios.cameraview.FileCallback;
|
||||
import com.otaliastudios.cameraview.PictureResult;
|
||||
import com.otaliastudios.cameraview.VideoResult;
|
||||
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;
|
||||
@ -65,6 +67,8 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
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_MAP_ROTATE_NO_CENTER;
|
||||
|
||||
public class PicturesActivity extends BaseActivity implements View.OnClickListener {
|
||||
private static final CameraLogger LOG = CameraLogger.create("Picture");
|
||||
@ -79,6 +83,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
private String finalVideoPath; // 摄像后最终保存的文件名
|
||||
private ViewGroup layerChange; // 切换地图和相机的父控件
|
||||
private CheckBox capturePicture;//拍照
|
||||
private boolean isMapSlide = false;
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
@ -90,7 +95,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
}
|
||||
} else if (msg.what == 0x103) {
|
||||
listenerPicture = false;
|
||||
if (type!=3){
|
||||
if (type != 3) {
|
||||
capturePicture.setText("开始采集");
|
||||
}
|
||||
capturePicture.setChecked(false);
|
||||
@ -103,6 +108,10 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
private File paperFile;
|
||||
private int type;
|
||||
private int videoIndex;
|
||||
private ImageView ivZoomAdd;
|
||||
private ImageView ivZoomDel;
|
||||
private ImageView ivLocation;
|
||||
private CheckBox cbMapType;
|
||||
|
||||
|
||||
@Override
|
||||
@ -132,26 +141,45 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
btnSwitch.setOnClickListener(this);
|
||||
//相机记录器
|
||||
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
|
||||
ivZoomAdd = findViewById(R.id.iv_zoom_add);
|
||||
ivZoomAdd.setOnClickListener(this);
|
||||
ivZoomDel = findViewById(R.id.iv_zoom_del);
|
||||
ivZoomDel.setOnClickListener(this);
|
||||
cbMapType = findViewById(R.id.cb_map_type);
|
||||
cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
|
||||
|
||||
} else {
|
||||
setLocMarkerStyle(LOCATION_TYPE_MAP_ROTATE_NO_CENTER);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
ivLocation = findViewById(R.id.iv_location);
|
||||
ivLocation.setOnClickListener(this);
|
||||
camera = findViewById(R.id.camera);
|
||||
camera.setOnClickListener(this);
|
||||
capturePicture = findViewById(R.id.capture_picture);
|
||||
if (type==3){
|
||||
if (type == 3) {
|
||||
capturePicture.setText("拍摄");
|
||||
}else {
|
||||
} else {
|
||||
capturePicture.setText("开始采集");
|
||||
}
|
||||
capturePicture.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) { // 开始采集,设置按钮文字内容为“结束采集”
|
||||
if (type!=3){
|
||||
if (type != 3) {
|
||||
capturePicture.setText("暂停采集");
|
||||
}
|
||||
listenerPicture = true;
|
||||
camera.takePicture();
|
||||
} else {
|
||||
listenerPicture = false;
|
||||
if (type!=3){
|
||||
if (type != 3) {
|
||||
capturePicture.setText("开始采集");
|
||||
}
|
||||
}
|
||||
@ -162,12 +190,11 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
stopPicture.setOnClickListener(this);
|
||||
//获取地图
|
||||
tencentMap = ivMap.getMap();
|
||||
|
||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE);
|
||||
//获取地图UI 设置对象
|
||||
UiSettings uiSettings = tencentMap.getUiSettings();
|
||||
//设置logo的大小
|
||||
uiSettings.setLogoScale(0.7f);
|
||||
setLocMarkerStyle(); // 设置当前位置显示样式
|
||||
initLine();
|
||||
//相机预览监听
|
||||
camera.addCameraListener(new CameraListener() {
|
||||
@ -289,9 +316,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
case R.id.btn_stop_picture:
|
||||
listenerPicture = false;
|
||||
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("type",type);
|
||||
intent.putExtra("type", type);
|
||||
setResult(0x102, intent);
|
||||
finish();
|
||||
break;
|
||||
@ -301,6 +328,25 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
handler.sendEmptyMessageDelayed(0x102, 2000); // 利用handler延迟发送更改状态信息
|
||||
benSwitch();
|
||||
break;
|
||||
case R.id.iv_zoom_add://放大
|
||||
CameraUpdate cameraUpdateIn = CameraUpdateFactory.zoomIn();
|
||||
tencentMap.animateCamera(cameraUpdateIn);
|
||||
break;
|
||||
case R.id.iv_zoom_del://缩小
|
||||
CameraUpdate cameraUpdateOut = CameraUpdateFactory.zoomOut();
|
||||
tencentMap.animateCamera(cameraUpdateOut);
|
||||
break;
|
||||
case R.id.iv_location://定位:
|
||||
if (Constant.currentLocation != null) {
|
||||
CameraUpdate cameraSigma =
|
||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
0)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,12 +367,13 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
/**
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setLocMarkerStyle() {
|
||||
private void setLocMarkerStyle(int type) {
|
||||
tencentMap.setLocationSource(new MyTecentLocationSource(this));
|
||||
tencentMap.setMyLocationEnabled(true);
|
||||
|
||||
MyLocationStyle locationStyle = new MyLocationStyle();
|
||||
locationStyle = locationStyle.myLocationType(LOCATION_TYPE_LOCATION_ROTATE);
|
||||
//LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER
|
||||
locationStyle = locationStyle.myLocationType(type);
|
||||
//创建图标
|
||||
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap());
|
||||
locationStyle.icon(bitmapDescriptor);
|
||||
@ -359,6 +406,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
ivMap.setLayoutParams(layoutParamsMap);
|
||||
layerChange.addView(camera);
|
||||
layerChange.addView(ivMap);
|
||||
initMapBig();
|
||||
} else {
|
||||
layoutParamsMap.height = dm.heightPixels;
|
||||
layoutParamsMap.width = dm.widthPixels;
|
||||
@ -368,9 +416,32 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
ivMap.setLayoutParams(layoutParamsMap);
|
||||
layerChange.addView(ivMap);
|
||||
layerChange.addView(camera);
|
||||
initMapShort();
|
||||
}
|
||||
}
|
||||
|
||||
//小图
|
||||
private void initMapBig() {
|
||||
isMapSlide = false;
|
||||
ivZoomAdd.setVisibility(View.GONE);
|
||||
ivZoomDel.setVisibility(View.GONE);
|
||||
cbMapType.setVisibility(View.GONE);
|
||||
ivLocation.setVisibility(View.GONE);
|
||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE);
|
||||
cbMapType.setChecked(false);
|
||||
|
||||
}
|
||||
|
||||
//大图
|
||||
private void initMapShort() {
|
||||
isMapSlide = true;
|
||||
ivZoomAdd.setVisibility(View.VISIBLE);
|
||||
ivZoomDel.setVisibility(View.VISIBLE);
|
||||
cbMapType.setVisibility(View.VISIBLE);
|
||||
ivLocation.setVisibility(View.VISIBLE);
|
||||
setLocMarkerStyle(LOCATION_TYPE_MAP_ROTATE_NO_CENTER);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
@ -379,11 +450,12 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
if (type!=3){
|
||||
if (type != 3) {
|
||||
capturePicture.setChecked(false);
|
||||
capturePicture.setText("继续采集");
|
||||
}
|
||||
@ -393,7 +465,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
camera.close();
|
||||
if (type!=3){
|
||||
if (type != 3) {
|
||||
listenerPicture = false;
|
||||
}
|
||||
|
||||
@ -422,14 +494,16 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMessageMainThread(Message msg) {
|
||||
if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
|
||||
if (tencentMap != null) {
|
||||
if (tencentMap != null && !isMapSlide) {
|
||||
TencentLocation tencentLocation = (TencentLocation) msg.obj;
|
||||
CameraUpdate cameraSigma =
|
||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||
16, //目标缩放级别
|
||||
new LatLng(tencentLocation.getLatitude(), tencentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
0, //目标倾斜角
|
||||
0)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ import org.json.JSONArray;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
@ -116,13 +117,13 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_gathering:
|
||||
getActivity().finish();
|
||||
Objects.requireNonNull(getActivity()).finish();
|
||||
break;
|
||||
case R.id.et_bank_num:
|
||||
|
||||
break;
|
||||
case R.id.iv_bank:
|
||||
String bankJson = new GetJsonDataUtil().getJson(getContext(), "bank.json");//获取assets目录下的json文件数据
|
||||
String bankJson = new GetJsonDataUtil().getJson(Objects.requireNonNull(getContext()), "bank.json");//获取assets目录下的json文件数据
|
||||
//用Gabon 转成实体
|
||||
jsonBean = parseData(bankJson);
|
||||
Dialog dialog = new Dialog(getContext());
|
||||
@ -146,6 +147,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
Window window = dialog.getWindow();
|
||||
assert window != null;
|
||||
WindowManager.LayoutParams wlp = window.getAttributes();
|
||||
wlp.gravity = Gravity.BOTTOM;
|
||||
wlp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
@ -154,7 +156,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
dialog.show();
|
||||
break;
|
||||
case R.id.btn_bank:
|
||||
if (etBankNum.getText().toString() == null && etBankNum.getText().toString().equals("")) {
|
||||
if (etBankNum.getText().toString().equals("")) {
|
||||
Toast.makeText(getActivity(), "银行卡号不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
@ -202,7 +204,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
public void onSuccess(BankPhoneBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "绑定成功", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "绑定成功", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Constant.BANKACCOUNT=value;
|
||||
@ -212,7 +214,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "绑定失败", "确定","取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "绑定失败", "确定","取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Toast.makeText(getActivity(), response.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
@ -234,7 +236,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 131 && resultCode == RESULT_OK) {
|
||||
if (file == null && !file.exists()) {
|
||||
if (file == null||!file.exists()) {
|
||||
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
@ -242,14 +244,20 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
Constant.FILE_PATH = absolutePath;
|
||||
gatheringCamera.setTag(absolutePath);
|
||||
//银行卡识别
|
||||
BankCardBean bankCardBean = new Gson().fromJson(BankCard.bankCard(), BankCardBean.class);
|
||||
if (bankCardBean==null){
|
||||
Toast.makeText(getContext(), "请手动添加银行卡号", Toast.LENGTH_SHORT).show();
|
||||
String bankCard = BankCard.bankCard();
|
||||
if (bankCard!=null&&!bankCard.equals("")){
|
||||
BankCardBean bankCardBean = new Gson().fromJson(bankCard, BankCardBean.class);
|
||||
if (bankCardBean==null){
|
||||
Toast.makeText(getContext(), "请手动添加银行卡号", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
String bank_card_number = bankCardBean.getResult().getBank_card_number();
|
||||
etBankNum.setText(bank_card_number);
|
||||
}
|
||||
}else {
|
||||
String bank_card_number = bankCardBean.getResult().getBank_card_number();
|
||||
etBankNum.setText(bank_card_number);
|
||||
Toast.makeText(getContext(), "请手动添加银行卡号", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private MyLocationStyle locationStyle;
|
||||
private ImageView ivLocation;
|
||||
private ImageView ivSubmit;
|
||||
private ImageView ivRefish;
|
||||
private ImageView ivRaffish;
|
||||
private SlidingUpPanelLayout sliding_layout;
|
||||
// private FragmentTransaction fragmentTransaction;
|
||||
private Marker markerPoi;
|
||||
@ -113,10 +113,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private Point screenPosition; //marker的屏幕坐标
|
||||
private FrameLayout frameLayout;
|
||||
private GatherGetFragment gatherGetFragment;
|
||||
private LinearLayout dragView;
|
||||
public ImageView ivMessage;
|
||||
private PoiDao poiDao;
|
||||
private String userEncode;
|
||||
private String centerEncode;
|
||||
private List<Removable> removables;
|
||||
private List<Removable> removableScreenMarker;
|
||||
@ -182,10 +180,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
|
||||
poiDao = poiDatabase.getPoiDao();
|
||||
sliding_layout = findViewById(R.id.sliding_layout);
|
||||
dragView = findViewById(R.id.dragView);
|
||||
LinearLayout dragView = findViewById(R.id.dragView);
|
||||
frameLayout = findViewById(R.id.frame_layout);
|
||||
ivRefish = findViewById(R.id.iv_refrish);
|
||||
ivRefish.setOnClickListener(this);
|
||||
ivRaffish = findViewById(R.id.iv_refrish);
|
||||
ivRaffish.setOnClickListener(this);
|
||||
ivFilter = findViewById(R.id.iv_filter);
|
||||
ivFilter.setOnClickListener(this);
|
||||
ivSubmit = findViewById(R.id.iv_submit);
|
||||
@ -388,7 +386,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
if (mapCenterPoint != null) {
|
||||
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
|
||||
}
|
||||
userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
||||
String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
||||
OkGo.getInstance().cancelTag(this);
|
||||
showLoadingDialog();
|
||||
// 请求方式和请求url
|
||||
@ -1225,7 +1223,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
ivZoomAdd.setVisibility(visitable);
|
||||
ivZoomDel.setVisibility(visitable);
|
||||
ivLocation.setVisibility(visitable);
|
||||
ivRefish.setVisibility(visitable);
|
||||
ivRaffish.setVisibility(visitable);
|
||||
cbMapType.setVisibility(visitable);
|
||||
ivSubmit.setVisibility(visitable);
|
||||
ivFilter.setVisibility(visitable);
|
||||
@ -1276,7 +1274,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
locationStyle = new MyLocationStyle();
|
||||
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
|
||||
//创建图标
|
||||
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.location));
|
||||
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap());
|
||||
locationStyle.icon(bitmapDescriptor);
|
||||
//设置定位圆形区域的边框宽度;
|
||||
locationStyle.strokeWidth(1);
|
||||
@ -1301,8 +1299,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
tencentMap.setMyLocationStyle(locationStyle);
|
||||
}
|
||||
|
||||
private Bitmap getBitMap(int resourceId) {
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
|
||||
private Bitmap getBitMap() {
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.location);
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
int newWidth = 55;
|
||||
|
@ -342,7 +342,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
tvCard3.setVisibility(View.GONE);
|
||||
|
||||
}else if (requestCode == 124 && resultCode == RESULT_OK){
|
||||
if (file == null && !file.exists()) {
|
||||
if (file == null || !file.exists()) {
|
||||
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
@ -350,13 +350,20 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
Constant.FILE_PATH = absolutePath;
|
||||
useCamera.setTag(absolutePath);
|
||||
//身份证识别
|
||||
IdCardNumberBean idCardNumberBean = new Gson().fromJson(IdCard.idcard(), IdCardNumberBean.class);
|
||||
if (idCardNumberBean ==null){
|
||||
Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show();
|
||||
String icarus = IdCard.icarus();
|
||||
if (icarus!=null&&!icarus.equals("")){
|
||||
IdCardNumberBean idCardNumberBean = new Gson().fromJson(icarus, IdCardNumberBean.class);
|
||||
if (idCardNumberBean ==null){
|
||||
Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
String words = idCardNumberBean.getWords_result().get公民身份号码().getWords();
|
||||
etNamePhone.setText(words);
|
||||
}
|
||||
}else {
|
||||
String words = idCardNumberBean.getWords_result().get公民身份号码().getWords();
|
||||
etNamePhone.setText(words);
|
||||
Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,13 +65,13 @@ public class HttpUtil {
|
||||
BufferedReader in = null;
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), encoding));
|
||||
String result = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
String getLine;
|
||||
while ((getLine = in.readLine()) != null) {
|
||||
result += getLine;
|
||||
result.append(getLine);
|
||||
}
|
||||
in.close();
|
||||
System.err.println("result:" + result);
|
||||
return result;
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,49 @@
|
||||
app:layout_constraintWidth_percent="0.4" />
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_zoom_add"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@mipmap/zoom_add"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_zoom_del"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@mipmap/zoom_del"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_add"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_add" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_map_type"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:background="@drawable/atlas_selector"
|
||||
android:button="@null"
|
||||
android:checked="false"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_location"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@mipmap/mine_location"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/cb_map_type"
|
||||
app:layout_constraintTop_toBottomOf="@id/cb_map_type" />
|
||||
<Button
|
||||
android:id="@+id/btn_switch"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -6,10 +6,12 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FF444444"
|
||||
tools:context=".activity.PicturesActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layer_change"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.otaliastudios.cameraview.CameraView
|
||||
android:id="@+id/camera"
|
||||
android:layout_width="match_parent"
|
||||
@ -30,6 +32,50 @@
|
||||
app:layout_constraintWidth_percent="0.4" />
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_zoom_add"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@mipmap/zoom_add"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_zoom_del"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@mipmap/zoom_del"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_add"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_add" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_map_type"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:background="@drawable/atlas_selector"
|
||||
android:button="@null"
|
||||
android:checked="false"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_location"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@mipmap/mine_location"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/cb_map_type"
|
||||
app:layout_constraintTop_toBottomOf="@id/cb_map_type" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_switch"
|
||||
@ -42,7 +88,6 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/capture_picture"
|
||||
style="@style/user_data_style"
|
||||
|
@ -57,11 +57,11 @@
|
||||
android:id="@+id/cb_map_type"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/atlas_selector"
|
||||
android:button="@null"
|
||||
android:checked="false"
|
||||
app:layout_constraintBottom_toTopOf="@+id/iv_submit"
|
||||
app:layout_constraintBottom_toTopOf="@+id/iv_submit"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_zoom_add"
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user