修改点位作业的拍照

This commit is contained in:
wangdongsheng 2021-09-10 18:17:41 +08:00
parent 30c374b2d9
commit 5ace14ca36
14 changed files with 419 additions and 513 deletions

View File

@ -58,8 +58,10 @@
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" <activity
android:screenOrientation="portrait" /> android:name=".activity.PhotographActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
android:launchMode="singleTop" />
<meta-data <meta-data
android:name="TencentMapSDK" android:name="TencentMapSDK"

View File

@ -74,9 +74,8 @@ import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_
/** /**
* 照片对应 * 照片对应
*/ */
public class PhotographActivity extends BaseActivity implements View.OnClickListener { public class PhotographActivity extends BaseActivity implements View.OnClickListener {
private static final CameraLogger LOG = CameraLogger.create("Picture");
private CameraView cameraView; private CameraView cameraView;
private String photo_path; private String photo_path;
@ -105,6 +104,8 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
if (getIntent()!=null){ if (getIntent()!=null){
photo_path = getIntent().getStringExtra(Constant.INTENT_PHOTO_PATH); photo_path = getIntent().getStringExtra(Constant.INTENT_PHOTO_PATH);
} }
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
cameraView = findViewById(R.id.camera); cameraView = findViewById(R.id.camera);
cameraView.setOnClickListener(this); cameraView.setOnClickListener(this);
Button btnCapturePicture = findViewById(R.id.capture_picture); Button btnCapturePicture = findViewById(R.id.capture_picture);
@ -152,5 +153,4 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
EventBus.getDefault().unregister(this); EventBus.getDefault().unregister(this);
} }
} }
} }

View File

@ -588,7 +588,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
public void benSwitch() { public void benSwitch() {
DisplayMetrics dm = new DisplayMetrics(); DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm); getWindowManager().getDefaultDisplay().getMetrics(dm);
System.out.println("width-display :" + dm.widthPixels); System.out.println("width-display :" + dm.widthPixels);
System.out.println("height-display :" + dm.heightPixels); System.out.println("height-display :" + dm.heightPixels);
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//地图的宽高 FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//地图的宽高
@ -630,7 +629,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
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);
} }
//大图 //大图
@ -640,7 +638,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
ivZoomDel.setVisibility(View.VISIBLE); ivZoomDel.setVisibility(View.VISIBLE);
ivLocation.setVisibility(View.VISIBLE); ivLocation.setVisibility(View.VISIBLE);
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER); setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
} }
@Override @Override
@ -662,8 +659,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
super.onPause(); super.onPause();
camera.close(); camera.close();
stopTakenVideo(); stopTakenVideo();
} }
@Override @Override
@ -738,7 +733,9 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
sb.append("\r\n"); sb.append("\r\n");
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);

View File

