|
@@ -1,14 +1,22 @@
|
|
|
package com.sheep.gamegroup.view.activity;
|
|
package com.sheep.gamegroup.view.activity;
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.SuppressLint;
|
|
|
|
|
+import android.app.Activity;
|
|
|
import android.graphics.drawable.Drawable;
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
|
+import android.os.Bundle;
|
|
|
import android.support.annotation.Nullable;
|
|
import android.support.annotation.Nullable;
|
|
|
import android.support.v4.view.ViewPager;
|
|
import android.support.v4.view.ViewPager;
|
|
|
|
|
+import android.support.v7.widget.GridLayoutManager;
|
|
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
|
|
+import android.text.TextUtils;
|
|
|
|
|
+import android.util.SparseArray;
|
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.MotionEvent;
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
|
|
+import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.Glide;
|
|
|
import com.bumptech.glide.load.DataSource;
|
|
import com.bumptech.glide.load.DataSource;
|
|
|
import com.bumptech.glide.load.engine.GlideException;
|
|
import com.bumptech.glide.load.engine.GlideException;
|
|
@@ -16,31 +24,78 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
|
|
import com.bumptech.glide.request.RequestListener;
|
|
import com.bumptech.glide.request.RequestListener;
|
|
|
import com.bumptech.glide.request.RequestOptions;
|
|
import com.bumptech.glide.request.RequestOptions;
|
|
|
import com.bumptech.glide.request.target.Target;
|
|
import com.bumptech.glide.request.target.Target;
|
|
|
|
|
+import com.kfzs.duanduan.utils.StatusBarUtils;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.DialogConfig;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.FriendAndAwardEntity;
|
|
|
import com.sheep.gamegroup.model.entity.PictureInvitationEntity;
|
|
import com.sheep.gamegroup.model.entity.PictureInvitationEntity;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.transformer.ScaleTransformer;
|
|
import com.sheep.gamegroup.transformer.ScaleTransformer;
|
|
|
|
|
+import com.sheep.gamegroup.util.CommonUtil;
|
|
|
|
|
+import com.sheep.gamegroup.util.DataUtil;
|
|
|
|
|
+import com.sheep.gamegroup.util.FastJsonUtils;
|
|
|
|
|
+import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
|
|
+import com.sheep.gamegroup.util.ListUtil;
|
|
|
|
|
+import com.sheep.gamegroup.util.StringUtils;
|
|
|
|
|
+import com.sheep.gamegroup.util.ViewHolder;
|
|
|
|
|
+import com.sheep.gamegroup.util.ViewUtil;
|
|
|
|
|
+import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
|
|
|
import com.sheep.gamegroup.view.adapter.ArrayPagerAdapter;
|
|
import com.sheep.gamegroup.view.adapter.ArrayPagerAdapter;
|
|
|
|
|
+import com.sheep.gamegroup.view.dialog.DialogShare;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.ClassFileHelper;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
|
|
+import com.umeng.socialize.ShareAction;
|
|
|
|
|
+import com.umeng.socialize.bean.SHARE_MEDIA;
|
|
|
|
|
+import com.umeng.socialize.media.UMImage;
|
|
|
|
|
+import com.umeng.socialize.media.UMWeb;
|
|
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Locale;
|
|
|
|
|
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
|
|
|
+import butterknife.OnClick;
|
|
|
import rx.android.schedulers.AndroidSchedulers;
|
|
import rx.android.schedulers.AndroidSchedulers;
|
|
|
|
|
+import rx.functions.Action1;
|
|
|
import rx.schedulers.Schedulers;
|
|
import rx.schedulers.Schedulers;
|
|
|
|
|
|
|
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.LINK_SHARE;
|
|
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.QR_COPY;
|
|
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.SHARE_TO_QQ;
|
|
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.SHARE_TO_WEIXIN_CIRCLE;
|
|
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.SHARE_TO_WX;
|
|
|
|
|
+import static com.sheep.gamegroup.util.ViewUtil.getNetImgByName;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Created by realicing on 2018/9/7.
|
|
* Created by realicing on 2018/9/7.
|
|
|
* realicing@sina.com
|
|
* realicing@sina.com
|
|
|
*/
|
|
*/
|
|
|
public class ActInvitation extends BaseActivity {
|
|
public class ActInvitation extends BaseActivity {
|
|
|
|
|
+ @BindView(R.id.ask_share_list)
|
|
|
|
|
+ RecyclerView ask_share_list;
|
|
|
|
|
+ @BindView(R.id.img_baseactivity_title)
|
|
|
|
|
+ ImageView img_baseactivity_title;
|
|
|
|
|
+
|
|
|
|
|
+ GridLayoutManager gridLayoutManager;
|
|
|
|
|
+ UserEntity userEntity = DataUtil.getInstance().getUserEntity();
|
|
|
|
|
+ private FriendAndAwardEntity friendAndAwardEntity;
|
|
|
@BindView(R.id.act_invitation_rl)
|
|
@BindView(R.id.act_invitation_rl)
|
|
|
View act_invitation_rl;
|
|
View act_invitation_rl;
|
|
|
@BindView(R.id.act_invitation_cvp)
|
|
@BindView(R.id.act_invitation_cvp)
|
|
|
ViewPager viewPager;
|
|
ViewPager viewPager;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
|
|
+ StatusBarUtils.setTranslucent(this);
|
|
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected int getLayoutId() {
|
|
protected int getLayoutId() {
|
|
|
return R.layout.act_invitation;
|
|
return R.layout.act_invitation;
|
|
@@ -51,6 +106,9 @@ public class ActInvitation extends BaseActivity {
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
@Override
|
|
@Override
|
|
|
public void initView() {
|
|
public void initView() {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void initListener() {
|
|
|
act_invitation_rl.setOnTouchListener(new View.OnTouchListener() {
|
|
act_invitation_rl.setOnTouchListener(new View.OnTouchListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean onTouch(View v, MotionEvent event) {
|
|
public boolean onTouch(View v, MotionEvent event) {
|
|
@@ -61,6 +119,19 @@ public class ActInvitation extends BaseActivity {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void initData() {
|
|
public void initData() {
|
|
|
|
|
+ showProgress();
|
|
|
|
|
+ if(userEntity == null) {
|
|
|
|
|
+ CommonUtil.getInstance().callActionWithUserInfo(new Action1<UserEntity>() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void call(UserEntity userEntity) {
|
|
|
|
|
+ load++;
|
|
|
|
|
+ checkLoadFinish();
|
|
|
|
|
+ checkLoadLinkAndDesFinish();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ load++;
|
|
|
|
|
+ }
|
|
|
SheepApp.getInstance()
|
|
SheepApp.getInstance()
|
|
|
.getNetComponent()
|
|
.getNetComponent()
|
|
|
.getApiService()
|
|
.getApiService()
|
|
@@ -70,21 +141,65 @@ public class ActInvitation extends BaseActivity {
|
|
|
.subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
.subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
@Override
|
|
@Override
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ load++;
|
|
|
mPictureList.addAll(baseMessage.getDataList(PictureInvitationEntity.class));
|
|
mPictureList.addAll(baseMessage.getDataList(PictureInvitationEntity.class));
|
|
|
loadData();
|
|
loadData();
|
|
|
|
|
+ checkLoadFinish();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ load++;
|
|
|
|
|
+ checkLoadFinish();
|
|
|
|
|
+ G.showToast(baseMessage);
|
|
|
}
|
|
}
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().FriendCountAndAward()
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
@Override
|
|
@Override
|
|
|
public void onError(BaseMessage baseMessage) {
|
|
public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ load++;
|
|
|
|
|
+ if (BuildConfig.DEBUG)
|
|
|
|
|
+ G.showToast(baseMessage);
|
|
|
|
|
+ checkLoadFinish();
|
|
|
|
|
+ checkLoadLinkAndDesFinish();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ load++;
|
|
|
|
|
+ if (baseMessage != null) {
|
|
|
|
|
+ friendAndAwardEntity = FastJsonUtils.toBean(JSONObject.toJSONString(baseMessage.getData()), FriendAndAwardEntity.class);
|
|
|
|
|
+ }
|
|
|
|
|
+ checkLoadFinish();
|
|
|
|
|
+ checkLoadLinkAndDesFinish();
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ private int load = 0;
|
|
|
|
|
+ private void checkLoadLinkAndDesFinish() {
|
|
|
|
|
+ if(userEntity != null && friendAndAwardEntity != null){
|
|
|
|
|
+ init(userEntity.getShareLink(), friendAndAwardEntity.getShare_desc());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void checkLoadFinish() {
|
|
|
|
|
+ if(load == 3){
|
|
|
|
|
+ hideProgress();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
private void loadData() {
|
|
private void loadData() {
|
|
|
|
|
+ int size = 0;
|
|
|
for (final PictureInvitationEntity item : mPictureList) {
|
|
for (final PictureInvitationEntity item : mPictureList) {
|
|
|
View itemView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.item_image2, null);
|
|
View itemView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.item_image2, null);
|
|
|
|
|
|
|
|
ImageView image_full = itemView.findViewById(R.id.image_full);
|
|
ImageView image_full = itemView.findViewById(R.id.image_full);
|
|
|
|
|
+ ImageView image_bottom = itemView.findViewById(R.id.image_bottom);
|
|
|
Glide.with(SheepApp.getInstance())
|
|
Glide.with(SheepApp.getInstance())
|
|
|
.load(item.getPicture())
|
|
.load(item.getPicture())
|
|
|
.listener(new RequestListener<Drawable>() {
|
|
.listener(new RequestListener<Drawable>() {
|
|
@@ -102,11 +217,210 @@ public class ActInvitation extends BaseActivity {
|
|
|
})
|
|
})
|
|
|
.apply(new RequestOptions().centerCrop().transform(new RoundedCorners((int) getResources().getDimension(R.dimen.content_padding_8))))
|
|
.apply(new RequestOptions().centerCrop().transform(new RoundedCorners((int) getResources().getDimension(R.dimen.content_padding_8))))
|
|
|
.into(image_full);
|
|
.into(image_full);
|
|
|
|
|
+ GlideImageLoader.saveAndSetRqImage(image_bottom, item.getLink(), 800);
|
|
|
viewArrayList.add(itemView);
|
|
viewArrayList.add(itemView);
|
|
|
|
|
+ viewList.put(size, itemView);
|
|
|
|
|
+ size++;
|
|
|
}
|
|
}
|
|
|
ArrayPagerAdapter adapter = new ArrayPagerAdapter(viewArrayList);
|
|
ArrayPagerAdapter adapter = new ArrayPagerAdapter(viewArrayList);
|
|
|
viewPager.setAdapter(adapter);
|
|
viewPager.setAdapter(adapter);
|
|
|
- viewPager.setOffscreenPageLimit(mPictureList.size());
|
|
|
|
|
|
|
+ viewPager.setOffscreenPageLimit(size);
|
|
|
viewPager.setPageTransformer(true, new ScaleTransformer());
|
|
viewPager.setPageTransformer(true, new ScaleTransformer());
|
|
|
|
|
+ viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onPageSelected(int position) {
|
|
|
|
|
+ curPosition = position;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onPageScrollStateChanged(int state) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if(size > 2)
|
|
|
|
|
+ viewPager.setCurrentItem((size-1) / 2, false);
|
|
|
|
|
+ }
|
|
|
|
|
+ private int curPosition = 0;
|
|
|
|
|
+ private SparseArray<View> viewList = new SparseArray<>();
|
|
|
|
|
+
|
|
|
|
|
+ private void init(final String url, final String description) {
|
|
|
|
|
+ gridLayoutManager = new GridLayoutManager(this, 5);
|
|
|
|
|
+ ask_share_list.setLayoutManager(gridLayoutManager);
|
|
|
|
|
+ final List<String> list = ListUtil.emptyList();
|
|
|
|
|
+ list.add(DialogShare.FACE_TO_FACE);
|
|
|
|
|
+ list.add(DialogShare.WX);
|
|
|
|
|
+ list.add(DialogShare.QQ);
|
|
|
|
|
+ list.add(DialogShare.WEIXIN_CIRCLE);
|
|
|
|
|
+ list.add(DialogShare.COPY_SHARE_LINK);
|
|
|
|
|
+ final List<String> imgList = ListUtil.emptyList();
|
|
|
|
|
+ imgList.add("share_face_to_face");
|
|
|
|
|
+ imgList.add("share_wx");
|
|
|
|
|
+ imgList.add("share_qq");
|
|
|
|
|
+ imgList.add("share_weixin_circle");
|
|
|
|
|
+ imgList.add("share_copy_share_link");
|
|
|
|
|
+ final List<String> nameList = ListUtil.emptyList();
|
|
|
|
|
+ nameList.add("面对面");
|
|
|
|
|
+ nameList.add("微信");
|
|
|
|
|
+ nameList.add("QQ好友");
|
|
|
|
|
+ nameList.add("朋友圈");
|
|
|
|
|
+ nameList.add("复制链接");
|
|
|
|
|
+ AdbCommonRecycler<String> adapter = new AdbCommonRecycler<String>(this, list) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int getViewIdByType(int type) {
|
|
|
|
|
+ return R.layout.ask_to_share_item;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void convert(ViewHolder holder, final String item) {
|
|
|
|
|
+ View itemView = holder.itemView;
|
|
|
|
|
+ if (item == null)
|
|
|
|
|
+ return;
|
|
|
|
|
+ ImageView ask_to_share_item_img = itemView.findViewById(R.id.ask_to_share_item_img);
|
|
|
|
|
+ TextView ask_to_share_item_name = itemView.findViewById(R.id.ask_to_share_item_name);
|
|
|
|
|
+ final int position = holder.getAdapterPosition();
|
|
|
|
|
+ GlideImageLoader.setImage(ask_to_share_item_img, getNetImgByName(imgList.get(position)));
|
|
|
|
|
+ ask_to_share_item_name.setText(nameList.get(position));
|
|
|
|
|
+ itemView.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View view) {
|
|
|
|
|
+ File file = null;
|
|
|
|
|
+ switch (position){
|
|
|
|
|
+ case 1://qq
|
|
|
|
|
+ case 2://wx
|
|
|
|
|
+ PictureInvitationEntity picItem = ListUtil.getItem(mPictureList, curPosition);
|
|
|
|
|
+ if(picItem != null && picItem.isLoaded()) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String fileName = String.format(Locale.CHINA, "share%d%s%d.jpg", position, 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();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ G.showToast("图片正在加载中,请稍等");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ popShare(ActInvitation.this, url, item, description, file);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ ask_share_list.setAdapter(adapter);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分享 url type 拼接
|
|
|
|
|
+ */
|
|
|
|
|
+ public String jointString(String url, @DialogShare.SHARE_TYPE String type) {
|
|
|
|
|
+ if (url.contains("&type="))
|
|
|
|
|
+ return url;
|
|
|
|
|
+ switch (type) {
|
|
|
|
|
+ case "qq":
|
|
|
|
|
+ return url + "&type=2";
|
|
|
|
|
+ case "wx":
|
|
|
|
|
+ return url + "&type=1";
|
|
|
|
|
+ default:
|
|
|
|
|
+ return url + "&type=4";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分享
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param activity
|
|
|
|
|
+ * @param url
|
|
|
|
|
+ * @param type qq wx all
|
|
|
|
|
+ * @param description
|
|
|
|
|
+ */
|
|
|
|
|
+ public void popShare(Activity activity, final String url, @DialogShare.SHARE_TYPE String type, String description, File file) {
|
|
|
|
|
+ if (activity == null || TextUtils.isEmpty(type) || TextUtils.isEmpty(url)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ final String realUrl = jointString(url, type);
|
|
|
|
|
+ SHARE_MEDIA share_media;
|
|
|
|
|
+ switch (type) {
|
|
|
|
|
+ case DialogShare.ALL:
|
|
|
|
|
+ ViewUtil.newInstance().showShare(activity, realUrl, description);
|
|
|
|
|
+ return;
|
|
|
|
|
+ case DialogShare.FACE_TO_FACE:
|
|
|
|
|
+ ViewUtil.showQR(activity, realUrl);
|
|
|
|
|
+ return;
|
|
|
|
|
+ case DialogShare.COPY_SHARE_LINK:
|
|
|
|
|
+ LINK_SHARE.onEvent();
|
|
|
|
|
+ ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("分享链接").setMsg(realUrl)
|
|
|
|
|
+ .setMsgMore("他人通过该链接加入小绵羊即可成为你的好友").setMsgMoreColor(R.color.txt_black_9e9c9c)
|
|
|
|
|
+ .setBtnLeftText("复制链接").setBtnLeftOnClickListener(new View.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(View view) {
|
|
|
|
|
+ QR_COPY.onEvent();
|
|
|
|
|
+ StringUtils.CopyText(realUrl);
|
|
|
|
|
+ G.showToast("复制链接成功");
|
|
|
|
|
+ }
|
|
|
|
|
+ }));
|
|
|
|
|
+ return;
|
|
|
|
|
+ case DialogShare.QQ:
|
|
|
|
|
+ SHARE_TO_QQ.onEvent();
|
|
|
|
|
+ share_media = SHARE_MEDIA.QQ;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case DialogShare.WX:
|
|
|
|
|
+ SHARE_TO_WX.onEvent();
|
|
|
|
|
+ share_media = SHARE_MEDIA.WEIXIN;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case DialogShare.WEIXIN_CIRCLE:
|
|
|
|
|
+ default:
|
|
|
|
|
+ SHARE_TO_WEIXIN_CIRCLE.onEvent();
|
|
|
|
|
+ share_media = SHARE_MEDIA.WEIXIN_CIRCLE;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ UMImage umImage;
|
|
|
|
|
+ switch (type){
|
|
|
|
|
+ case DialogShare.QQ:
|
|
|
|
|
+ case DialogShare.WX:
|
|
|
|
|
+ umImage = new UMImage(activity, file);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ umImage = new UMImage(activity, R.mipmap.icon);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ UMWeb umWeb = new UMWeb(realUrl);
|
|
|
|
|
+ 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);
|
|
|
|
|
+ switch (type){
|
|
|
|
|
+ case DialogShare.QQ:
|
|
|
|
|
+ case DialogShare.WX:
|
|
|
|
|
+ new ShareAction(activity)
|
|
|
|
|
+ .setPlatform(share_media)
|
|
|
|
|
+ .withMedia(umImage)
|
|
|
|
|
+ .setCallback(new CommonUtil.UMShareListener())
|
|
|
|
|
+ .share();
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ new ShareAction(activity)
|
|
|
|
|
+ .setPlatform(share_media)
|
|
|
|
|
+ .withMedia(umWeb)
|
|
|
|
|
+ .setCallback(new CommonUtil.UMShareListener())
|
|
|
|
|
+ .share();
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ @OnClick(R.id.img_baseactivity_title)
|
|
|
|
|
+ public void onViewClicked(View view) {
|
|
|
|
|
+ switch (view.getId()) {
|
|
|
|
|
+ case R.id.img_baseactivity_title:
|
|
|
|
|
+ finish();
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|