|
|
@@ -306,7 +306,7 @@ public class ActInvitation extends BaseActivity {
|
|
|
final ImageView image_bottom = itemView.findViewById(R.id.image_bottom);
|
|
|
final ImageView image_logo = itemView.findViewById(R.id.image_logo);
|
|
|
final TextView image_tip = itemView.findViewById(R.id.image_tip);
|
|
|
- if(viewPager != null) {
|
|
|
+ if (viewPager != null) {
|
|
|
viewPager.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
@@ -407,29 +407,29 @@ public class ActInvitation extends BaseActivity {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
File file = null;
|
|
|
- switch (position) {
|
|
|
- case 2://qq
|
|
|
- case 1://wx
|
|
|
- PictureInvitationEntity picItem = ListUtil.getItem(mPictureList, curPosition);
|
|
|
- if (picItem != null && picItem.isLoaded()) {
|
|
|
- try {
|
|
|
- String fileName = String.format(Locale.CHINA, "share%d%s%d.jpg", curPosition, BuildConfig.FLAVOR, picItem.getPicture().hashCode());
|
|
|
- file = new File(ClassFileHelper.DIR, fileName);
|
|
|
- if (!file.exists()) {
|
|
|
- file = ViewUtil.saveImage(viewList.get(curPosition), ClassFileHelper.DIR, fileName);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- G.showToast(e.getMessage());
|
|
|
- return;
|
|
|
- }
|
|
|
- } else {
|
|
|
- G.showToast("图片正在加载中,请稍等");
|
|
|
- return;
|
|
|
+// switch (position) {
|
|
|
+// case 2://qq
|
|
|
+// case 1://wx
|
|
|
+ PictureInvitationEntity picItem = ListUtil.getItem(mPictureList, curPosition);
|
|
|
+ if (picItem != null && picItem.isLoaded()) {
|
|
|
+ try {
|
|
|
+ String fileName = String.format(Locale.CHINA, "share%d%s%d.jpg", curPosition, BuildConfig.FLAVOR, picItem.getPicture().hashCode());
|
|
|
+ file = new File(ClassFileHelper.DIR, fileName);
|
|
|
+ if (!file.exists()) {
|
|
|
+ file = ViewUtil.saveImage(viewList.get(curPosition), ClassFileHelper.DIR, fileName);
|
|
|
}
|
|
|
- break;
|
|
|
-
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ G.showToast(e.getMessage());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ G.showToast("图片正在加载中,请稍等");
|
|
|
+ return;
|
|
|
}
|
|
|
+// break;
|
|
|
+//
|
|
|
+// }
|
|
|
popShare(ActInvitation.this, url, item, description, file);
|
|
|
}
|
|
|
});
|
|
|
@@ -503,38 +503,33 @@ public class ActInvitation extends BaseActivity {
|
|
|
share_media = SHARE_MEDIA.WEIXIN_CIRCLE;
|
|
|
break;
|
|
|
}
|
|
|
+ String title = activity.getResources().getString(R.string.app_name);
|
|
|
UMImage umImage;
|
|
|
- UMWeb umWeb = new UMWeb(realUrl);
|
|
|
- switch (type) {
|
|
|
- case DialogShare.QQ:
|
|
|
- case DialogShare.WX:
|
|
|
- umImage = new UMImage(activity, file);
|
|
|
- break;
|
|
|
- default:
|
|
|
- umImage = new UMImage(activity, R.mipmap.icon);
|
|
|
- umWeb.setTitle(activity.getResources().getString(R.string.app_name));
|
|
|
- umWeb.setThumb(umImage);
|
|
|
- umWeb.setDescription(TextUtils.isEmpty(description) ? activity.getResources().getString(R.string.app_name) : description);
|
|
|
- break;
|
|
|
- }
|
|
|
- switch (type) {
|
|
|
- case DialogShare.QQ:
|
|
|
- case DialogShare.WX:
|
|
|
- new ShareAction(activity)
|
|
|
- .setPlatform(share_media)
|
|
|
- .withMedia(umImage)
|
|
|
- .setCallback(new CommonUtil.CommonUMShareListener())
|
|
|
- .share();
|
|
|
- break;
|
|
|
- case DialogShare.WEIXIN_CIRCLE://微信朋友圈分享时只会显示标题,所以这里使用描述
|
|
|
- umWeb.setTitle(TextUtils.isEmpty(description) ? activity.getResources().getString(R.string.app_name) : description);
|
|
|
- default:
|
|
|
- new ShareAction(activity)
|
|
|
- .setPlatform(share_media)
|
|
|
- .withMedia(umWeb)
|
|
|
- .setCallback(new CommonUtil.CommonUMShareListener())
|
|
|
- .share();
|
|
|
- break;
|
|
|
+ UMWeb umWeb;
|
|
|
+ if (file == null || !file.exists()) {
|
|
|
+ umImage = new UMImage(SheepApp.getInstance(), R.mipmap.icon);
|
|
|
+ umWeb = new UMWeb(realUrl);
|
|
|
+ umWeb.setTitle(title);
|
|
|
+ umWeb.setThumb(umImage);
|
|
|
+ umWeb.setDescription(TextUtils.isEmpty(description) ? title : description);
|
|
|
+ switch (type) {
|
|
|
+ case DialogShare.WEIXIN_CIRCLE://微信朋友圈分享时只会显示标题,所以这里使用描述
|
|
|
+ umWeb.setTitle(TextUtils.isEmpty(description) ? title : (title + "\n" + description));
|
|
|
+ default:
|
|
|
+ new ShareAction(activity)
|
|
|
+ .setPlatform(share_media)
|
|
|
+ .withMedia(umWeb)
|
|
|
+ .setCallback(new CommonUtil.CommonUMShareListener())
|
|
|
+ .share();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ umImage = new UMImage(activity, file);
|
|
|
+ new ShareAction(activity)
|
|
|
+ .setPlatform(share_media)
|
|
|
+ .withMedia(umImage)
|
|
|
+ .setCallback(new CommonUtil.CommonUMShareListener())
|
|
|
+ .share();
|
|
|
}
|
|
|
}
|
|
|
|