@ -41,6 +41,7 @@ import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
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.ChargingPileSaveBean; import com.navinfo.outdoor.bean.ChargingPileSaveBean;
@ -108,7 +109,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private String pid; private String pid;
private String station; private String station;
private LatLng latLng; private LatLng latLng;
private File file;
private Marker markerPile; private Marker markerPile;
private Point screenPilePositions; private Point screenPilePositions;
private ChargingPileEntity chargingPileEntity; private ChargingPileEntity chargingPileEntity;
@ -909,64 +909,64 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}); });
break; break;
case R.id.rl_panorama: case R.id.rl_panorama:
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("a", latLng); File panoramaFile = PhotoUtils.showPhotoFile("a", latLng);
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, panoramaFile.getPath());
startActivityForResult(intentPanorama, 101); startActivityForResult(intentPanorama, 101);
break; break;
case R.id.rl_coding: case R.id.rl_coding:
Intent intentCoding = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentCoding = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("b", latLng); File codingFile = PhotoUtils.showPhotoFile("b", latLng);
intentCoding.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentCoding.putExtra(Constant.INTENT_PHOTO_PATH, codingFile.getPath());
startActivityForResult(intentCoding, 102); startActivityForResult(intentCoding, 102);
break; break;
case R.id.rl_equipment: case R.id.rl_equipment:
Intent intentEquipment = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentEquipment = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("c", latLng); File equipmentFile = PhotoUtils.showPhotoFile("c", latLng);
intentEquipment.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentEquipment.putExtra(Constant.INTENT_PHOTO_PATH, equipmentFile.getPath());
startActivityForResult(intentEquipment, 103); startActivityForResult(intentEquipment, 103);
break; break;
case R.id.rl_facility: case R.id.rl_facility:
Intent intentFacility = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentFacility = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("c", latLng); File facilityFile = PhotoUtils.showPhotoFile("c", latLng);
intentFacility.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentFacility.putExtra(Constant.INTENT_PHOTO_PATH, facilityFile.getPath());
startActivityForResult(intentFacility, 104); startActivityForResult(intentFacility, 104);
break; break;
case R.id.rl_scutcheon: case R.id.rl_scutcheon:
Intent intentScutcheon = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("c", latLng); File scutcheonFile = PhotoUtils.showPhotoFile("c", latLng);
intentScutcheon.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
startActivityForResult(intentScutcheon, 105); startActivityForResult(intentScutcheon, 105);
break; break;
case R.id.rl_device: case R.id.rl_device:
Intent intentDevice = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentDevice = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("c", latLng); File deviceFile = PhotoUtils.showPhotoFile("c", latLng);
intentDevice.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentDevice.putExtra(Constant.INTENT_PHOTO_PATH, deviceFile.getPath());
startActivityForResult(intentDevice, 106); startActivityForResult(intentDevice, 106);
break; break;
case R.id.rl_usable: case R.id.rl_usable:
Intent intentUsable = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentUsable = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("d", latLng); File usableFile = PhotoUtils.showPhotoFile("d", latLng);
intentUsable.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentUsable.putExtra(Constant.INTENT_PHOTO_PATH, usableFile.getPath());
startActivityForResult(intentUsable, 107); startActivityForResult(intentUsable, 107);
break; break;
case R.id.rl_available: case R.id.rl_available:
Intent intentAvailable = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentAvailable = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("d", latLng); File availableFile = PhotoUtils.showPhotoFile("d", latLng);
intentAvailable.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentAvailable.putExtra(Constant.INTENT_PHOTO_PATH, availableFile.getPath());
startActivityForResult(intentAvailable, 108); startActivityForResult(intentAvailable, 108);
break; break;
case R.id.rl_parking: case R.id.rl_parking:
Intent intentParking = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentParking = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("e", latLng); File parkingFile = PhotoUtils.showPhotoFile("e", latLng);
intentParking.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentParking.putExtra(Constant.INTENT_PHOTO_PATH, parkingFile.getPath());
startActivityForResult(intentParking, 109); startActivityForResult(intentParking, 109);
break; break;
case R.id.rl_number: case R.id.rl_number:
Intent intentNumber = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentNumber = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("e", latLng); File numberFile = PhotoUtils.showPhotoFile("e", latLng);
intentNumber.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentNumber.putExtra(Constant.INTENT_PHOTO_PATH, numberFile.getPath());
startActivityForResult(intentNumber, 110); startActivityForResult(intentNumber, 110);
break; break;
@ -1058,114 +1058,98 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@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 (file == null || !file.exists()) { if (requestCode==101){
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); assert data != null;
return; String file = data.getStringExtra("file");
assert file != null;
} else { File videoFile = new File(file);
String s = PhotoUtils.showPhotoAndGetPath(file, ivPanorama); if (videoFile.exists()) {
tvPanorama.setTag(s); String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPanorama);
tvPanorama.setTag(andGetPath);
} }
file = null; } else if (requestCode==102){
} else if (requestCode == 102 && resultCode == RESULT_OK) { assert data != null;
if (file == null || !file.exists()) { String file = data.getStringExtra("file");
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); assert file != null;
return; File videoFile = new File(file);
if (videoFile.exists()) {
} else { String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivCoding);
String s = PhotoUtils.showPhotoAndGetPath(file, ivCoding); tvCoding.setTag(andGetPath);
tvCoding.setTag(s);
} }
file = null; }else if (requestCode==103){
} else if (requestCode == 103 && resultCode == RESULT_OK) { assert data != null;
if (file == null || !file.exists()) { String file = data.getStringExtra("file");
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); assert file != null;
return; File videoFile = new File(file);
if (videoFile.exists()) {
} else { String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivEquipment);
String s = PhotoUtils.showPhotoAndGetPath(file, ivEquipment); tvEquipment.setTag(andGetPath);
tvEquipment.setTag(s);
} }
file = null; }else if (requestCode==104){
assert data != null;
} else if (requestCode == 104 && resultCode == RESULT_OK) { String file = data.getStringExtra("file");
if (file == null || !file.exists()) { assert file != null;
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); File videoFile = new File(file);
return; if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivFacility);
} else { tvFacility.setTag(andGetPath);
String s = PhotoUtils.showPhotoAndGetPath(file, ivFacility);
tvFacility.setTag(s);
} }
file = null; }else if (requestCode==105){
assert data != null;
} else if (requestCode == 105 && resultCode == RESULT_OK) { String file = data.getStringExtra("file");
if (file == null || !file.exists()) { assert file != null;
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); File videoFile = new File(file);
return; if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivScutcheon);
} else { tvScutcheon.setTag(andGetPath);
String s = PhotoUtils.showPhotoAndGetPath(file, ivScutcheon);
tvScutcheon.setTag(s);
} }
file = null; }else if (requestCode==106){
assert data != null;
} else if (requestCode == 106 && resultCode == RESULT_OK) { String file = data.getStringExtra("file");
if (file == null || !file.exists()) { assert file != null;
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); File videoFile = new File(file);
return; if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivDevice);
} else { tvDevice.setTag(andGetPath);
String s = PhotoUtils.showPhotoAndGetPath(file, ivDevice);
tvDevice.setTag(s);
} }
}else if (requestCode==107){
file = null; assert data != null;
String file = data.getStringExtra("file");
} else if (requestCode == 107 && resultCode == RESULT_OK) { assert file != null;
if (file == null || !file.exists()) { File videoFile = new File(file);
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); if (videoFile.exists()) {
return; String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivUsable);
tvUsable.setTag(andGetPath);
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivUsable);
tvUsable.setTag(s);
} }
file = null; }else if (requestCode==108){
assert data != null;
} else if (requestCode == 108 && resultCode == RESULT_OK) { String file = data.getStringExtra("file");
if (file == null || !file.exists()) { assert file != null;
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); File videoFile = new File(file);
return; if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAvailable);
} else { tvAvailable.setTag(andGetPath);
String s = PhotoUtils.showPhotoAndGetPath(file, ivAvailable);
tvAvailable.setTag(s);
} }
file = null; }else if (requestCode==109){
assert data != null;
} else if (requestCode == 109 && resultCode == RESULT_OK) { String file = data.getStringExtra("file");
if (file == null || !file.exists()) { assert file != null;
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); File videoFile = new File(file);
return; if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivParking);
} else { tvParking.setTag(andGetPath);
String s = PhotoUtils.showPhotoAndGetPath(file, ivParking); }
tvParking.setTag(s); }else if (requestCode==110){
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivNumber);
tvNumber.setTag(andGetPath);
} }
file = null;
} else if (requestCode == 110 && resultCode == RESULT_OK) {
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivNumber);
tvNumber.setTag(s);
} }
file = null;
} }
} }

