@Test public void shareView(){ DirectroyController.getInstance().init(application); Wallet wallet = new Wallet(); wallet.setUuid("9eed1da8-58e9-4b10-8bea-2bfdd1cac433"); wallet.setAvatar("avatar_3"); wallet.setAddress("0x0d395e21b23f8d920f8556cbf573af9ba2ad1a59"); wallet.setChainId("101"); wallet.setName("Ella"); wallet.setKeystorePath("UTC--2020-06-28T06-36-42.751--b1ca4a13ee33ed68d097223f186f65864ecdb98c9b35c664566f096761649aa7d9c9c2bc317785a5c2580b305803e5f29aafce422e49579792623575215675e7.json"); Bech32Address bech32Address = new Bech32Address("lat1p5u4ugdj87xeyru92m9l2ua0nw326xjekflsf8","lax1p5u4ugdj87xeyru92m9l2ua0nw326xjeevdl8g"); wallet.setBech32Address(bech32Address); Bitmap bmp = BitmapFactory.decodeResource(application.getResources(),R.drawable.avatar_1); presenter.setWalletEntity(wallet); presenter.setmQRCodeBitmap(bmp); }
@Override public void shareView() { if (mQRCodeBitmap == null || walletEntity == null) { return; } String text = walletEntity.getPrefixAddress(); View shareView = getView().shareView(walletEntity.getName(), text, mQRCodeBitmap); final BaseActivity activity = currentActivity(); DirectroyController.getInstance().getDir(activity, DirType.image, new DirectroyController.DirCallback() { @Override public void callback(File dir) { if (dir != null) { Bitmap shareBitmap = screenShot(shareView); boolean saved = PhotoUtil.saveImageToAlbum(activity, dir, getImageName(), shareBitmap); if (saved) { ToastUtil.showLongToast(activity, activity.getResources().getString(R.string.save_image_tips)); List<ShareAppInfo> shareAppInfoList = Arrays.asList(ShareAppInfo.values()); if (!shareAppInfoList.isEmpty()) { ShareDialogFragment.newInstance(new ArrayList<>(shareAppInfoList)) .setOnShareItemClickListener(new ShareDialogFragment.OnShareItemClickListener() { @Override public void onShareItemClick(BaseDialogFragment dialogFragment, ShareAppInfo shareAppInfo) { dialogFragment.dismiss(); shareAppInfo.share(currentActivity(), shareBitmap, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { showLoadingDialog(); } @Override public void onResult(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_success); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_failed); } @Override public void onCancel(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_cancelled); } }); } }) .show(activity.getSupportFragmentManager(), "showShareDialogFragment"); } } else { showShortToast(R.string.save_image_failed_tips); } } } }); }
ReceiveTransactionPresenter extends BasePresenter<ReceiveTransationContract.View> implements ReceiveTransationContract.Presenter { @Override public void shareView() { if (mQRCodeBitmap == null || walletEntity == null) { return; } String text = walletEntity.getPrefixAddress(); View shareView = getView().shareView(walletEntity.getName(), text, mQRCodeBitmap); final BaseActivity activity = currentActivity(); DirectroyController.getInstance().getDir(activity, DirType.image, new DirectroyController.DirCallback() { @Override public void callback(File dir) { if (dir != null) { Bitmap shareBitmap = screenShot(shareView); boolean saved = PhotoUtil.saveImageToAlbum(activity, dir, getImageName(), shareBitmap); if (saved) { ToastUtil.showLongToast(activity, activity.getResources().getString(R.string.save_image_tips)); List<ShareAppInfo> shareAppInfoList = Arrays.asList(ShareAppInfo.values()); if (!shareAppInfoList.isEmpty()) { ShareDialogFragment.newInstance(new ArrayList<>(shareAppInfoList)) .setOnShareItemClickListener(new ShareDialogFragment.OnShareItemClickListener() { @Override public void onShareItemClick(BaseDialogFragment dialogFragment, ShareAppInfo shareAppInfo) { dialogFragment.dismiss(); shareAppInfo.share(currentActivity(), shareBitmap, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { showLoadingDialog(); } @Override public void onResult(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_success); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_failed); } @Override public void onCancel(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_cancelled); } }); } }) .show(activity.getSupportFragmentManager(), "showShareDialogFragment"); } } else { showShortToast(R.string.save_image_failed_tips); } } } }); } }
ReceiveTransactionPresenter extends BasePresenter<ReceiveTransationContract.View> implements ReceiveTransationContract.Presenter { @Override public void shareView() { if (mQRCodeBitmap == null || walletEntity == null) { return; } String text = walletEntity.getPrefixAddress(); View shareView = getView().shareView(walletEntity.getName(), text, mQRCodeBitmap); final BaseActivity activity = currentActivity(); DirectroyController.getInstance().getDir(activity, DirType.image, new DirectroyController.DirCallback() { @Override public void callback(File dir) { if (dir != null) { Bitmap shareBitmap = screenShot(shareView); boolean saved = PhotoUtil.saveImageToAlbum(activity, dir, getImageName(), shareBitmap); if (saved) { ToastUtil.showLongToast(activity, activity.getResources().getString(R.string.save_image_tips)); List<ShareAppInfo> shareAppInfoList = Arrays.asList(ShareAppInfo.values()); if (!shareAppInfoList.isEmpty()) { ShareDialogFragment.newInstance(new ArrayList<>(shareAppInfoList)) .setOnShareItemClickListener(new ShareDialogFragment.OnShareItemClickListener() { @Override public void onShareItemClick(BaseDialogFragment dialogFragment, ShareAppInfo shareAppInfo) { dialogFragment.dismiss(); shareAppInfo.share(currentActivity(), shareBitmap, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { showLoadingDialog(); } @Override public void onResult(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_success); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_failed); } @Override public void onCancel(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_cancelled); } }); } }) .show(activity.getSupportFragmentManager(), "showShareDialogFragment"); } } else { showShortToast(R.string.save_image_failed_tips); } } } }); }  }
ReceiveTransactionPresenter extends BasePresenter<ReceiveTransationContract.View> implements ReceiveTransationContract.Presenter { @Override public void shareView() { if (mQRCodeBitmap == null || walletEntity == null) { return; } String text = walletEntity.getPrefixAddress(); View shareView = getView().shareView(walletEntity.getName(), text, mQRCodeBitmap); final BaseActivity activity = currentActivity(); DirectroyController.getInstance().getDir(activity, DirType.image, new DirectroyController.DirCallback() { @Override public void callback(File dir) { if (dir != null) { Bitmap shareBitmap = screenShot(shareView); boolean saved = PhotoUtil.saveImageToAlbum(activity, dir, getImageName(), shareBitmap); if (saved) { ToastUtil.showLongToast(activity, activity.getResources().getString(R.string.save_image_tips)); List<ShareAppInfo> shareAppInfoList = Arrays.asList(ShareAppInfo.values()); if (!shareAppInfoList.isEmpty()) { ShareDialogFragment.newInstance(new ArrayList<>(shareAppInfoList)) .setOnShareItemClickListener(new ShareDialogFragment.OnShareItemClickListener() { @Override public void onShareItemClick(BaseDialogFragment dialogFragment, ShareAppInfo shareAppInfo) { dialogFragment.dismiss(); shareAppInfo.share(currentActivity(), shareBitmap, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { showLoadingDialog(); } @Override public void onResult(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_success); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_failed); } @Override public void onCancel(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_cancelled); } }); } }) .show(activity.getSupportFragmentManager(), "showShareDialogFragment"); } } else { showShortToast(R.string.save_image_failed_tips); } } } }); }  Wallet getWalletEntity(); void setWalletEntity(Wallet walletEntity); Bitmap getmQRCodeBitmap(); void setmQRCodeBitmap(Bitmap mQRCodeBitmap); @Override void loadData(); @Override void shareView(); @Override void copy(); }
ReceiveTransactionPresenter extends BasePresenter<ReceiveTransationContract.View> implements ReceiveTransationContract.Presenter { @Override public void shareView() { if (mQRCodeBitmap == null || walletEntity == null) { return; } String text = walletEntity.getPrefixAddress(); View shareView = getView().shareView(walletEntity.getName(), text, mQRCodeBitmap); final BaseActivity activity = currentActivity(); DirectroyController.getInstance().getDir(activity, DirType.image, new DirectroyController.DirCallback() { @Override public void callback(File dir) { if (dir != null) { Bitmap shareBitmap = screenShot(shareView); boolean saved = PhotoUtil.saveImageToAlbum(activity, dir, getImageName(), shareBitmap); if (saved) { ToastUtil.showLongToast(activity, activity.getResources().getString(R.string.save_image_tips)); List<ShareAppInfo> shareAppInfoList = Arrays.asList(ShareAppInfo.values()); if (!shareAppInfoList.isEmpty()) { ShareDialogFragment.newInstance(new ArrayList<>(shareAppInfoList)) .setOnShareItemClickListener(new ShareDialogFragment.OnShareItemClickListener() { @Override public void onShareItemClick(BaseDialogFragment dialogFragment, ShareAppInfo shareAppInfo) { dialogFragment.dismiss(); shareAppInfo.share(currentActivity(), shareBitmap, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { showLoadingDialog(); } @Override public void onResult(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_success); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_failed); } @Override public void onCancel(SHARE_MEDIA share_media) { dismissLoadingDialogImmediately(); showLongToast(R.string.msg_share_cancelled); } }); } }) .show(activity.getSupportFragmentManager(), "showShareDialogFragment"); } } else { showShortToast(R.string.save_image_failed_tips); } } } }); }  Wallet getWalletEntity(); void setWalletEntity(Wallet walletEntity); Bitmap getmQRCodeBitmap(); void setmQRCodeBitmap(Bitmap mQRCodeBitmap); @Override void loadData(); @Override void shareView(); @Override void copy();  }