|
|
|
@ -11,6 +11,8 @@ import android.content.pm.PackageManager;
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import android.graphics.BitmapFactory;
|
|
|
|
import android.graphics.BitmapFactory;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.Color;
|
|
|
|
|
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
|
|
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
@ -65,13 +67,20 @@ import com.rehome.zhdcoa.ui.activity.LoginActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.MyAdviceActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.MyAdviceActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.MyOrderActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.MyOrderActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.OtherCountMeActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.OtherCountMeActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.QrCodeActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.QrCodeNewActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.SqActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.SqActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.UpdatePwdActivity;
|
|
|
|
import com.rehome.zhdcoa.ui.activity.UpdatePwdActivity;
|
|
|
|
import com.rehome.zhdcoa.utils.HttpUtils;
|
|
|
|
import com.rehome.zhdcoa.utils.HttpUtils;
|
|
|
|
|
|
|
|
import com.rehome.zhdcoa.utils.NohttpUtils;
|
|
|
|
import com.rehome.zhdcoa.utils.XToastUtils;
|
|
|
|
import com.rehome.zhdcoa.utils.XToastUtils;
|
|
|
|
import com.rehome.zhdcoa.weiget.AuditDialog;
|
|
|
|
import com.rehome.zhdcoa.weiget.AuditDialog;
|
|
|
|
import com.rehome.zhdcoa.weiget.ListDialog;
|
|
|
|
import com.rehome.zhdcoa.weiget.ListDialog;
|
|
|
|
|
|
|
|
import com.yolanda.nohttp.NoHttp;
|
|
|
|
|
|
|
|
import com.yolanda.nohttp.rest.CacheMode;
|
|
|
|
|
|
|
|
import com.yolanda.nohttp.rest.OnResponseListener;
|
|
|
|
|
|
|
|
import com.yolanda.nohttp.rest.Request;
|
|
|
|
|
|
|
|
import com.yolanda.nohttp.rest.RequestQueue;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
@ -79,6 +88,11 @@ import java.io.OutputStream;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.net.ssl.HostnameVerifier;
|
|
|
|
|
|
|
|
import javax.net.ssl.SSLSession;
|
|
|
|
|
|
|
|
import javax.net.ssl.SSLSocketFactory;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
|
import de.hdodenhof.circleimageview.CircleImageView;
|
|
|
|
import de.hdodenhof.circleimageview.CircleImageView;
|
|
|
|
import okhttp3.MediaType;
|
|
|
|
import okhttp3.MediaType;
|
|
|
|
@ -96,6 +110,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
private static final int ALBUM = 1;
|
|
|
|
private static final int ALBUM = 1;
|
|
|
|
private static final int CROP = 2;
|
|
|
|
private static final int CROP = 2;
|
|
|
|
public static final int UPDATE_HEAD_PHOTO = 100;
|
|
|
|
public static final int UPDATE_HEAD_PHOTO = 100;
|
|
|
|
|
|
|
|
private RequestQueue queue;
|
|
|
|
|
|
|
|
|
|
|
|
private ActivityResultLauncher<Intent> launcherResultEmoji;
|
|
|
|
private ActivityResultLauncher<Intent> launcherResultEmoji;
|
|
|
|
|
|
|
|
|
|
|
|
@ -168,6 +183,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
findView();
|
|
|
|
findView();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queue = NoHttp.newRequestQueue(1);
|
|
|
|
array.add("\uD83D\uDE00");
|
|
|
|
array.add("\uD83D\uDE00");
|
|
|
|
array.add("😃");
|
|
|
|
array.add("😃");
|
|
|
|
array.add("😄");
|
|
|
|
array.add("😄");
|
|
|
|
@ -395,8 +411,8 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void intentTOQRCode(){
|
|
|
|
private void intentTOQRCode() {
|
|
|
|
Intent intent = new Intent(getActivity(), QrCodeActivity.class);
|
|
|
|
Intent intent = new Intent(getActivity(), QrCodeNewActivity.class);
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
|
|
launcherResultQRCode.launch(intent);
|
|
|
|
launcherResultQRCode.launch(intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -408,7 +424,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
|
|
|
|
|
|
|
|
clearImageDiskCache(getActivity());
|
|
|
|
clearImageDiskCache(getActivity());
|
|
|
|
loadImage();
|
|
|
|
loadImage();
|
|
|
|
if(App.getInstance().getUserInfo()!=null&&App.getInstance().getUserInfo().getManid()!=null){
|
|
|
|
if (App.getInstance().getUserInfo() != null && App.getInstance().getUserInfo().getManid() != null) {
|
|
|
|
if (App.getInstance().getUserInfo().getManid().equals("310569") || App.getInstance().getUserInfo().getManid().equals("ZHPS_Admin") || App.getInstance().getUserInfo().getManid().equals("310674")) {
|
|
|
|
if (App.getInstance().getUserInfo().getManid().equals("310569") || App.getInstance().getUserInfo().getManid().equals("ZHPS_Admin") || App.getInstance().getUserInfo().getManid().equals("310674")) {
|
|
|
|
tvSq.setVisibility(View.VISIBLE);
|
|
|
|
tvSq.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -472,7 +488,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
int resultCode = result.getResultCode();
|
|
|
|
int resultCode = result.getResultCode();
|
|
|
|
Intent data = result.getData();
|
|
|
|
Intent data = result.getData();
|
|
|
|
if (resultCode == RESULT_OK) {
|
|
|
|
if (resultCode == RESULT_OK) {
|
|
|
|
if(data!=null){
|
|
|
|
if (data != null) {
|
|
|
|
String code = data.getStringExtra("code");
|
|
|
|
String code = data.getStringExtra("code");
|
|
|
|
showToast(code);
|
|
|
|
showToast(code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -510,12 +526,74 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void loadImage() {
|
|
|
|
public void loadImage() {
|
|
|
|
|
|
|
|
showLog("---------App.getInstance().getUserInfo().getUserHeadUrl()---------");
|
|
|
|
|
|
|
|
showLog(App.getInstance().getUserInfo().getUserHeadUrl());
|
|
|
|
if (!TextUtils.isEmpty(App.getInstance().getUserInfo().getUserHeadUrl())) {
|
|
|
|
if (!TextUtils.isEmpty(App.getInstance().getUserInfo().getUserHeadUrl())) {
|
|
|
|
Glide.with(requireContext())
|
|
|
|
String fullPath = Contans.BASE_URL + App.getInstance().getUserInfo().getUserHeadUrl();
|
|
|
|
.load(Contans.BASE_URL + App.getInstance().getUserInfo().getUserHeadUrl())
|
|
|
|
showLog(fullPath);
|
|
|
|
.dontAnimate()
|
|
|
|
Request<Bitmap> request = NoHttp.createImageRequest(fullPath);
|
|
|
|
.placeholder(R.drawable.head_photo)
|
|
|
|
request.setCacheMode(CacheMode.NONE_CACHE_REQUEST_NETWORK);
|
|
|
|
.into(civHead);
|
|
|
|
|
|
|
|
|
|
|
|
if (Contans.BASE_URL_AI_3D_SERVER.equals(Contans.BASE_URL_AI_3D_SERVER_EXTRANET)) {
|
|
|
|
|
|
|
|
SSLSocketFactory socketFactory = NohttpUtils.getSSLSocketFactory(context);
|
|
|
|
|
|
|
|
if (socketFactory != null) {
|
|
|
|
|
|
|
|
request.setSSLSocketFactory(socketFactory);
|
|
|
|
|
|
|
|
request.setHostnameVerifier(new HostnameVerifier() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean verify(String s, SSLSession sslSession) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(request.url())) {
|
|
|
|
|
|
|
|
String url = request.url();
|
|
|
|
|
|
|
|
if (url.startsWith("https://219.131.195.3:7100") || url.startsWith("https://219.131.195.3:7011") || url.startsWith("https://219.131.195.3:7081") || url.startsWith("https://219.131.195.3:7082")) {
|
|
|
|
|
|
|
|
SSLSocketFactory socketFactory = NohttpUtils.getSSLSocketFactory(context);
|
|
|
|
|
|
|
|
if (socketFactory != null) {
|
|
|
|
|
|
|
|
request.setSSLSocketFactory(socketFactory);
|
|
|
|
|
|
|
|
request.setHostnameVerifier(new HostnameVerifier() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean verify(String s, SSLSession sslSession) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
queue.add(8, request, new OnResponseListener<>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onStart(int what) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onSucceed(int what, com.yolanda.nohttp.rest.Response<Bitmap> response) {
|
|
|
|
|
|
|
|
Bitmap bitmap = response.get();
|
|
|
|
|
|
|
|
Drawable drawable = new BitmapDrawable(context.getResources(), bitmap);
|
|
|
|
|
|
|
|
civHead.setImageDrawable(drawable);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onFailed(int what, com.yolanda.nohttp.rest.Response<Bitmap> response) {
|
|
|
|
|
|
|
|
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.head_photo);
|
|
|
|
|
|
|
|
Drawable drawable = new BitmapDrawable(context.getResources(), bitmap);
|
|
|
|
|
|
|
|
civHead.setImageDrawable(drawable);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onFinish(int what) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Glide.with(requireContext())
|
|
|
|
|
|
|
|
// .load(Contans.BASE_URL + App.getInstance().getUserInfo().getUserHeadUrl())
|
|
|
|
|
|
|
|
// .dontAnimate()
|
|
|
|
|
|
|
|
// .placeholder(R.drawable.head_photo)
|
|
|
|
|
|
|
|
// .into(civHead);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -540,7 +618,6 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void SQApp() {
|
|
|
|
private void SQApp() {
|
|
|
|
Intent intent = new Intent(getActivity(), SqActivity.class);
|
|
|
|
Intent intent = new Intent(getActivity(), SqActivity.class);
|
|
|
|
startActivity(intent);
|
|
|
|
startActivity(intent);
|
|
|
|
@ -569,7 +646,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!appVersionName.equals(getVersionName())) {
|
|
|
|
if (!appVersionName.equals(getVersionName())) {
|
|
|
|
downloadAndInstall(appURL, appVersionName, appDesc, android_versioncode);
|
|
|
|
downloadAndInstall(appURL, appVersionName, appDesc, android_versioncode);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
showToast("当前已是最新版本!");
|
|
|
|
showToast("当前已是最新版本!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -713,14 +790,14 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
public void onSuccess(Call<AboutMeBean> call, Response<AboutMeBean> response) {
|
|
|
|
public void onSuccess(Call<AboutMeBean> call, Response<AboutMeBean> response) {
|
|
|
|
AboutMeBean bean = response.body();
|
|
|
|
AboutMeBean bean = response.body();
|
|
|
|
if (bean != null) {
|
|
|
|
if (bean != null) {
|
|
|
|
if (bean.getTotal()!=null&&(!bean.getTotal().equals("0"))) {
|
|
|
|
if (bean.getTotal() != null && (!bean.getTotal().equals("0"))) {
|
|
|
|
if(bean.getRows()!=null&&bean.getRows().size()>0){
|
|
|
|
if (bean.getRows() != null && bean.getRows().size() > 0) {
|
|
|
|
List<AboutMeBean.RowsBean> rowsBeanList = bean.getRows();
|
|
|
|
List<AboutMeBean.RowsBean> rowsBeanList = bean.getRows();
|
|
|
|
for (AboutMeBean.RowsBean rowsBean : rowsBeanList) {
|
|
|
|
for (AboutMeBean.RowsBean rowsBean : rowsBeanList) {
|
|
|
|
if(rowsBean.getAboutme()!=null){
|
|
|
|
if (rowsBean.getAboutme() != null) {
|
|
|
|
if ("3".equals(rowsBean.getAboutme())) {
|
|
|
|
if ("3".equals(rowsBean.getAboutme())) {
|
|
|
|
if(rowsBean.getCountnum()!=null){
|
|
|
|
if (rowsBean.getCountnum() != null) {
|
|
|
|
if(tvAuditNum!=null){
|
|
|
|
if (tvAuditNum != null) {
|
|
|
|
if (!rowsBean.getCountnum().equals("0")) {
|
|
|
|
if (!rowsBean.getCountnum().equals("0")) {
|
|
|
|
tvAuditNum.setVisibility(View.VISIBLE);
|
|
|
|
tvAuditNum.setVisibility(View.VISIBLE);
|
|
|
|
tvAuditNum.setText(rowsBean.getCountnum());
|
|
|
|
tvAuditNum.setText(rowsBean.getCountnum());
|
|
|
|
@ -792,7 +869,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
if (sdCardExist) {
|
|
|
|
if (sdCardExist) {
|
|
|
|
//android 10 以上
|
|
|
|
//android 10 以上
|
|
|
|
if (requireActivity().getExternalFilesDir(null) != null) {
|
|
|
|
if (requireActivity().getExternalFilesDir(null) != null) {
|
|
|
|
String pathSd = Objects.requireNonNull(requireActivity().getExternalFilesDir(null)).getPath() + "/Radio" ;
|
|
|
|
String pathSd = Objects.requireNonNull(requireActivity().getExternalFilesDir(null)).getPath() + "/Radio";
|
|
|
|
deleteDirectory(pathSd);
|
|
|
|
deleteDirectory(pathSd);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
String pathSd = requireActivity().getFilesDir().getPath() + "/Radio";
|
|
|
|
String pathSd = requireActivity().getFilesDir().getPath() + "/Radio";
|
|
|
|
@ -875,6 +952,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 点击拍照按钮后,调用摄像头
|
|
|
|
* 点击拍照按钮后,调用摄像头
|
|
|
|
|
|
|
|
*
|
|
|
|
* @throws IOException
|
|
|
|
* @throws IOException
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void cropFromTake() throws IOException {
|
|
|
|
private void cropFromTake() throws IOException {
|
|
|
|
@ -912,7 +990,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
.setSandboxFileEngine(new UriToFileTransformEngine() {
|
|
|
|
.setSandboxFileEngine(new UriToFileTransformEngine() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onUriToFileAsyncTransform(Context context, String srcPath, String mineType, OnKeyValueResultCallbackListener call) {
|
|
|
|
public void onUriToFileAsyncTransform(Context context, String srcPath, String mineType, OnKeyValueResultCallbackListener call) {
|
|
|
|
Log.i("app",srcPath);
|
|
|
|
Log.i("app", srcPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.forResult(new OnResultCallbackListener<LocalMedia>() {
|
|
|
|
.forResult(new OnResultCallbackListener<LocalMedia>() {
|
|
|
|
@ -966,7 +1044,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
//这里调用了截取图片的方法
|
|
|
|
//这里调用了截取图片的方法
|
|
|
|
uriTakePic = uriToExternalFile(data.getData(), fileName);
|
|
|
|
uriTakePic = uriToExternalFile(data.getData(), fileName);
|
|
|
|
startPhotoZoom(uriTakePic, fileName,PICTURE_BOOK_CODE_END);
|
|
|
|
startPhotoZoom(uriTakePic, fileName, PICTURE_BOOK_CODE_END);
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -974,7 +1052,7 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
case CAMERA_REQUEST_CODE:
|
|
|
|
case CAMERA_REQUEST_CODE:
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
//这里调用了截取图片的方法
|
|
|
|
//这里调用了截取图片的方法
|
|
|
|
startPhotoZoom(uriTakePic, fileName,CAMERA_REQUEST_CODE_END);
|
|
|
|
startPhotoZoom(uriTakePic, fileName, CAMERA_REQUEST_CODE_END);
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1006,10 +1084,10 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String applicationId = App.getApplicationId(context);
|
|
|
|
String applicationId = App.getApplicationId(context);
|
|
|
|
File fos = this.createFileIfNeed(path, filename);
|
|
|
|
File fos = this.createFileIfNeed(path, filename);
|
|
|
|
Uri uriOut=FileProvider.getUriForFile(getActivity(), applicationId + ".fileprovider", fos);
|
|
|
|
Uri uriOut = FileProvider.getUriForFile(getActivity(), applicationId + ".fileprovider", fos);
|
|
|
|
out = getActivity().getContentResolver().openOutputStream(uriOut);
|
|
|
|
out = getActivity().getContentResolver().openOutputStream(uriOut);
|
|
|
|
fis = getActivity().getContentResolver().openInputStream(uri);
|
|
|
|
fis = getActivity().getContentResolver().openInputStream(uri);
|
|
|
|
IoUtil.copy(fis,out);
|
|
|
|
IoUtil.copy(fis, out);
|
|
|
|
return FileProvider.getUriForFile(getActivity(), applicationId + ".fileprovider", fos);
|
|
|
|
return FileProvider.getUriForFile(getActivity(), applicationId + ".fileprovider", fos);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -1031,36 +1109,37 @@ public class MineFragment extends BaseLazyFragment {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 拍照或者选择像片成功后发起截图
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* 拍照或者选择像片成功后发起截图
|
|
|
|
* @param uri
|
|
|
|
*
|
|
|
|
* @param fileName
|
|
|
|
* @param uri
|
|
|
|
* @param flags
|
|
|
|
* @param fileName
|
|
|
|
* @throws IOException
|
|
|
|
* @param flags
|
|
|
|
*/
|
|
|
|
* @throws IOException
|
|
|
|
private void startPhotoZoom(Uri uri, String fileName, int flags) throws IOException {
|
|
|
|
*/
|
|
|
|
String applicationId = App.getApplicationId(context);
|
|
|
|
private void startPhotoZoom(Uri uri, String fileName, int flags) throws IOException {
|
|
|
|
File CropPhoto = this.createFileIfNeed(path, fileName);
|
|
|
|
String applicationId = App.getApplicationId(context);
|
|
|
|
uriTakePicOutput = FileProvider.getUriForFile(requireActivity(), applicationId + ".fileprovider", CropPhoto);
|
|
|
|
File CropPhoto = this.createFileIfNeed(path, fileName);
|
|
|
|
|
|
|
|
uriTakePicOutput = FileProvider.getUriForFile(requireActivity(), applicationId + ".fileprovider", CropPhoto);
|
|
|
|
Intent intent = new Intent("com.android.camera.action.CROP");
|
|
|
|
|
|
|
|
intent.setDataAndType(uri, "image/*");
|
|
|
|
Intent intent = new Intent("com.android.camera.action.CROP");
|
|
|
|
|
|
|
|
intent.setDataAndType(uri, "image/*");
|
|
|
|
//添加这一句表示对目标应用临时授权该Uri所代表的文件
|
|
|
|
|
|
|
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
|
|
|
//添加这一句表示对目标应用临时授权该Uri所代表的文件
|
|
|
|
|
|
|
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
|
|
|
intent.putExtra("crop", "true");
|
|
|
|
|
|
|
|
//intent.putExtra("scale", true);
|
|
|
|
intent.putExtra("crop", "true");
|
|
|
|
//intent.putExtra("aspectX", 1);
|
|
|
|
//intent.putExtra("scale", true);
|
|
|
|
//intent.putExtra("aspectY", 1);
|
|
|
|
//intent.putExtra("aspectX", 1);
|
|
|
|
//输出的宽高
|
|
|
|
//intent.putExtra("aspectY", 1);
|
|
|
|
//intent.putExtra("outputX", 300);
|
|
|
|
//输出的宽高
|
|
|
|
//intent.putExtra("outputY", 300);
|
|
|
|
//intent.putExtra("outputX", 300);
|
|
|
|
intent.putExtra("return-data", false);
|
|
|
|
//intent.putExtra("outputY", 300);
|
|
|
|
intent.putExtra(MediaStore.EXTRA_OUTPUT, uriTakePicOutput);
|
|
|
|
intent.putExtra("return-data", false);
|
|
|
|
intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
|
|
|
|
intent.putExtra(MediaStore.EXTRA_OUTPUT, uriTakePicOutput);
|
|
|
|
intent.putExtra("noFaceDetection", true); // no face detection
|
|
|
|
intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
|
|
|
|
startActivityForResult(intent, flags);
|
|
|
|
intent.putExtra("noFaceDetection", true); // no face detection
|
|
|
|
}
|
|
|
|
startActivityForResult(intent, flags);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|