View File

@ -42,6 +42,7 @@ import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
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.adapter.ChargingPileAdapter; import com.navinfo.outdoor.adapter.ChargingPileAdapter;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment; import com.navinfo.outdoor.base.BaseDrawerFragment;
@ -126,7 +127,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String str = ""; String str = "";
// private ArrayList<File> fileList; // private ArrayList<File> fileList;
private File photoFile; // 拍照保存的路径
private NestedScrollView nestedScrollView; private NestedScrollView nestedScrollView;
private Marker markerStation; private Marker markerStation;
private Point screenStationPositions; private Point screenStationPositions;
@ -844,33 +844,33 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
findingDuplicateByWork(); findingDuplicateByWork();
break; break;
case R.id.rl_panorama: case R.id.rl_panorama:
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
photoFile = PhotoUtils.showPhotoFile("a", latLng); File PanoramaFile = PhotoUtils.showPhotoFile("a", latLng);
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, PanoramaFile.getPath());
startActivityForResult(intentPanorama, 101); startActivityForResult(intentPanorama, 101);
break; break;
case R.id.rl_name: case R.id.rl_name:
Intent intentName = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentName = new Intent(getActivity(), PhotographActivity.class);
photoFile = PhotoUtils.showPhotoFile("b", latLng); File nameFile = PhotoUtils.showPhotoFile("b", latLng);
intentName.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); intentName.putExtra(Constant.INTENT_PHOTO_PATH, nameFile.getPath());
startActivityForResult(intentName, 102); startActivityForResult(intentName, 102);
break; break;
case R.id.rl_internal_photos: case R.id.rl_internal_photos:
Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
photoFile = PhotoUtils.showPhotoFile("c", latLng); File internalFile = PhotoUtils.showPhotoFile("c", latLng);
intentInternal.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, internalFile.getPath());
startActivityForResult(intentInternal, 103); startActivityForResult(intentInternal, 103);
break; break;
case R.id.rl_else: case R.id.rl_else:
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
photoFile = PhotoUtils.showPhotoFile("d", latLng); File elseFile = PhotoUtils.showPhotoFile("d", latLng);
intentElse.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); intentElse.putExtra(Constant.INTENT_PHOTO_PATH, elseFile.getPath());
startActivityForResult(intentElse, 104); startActivityForResult(intentElse, 104);
break; break;
case R.id.rl_scutcheon: case R.id.rl_scutcheon:
Intent intentScutcheon = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
photoFile = PhotoUtils.showPhotoFile("e", latLng); File scutcheonFile = PhotoUtils.showPhotoFile("e", latLng);
intentScutcheon.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
startActivityForResult(intentScutcheon, 105); startActivityForResult(intentScutcheon, 105);
break; break;
case R.id.linear_charging_pile: case R.id.linear_charging_pile:
@ -1313,46 +1313,53 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@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 (photoFile == null || !photoFile.exists()) { if (requestCode==101){
ToastUtil.showShort(getActivity(), "取消拍照"); assert data != null;
return; String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPanorama);
tvPanorama.setTag(andGetPath);
} }
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivPanorama); }else if (requestCode==102){
tvPanorama.setTag(photoPath); assert data != null;
photoFile = null; String file = data.getStringExtra("file");
} else if (requestCode == 102 && resultCode == RESULT_OK) { assert file != null;
if (photoFile == null || !photoFile.exists()) { File videoFile = new File(file);
ToastUtil.showShort(getActivity(), "取消拍照"); if (videoFile.exists()) {
return; String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivName);
tvNamePic.setTag(andGetPath);
} }
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivName); }else if (requestCode==103){
tvNamePic.setTag(photoPath); assert data != null;
photoFile = null; String file = data.getStringExtra("file");
} else if (requestCode == 103 && resultCode == RESULT_OK) { assert file != null;
if (photoFile == null || !photoFile.exists()) { File videoFile = new File(file);
ToastUtil.showShort(getActivity(), "取消拍照"); if (videoFile.exists()) {
return; String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivInternal);
tvInternal.setTag(andGetPath);
} }
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivInternal); }else if (requestCode==104){
tvInternal.setTag(photoPath); assert data != null;
photoFile = null; String file = data.getStringExtra("file");
} else if (requestCode == 104 && resultCode == RESULT_OK) { assert file != null;
if (photoFile == null || !photoFile.exists()) { File videoFile = new File(file);
ToastUtil.showShort(getActivity(), "取消拍照"); if (videoFile.exists()) {
return; String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivElse);
tvElse.setTag(andGetPath);
}
}else if (requestCode==105){
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivScutcheon);
tvScutcheon.setTag(andGetPath);
} }
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivElse);
tvElse.setTag(photoPath);
photoFile = null;
} else if (requestCode == 105 && resultCode == RESULT_OK) {
if (photoFile == null || !photoFile.exists()) {
ToastUtil.showShort(getActivity(), "取消拍照");
return;
} }
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivScutcheon);
tvScutcheon.setTag(photoPath);
photoFile = null;
} }
} }

