Commit aa8ba763ab96ba5f9baa714ce0c146a2ae9e463b
1 parent
c25d296a
添加长按事件加载动画,添加是否有二维码扫描功能,添加相应权限
Showing
8 changed files
with
158 additions
and
35 deletions
app/strike/src/main/java/com/cnlive/strike/imgutil/ImgActivity.java
| @@ -143,7 +143,6 @@ public class ImgActivity extends AppCompatActivity { | @@ -143,7 +143,6 @@ public class ImgActivity extends AppCompatActivity { | ||
| 143 | data.setSid(UserService.getUid(this)); | 143 | data.setSid(UserService.getUid(this)); |
| 144 | data.setType("1"); | 144 | data.setType("1"); |
| 145 | data.setUserId(UserService.getUid(this)); | 145 | data.setUserId(UserService.getUid(this)); |
| 146 | - data.setCollection(true); | ||
| 147 | data.setSave(true); | 146 | data.setSave(true); |
| 148 | 147 | ||
| 149 | ArrayList<ImagePreviewShowInfo> list = new ArrayList<>(); | 148 | ArrayList<ImagePreviewShowInfo> list = new ArrayList<>(); |
core/base/src/main/res/anim/anim_enter.xml
0 → 100644
core/base/src/main/res/anim/anim_exit.xml
0 → 100644
core/imageload/src/main/java/com/cnlive/core/imageload/preview/PreviewImageViewActivity.java
| @@ -96,17 +96,17 @@ public class PreviewImageViewActivity extends BaseActivity<PreviewImageView, Pre | @@ -96,17 +96,17 @@ public class PreviewImageViewActivity extends BaseActivity<PreviewImageView, Pre | ||
| 96 | public void showProcessDialog(ImagePreviewShowInfo info){ | 96 | public void showProcessDialog(ImagePreviewShowInfo info){ |
| 97 | previewInfo=info; | 97 | previewInfo=info; |
| 98 | requestPermission(String.valueOf(R.string.dialog_imagepicker_permission_save_pic),new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, new OnPermissionResponseListener() { | 98 | requestPermission(String.valueOf(R.string.dialog_imagepicker_permission_save_pic),new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, new OnPermissionResponseListener() { |
| 99 | - @Override | ||
| 100 | - public void onSuccess(String[] permissions) { | ||
| 101 | - if(getMvpView() != null) { | ||
| 102 | - getMvpView().showQrDialog("", info.getImgPath()); | 99 | + @Override |
| 100 | + public void onSuccess(String[] permissions) { | ||
| 101 | + if(getMvpView() != null) { | ||
| 102 | + getMvpView().showQrDialog("", info.getImgPath()); | ||
| 103 | + } | ||
| 103 | } | 104 | } |
| 104 | - } | ||
| 105 | 105 | ||
| 106 | - @Override | ||
| 107 | - public void onFail() { | 106 | + @Override |
| 107 | + public void onFail() { | ||
| 108 | 108 | ||
| 109 | - } | 109 | + } |
| 110 | }); | 110 | }); |
| 111 | } | 111 | } |
| 112 | 112 |
core/imageload/src/main/java/com/cnlive/core/ui/model/PreViewImgData.java
| @@ -35,7 +35,6 @@ public class PreViewImgData implements Serializable { | @@ -35,7 +35,6 @@ public class PreViewImgData implements Serializable { | ||
| 35 | private boolean isLife = true; | 35 | private boolean isLife = true; |
| 36 | private boolean isCollection; | 36 | private boolean isCollection; |
| 37 | private boolean isSave; | 37 | private boolean isSave; |
| 38 | - private boolean isScan; | ||
| 39 | 38 | ||
| 40 | //收藏 | 39 | //收藏 |
| 41 | private String collectionId; | 40 | private String collectionId; |
| @@ -195,14 +194,6 @@ public class PreViewImgData implements Serializable { | @@ -195,14 +194,6 @@ public class PreViewImgData implements Serializable { | ||
| 195 | isSave = save; | 194 | isSave = save; |
| 196 | } | 195 | } |
| 197 | 196 | ||
| 198 | - public boolean isScan() { | ||
| 199 | - return isScan; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - public void setScan(boolean scan) { | ||
| 203 | - isScan = scan; | ||
| 204 | - } | ||
| 205 | - | ||
| 206 | public String getCollectionId() { | 197 | public String getCollectionId() { |
| 207 | return collectionId; | 198 | return collectionId; |
| 208 | } | 199 | } |
core/imageload/src/main/java/com/cnlive/core/ui/presenter/PreViewImagePresenter.java
| @@ -9,15 +9,16 @@ import android.text.TextUtils; | @@ -9,15 +9,16 @@ import android.text.TextUtils; | ||
| 9 | import android.util.Log; | 9 | import android.util.Log; |
| 10 | 10 | ||
| 11 | import com.bumptech.glide.Glide; | 11 | import com.bumptech.glide.Glide; |
| 12 | +import com.bumptech.glide.request.FutureTarget; | ||
| 13 | +import com.bumptech.glide.request.target.Target; | ||
| 12 | import com.cnlive.cloud.user.auth.UserService; | 14 | import com.cnlive.cloud.user.auth.UserService; |
| 13 | import com.cnlive.core.imageload.api.ApiServiceStock; | 15 | import com.cnlive.core.imageload.api.ApiServiceStock; |
| 14 | -import com.cnlive.core.imageload.preview.DataProcessingActivity; | ||
| 15 | -import com.cnlive.core.imageload.preview.model.PreviewData; | ||
| 16 | import com.cnlive.core.libs.base.application.AppConfig; | 16 | import com.cnlive.core.libs.base.application.AppConfig; |
| 17 | import com.cnlive.core.libs.base.frame.presenter.BasePresenter; | 17 | import com.cnlive.core.libs.base.frame.presenter.BasePresenter; |
| 18 | import com.cnlive.core.libs.base.util.FileTypeUtil; | 18 | import com.cnlive.core.libs.base.util.FileTypeUtil; |
| 19 | import com.cnlive.core.libs.base.util.FileUtils; | 19 | import com.cnlive.core.libs.base.util.FileUtils; |
| 20 | import com.cnlive.core.libs.base.util.MD5Util; | 20 | import com.cnlive.core.libs.base.util.MD5Util; |
| 21 | +import com.cnlive.core.libs.base.util.NetworkUtil; | ||
| 21 | import com.cnlive.core.network.HttpConn; | 22 | import com.cnlive.core.network.HttpConn; |
| 22 | import com.cnlive.core.network.NetCallBack; | 23 | import com.cnlive.core.network.NetCallBack; |
| 23 | import com.cnlive.core.network.model.BaseResult; | 24 | import com.cnlive.core.network.model.BaseResult; |
| @@ -37,6 +38,7 @@ import java.util.HashMap; | @@ -37,6 +38,7 @@ import java.util.HashMap; | ||
| 37 | import java.util.List; | 38 | import java.util.List; |
| 38 | import java.util.Map; | 39 | import java.util.Map; |
| 39 | 40 | ||
| 41 | +import androidx.annotation.Nullable; | ||
| 40 | import cn.bertsir.zbar.utils.QRUtils; | 42 | import cn.bertsir.zbar.utils.QRUtils; |
| 41 | import io.reactivex.Observable; | 43 | import io.reactivex.Observable; |
| 42 | import io.reactivex.ObservableEmitter; | 44 | import io.reactivex.ObservableEmitter; |
| @@ -339,6 +341,90 @@ public class PreViewImagePresenter extends BasePresenter<PreViewImageView> { | @@ -339,6 +341,90 @@ public class PreViewImagePresenter extends BasePresenter<PreViewImageView> { | ||
| 339 | } | 341 | } |
| 340 | } | 342 | } |
| 341 | 343 | ||
| 344 | + | ||
| 345 | + /** | ||
| 346 | + *是否存在二维码 | ||
| 347 | + * @param activity | ||
| 348 | + * @param imgUrl | ||
| 349 | + */ | ||
| 350 | + public void isScan(Activity activity,String imgUrl,int position) { | ||
| 351 | + if (TextUtils.isEmpty(imgUrl)) { | ||
| 352 | + return; | ||
| 353 | + } | ||
| 354 | + if (!NetworkUtil.isConnectInternet(activity)) { | ||
| 355 | + return; | ||
| 356 | + } | ||
| 357 | + Observable.create(new ObservableOnSubscribe<String>() { | ||
| 358 | + @Override | ||
| 359 | + public void subscribe(ObservableEmitter<String> emitter) throws Exception { | ||
| 360 | + File scanFile = getFile(emitter, imgUrl, activity); | ||
| 361 | + if (scanFile != null && FileUtils.isFileExists(scanFile) && scanFile.length() > 0) { | ||
| 362 | + String content = null; | ||
| 363 | + content = QRUtils.getInstance().decodeQRcode(scanFile.getAbsolutePath()); | ||
| 364 | + if (TextUtils.isEmpty(scanFile.getAbsolutePath())) { | ||
| 365 | + content = QRUtils.getInstance().decodeQRcodeByZxing(scanFile.getAbsolutePath()); | ||
| 366 | + } | ||
| 367 | + if (content != null && content.length() > 0) { | ||
| 368 | + emitter.onNext(content); | ||
| 369 | + } else emitter.onNext(""); | ||
| 370 | + } else { | ||
| 371 | + emitter.onError(new Throwable("图片解析异常")); | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + }).subscribeOn(Schedulers.io()) //指定被观察者中的方法在io线程中进行处理 | ||
| 377 | + .observeOn(AndroidSchedulers.mainThread()) //指定观察者接收数据在主线程中 | ||
| 378 | + .subscribe(new Observer<String>() { | ||
| 379 | + @Override | ||
| 380 | + public void onSubscribe(Disposable d) { | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + @Override | ||
| 384 | + public void onNext(String s) { | ||
| 385 | + if(!TextUtils.isEmpty(s) && s.length() > 0 && getView() != null){ | ||
| 386 | + getView().showDialog(position,true); | ||
| 387 | + }else { | ||
| 388 | + if(getView() != null) getView().showDialog(position,false); | ||
| 389 | + } | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + @Override | ||
| 393 | + public void onError(Throwable e) { | ||
| 394 | + if(getView() != null)getView().showDialog(position,false); | ||
| 395 | + } | ||
| 396 | + | ||
| 397 | + @Override | ||
| 398 | + public void onComplete() { | ||
| 399 | + | ||
| 400 | + } | ||
| 401 | + }); | ||
| 402 | + } | ||
| 403 | + | ||
| 404 | + | ||
| 405 | + @Nullable | ||
| 406 | + private File getFile(ObservableEmitter<String> emitter, String imgUrl, Context mContext) throws InterruptedException, java.util.concurrent.ExecutionException { | ||
| 407 | + File scanFile = null; | ||
| 408 | + if (FileUtils.isFileExists(imgUrl) && FileUtils.getFileByPath(imgUrl).length() > 0) { | ||
| 409 | + scanFile = FileUtils.getFileByPath(imgUrl); | ||
| 410 | + } else { | ||
| 411 | + if (imgUrl.contains("http")) { | ||
| 412 | + FutureTarget<File> future = Glide.with(mContext) | ||
| 413 | + .load(imgUrl) | ||
| 414 | + .downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL); | ||
| 415 | + File file = future.get(); | ||
| 416 | + if (file != null && file.exists() && file.length() > 0) { | ||
| 417 | + scanFile = file; | ||
| 418 | + } else { | ||
| 419 | + emitter.onError(new Throwable("图片解析异常")); | ||
| 420 | + } | ||
| 421 | + } else { | ||
| 422 | + emitter.onError(new Throwable("图片解析异常")); | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + return scanFile; | ||
| 426 | + } | ||
| 427 | + | ||
| 342 | /** | 428 | /** |
| 343 | * 扫描二维码 | 429 | * 扫描二维码 |
| 344 | * | 430 | * |
| @@ -394,7 +480,8 @@ public class PreViewImagePresenter extends BasePresenter<PreViewImageView> { | @@ -394,7 +480,8 @@ public class PreViewImagePresenter extends BasePresenter<PreViewImageView> { | ||
| 394 | public void onNext(String qrContent) { | 480 | public void onNext(String qrContent) { |
| 395 | // if (getView()!=null)getView().hideLoading(); | 481 | // if (getView()!=null)getView().hideLoading(); |
| 396 | if (qrContent != null && qrContent.length() > 0) { | 482 | if (qrContent != null && qrContent.length() > 0) { |
| 397 | - ifViewAttached(view -> view.processQrContent(qrContent)); | 483 | + if (getView()!=null)getView().processQrContent(qrContent); |
| 484 | +// ifViewAttached(view -> view.processQrContent(qrContent)); | ||
| 398 | } else { | 485 | } else { |
| 399 | ifViewAttached(view -> view.showMessage("未识别二维码")); | 486 | ifViewAttached(view -> view.showMessage("未识别二维码")); |
| 400 | } | 487 | } |
core/imageload/src/main/java/com/cnlive/core/ui/view/PreViewImageView.java
| 1 | package com.cnlive.core.ui.view; | 1 | package com.cnlive.core.ui.view; |
| 2 | 2 | ||
| 3 | +import android.Manifest; | ||
| 3 | import android.annotation.SuppressLint; | 4 | import android.annotation.SuppressLint; |
| 4 | import android.app.Dialog; | 5 | import android.app.Dialog; |
| 5 | import android.content.ContentResolver; | 6 | import android.content.ContentResolver; |
| @@ -24,6 +25,7 @@ import com.cnlive.core.imageload.preview.widget.CustomTipDialog; | @@ -24,6 +25,7 @@ import com.cnlive.core.imageload.preview.widget.CustomTipDialog; | ||
| 24 | import com.cnlive.core.imageload.preview.widget.DownloadUtil; | 25 | import com.cnlive.core.imageload.preview.widget.DownloadUtil; |
| 25 | import com.cnlive.core.imagepreview.listener.OnItemLongPressListener; | 26 | import com.cnlive.core.imagepreview.listener.OnItemLongPressListener; |
| 26 | import com.cnlive.core.libs.base.frame.view.BaseView; | 27 | import com.cnlive.core.libs.base.frame.view.BaseView; |
| 28 | +import com.cnlive.core.libs.base.interfaces.OnPermissionResponseListener; | ||
| 27 | import com.cnlive.core.libs.base.util.AlertUtil; | 29 | import com.cnlive.core.libs.base.util.AlertUtil; |
| 28 | import com.cnlive.core.libs.base.util.FileTypeUtil; | 30 | import com.cnlive.core.libs.base.util.FileTypeUtil; |
| 29 | import com.cnlive.core.libs.base.util.FileUtils; | 31 | import com.cnlive.core.libs.base.util.FileUtils; |
| @@ -71,6 +73,10 @@ public class PreViewImageView extends BaseView { | @@ -71,6 +73,10 @@ public class PreViewImageView extends BaseView { | ||
| 71 | if (TextUtils.isEmpty(activity.type)) { | 73 | if (TextUtils.isEmpty(activity.type)) { |
| 72 | showError(); | 74 | showError(); |
| 73 | } | 75 | } |
| 76 | + | ||
| 77 | + PreViewImgInfo preViewImgInfo = new PreViewImgInfo(); | ||
| 78 | + preViewImgInfo.setImgUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583074722432&di=7ba0e34112d2c6e3b870fa7ce18827b1&imgtype=0&src=http%3A%2F%2Fm.dazhuanglawyer.com%2Ftupian%2F20190904%2F201909041739423115.jpg"); | ||
| 79 | + activity.data.getPicInfoList().add(preViewImgInfo); | ||
| 74 | if (activity.type.equals("1")) { | 80 | if (activity.type.equals("1")) { |
| 75 | preViewImgList = activity.data.getPicInfoList(); | 81 | preViewImgList = activity.data.getPicInfoList(); |
| 76 | if (preViewImgList.size() == 1) { | 82 | if (preViewImgList.size() == 1) { |
| @@ -79,7 +85,7 @@ public class PreViewImageView extends BaseView { | @@ -79,7 +85,7 @@ public class PreViewImageView extends BaseView { | ||
| 79 | PreViewImgInfo curPreInfo = activity.data.getCurrPrewInfo(); | 85 | PreViewImgInfo curPreInfo = activity.data.getCurrPrewInfo(); |
| 80 | for (int i = 0; i < preViewImgList.size(); i++) { | 86 | for (int i = 0; i < preViewImgList.size(); i++) { |
| 81 | activity.picList.add(TextUtils.isEmpty(preViewImgList.get(i).getPreviewImgUrl()) ? preViewImgList.get(i).getImgUrl() : preViewImgList.get(i).getPreviewImgUrl()); | 87 | activity.picList.add(TextUtils.isEmpty(preViewImgList.get(i).getPreviewImgUrl()) ? preViewImgList.get(i).getImgUrl() : preViewImgList.get(i).getPreviewImgUrl()); |
| 82 | - if ((!TextUtils.isEmpty(preViewImgList.get(i).getPreviewImgUrl()) && !TextUtils.isEmpty(curPreInfo.getPreviewImgUrl()) && curPreInfo.getPreviewImgUrl().equals(preViewImgList.get(i).getPreviewImgUrl()) ) | 88 | + if ((!TextUtils.isEmpty(preViewImgList.get(i).getPreviewImgUrl()) && !TextUtils.isEmpty(curPreInfo.getPreviewImgUrl()) && curPreInfo.getPreviewImgUrl().equals(preViewImgList.get(i).getPreviewImgUrl())) |
| 83 | || (!TextUtils.isEmpty(preViewImgList.get(i).getImgUrl()) && !TextUtils.isEmpty(curPreInfo.getImgUrl()) && curPreInfo.getImgUrl().equals(preViewImgList.get(i).getImgUrl()))) { | 89 | || (!TextUtils.isEmpty(preViewImgList.get(i).getImgUrl()) && !TextUtils.isEmpty(curPreInfo.getImgUrl()) && curPreInfo.getImgUrl().equals(preViewImgList.get(i).getImgUrl()))) { |
| 84 | activity.position = i; | 90 | activity.position = i; |
| 85 | } | 91 | } |
| @@ -91,6 +97,7 @@ public class PreViewImageView extends BaseView { | @@ -91,6 +97,7 @@ public class PreViewImageView extends BaseView { | ||
| 91 | } | 97 | } |
| 92 | } | 98 | } |
| 93 | 99 | ||
| 100 | + | ||
| 94 | public void setPreview() { | 101 | public void setPreview() { |
| 95 | activity.binding.imagePre.overlayStatusBar(false) | 102 | activity.binding.imagePre.overlayStatusBar(false) |
| 96 | .imageData(activity.picList) | 103 | .imageData(activity.picList) |
| @@ -100,48 +107,68 @@ public class PreViewImageView extends BaseView { | @@ -100,48 +107,68 @@ public class PreViewImageView extends BaseView { | ||
| 100 | activity.binding.imagePre.setOnItemLongPressListener(new OnItemLongPressListener() { | 107 | activity.binding.imagePre.setOnItemLongPressListener(new OnItemLongPressListener() { |
| 101 | @Override | 108 | @Override |
| 102 | public boolean onItemLongPress(int position, ImageView imageView) { | 109 | public boolean onItemLongPress(int position, ImageView imageView) { |
| 103 | - showDialog(position); | 110 | + activity.requestPermission(String.valueOf(R.string.dialog_imagepicker_permission_save_pic),new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, new OnPermissionResponseListener() { |
| 111 | + @Override | ||
| 112 | + public void onSuccess(String[] permissions) { | ||
| 113 | + activity.getPresenter().isScan(activity,activity.picList.get(position),position); | ||
| 114 | + | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + @Override | ||
| 118 | + public void onFail() { | ||
| 119 | + | ||
| 120 | + } | ||
| 121 | + }); | ||
| 104 | return false; | 122 | return false; |
| 105 | } | 123 | } |
| 106 | }); | 124 | }); |
| 107 | } | 125 | } |
| 108 | 126 | ||
| 109 | //长按弹框事件 | 127 | //长按弹框事件 |
| 110 | - public void showDialog(int position) { | 128 | + public void showDialog(int position,boolean isScan) { |
| 111 | if (dialog == null) { | 129 | if (dialog == null) { |
| 112 | dialog = new Dialog(activity, R.style.CustomDialogStyle); | 130 | dialog = new Dialog(activity, R.style.CustomDialogStyle); |
| 113 | View view = View.inflate(activity, R.layout.dialog_show, null); | 131 | View view = View.inflate(activity, R.layout.dialog_show, null); |
| 114 | dialog.setContentView(view); | 132 | dialog.setContentView(view); |
| 115 | Window window = dialog.getWindow(); | 133 | Window window = dialog.getWindow(); |
| 116 | window.setGravity(Gravity.BOTTOM); | 134 | window.setGravity(Gravity.BOTTOM); |
| 117 | -// window.setWindowAnimations(R.style.main_menu_animStyle); | 135 | + window.setWindowAnimations(R.style.dialogStyle); |
| 118 | window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); | 136 | window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
| 119 | dialog.findViewById(R.id.share_friend).setVisibility(activity.data.isFriend() ? View.VISIBLE : View.GONE); | 137 | dialog.findViewById(R.id.share_friend).setVisibility(activity.data.isFriend() ? View.VISIBLE : View.GONE); |
| 120 | dialog.findViewById(R.id.share_cirfriend).setVisibility(activity.data.isLife() ? View.VISIBLE : View.GONE); | 138 | dialog.findViewById(R.id.share_cirfriend).setVisibility(activity.data.isLife() ? View.VISIBLE : View.GONE); |
| 121 | dialog.findViewById(R.id.cellection).setVisibility(activity.data.isCollection() ? View.VISIBLE : View.GONE); | 139 | dialog.findViewById(R.id.cellection).setVisibility(activity.data.isCollection() ? View.VISIBLE : View.GONE); |
| 122 | dialog.findViewById(R.id.save_picture).setVisibility(activity.data.isSave() ? View.VISIBLE : View.GONE); | 140 | dialog.findViewById(R.id.save_picture).setVisibility(activity.data.isSave() ? View.VISIBLE : View.GONE); |
| 123 | - dialog.findViewById(R.id.can_scan).setVisibility(activity.data.isScan() ? View.VISIBLE : View.GONE); | ||
| 124 | dialog.findViewById(R.id.cancle).setOnClickListener(view1 -> dialog.dismiss()); | 141 | dialog.findViewById(R.id.cancle).setOnClickListener(view1 -> dialog.dismiss()); |
| 125 | dialog.show(); | 142 | dialog.show(); |
| 126 | } else { | 143 | } else { |
| 127 | dialog.show(); | 144 | dialog.show(); |
| 128 | } | 145 | } |
| 146 | + dialog.findViewById(R.id.can_scan).setVisibility(isScan ? View.VISIBLE : View.GONE); | ||
| 147 | + dialog.findViewById(R.id.share_friend).setOnClickListener(view -> { | ||
| 148 | + dialog.dismiss(); | ||
| 149 | + activity.getPresenter().shareFriendLife(activity, "friends", TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl()); | ||
| 129 | 150 | ||
| 130 | - dialog.findViewById(R.id.share_friend).setOnClickListener(view -> | ||
| 131 | - activity.getPresenter().shareFriendLife(activity, "friends", TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl())); | ||
| 132 | - dialog.findViewById(R.id.share_cirfriend).setOnClickListener(view -> | ||
| 133 | - activity.getPresenter().shareFriendLife(activity, "life", TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl())); | ||
| 134 | - dialog.findViewById(R.id.cellection).setOnClickListener(view -> | ||
| 135 | - activity.getPresenter().collectionPic(activity, TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl())); | 151 | + }); |
| 152 | + dialog.findViewById(R.id.share_cirfriend).setOnClickListener(view -> { | ||
| 153 | + dialog.dismiss(); | ||
| 154 | + activity.getPresenter().shareFriendLife(activity, "life", TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl()); | ||
| 155 | + }); | ||
| 156 | + dialog.findViewById(R.id.cellection).setOnClickListener(view -> { | ||
| 157 | + dialog.dismiss(); | ||
| 158 | + activity.getPresenter().collectionPic(activity, TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl()); | ||
| 159 | + }); | ||
| 136 | dialog.findViewById(R.id.save_picture).setOnClickListener(view -> { | 160 | dialog.findViewById(R.id.save_picture).setOnClickListener(view -> { |
| 161 | + dialog.dismiss(); | ||
| 137 | if (activity.data.getType().equals("1")) { | 162 | if (activity.data.getType().equals("1")) { |
| 138 | activity.getPresenter().savePicture(activity, TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl()); | 163 | activity.getPresenter().savePicture(activity, TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl()); |
| 139 | } else if (activity.data.getType().equals("1")) { | 164 | } else if (activity.data.getType().equals("1")) { |
| 140 | activity.getPresenter().saveVideo(activity, TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl()); | 165 | activity.getPresenter().saveVideo(activity, TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl()); |
| 141 | } | 166 | } |
| 142 | }); | 167 | }); |
| 143 | - dialog.findViewById(R.id.can_scan).setOnClickListener(view -> | ||
| 144 | - activity.getPresenter().doScan(activity, TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl())); | 168 | + dialog.findViewById(R.id.can_scan).setOnClickListener(view -> { |
| 169 | + dialog.dismiss(); | ||
| 170 | + activity.getPresenter().doScan(activity, TextUtils.isEmpty(preViewImgList.get(position).getImgUrl()) ? preViewImgList.get(position).getImgUrl() : preViewImgList.get(position).getImgUrl()); | ||
| 171 | + }); | ||
| 145 | } | 172 | } |
| 146 | 173 | ||
| 147 | 174 | ||
| @@ -356,7 +383,6 @@ public class PreViewImageView extends BaseView { | @@ -356,7 +383,6 @@ public class PreViewImageView extends BaseView { | ||
| 356 | 383 | ||
| 357 | public void hideLoading() { | 384 | public void hideLoading() { |
| 358 | if (loadingDiaog != null) loadingDiaog.dismiss(); | 385 | if (loadingDiaog != null) loadingDiaog.dismiss(); |
| 359 | - if (activity != null) activity.finish(); | ||
| 360 | } | 386 | } |
| 361 | 387 | ||
| 362 | public void showError() { | 388 | public void showError() { |
core/imageload/src/main/res/values/style.xml
| @@ -51,4 +51,10 @@ | @@ -51,4 +51,10 @@ | ||
| 51 | <item name="android:windowIsTranslucent">true</item> | 51 | <item name="android:windowIsTranslucent">true</item> |
| 52 | <item name="android:windowAnimationStyle">@style/ActivityInOutAnimation</item> | 52 | <item name="android:windowAnimationStyle">@style/ActivityInOutAnimation</item> |
| 53 | </style> | 53 | </style> |
| 54 | + | ||
| 55 | + | ||
| 56 | + <style name="dialogStyle" parent="android:Animation"> | ||
| 57 | + <item name="android:windowEnterAnimation">@anim/anim_enter</item> | ||
| 58 | + <item name="android:windowExitAnimation">@anim/anim_exit</item> | ||
| 59 | + </style> | ||
| 54 | </resources> | 60 | </resources> |
| 55 | \ No newline at end of file | 61 | \ No newline at end of file |