修改点位作业的拍照

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 && resultCode == RESULT_OK) { } else if (requestCode==102){
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, ivCoding); String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivCoding);
tvCoding.setTag(s); tvCoding.setTag(andGetPath);
} }
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); }
} }else if (requestCode==104){
file = null; assert data != null;
String file = data.getStringExtra("file");
} else if (requestCode == 104 && 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, ivFacility);
tvFacility.setTag(andGetPath);
} else { }
String s = PhotoUtils.showPhotoAndGetPath(file, ivFacility); }else if (requestCode==105){
tvFacility.setTag(s); assert data != null;
} String file = data.getStringExtra("file");
file = null; assert file != null;
File videoFile = new File(file);
} else if (requestCode == 105 && resultCode == RESULT_OK) { if (videoFile.exists()) {
if (file == null || !file.exists()) { String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivScutcheon);
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); tvScutcheon.setTag(andGetPath);
return; }
}else if (requestCode==106){
} else { assert data != null;
String s = PhotoUtils.showPhotoAndGetPath(file, ivScutcheon); String file = data.getStringExtra("file");
tvScutcheon.setTag(s); assert file != null;
} File videoFile = new File(file);
file = null; if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivDevice);
} else if (requestCode == 106 && resultCode == RESULT_OK) { tvDevice.setTag(andGetPath);
if (file == null || !file.exists()) { }
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); }else if (requestCode==107){
return; assert data != null;
String file = data.getStringExtra("file");
} else { assert file != null;
String s = PhotoUtils.showPhotoAndGetPath(file, ivDevice); File videoFile = new File(file);
tvDevice.setTag(s); if (videoFile.exists()) {
} String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivUsable);
tvUsable.setTag(andGetPath);
file = null; }
}else if (requestCode==108){
} else if (requestCode == 107 && 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, ivAvailable);
String s = PhotoUtils.showPhotoAndGetPath(file, ivUsable); tvAvailable.setTag(andGetPath);
tvUsable.setTag(s); }
} }else if (requestCode==109){
file = null; assert data != null;
String file = data.getStringExtra("file");
} else if (requestCode == 108 && 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, ivParking);
tvParking.setTag(andGetPath);
} else { }
String s = PhotoUtils.showPhotoAndGetPath(file, ivAvailable); }else if (requestCode==110){
tvAvailable.setTag(s); assert data != null;
} String file = data.getStringExtra("file");
file = null; assert file != null;
File videoFile = new File(file);
} else if (requestCode == 109 && resultCode == RESULT_OK) { if (videoFile.exists()) {
if (file == null || !file.exists()) { String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivNumber);
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show(); tvNumber.setTag(andGetPath);
return; }
}
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivParking);
tvParking.setTag(s);
}
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);
}
}else if (requestCode==102){
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivName);
tvNamePic.setTag(andGetPath);
}
}else if (requestCode==103){
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivInternal);
tvInternal.setTag(andGetPath);
}
}else if (requestCode==104){
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
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, ivPanorama);
tvPanorama.setTag(photoPath);
photoFile = null;
} else if (requestCode == 102 && resultCode == RESULT_OK) {
if (photoFile == null || !photoFile.exists()) {
ToastUtil.showShort(getActivity(), "取消拍照");
return;
}
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivName);
tvNamePic.setTag(photoPath);
photoFile = null;
} else if (requestCode == 103 && resultCode == RESULT_OK) {
if (photoFile == null || !photoFile.exists()) {
ToastUtil.showShort(getActivity(), "取消拍照");
return;
}
String photoPath = PhotoUtils.showPhotoAndGetPath(photoFile, ivInternal);
tvInternal.setTag(photoPath);
photoFile = null;
} else if (requestCode == 104 && resultCode == RESULT_OK) {
if (photoFile == null || !photoFile.exists()) {
ToastUtil.showShort(getActivity(), "取消拍照");
return;
}
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,24 +223,28 @@ 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);
Constant.FILE_PATH = absolutePath; if (videoFile.exists()) {
gatheringCamera.setTag(absolutePath); String absolutePath = videoFile.getAbsolutePath();
//银行卡识别 Constant.FILE_PATH = absolutePath;
BankCardBean bankCardBean = new Gson().fromJson(BankCard.bankCard(), BankCardBean.class); gatheringCamera.setTag(absolutePath);
if (bankCardBean==null){ //银行卡识别
Toast.makeText(getContext(), "请手动添加银行卡号", Toast.LENGTH_SHORT).show(); BankCardBean bankCardBean = new Gson().fromJson(BankCard.bankCard(), BankCardBean.class);
}else { if (bankCardBean==null){
if (bankCardBean.getResult()!=null&&bankCardBean.getResult().getBank_card_number()!=null){ Toast.makeText(getContext(), "请手动添加银行卡号", Toast.LENGTH_SHORT).show();
String bank_card_number = bankCardBean.getResult().getBank_card_number(); }else {
etBankNum.setText(bank_card_number); if (bankCardBean.getResult()!=null&&bankCardBean.getResult().getBank_card_number()!=null){
}else { String bank_card_number = bankCardBean.getResult().getBank_card_number();
Toast.makeText(getActivity(), "请拍银行卡照片", Toast.LENGTH_SHORT).show(); etBankNum.setText(bank_card_number);
}else {
Toast.makeText(getActivity(), "请拍银行卡照片", Toast.LENGTH_SHORT).show();
}
}
} }
} }
} }