View File

@ -28,6 +28,7 @@ import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.v3.MessageDialog; import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.PhotographActivity;
import com.navinfo.outdoor.adapter.BankAdapter; import com.navinfo.outdoor.adapter.BankAdapter;
import com.navinfo.outdoor.api.BankCard; import com.navinfo.outdoor.api.BankCard;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
@ -60,7 +61,6 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
private ArrayList<BankPathBean> jsonBean; private ArrayList<BankPathBean> jsonBean;
private String value; private String value;
private File file;
public static GatheringFragment newInstance(Bundle bundle) { public static GatheringFragment newInstance(Bundle bundle) {
@ -152,9 +152,9 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
gatheringNetWork(); gatheringNetWork();
break; break;
case R.id.gathering_camera: case R.id.gathering_camera:
Intent gatheringNumberIntent = new Intent("android.media.action.IMAGE_CAPTURE"); Intent gatheringNumberIntent = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("a", null); File file = PhotoUtils.showPhotoFile("a", null);
gatheringNumberIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); gatheringNumberIntent.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
startActivityForResult(gatheringNumberIntent, 131); startActivityForResult(gatheringNumberIntent, 131);
break; break;
} }
@ -223,12 +223,14 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
@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 == 131 && resultCode == RESULT_OK) { if (resultCode == 0x104) {
if (file == null||!file.exists()) { if (requestCode == 131) {
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show(); assert data != null;
return; String file = data.getStringExtra("file");
} assert file != null;
String absolutePath = file.getAbsolutePath(); File videoFile = new File(file);
if (videoFile.exists()) {
String absolutePath = videoFile.getAbsolutePath();
Constant.FILE_PATH = absolutePath; Constant.FILE_PATH = absolutePath;
gatheringCamera.setTag(absolutePath); gatheringCamera.setTag(absolutePath);
//银行卡识别 //银行卡识别
@ -245,6 +247,8 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
} }
} }
} }
}
}
//所属银行解析 //所属银行解析
public ArrayList<BankPathBean> parseData(String result) {//Gao 解析 public ArrayList<BankPathBean> parseData(String result) {//Gao 解析

View File

@ -108,8 +108,6 @@ public class MessageFragment extends BaseFragment implements View.OnClickListene
}else { }else {
Toast.makeText(getActivity(), taskPrefectureBean.getMessage()+"", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), taskPrefectureBean.getMessage()+"", Toast.LENGTH_SHORT).show();
} }
Log.d("TAG", "onSuccess: " + taskPrefectureBean.getMessage() + ""); Log.d("TAG", "onSuccess: " + taskPrefectureBean.getMessage() + "");
//initTaskSpecification(taskSpecificationBean,start); //initTaskSpecification(taskSpecificationBean,start);
} }

