修改poi图片回复

This commit is contained in:
md 2021-08-06 23:20:30 +08:00
parent d7ff986a73
commit 6c87aece6d
4 changed files with 54 additions and 8 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
// ndkVersion '23.0.7123448'
ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@ -5,7 +5,9 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
@ -38,8 +40,10 @@ import com.navinfo.outdoor.bean.BankPathBean;
import com.navinfo.outdoor.bean.BankPhoneBean;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GetJsonDataUtil;
import com.navinfo.outdoor.util.PhotoPathUtil;
import com.navinfo.outdoor.util.PhotoUtils;
import org.json.JSONArray;
@ -65,6 +69,8 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
private String value;
private SharedPreferences navInfo;
private SharedPreferences.Editor navInfoEditor;
private File gatherFile;
private String file;
public static GatheringFragment newInstance(Bundle bundle) {
@ -233,12 +239,15 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
gatherFile = new File(Constant.PICTURE_FOLDER+"/aaaaaa.jpg");
PhotoUtils.showPhotoFile("a", null);
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(gatherFile));
startActivityForResult(intentPanorama, 400);
return false;
}
});
} else {
gatheringPath = PhotoPathUtil.getTakePhotoPath(data, "", "");
file = PhotoPathUtil.getTakePhotoPath(data, "", "");
}
}

View File

@ -590,24 +590,33 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
break;
case R.id.rl_panorama:
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
file = PhotoUtils.showPhotoFile("a",latLng);
file = PhotoUtils.showPhotoFile("a", latLng);;
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
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));
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));
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));
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));
startActivityForResult(intentElse, 105);
break;
}
@ -821,11 +830,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
String takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
if (file==null||!file.exists()){
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
}else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivPanorama);
tvPanorama.setTag(s);
}
file=null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -843,6 +855,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}*/
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
if (file==null||!file.exists()){
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
}
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvName.setTag(takePhotoPath2);
@ -864,10 +880,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}*/
} else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
if (file==null||!file.exists()){
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
}
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvInternal.setTag(takePhotoPath3);
ivInternal.setImageBitmap(bitmap);//显示图像
file = null;
/*int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -885,10 +906,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}*/
} else if (requestCode == 104 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
if (file==null||!file.exists()){
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
}
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
String takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvCard.setTag(takePhotoPath4);
ivCard.setImageBitmap(bitmap);//显示图像
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -906,10 +932,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}*/
} else if (requestCode == 105 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
if (file==null||!file.exists()){
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
return;
}
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
String takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvElse.setTag(takePhotoPath5);
ivElse.setImageBitmap(bitmap);//显示图像
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-files-path
name="my_images"
path="Android/data/com.navinfo.outdoor/files/Pictures" />
</paths>