fix [修复-bug]

This commit is contained in:
hch
2024-04-03 13:11:10 +08:00
parent 0f9f53a080
commit 04bc9af501
28 changed files with 469 additions and 238 deletions

View File

@@ -31,6 +31,16 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
private List<ShareBean> list;
ShareCallback shareCallback;
private onShareListener onShareListener;
public ShareAppAdapter.onShareListener getOnShareListener() {
return onShareListener;
}
public void setOnShareListener(ShareAppAdapter.onShareListener onShareListener) {
this.onShareListener = onShareListener;
}
public ShareAppAdapter(Context mContext) {
list = new ArrayList<>();
this.mContext = mContext;
@@ -50,7 +60,7 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
@Override
public void onBindViewHolder(@NonNull AppViewHolder holder, int position) {
ShareBean builder = list.get(position);
System.out.println("------type------>"+builder.getType());
System.out.println("------type------>" + builder.getType());
switch (builder.getType()) {
case ShareBean.APP_FACEBOOK:
holder.setData(builder, R.mipmap.icon_share_facebook, R.string.dialog_share_app_facebook);
@@ -125,11 +135,17 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
new Internal(itemView.getContext()).share(bean, shareCallback);
break;
}
if (onShareListener != null) {
onShareListener.onAddShareCount();
}
});
}
}
public interface onShareListener {
void onAddShareCount();
}
public static class ShareCallback implements ICallback {
@Override

View File

@@ -40,21 +40,26 @@ public class SharePopDialog extends AbsDialogPopupWindow {
private String shareLink;
private int type;
private ShareBean bean;
public onShareListener onShareListener;
public void setOnShareListener(SharePopDialog.onShareListener onShareListener) {
this.onShareListener = onShareListener;
}
public SharePopDialog(@NonNull Context context) {
super(context);
}
public SharePopDialog setShareType(int type) {
this.type = type;
return this;
}
public SharePopDialog setShareData(ShareBean build) {
this.bean=build;
this.bean = build;
return this;
}
public SharePopDialog setShareLink(String link) {
this.shareLink = link + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
return this;
@@ -87,6 +92,14 @@ public class SharePopDialog extends AbsDialogPopupWindow {
dismiss();
}
});
adapter.setOnShareListener(new ShareAppAdapter.onShareListener() {
@Override
public void onAddShareCount() {
if (onShareListener != null) {
onShareListener.onShareAddCount();
}
}
});
list.setLayoutManager(new GridLayoutManager(getContext(), 3));
list.setAdapter(adapter);
initData();
@@ -114,7 +127,7 @@ public class SharePopDialog extends AbsDialogPopupWindow {
url = url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
link.setText(url);
info.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(bean.getAnchorName()) ? "" : bean.getAnchorName()));
ImgLoader.display(getContext(), bean.getAnchorAvatar(), avatar);
ImgLoader.display(getContext(), bean.getAnchorAvatar(), avatar);
}
private ShareBean builder(int type) {
@@ -137,4 +150,8 @@ public class SharePopDialog extends AbsDialogPopupWindow {
ToastUtil.show(getContext().getString(com.yunbao.common.R.string.copy_success));
}
public interface onShareListener {
void onShareAddCount();
}
}