View File

@ -1,5 +1,6 @@
package com.navinfo.outdoor.fragment; package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
@ -61,6 +62,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
return R.layout.mine_fragment; return R.layout.mine_fragment;
} }
@SuppressLint("SetTextI18n")
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
@ -96,7 +98,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
mainGrade = (TextView) findViewById(R.id.main_grade); mainGrade = (TextView) findViewById(R.id.main_grade);
tvMainGrade = findViewById(R.id.tv_main_grade); tvMainGrade = findViewById(R.id.tv_main_grade);
if (Constant.LEVEL != 0) { if (Constant.LEVEL != 0) {
tvMainGrade.setText(Constant.LEVEL); tvMainGrade.setText(Constant.LEVEL+"");
} }
initNetWork(); initNetWork();

View File

@ -636,7 +636,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
assert file != null; assert file != null;
File videoFile = new File(file); File videoFile = new File(file);
if (videoFile.exists()) { if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPicture, 500);
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPicture); String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPicture);
tvPicture.setTag(andGetPath); tvPicture.setTag(andGetPath);
} }
@ -646,33 +645,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
assert file != null; assert file != null;
File videoFile = new File(file); File videoFile = new File(file);
if (videoFile.exists()) { if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPictures, 500);
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPictures); String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPictures);
tvPictures.setTag(andGetPath); tvPictures.setTag(andGetPath);
} }
} }
} }
/* if (requestCode == 101 && resultCode == RESULT_OK) {
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivPicture);
tvPicture.setTag(s);
}
file = null;
} else if (requestCode == 102 && resultCode == RESULT_OK) {
//照片路径
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivPictures);
tvPictures.setTag(s);
}
file = null;
}*/
} }
@Override @Override

View File

