diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2d684a1..1a6001d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -58,8 +58,10 @@
android:name=".activity.PictureActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
android:launchMode="singleTop" />
-
+
fileList;
- private File photoFile; // 拍照保存的路径
private NestedScrollView nestedScrollView;
private Marker markerStation;
private Point screenStationPositions;
@@ -844,33 +844,33 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
findingDuplicateByWork();
break;
case R.id.rl_panorama:
- Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
- photoFile = PhotoUtils.showPhotoFile("a", latLng);
- intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
+ Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
+ File PanoramaFile = PhotoUtils.showPhotoFile("a", latLng);
+ intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, PanoramaFile.getPath());
startActivityForResult(intentPanorama, 101);
break;
case R.id.rl_name:
- Intent intentName = new Intent("android.media.action.IMAGE_CAPTURE");
- photoFile = PhotoUtils.showPhotoFile("b", latLng);
- intentName.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
+ Intent intentName = new Intent(getActivity(), PhotographActivity.class);
+ File nameFile = PhotoUtils.showPhotoFile("b", latLng);
+ intentName.putExtra(Constant.INTENT_PHOTO_PATH, nameFile.getPath());
startActivityForResult(intentName, 102);
break;
case R.id.rl_internal_photos:
- Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE");
- photoFile = PhotoUtils.showPhotoFile("c", latLng);
- intentInternal.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
+ Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
+ File internalFile = PhotoUtils.showPhotoFile("c", latLng);
+ intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, internalFile.getPath());
startActivityForResult(intentInternal, 103);
break;
case R.id.rl_else:
- Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
- photoFile = PhotoUtils.showPhotoFile("d", latLng);
- intentElse.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
+ Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
+ File elseFile = PhotoUtils.showPhotoFile("d", latLng);
+ intentElse.putExtra(Constant.INTENT_PHOTO_PATH, elseFile.getPath());
startActivityForResult(intentElse, 104);
break;
case R.id.rl_scutcheon:
- Intent intentScutcheon = new Intent("android.media.action.IMAGE_CAPTURE");
- photoFile = PhotoUtils.showPhotoFile("e", latLng);
- intentScutcheon.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
+ Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
+ File scutcheonFile = PhotoUtils.showPhotoFile("e", latLng);
+ intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
startActivityForResult(intentScutcheon, 105);
break;
case R.id.linear_charging_pile:
@@ -1313,46 +1313,53 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == 101 && resultCode == RESULT_OK) {
- if (photoFile == null || !photoFile.exists()) {
- ToastUtil.showShort(getActivity(), "取消拍照");
- return;
+ if (resultCode==0x104){
+ if (requestCode==101){
+ assert data != null;
+ String file = data.getStringExtra("file");
+ assert file != null;
+ File videoFile = new File(file);
+ if (videoFile.exists()) {
+ 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;
}
}
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/GatheringFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/GatheringFragment.java
index 9305939..fbaf0aa 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/GatheringFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/GatheringFragment.java
@@ -28,6 +28,7 @@ import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
+import com.navinfo.outdoor.activity.PhotographActivity;
import com.navinfo.outdoor.adapter.BankAdapter;
import com.navinfo.outdoor.api.BankCard;
import com.navinfo.outdoor.api.Constant;
@@ -60,7 +61,6 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
private ArrayList jsonBean;
private String value;
- private File file;
public static GatheringFragment newInstance(Bundle bundle) {
@@ -152,9 +152,9 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
gatheringNetWork();
break;
case R.id.gathering_camera:
- Intent gatheringNumberIntent = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("a", null);
- gatheringNumberIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent gatheringNumberIntent = new Intent(getActivity(), PhotographActivity.class);
+ File file = PhotoUtils.showPhotoFile("a", null);
+ gatheringNumberIntent.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
startActivityForResult(gatheringNumberIntent, 131);
break;
}
@@ -223,24 +223,28 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == 131 && resultCode == RESULT_OK) {
- if (file == null||!file.exists()) {
- Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
- return;
- }
- String absolutePath = file.getAbsolutePath();
- Constant.FILE_PATH = absolutePath;
- gatheringCamera.setTag(absolutePath);
- //银行卡识别
- BankCardBean bankCardBean = new Gson().fromJson(BankCard.bankCard(), BankCardBean.class);
- if (bankCardBean==null){
- Toast.makeText(getContext(), "请手动添加银行卡号", Toast.LENGTH_SHORT).show();
- }else {
- if (bankCardBean.getResult()!=null&&bankCardBean.getResult().getBank_card_number()!=null){
- String bank_card_number = bankCardBean.getResult().getBank_card_number();
- etBankNum.setText(bank_card_number);
- }else {
- Toast.makeText(getActivity(), "请拍银行卡照片", Toast.LENGTH_SHORT).show();
+ if (resultCode == 0x104) {
+ if (requestCode == 131) {
+ 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;
+ gatheringCamera.setTag(absolutePath);
+ //银行卡识别
+ BankCardBean bankCardBean = new Gson().fromJson(BankCard.bankCard(), BankCardBean.class);
+ if (bankCardBean==null){
+ Toast.makeText(getContext(), "请手动添加银行卡号", Toast.LENGTH_SHORT).show();
+ }else {
+ if (bankCardBean.getResult()!=null&&bankCardBean.getResult().getBank_card_number()!=null){
+ String bank_card_number = bankCardBean.getResult().getBank_card_number();
+ etBankNum.setText(bank_card_number);
+ }else {
+ Toast.makeText(getActivity(), "请拍银行卡照片", Toast.LENGTH_SHORT).show();
+ }
+ }
}
}
}
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/MessageFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/MessageFragment.java
index a360765..12086c8 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/MessageFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/MessageFragment.java
@@ -31,7 +31,7 @@ import java.util.Objects;
/**
* 寻宝-消息的Fragment
*/
-public class MessageFragment extends BaseFragment implements View.OnClickListener {
+public class MessageFragment extends BaseFragment implements View.OnClickListener {
private MessageAdapter messageAdapter;
private int messagePage = 1;
@@ -108,8 +108,6 @@ public class MessageFragment extends BaseFragment implements View.OnClickListene
}else {
Toast.makeText(getActivity(), taskPrefectureBean.getMessage()+"", Toast.LENGTH_SHORT).show();
}
-
-
Log.d("TAG", "onSuccess: " + taskPrefectureBean.getMessage() + "");
//initTaskSpecification(taskSpecificationBean,start);
}
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/MineFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/MineFragment.java
index 00ecb31..5918ab0 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/MineFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/MineFragment.java
@@ -1,5 +1,6 @@
package com.navinfo.outdoor.fragment;
+import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
@@ -61,6 +62,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
return R.layout.mine_fragment;
}
+ @SuppressLint("SetTextI18n")
@Override
protected void initView() {
super.initView();
@@ -96,7 +98,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
mainGrade = (TextView) findViewById(R.id.main_grade);
tvMainGrade = findViewById(R.id.tv_main_grade);
if (Constant.LEVEL != 0) {
- tvMainGrade.setText(Constant.LEVEL);
+ tvMainGrade.setText(Constant.LEVEL+"");
}
initNetWork();
@@ -171,21 +173,21 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
intentWithdraw.putExtra("tag", 15);
startActivity(intentWithdraw);
break;
- // Intent intentGrade = new Intent(getActivity(), FragmentManagement.class);
-// intentGrade.putExtra("tag", 17);
-// startActivity(intentGrade);
- // Intent intentPrivilege = new Intent(getActivity(), FragmentManagement.class);
-// intentPrivilege.putExtra("tag", 18);
-// startActivity(intentPrivilege);
- // Intent intentMap = new Intent(getActivity(), FragmentManagement.class);
-// intentMap.putExtra("tag", 19);
-// startActivity(intentMap);
- // Intent intentIssue = new Intent(getActivity(), FragmentManagement.class);
-// intentIssue.putExtra("tag", 20);
-// startActivity(intentIssue);
- // Intent intentSet = new Intent(getActivity(), FragmentManagement.class);
-// intentSet.putExtra("tag", 22);
-// startActivity(intentSet);
+// Intent intentGrade = new Intent(getActivity(), FragmentManagement.class);
+// intentGrade.putExtra("tag", 17);
+// startActivity(intentGrade);
+// Intent intentPrivilege = new Intent(getActivity(), FragmentManagement.class);
+// intentPrivilege.putExtra("tag", 18);
+// startActivity(intentPrivilege);
+// Intent intentMap = new Intent(getActivity(), FragmentManagement.class);
+// intentMap.putExtra("tag", 19);
+// startActivity(intentMap);
+// Intent intentIssue = new Intent(getActivity(), FragmentManagement.class);
+// intentIssue.putExtra("tag", 20);
+// startActivity(intentIssue);
+// Intent intentSet = new Intent(getActivity(), FragmentManagement.class);
+// intentSet.putExtra("tag", 22);
+// startActivity(intentSet);
case R.id.rl_contact://联系我们
Intent intentContact = new Intent(getActivity(), FragmentManagement.class);
intentContact.putExtra("tag", 21);
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/OtherFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/OtherFragment.java
index 9018f92..e7aebf4 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/OtherFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/OtherFragment.java
@@ -636,7 +636,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
- AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPicture, 500);
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPicture);
tvPicture.setTag(andGetPath);
}
@@ -646,33 +645,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
assert file != null;
File videoFile = new File(file);
if (videoFile.exists()) {
- AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPictures, 500);
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPictures);
tvPictures.setTag(andGetPath);
}
}
}
- /* if (requestCode == 101 && resultCode == RESULT_OK) {
- if (file == null || !file.exists()) {
- 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
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/PoiFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/PoiFragment.java
index 4cf1e44..068e03d 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/PoiFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/PoiFragment.java
@@ -41,6 +41,7 @@ import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
+import com.navinfo.outdoor.activity.PhotographActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.GetPhoneBean;
@@ -111,7 +112,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
private LinearLayout linearContact;
private ContactView contactView;
private ArrayList poiPicList;
- private File file;
private Marker markerPoi;
private Point screenPoiPositions;
@@ -648,33 +648,33 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
findingDuplicateByWork();
break;
case R.id.rl_panorama:
- Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("a", latLng);
- intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
+ File filePanorama = PhotoUtils.showPhotoFile("a", latLng);
+ intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, filePanorama.getPath());
startActivityForResult(intentPanorama, 101);
break;
case R.id.rl_name:
- Intent intentName = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("b", latLng);
- intentName.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent intentName = new Intent(getActivity(), PhotographActivity.class);
+ File fileName = PhotoUtils.showPhotoFile("b", latLng);
+ intentName.putExtra(Constant.INTENT_PHOTO_PATH, fileName.getPath());
startActivityForResult(intentName, 102);
break;
case R.id.rl_internal_photos:
- Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("c", latLng);
- intentInternal.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
+ File fileInternal = PhotoUtils.showPhotoFile("c", latLng);
+ intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, fileInternal.getPath());
startActivityForResult(intentInternal, 103);
break;
case R.id.rl_card:
- Intent intentCard = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("d", latLng);
- intentCard.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent intentCard = new Intent(getActivity(), PhotographActivity.class);
+ File fileCard = PhotoUtils.showPhotoFile("d", latLng);
+ intentCard.putExtra(Constant.INTENT_PHOTO_PATH, fileCard.getPath());
startActivityForResult(intentCard, 104);
break;
case R.id.rl_else:
- Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("e", latLng);
- intentElse.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
+ File fileElse = PhotoUtils.showPhotoFile("e", latLng);
+ intentElse.putExtra(Constant.INTENT_PHOTO_PATH, fileElse.getPath());
startActivityForResult(intentElse, 105);
break;
}
@@ -925,128 +925,53 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- 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, ivPanorama);
- tvPanorama.setTag(s);
+ if (resultCode==0x104){
+ if (requestCode==101){
+ assert data != null;
+ String file = data.getStringExtra("file");
+ assert file != null;
+ File videoFile = new File(file);
+ if (videoFile.exists()) {
+ 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 {}*/
-
-
}
}
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/UserAttestationFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/UserAttestationFragment.java
index e5cae26..1273da9 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/UserAttestationFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/UserAttestationFragment.java
@@ -23,6 +23,7 @@ import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
+import com.navinfo.outdoor.activity.PhotographActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.api.IdCard;
import com.navinfo.outdoor.base.BaseFragment;
@@ -57,11 +58,10 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
private TextView tvCard2;
private ImageView ivHera3;
private TextView tvCard3;
- private File file;
- private LinearLayout linearHint;
- private TextView tvTitle;
- private LinearLayout linearLayout;
- private View userAttestView;
+ /* private LinearLayout linearHint;
+ private TextView tvTitle;
+ private LinearLayout linearLayout;
+ private View userAttestView;*/
private ImageView useCamera;
@@ -112,8 +112,8 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
LinearLayout linearLayout = findViewById(R.id.ll_pic);//身份证照片
useCamera = findViewById(R.id.user_attestation_camera);
useCamera.setOnClickListener(this);
- if (Constant.AUDIOTAPES ==-1){//审核中
- if (Constant.NAME!=null&&Constant.ID_NUM!=null){
+ if (Constant.AUDIOTAPES == -1) {//审核中
+ if (Constant.NAME != null && Constant.ID_NUM != null) {
tvTitle.setText("1.审核中");
linearHint.setVisibility(View.VISIBLE);
etAttestationName.setText(Constant.NAME);
@@ -121,20 +121,20 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
etAttestationName.setEnabled(false);
etNamePhone.setEnabled(false);
btnAttestation.setEnabled(false);
- }else {
+ } else {
linearHint.setVisibility(View.GONE);
etAttestationName.setEnabled(true);
etNamePhone.setEnabled(true);
btnAttestation.setEnabled(true);
}
- }else if (Constant.AUDIOTAPES ==0){//不通过
+ } else if (Constant.AUDIOTAPES == 0) {//不通过
linearHint.setVisibility(View.GONE);
etAttestationName.setText(Constant.NAME);
etNamePhone.setText(Constant.ID_NUM);
etAttestationName.setEnabled(true);
etNamePhone.setEnabled(true);
btnAttestation.setEnabled(true);
- }else if (Constant.AUDIOTAPES ==1){//通过
+ } else if (Constant.AUDIOTAPES == 1) {//通过
tvTitle.setText("1.审核通过");
linearHint.setVisibility(View.VISIBLE);
etAttestationName.setText(Constant.NAME);
@@ -157,21 +157,21 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
Objects.requireNonNull(getActivity()).finish();
break;
case R.id.iv_attestation1:
- Intent ivAttestationIntent1 = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("a", null);
- ivAttestationIntent1.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent ivAttestationIntent1 = new Intent(getActivity(), PhotographActivity.class);
+ File attestationFile1 = PhotoUtils.showPhotoFile("a", null);
+ ivAttestationIntent1.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile1.getPath());
startActivityForResult(ivAttestationIntent1, 121);
break;
case R.id.iv_attestation2:
- Intent ivAttestationIntent2 = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("b", null);
- ivAttestationIntent2.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent ivAttestationIntent2 = new Intent(getActivity(), PhotographActivity.class);
+ File attestationFile2 = PhotoUtils.showPhotoFile("b", null);
+ ivAttestationIntent2.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile2.getPath());
startActivityForResult(ivAttestationIntent2, 122);
break;
case R.id.iv_attestation3:
- Intent ivAttestationIntent3 = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("c", null);
- ivAttestationIntent3.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent ivAttestationIntent3 = new Intent(getActivity(), PhotographActivity.class);
+ File attestationFile3 = PhotoUtils.showPhotoFile("c", null);
+ ivAttestationIntent3.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile3.getPath());
startActivityForResult(ivAttestationIntent3, 123);
break;
case R.id.btn_attestation:
@@ -190,9 +190,9 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
nameAuthentication();
break;
case R.id.user_attestation_camera:
- Intent userCameraIntent = new Intent("android.media.action.IMAGE_CAPTURE");
- file = PhotoUtils.showPhotoFile("d", null);
- userCameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
+ Intent userCameraIntent = new Intent(getActivity(), PhotographActivity.class);
+ File file = PhotoUtils.showPhotoFile("d", null);
+ userCameraIntent.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
startActivityForResult(userCameraIntent, 124);
break;
}
@@ -270,24 +270,24 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
@Override
public void onSuccess(NameAuthenticationBean response, int id) {
dismissLoadingDialog();
- if (response.getCode()==200){
+ if (response.getCode() == 200) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "提交成功", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
- Constant.NAME=attestationName;
- Constant.ID_NUM=namePhone;
- Constant.AUDIOTAPES =-1;
- getActivity().finish();
+ Constant.NAME = attestationName;
+ Constant.ID_NUM = namePhone;
+ Constant.AUDIOTAPES = -1;
+ getActivity().finish();
return false;
}
});
- }else {
+ } else {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "提交失败", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
- Toast.makeText(getActivity(), response.getMessage()+"", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
return false;
}
});
@@ -297,7 +297,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
@Override
public void onError(Throwable e, int id) {
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
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == 121 && resultCode == RESULT_OK) {
- if (file == null || !file.exists()) {
- Toast.makeText(getActivity(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
- return;
-
- } else {
- String s = PhotoUtils.showPhotoAndGetPath(file, ivAttestation1);
- tvCard1.setTag(s);
- }
- 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();
- }
+ if (resultCode == 0x104) {
+ if (requestCode == 121) {
+ assert data != null;
+ String file = data.getStringExtra("file");
+ assert file != null;
+ File videoFile = new File(file);
+ if (videoFile.exists()) {
+ String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation1);
+ tvCard1.setTag(andGetPath);
}
- }else {
- Toast.makeText(getActivity(), "请手动添加身份证号", Toast.LENGTH_SHORT).show();
- }
+ ivHera1.setVisibility(View.GONE);
+ 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();
+ }
}
+
}
}
diff --git a/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java b/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java
index da775ff..6b5952e 100644
--- a/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java
+++ b/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java
@@ -3,9 +3,9 @@ package com.navinfo.outdoor.http;
import com.navinfo.outdoor.api.Constant;
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 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 APKIP = "http://172.23.139.4:8001/";
diff --git a/app/src/main/res/layout/activity_photograph.xml b/app/src/main/res/layout/activity_photograph.xml
index 06a9365..100a669 100644
--- a/app/src/main/res/layout/activity_photograph.xml
+++ b/app/src/main/res/layout/activity_photograph.xml
@@ -9,14 +9,18 @@
android:id="@+id/camera"
android:layout_width="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:cameraVideoSizeMaxArea="3686400"
- app:cameraVideoSizeMaxHeight="1920"
- app:cameraVideoSizeMaxWidth="1920"
- app:cameraVideoSizeMinArea="1166400"
- app:cameraVideoSizeMinHeight="1080"
- app:cameraVideoSizeMinWidth="1080"
+ app:cameraPictureFormat="jpeg"
+ app:cameraPictureSizeBiggest="true"
+ app:cameraPictureSizeSmallest="true"
+ app:cameraPictureMetering="true"
+ android:keepScreenOn="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
diff --git a/app/src/main/res/layout/activity_pictures.xml b/app/src/main/res/layout/activity_pictures.xml
index 32e1a38..c45457a 100644
--- a/app/src/main/res/layout/activity_pictures.xml
+++ b/app/src/main/res/layout/activity_pictures.xml
@@ -16,13 +16,17 @@
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:cameraVideoSizeMaxArea="3686400"
- app:cameraVideoSizeMinArea="1166400"
- app:cameraVideoSizeMaxHeight="1920"
- app:cameraVideoSizeMinHeight="1080"
- app:cameraVideoSizeMaxWidth="1920"
- app:cameraVideoSizeMinWidth="1080"
+ app:cameraPictureSizeMaxArea="3686400"
+ app:cameraPictureSizeMinArea="1166400"
+ app:cameraPictureSizeMaxHeight="1920"
+ app:cameraPictureSizeMinHeight="1080"
+ app:cameraPictureSizeMaxWidth="1920"
+ app:cameraPictureSizeMinWidth="1080"
app:cameraPictureSizeAspectRatio="1920:1080"
+ app:cameraPictureFormat="jpeg"
+ app:cameraPictureSizeBiggest="true"
+ app:cameraPictureSizeSmallest="true"
+ app:cameraPictureMetering="true"
android:keepScreenOn="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />