修改poi图片回复
This commit is contained in:
parent
d7ff986a73
commit
6c87aece6d
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
// ndkVersion '23.0.7123448'
|
ndkVersion '23.0.7123448'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.navinfo.outdoor"
|
applicationId "com.navinfo.outdoor"
|
||||||
|
@ -5,7 +5,9 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.MediaStore;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -38,8 +40,10 @@ import com.navinfo.outdoor.bean.BankPathBean;
|
|||||||
import com.navinfo.outdoor.bean.BankPhoneBean;
|
import com.navinfo.outdoor.bean.BankPhoneBean;
|
||||||
import com.navinfo.outdoor.http.DialogCallback;
|
import com.navinfo.outdoor.http.DialogCallback;
|
||||||
import com.navinfo.outdoor.http.HttpInterface;
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
|
import com.navinfo.outdoor.util.Geohash;
|
||||||
import com.navinfo.outdoor.util.GetJsonDataUtil;
|
import com.navinfo.outdoor.util.GetJsonDataUtil;
|
||||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||||
|
import com.navinfo.outdoor.util.PhotoUtils;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
|
||||||
@ -65,6 +69,8 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
|||||||
private String value;
|
private String value;
|
||||||
private SharedPreferences navInfo;
|
private SharedPreferences navInfo;
|
||||||
private SharedPreferences.Editor navInfoEditor;
|
private SharedPreferences.Editor navInfoEditor;
|
||||||
|
private File gatherFile;
|
||||||
|
private String file;
|
||||||
|
|
||||||
|
|
||||||
public static GatheringFragment newInstance(Bundle bundle) {
|
public static GatheringFragment newInstance(Bundle bundle) {
|
||||||
@ -233,12 +239,15 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
|||||||
@Override
|
@Override
|
||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
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);
|
startActivityForResult(intentPanorama, 400);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
gatheringPath = PhotoPathUtil.getTakePhotoPath(data, "", "");
|
file = PhotoPathUtil.getTakePhotoPath(data, "", "");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -590,24 +590,33 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
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("android.media.action.IMAGE_CAPTURE");
|
||||||
file = PhotoUtils.showPhotoFile("a",latLng);
|
file = PhotoUtils.showPhotoFile("a", latLng);;
|
||||||
|
|
||||||
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||||
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("android.media.action.IMAGE_CAPTURE");
|
||||||
|
file =PhotoUtils.showPhotoFile("b", latLng);
|
||||||
|
intentName.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||||
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("android.media.action.IMAGE_CAPTURE");
|
||||||
|
file =PhotoUtils.showPhotoFile("c", latLng);
|
||||||
|
intentInternal.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||||
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("android.media.action.IMAGE_CAPTURE");
|
||||||
|
file =PhotoUtils.showPhotoFile("d", latLng);
|
||||||
|
intentCard.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||||
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("android.media.action.IMAGE_CAPTURE");
|
||||||
|
file =PhotoUtils.showPhotoFile("e",latLng);
|
||||||
|
intentElse.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||||
startActivityForResult(intentElse, 105);
|
startActivityForResult(intentElse, 105);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -821,11 +830,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
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 (requestCode == 101 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
if (file==null||!file.exists()){
|
||||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||||
String takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
return;
|
||||||
tvPanorama.setTag(takePhotoPath1);
|
}else {
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
String s = PhotoUtils.showPhotoAndGetPath(file, ivPanorama);
|
||||||
|
tvPanorama.setTag(s);
|
||||||
|
}
|
||||||
|
file=null;
|
||||||
/* int height = bitmap.getHeight();
|
/* int height = bitmap.getHeight();
|
||||||
int width = bitmap.getWidth();
|
int width = bitmap.getWidth();
|
||||||
if (height > width) {
|
if (height > width) {
|
||||||
@ -843,6 +855,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}*/
|
}*/
|
||||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
|
if (file==null||!file.exists()){
|
||||||
|
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||||
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
tvName.setTag(takePhotoPath2);
|
tvName.setTag(takePhotoPath2);
|
||||||
@ -864,10 +880,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}*/
|
}*/
|
||||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
|
if (file==null||!file.exists()){
|
||||||
|
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||||
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
tvInternal.setTag(takePhotoPath3);
|
tvInternal.setTag(takePhotoPath3);
|
||||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||||
|
file = null;
|
||||||
/*int height = bitmap.getHeight();
|
/*int height = bitmap.getHeight();
|
||||||
int width = bitmap.getWidth();
|
int width = bitmap.getWidth();
|
||||||
if (height > width) {
|
if (height > width) {
|
||||||
@ -885,10 +906,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}*/
|
}*/
|
||||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
|
if (file==null||!file.exists()){
|
||||||
|
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||||
String takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
String takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
tvCard.setTag(takePhotoPath4);
|
tvCard.setTag(takePhotoPath4);
|
||||||
ivCard.setImageBitmap(bitmap);//显示图像
|
ivCard.setImageBitmap(bitmap);//显示图像
|
||||||
|
file = null;
|
||||||
/* int height = bitmap.getHeight();
|
/* int height = bitmap.getHeight();
|
||||||
int width = bitmap.getWidth();
|
int width = bitmap.getWidth();
|
||||||
if (height > width) {
|
if (height > width) {
|
||||||
@ -906,10 +932,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}*/
|
}*/
|
||||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
|
if (file==null||!file.exists()){
|
||||||
|
Toast.makeText(getActivity(), "请先拍照", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||||
String takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
String takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
tvElse.setTag(takePhotoPath5);
|
tvElse.setTag(takePhotoPath5);
|
||||||
ivElse.setImageBitmap(bitmap);//显示图像
|
ivElse.setImageBitmap(bitmap);//显示图像
|
||||||
|
file = null;
|
||||||
/* int height = bitmap.getHeight();
|
/* int height = bitmap.getHeight();
|
||||||
int width = bitmap.getWidth();
|
int width = bitmap.getWidth();
|
||||||
if (height > width) {
|
if (height > width) {
|
||||||
|
6
app/src/main/res/xml/file_paths.xml
Normal file
6
app/src/main/res/xml/file_paths.xml
Normal 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>
|
Loading…
x
Reference in New Issue
Block a user