@ -41,6 +41,7 @@ import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
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.GetPhoneBean; import com.navinfo.outdoor.bean.GetPhoneBean;
@ -111,7 +112,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
private LinearLayout linearContact; private LinearLayout linearContact;
private ContactView contactView; private ContactView contactView;
private ArrayList<File> poiPicList; private ArrayList<File> poiPicList;
private File file;
private Marker markerPoi; private Marker markerPoi;
private Point screenPoiPositions; private Point screenPoiPositions;
@ -648,33 +648,33 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
findingDuplicateByWork(); findingDuplicateByWork();
break; break;
case R.id.rl_panorama: case R.id.rl_panorama:
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("a", latLng); File filePanorama = PhotoUtils.showPhotoFile("a", latLng);
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, filePanorama.getPath());
startActivityForResult(intentPanorama, 101); startActivityForResult(intentPanorama, 101);
break; break;
case R.id.rl_name: case R.id.rl_name:
Intent intentName = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentName = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("b", latLng); File fileName = PhotoUtils.showPhotoFile("b", latLng);
intentName.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentName.putExtra(Constant.INTENT_PHOTO_PATH, fileName.getPath());
startActivityForResult(intentName, 102); startActivityForResult(intentName, 102);
break; break;
case R.id.rl_internal_photos: case R.id.rl_internal_photos:
Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("c", latLng); File fileInternal = PhotoUtils.showPhotoFile("c", latLng);
intentInternal.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, fileInternal.getPath());
startActivityForResult(intentInternal, 103); startActivityForResult(intentInternal, 103);
break; break;
case R.id.rl_card: case R.id.rl_card:
Intent intentCard = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentCard = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("d", latLng); File fileCard = PhotoUtils.showPhotoFile("d", latLng);
intentCard.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentCard.putExtra(Constant.INTENT_PHOTO_PATH, fileCard.getPath());
startActivityForResult(intentCard, 104); startActivityForResult(intentCard, 104);
break; break;
case R.id.rl_else: case R.id.rl_else:
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE"); Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("e", latLng); File fileElse = PhotoUtils.showPhotoFile("e", latLng);
intentElse.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); intentElse.putExtra(Constant.INTENT_PHOTO_PATH, fileElse.getPath());
startActivityForResult(intentElse, 105); startActivityForResult(intentElse, 105);
break; break;
} }
@ -925,128 +925,53 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@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 (file == null || !file.exists()) { if (requestCode==101){
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show(); assert data != null;
return; String file = data.getStringExtra("file");
} else { assert file != null;
String s = PhotoUtils.showPhotoAndGetPath(file, ivPanorama); File videoFile = new File(file);
tvPanorama.setTag(s); if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPanorama);
tvPanorama.setTag(andGetPath);
} }
file = null; }else if (requestCode==102){
/* int height = bitmap.getHeight(); assert data != null;
int width = bitmap.getWidth(); String file = data.getStringExtra("file");
if (height > width) { assert file != null;
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE; File videoFile = new File(file);
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() { if (videoFile.exists()) {
@Override String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivName);
public boolean onClick(BaseDialog baseDialog, View v) { tvPoiNamePic.setTag(andGetPath);
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 101);
return false;
} }
}); }else if (requestCode==103){
} else { assert data != null;
String file = data.getStringExtra("file");
}*/ assert file != null;
} else if (requestCode == 102 && resultCode == RESULT_OK) { File videoFile = new File(file);
if (videoFile.exists()) {
if (file == null || !file.exists()) { String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivInternal);
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show(); tvInternal.setTag(andGetPath);
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivName);
tvPoiNamePic.setTag(s);
} }
file = null; }else if (requestCode==104){
assert data != null;
/* int height = bitmap.getHeight(); String file = data.getStringExtra("file");
int width = bitmap.getWidth(); assert file != null;
if (height > width) { File videoFile = new File(file);
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE; if (videoFile.exists()) {
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() { String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivCard);
@Override tvCard.setTag(andGetPath);
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 102);
return false;
} }
}); }else if (requestCode==105){
} else { assert data != null;
String file = data.getStringExtra("file");
}*/ assert file != null;
} else if (requestCode == 103 && resultCode == RESULT_OK) { File videoFile = new File(file);
if (file == null || !file.exists()) { if (videoFile.exists()) {
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show(); String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivElse);
return; tvElse.setTag(andGetPath);
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivInternal);
tvInternal.setTag(s);
} }
file = null;
/*int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 103);
return false;
} }
});
} else {
}*/
} else if (requestCode == 104 && resultCode == RESULT_OK) {
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivCard);
tvCard.setTag(s);
}
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 104);
return false;
}
});
} else {
}*/
} else if (requestCode == 105 && resultCode == RESULT_OK) {
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivElse);
tvElse.setTag(s);
}
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 105);
return false;
}
});
} else {}*/
} }
} }