View File

@ -31,7 +31,7 @@ import java.util.Objects;
/** /**
* 寻宝-消息的Fragment * 寻宝-消息的Fragment
*/ */
public class MessageFragment extends BaseFragment implements View.OnClickListener { public class MessageFragment extends BaseFragment implements View.OnClickListener {
private MessageAdapter messageAdapter; private MessageAdapter messageAdapter;
private int messagePage = 1; private int messagePage = 1;
@ -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();
@ -171,21 +173,21 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
intentWithdraw.putExtra("tag", 15); intentWithdraw.putExtra("tag", 15);
startActivity(intentWithdraw); startActivity(intentWithdraw);
break; break;
// Intent intentGrade = new Intent(getActivity(), FragmentManagement.class); // Intent intentGrade = new Intent(getActivity(), FragmentManagement.class);
// intentGrade.putExtra("tag", 17); // intentGrade.putExtra("tag", 17);
// startActivity(intentGrade); // startActivity(intentGrade);
// Intent intentPrivilege = new Intent(getActivity(), FragmentManagement.class); // Intent intentPrivilege = new Intent(getActivity(), FragmentManagement.class);
// intentPrivilege.putExtra("tag", 18); // intentPrivilege.putExtra("tag", 18);
// startActivity(intentPrivilege); // startActivity(intentPrivilege);
// Intent intentMap = new Intent(getActivity(), FragmentManagement.class); // Intent intentMap = new Intent(getActivity(), FragmentManagement.class);
// intentMap.putExtra("tag", 19); // intentMap.putExtra("tag", 19);
// startActivity(intentMap); // startActivity(intentMap);
// Intent intentIssue = new Intent(getActivity(), FragmentManagement.class); // Intent intentIssue = new Intent(getActivity(), FragmentManagement.class);
// intentIssue.putExtra("tag", 20); // intentIssue.putExtra("tag", 20);
// startActivity(intentIssue); // startActivity(intentIssue);
// Intent intentSet = new Intent(getActivity(), FragmentManagement.class); // Intent intentSet = new Intent(getActivity(), FragmentManagement.class);
// intentSet.putExtra("tag", 22); // intentSet.putExtra("tag", 22);
// startActivity(intentSet); // startActivity(intentSet);
case R.id.rl_contact://联系我们 case R.id.rl_contact://联系我们
Intent intentContact = new Intent(getActivity(), FragmentManagement.class); Intent intentContact = new Intent(getActivity(), FragmentManagement.class);
intentContact.putExtra("tag", 21); intentContact.putExtra("tag", 21);

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);
}
}else if (requestCode==102){
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivName);
tvPoiNamePic.setTag(andGetPath);
}
}else if (requestCode==103){
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivInternal);
tvInternal.setTag(andGetPath);
}
}else if (requestCode==104){
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivCard);
tvCard.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, ivElse);
tvElse.setTag(andGetPath);
}
} }
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, 101);
return false;
}
});
} else {
}*/
} 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, ivName);
tvPoiNamePic.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, 102);
return false;
}
});
} else {
}*/
} else if (requestCode == 103 && resultCode == RESULT_OK) {
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivInternal);
tvInternal.setTag(s);
}
file = null;
/*int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
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;
@ -112,8 +112,8 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
LinearLayout linearLayout = findViewById(R.id.ll_pic);//身份证照片 LinearLayout linearLayout = findViewById(R.id.ll_pic);//身份证照片
useCamera = findViewById(R.id.user_attestation_camera); useCamera = findViewById(R.id.user_attestation_camera);
useCamera.setOnClickListener(this); useCamera.setOnClickListener(this);
if (Constant.AUDIOTAPES ==-1){//审核中 if (Constant.AUDIOTAPES == -1) {//审核中
if (Constant.NAME!=null&&Constant.ID_NUM!=null){ if (Constant.NAME != null && Constant.ID_NUM != null) {
tvTitle.setText("1.审核中"); tvTitle.setText("1.审核中");
linearHint.setVisibility(View.VISIBLE); linearHint.setVisibility(View.VISIBLE);
etAttestationName.setText(Constant.NAME); etAttestationName.setText(Constant.NAME);
@ -121,20 +121,20 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
etAttestationName.setEnabled(false); etAttestationName.setEnabled(false);
etNamePhone.setEnabled(false); etNamePhone.setEnabled(false);
btnAttestation.setEnabled(false); btnAttestation.setEnabled(false);
}else { } else {
linearHint.setVisibility(View.GONE); linearHint.setVisibility(View.GONE);
etAttestationName.setEnabled(true); etAttestationName.setEnabled(true);
etNamePhone.setEnabled(true); etNamePhone.setEnabled(true);
btnAttestation.setEnabled(true); btnAttestation.setEnabled(true);
} }
}else if (Constant.AUDIOTAPES ==0){//不通过 } else if (Constant.AUDIOTAPES == 0) {//不通过
linearHint.setVisibility(View.GONE); linearHint.setVisibility(View.GONE);
etAttestationName.setText(Constant.NAME); etAttestationName.setText(Constant.NAME);
etNamePhone.setText(Constant.ID_NUM); etNamePhone.setText(Constant.ID_NUM);
etAttestationName.setEnabled(true); etAttestationName.setEnabled(true);
etNamePhone.setEnabled(true); etNamePhone.setEnabled(true);
btnAttestation.setEnabled(true); btnAttestation.setEnabled(true);
}else if (Constant.AUDIOTAPES ==1){//通过 } else if (Constant.AUDIOTAPES == 1) {//通过
tvTitle.setText("1.审核通过"); tvTitle.setText("1.审核通过");
linearHint.setVisibility(View.VISIBLE); linearHint.setVisibility(View.VISIBLE);
etAttestationName.setText(Constant.NAME); etAttestationName.setText(Constant.NAME);
@ -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;
} }
@ -270,24 +270,24 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
@Override @Override
public void onSuccess(NameAuthenticationBean response, int id) { public void onSuccess(NameAuthenticationBean response, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
if (response.getCode()==200){ if (response.getCode() == 200) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE; DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "提交成功", "确定", "取消").setOkButton(new OnDialogButtonClickListener() { MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "提交成功", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override @Override
public boolean onClick(BaseDialog baseDialog, View v) { public boolean onClick(BaseDialog baseDialog, View v) {
Constant.NAME=attestationName; Constant.NAME = attestationName;
Constant.ID_NUM=namePhone; Constant.ID_NUM = namePhone;
Constant.AUDIOTAPES =-1; Constant.AUDIOTAPES = -1;
getActivity().finish(); getActivity().finish();
return false; return false;
} }
}); });
}else { } else {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE; DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "提交失败", "确定", "取消").setOkButton(new OnDialogButtonClickListener() { MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "提交失败", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override @Override
public boolean onClick(BaseDialog baseDialog, View v) { public boolean onClick(BaseDialog baseDialog, View v) {
Toast.makeText(getActivity(), response.getMessage()+"", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
return false; return false;
} }
}); });
@ -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,70 +305,72 @@ 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);
tvCard1.setVisibility(View.GONE);
} else if (requestCode == 122 && resultCode == RESULT_OK) {
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation2);
tvCard2.setTag(s);
}
file = null;
ivHera2.setVisibility(View.GONE);
tvCard2.setVisibility(View.GONE);
} else if (requestCode == 123 && resultCode == RESULT_OK) {
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation3);
tvCard3.setTag(s);
}
file = null;
ivHera3.setVisibility(View.GONE);
tvCard3.setVisibility(View.GONE);
}else if (requestCode == 124 && resultCode == RESULT_OK){
if (file == null || !file.exists()) {
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
}
String absolutePath = file.getAbsolutePath();
Constant.FILE_PATH = absolutePath;
useCamera.setTag(absolutePath);
//身份证识别
String idcard = IdCard.icarus();
if (idcard!=null){
IdCardNumberBean idCardNumberBean = new Gson().fromJson(idcard, IdCardNumberBean.class);
if (idCardNumberBean ==null){
Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show();
}else {
if (idCardNumberBean.getWords_result().get公民身份号码()!=null){
String words = idCardNumberBean.getWords_result().get公民身份号码().getWords();
etNamePhone.setText(words);
}else {
Toast.makeText(getActivity(), "请拍身份证照片", Toast.LENGTH_SHORT).show();
}
} }
}else { ivHera1.setVisibility(View.GONE);
Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show(); tvCard1.setVisibility(View.GONE);
} } else if (requestCode == 122) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation2);
tvCard2.setTag(andGetPath);
}
ivHera2.setVisibility(View.GONE);
tvCard2.setVisibility(View.GONE);
} else if (requestCode == 123) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation3);
tvCard3.setTag(andGetPath);
}
ivHera3.setVisibility(View.GONE);
tvCard3.setVisibility(View.GONE);
} else if (requestCode == 124) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
String absolutePath = videoFile.getAbsolutePath();
Constant.FILE_PATH = absolutePath;
useCamera.setTag(absolutePath);
//身份证识别
String inward = IdCard.icarus();
if (inward != null) {
IdCardNumberBean idCardNumberBean = new Gson().fromJson(inward, IdCardNumberBean.class);
if (idCardNumberBean == null) {
Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show();
} else {
if (idCardNumberBean.getWords_result().get公民身份号码() != null) {
String words = idCardNumberBean.getWords_result().get公民身份号码().getWords();
etNamePhone.setText(words);
} else {
Toast.makeText(getActivity(), "请拍身份证照片", Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show();
}
}
} 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" />