|
@@ -20,8 +20,10 @@ import android.webkit.WebView;
|
|
|
import android.widget.FrameLayout;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
+
|
|
|
import androidx.annotation.Nullable;
|
|
|
import androidx.annotation.RequiresApi;
|
|
|
+
|
|
|
import com.guadou.cs_cptservices.YYConstants;
|
|
|
import com.guadou.cs_cptservices.widget.PickPhotoDialog;
|
|
|
import com.guadou.lib_baselib.base.activity.BaseVMActivity;
|
|
@@ -288,54 +290,58 @@ public class HelpCenterProfileH5Activity extends BaseVMActivity<BaseViewModel> {
|
|
|
//选择相册
|
|
|
private void startAlbum() {
|
|
|
|
|
|
- ImageSelectExtKt.extOpenImageSelect(mActivity, new ArrayList<LocalMedia>(), new OnResultCallbackListener<LocalMedia>() {
|
|
|
-
|
|
|
+ PermissionExtKt.extRequestPermission(mActivity, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, new Function0<Unit>() {
|
|
|
@Override
|
|
|
- public void onResult(List<LocalMedia> result) {
|
|
|
+ public Unit invoke() {
|
|
|
|
|
|
- handlePath(result);
|
|
|
+ ImageSelectExtKt.extOpenImageSelect(mActivity, new ArrayList<LocalMedia>(), new OnResultCallbackListener<LocalMedia>() {
|
|
|
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public void onResult(List<LocalMedia> result) {
|
|
|
|
|
|
- @Override
|
|
|
- public void onCancel() {
|
|
|
+ handlePath(result);
|
|
|
|
|
|
- cancelFilePick();
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onCancel() {
|
|
|
+
|
|
|
+ cancelFilePick();
|
|
|
+
|
|
|
+ }
|
|
|
+ }, 1, false, false, true, 1, 1, false);
|
|
|
+
|
|
|
+ return null;
|
|
|
}
|
|
|
- }, 1, false, false, true, 1, 1, false);
|
|
|
-// ImageSelectEngine.get().openImageSelect(mActivity, null, 1, false, false, false, true, 1, 1, new OnResultCallbackListener<LocalMedia>() {
|
|
|
-// @Override
|
|
|
-// public void onResult(List<LocalMedia> result) {
|
|
|
-// handlePath(result);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onCancel() {
|
|
|
-// cancelFilePick();
|
|
|
-// }
|
|
|
-// });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
//选择相机
|
|
|
private void startCamera() {
|
|
|
|
|
|
- ImageSelectExtKt.extOpenCamera(mActivity, new ArrayList<LocalMedia>(), new OnResultCallbackListener<LocalMedia>() {
|
|
|
+ PermissionExtKt.extRequestPermission(mActivity, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, new Function0<Unit>() {
|
|
|
@Override
|
|
|
- public void onResult(List<LocalMedia> result) {
|
|
|
+ public Unit invoke() {
|
|
|
|
|
|
- handlePath(result);
|
|
|
+ ImageSelectExtKt.extOpenCamera(mActivity, new ArrayList<LocalMedia>(), new OnResultCallbackListener<LocalMedia>() {
|
|
|
+ @Override
|
|
|
+ public void onResult(List<LocalMedia> result) {
|
|
|
|
|
|
- }
|
|
|
+ handlePath(result);
|
|
|
|
|
|
- @Override
|
|
|
- public void onCancel() {
|
|
|
+ }
|
|
|
|
|
|
- cancelFilePick();
|
|
|
+ @Override
|
|
|
+ public void onCancel() {
|
|
|
|
|
|
- }
|
|
|
- }, false, true, 1, 1);
|
|
|
+ cancelFilePick();
|
|
|
+
|
|
|
+ }
|
|
|
+ }, false, true, 1, 1);
|
|
|
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
|
|
@@ -350,9 +356,9 @@ public class HelpCenterProfileH5Activity extends BaseVMActivity<BaseViewModel> {
|
|
|
String path = result.get(0).getCompressPath();
|
|
|
|
|
|
// Uri fileUri = Uri.fromFile(new File(path));
|
|
|
- Uri fileUri = UriExtKt.getFileUri(this, new File(path));
|
|
|
// Uri fileUri = AndPermission.getFileUri(mActivity, new File(path));
|
|
|
- YYLogUtils.w("fileUri:"+fileUri +" path:"+path);
|
|
|
+ Uri fileUri = UriExtKt.getFileUri(this, new File(path));
|
|
|
+ YYLogUtils.w("fileUri:" + fileUri + " path:" + path);
|
|
|
|
|
|
if (filePathCallback1 != null) {
|
|
|
filePathCallback1.onReceiveValue(new Uri[]{fileUri});
|