View File

@ -23,6 +23,7 @@ import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog; import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.PhotographActivity;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.api.IdCard; import com.navinfo.outdoor.api.IdCard;
import com.navinfo.outdoor.base.BaseFragment; import com.navinfo.outdoor.base.BaseFragment;
@ -57,11 +58,10 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
private TextView tvCard2; private TextView tvCard2;
private ImageView ivHera3; private ImageView ivHera3;
private TextView tvCard3; private TextView tvCard3;
private File file; /* private LinearLayout linearHint;
private LinearLayout linearHint;
private TextView tvTitle; private TextView tvTitle;
private LinearLayout linearLayout; private LinearLayout linearLayout;
private View userAttestView; private View userAttestView;*/
private ImageView useCamera; private ImageView useCamera;
@ -157,21 +157,21 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
Objects.requireNonNull(getActivity()).finish(); Objects.requireNonNull(getActivity()).finish();
break; break;
case R.id.iv_attestation1: case R.id.iv_attestation1:
Intent ivAttestationIntent1 = new Intent("android.media.action.IMAGE_CAPTURE"); Intent ivAttestationIntent1 = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("a", null); File attestationFile1 = PhotoUtils.showPhotoFile("a", null);
ivAttestationIntent1.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); ivAttestationIntent1.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile1.getPath());
startActivityForResult(ivAttestationIntent1, 121); startActivityForResult(ivAttestationIntent1, 121);
break; break;
case R.id.iv_attestation2: case R.id.iv_attestation2:
Intent ivAttestationIntent2 = new Intent("android.media.action.IMAGE_CAPTURE"); Intent ivAttestationIntent2 = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("b", null); File attestationFile2 = PhotoUtils.showPhotoFile("b", null);
ivAttestationIntent2.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); ivAttestationIntent2.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile2.getPath());
startActivityForResult(ivAttestationIntent2, 122); startActivityForResult(ivAttestationIntent2, 122);
break; break;
case R.id.iv_attestation3: case R.id.iv_attestation3:
Intent ivAttestationIntent3 = new Intent("android.media.action.IMAGE_CAPTURE"); Intent ivAttestationIntent3 = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("c", null); File attestationFile3 = PhotoUtils.showPhotoFile("c", null);
ivAttestationIntent3.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); ivAttestationIntent3.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile3.getPath());
startActivityForResult(ivAttestationIntent3, 123); startActivityForResult(ivAttestationIntent3, 123);
break; break;
case R.id.btn_attestation: case R.id.btn_attestation:
@ -190,9 +190,9 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
nameAuthentication(); nameAuthentication();
break; break;
case R.id.user_attestation_camera: case R.id.user_attestation_camera:
Intent userCameraIntent = new Intent("android.media.action.IMAGE_CAPTURE"); Intent userCameraIntent = new Intent(getActivity(), PhotographActivity.class);
file = PhotoUtils.showPhotoFile("d", null); File file = PhotoUtils.showPhotoFile("d", null);
userCameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); userCameraIntent.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
startActivityForResult(userCameraIntent, 124); startActivityForResult(userCameraIntent, 124);
break; break;
} }
@ -297,7 +297,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
Log.d("TAG", "onSuccess: sss********sssssssssssss 失败" + e.getMessage() + ""); Log.d("TAG", "onSuccess: 失败" + e.getMessage() + "");
} }
}); });
} }
@ -305,56 +305,53 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
@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 == 121 && resultCode == RESULT_OK) { if (resultCode == 0x104) {
if (file == null || !file.exists()) { if (requestCode == 121) {
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); assert data != null;
return; String file = data.getStringExtra("file");
assert file != null;
} else { File videoFile = new File(file);
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation1); if (videoFile.exists()) {
tvCard1.setTag(s); String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation1);
tvCard1.setTag(andGetPath);
} }
file = null;
ivHera1.setVisibility(View.GONE); ivHera1.setVisibility(View.GONE);
tvCard1.setVisibility(View.GONE); tvCard1.setVisibility(View.GONE);
} else if (requestCode == 122 && resultCode == RESULT_OK) { } else if (requestCode == 122) {
if (file == null || !file.exists()) { assert data != null;
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); String file = data.getStringExtra("file");
return; assert file != null;
File videoFile = new File(file);
} else { if (videoFile.exists()) {
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation2); String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation2);
tvCard2.setTag(s); tvCard2.setTag(andGetPath);
} }
file = null;
ivHera2.setVisibility(View.GONE); ivHera2.setVisibility(View.GONE);
tvCard2.setVisibility(View.GONE); tvCard2.setVisibility(View.GONE);
} else if (requestCode == 123 && resultCode == RESULT_OK) { } else if (requestCode == 123) {
if (file == null || !file.exists()) { assert data != null;
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); String file = data.getStringExtra("file");
return; assert file != null;
File videoFile = new File(file);
} else { if (videoFile.exists()) {
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation3); String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation3);
tvCard3.setTag(s); tvCard3.setTag(andGetPath);
} }
file = null;
ivHera3.setVisibility(View.GONE); ivHera3.setVisibility(View.GONE);
tvCard3.setVisibility(View.GONE); tvCard3.setVisibility(View.GONE);
} else if (requestCode == 124) {
}else if (requestCode == 124 && resultCode == RESULT_OK){ assert data != null;
if (file == null || !file.exists()) { String file = data.getStringExtra("file");
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show(); assert file != null;
return; File videoFile = new File(file);
} if (videoFile.exists()) {
String absolutePath = file.getAbsolutePath(); String absolutePath = videoFile.getAbsolutePath();
Constant.FILE_PATH = absolutePath; Constant.FILE_PATH = absolutePath;
useCamera.setTag(absolutePath); useCamera.setTag(absolutePath);
//身份证识别 //身份证识别
String idcard = IdCard.icarus(); String inward = IdCard.icarus();
if (idcard!=null){ if (inward != null) {
IdCardNumberBean idCardNumberBean = new Gson().fromJson(idcard, IdCardNumberBean.class); IdCardNumberBean idCardNumberBean = new Gson().fromJson(inward, IdCardNumberBean.class);
if (idCardNumberBean == null) { if (idCardNumberBean == null) {
Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show();
} else { } else {
@ -370,5 +367,10 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
} }
} }
} else {
Toast.makeText(getContext(), "请先拍照", Toast.LENGTH_SHORT).show();
}
}
} }
} }

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 = "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_TASK = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口 public static final String IP = "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

@ -9,14 +9,18 @@
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"
android:keepScreenOn="true" app:cameraPictureSizeMaxArea="3686400"
app:cameraPictureSizeMinArea="1166400"
app:cameraPictureSizeMaxHeight="1920"
app:cameraPictureSizeMinHeight="1080"
app:cameraPictureSizeMaxWidth="1920"
app:cameraPictureSizeMinWidth="1080"
app:cameraPictureSizeAspectRatio="1920:1080" app:cameraPictureSizeAspectRatio="1920:1080"
app:cameraVideoSizeMaxArea="3686400" app:cameraPictureFormat="jpeg"
app:cameraVideoSizeMaxHeight="1920" app:cameraPictureSizeBiggest="true"
app:cameraVideoSizeMaxWidth="1920" app:cameraPictureSizeSmallest="true"
app:cameraVideoSizeMinArea="1166400" app:cameraPictureMetering="true"
app:cameraVideoSizeMinHeight="1080" android:keepScreenOn="true"
app:cameraVideoSizeMinWidth="1080"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -16,13 +16,17 @@
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:cameraVideoSizeMaxArea="3686400" app:cameraPictureSizeMaxArea="3686400"
app:cameraVideoSizeMinArea="1166400" app:cameraPictureSizeMinArea="1166400"
app:cameraVideoSizeMaxHeight="1920" app:cameraPictureSizeMaxHeight="1920"
app:cameraVideoSizeMinHeight="1080" app:cameraPictureSizeMinHeight="1080"
app:cameraVideoSizeMaxWidth="1920" app:cameraPictureSizeMaxWidth="1920"
app:cameraVideoSizeMinWidth="1080" app:cameraPictureSizeMinWidth="1080"
app:cameraPictureSizeAspectRatio="1920:1080" app:cameraPictureSizeAspectRatio="1920:1080"
app:cameraPictureFormat="jpeg"
app:cameraPictureSizeBiggest="true"
app:cameraPictureSizeSmallest="true"
app:cameraPictureMetering="true"
android:keepScreenOn="true" android:keepScreenOn="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />