From ba5a80fb1d340a9697cf2db50d246c61fc083899 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 3 Apr 2023 14:19:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=9B=9E=E8=81=94=E7=B3=BB=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E7=A4=BC=E7=89=A9=E6=8E=A5=E5=8F=A3,=E4=BB=85?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=83=AD=E9=97=A8=E5=88=86=E7=B1=BB=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E7=A4=BC=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/InviteRewardListAdapter.java | 102 ------------ .../yunbao/share/bean/InviteRewardBean.java | 63 -------- .../share/ui/InviteRewardPopDialog.java | 148 ------------------ .../main/res/layout/item_invite_reward.xml | 70 --------- Share/src/main/res/values/strings.xml | 1 - .../adapter/LiveAnchorEditCallMeAdapter.java | 2 +- .../com/yunbao/live/dialog/GiftPopDialog.java | 9 ++ .../live/dialog/LiveGiftDialogFragment.java | 69 +++----- 8 files changed, 29 insertions(+), 435 deletions(-) delete mode 100644 Share/src/main/java/com/yunbao/share/adapters/InviteRewardListAdapter.java delete mode 100644 Share/src/main/java/com/yunbao/share/bean/InviteRewardBean.java delete mode 100644 Share/src/main/java/com/yunbao/share/ui/InviteRewardPopDialog.java delete mode 100644 Share/src/main/res/layout/item_invite_reward.xml diff --git a/Share/src/main/java/com/yunbao/share/adapters/InviteRewardListAdapter.java b/Share/src/main/java/com/yunbao/share/adapters/InviteRewardListAdapter.java deleted file mode 100644 index 8867a1978..000000000 --- a/Share/src/main/java/com/yunbao/share/adapters/InviteRewardListAdapter.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.yunbao.share.adapters; - -import android.content.Context; -import android.graphics.Color; -import android.graphics.Typeface; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.pdlive.shayu.R; -import com.yunbao.share.bean.InviteRewardBean; - -import java.util.List; - -public class InviteRewardListAdapter extends RecyclerView.Adapter { - private Context mContext; - private List list; - - public InviteRewardListAdapter(Context mContext) { - this.mContext = mContext; - } - - public void setList(List list) { - this.list = list; - } - - @NonNull - @Override - public RewardViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new RewardViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_invite_reward, parent, false)); - } - - @Override - public void onBindViewHolder(@NonNull RewardViewHolder holder, int position) { - holder.setData(list.get(position), position); - } - - @Override - public int getItemCount() { - return list.size(); - } - - - public static class RewardViewHolder extends RecyclerView.ViewHolder { - private final TextView item1; - private final TextView item2; - private final TextView item3; - private final TextView item4; - private final View divider, divider2; - - public RewardViewHolder(@NonNull View itemView) { - super(itemView); - item1 = itemView.findViewById(R.id.item1); - item2 = itemView.findViewById(R.id.item2); - item3 = itemView.findViewById(R.id.item3); - item4 = itemView.findViewById(R.id.item4); - divider = itemView.findViewById(R.id.divider); - divider2 = itemView.findViewById(R.id.divider2); - } - - void setData(InviteRewardBean bean, int position) { - item1.setText(bean.getUsername()); - item2.setText(bean.getInviteTime()); - item3.setText(bean.getType()); - item4.setText(bean.getReward()); - if (position != 0) { - divider.setVisibility(View.GONE); - divider2.setVisibility(View.GONE); - setColor("#2F87B2", item1, item2, item3, item4); - setType(Typeface.NORMAL, item1, item2, item3, item4); - } else { - setColor("#236586", item1, item2, item3, item4); - setType(Typeface.BOLD, item1, item2, item3, item4); - } - setSize(13, item1, item2, item3, item4); - } - - void setColor(String color, TextView... textView) { - for (TextView view : textView) { - view.setTextColor(Color.parseColor(color)); - } - } - - void setSize(float size, TextView... textView) { - for (TextView view : textView) { - view.setTextSize(size); - - } - } - - void setType(int type, TextView... textView) { - for (TextView view : textView) { - view.setTypeface(Typeface.defaultFromStyle(type)); - - } - } - } -} diff --git a/Share/src/main/java/com/yunbao/share/bean/InviteRewardBean.java b/Share/src/main/java/com/yunbao/share/bean/InviteRewardBean.java deleted file mode 100644 index af999aaa8..000000000 --- a/Share/src/main/java/com/yunbao/share/bean/InviteRewardBean.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.yunbao.share.bean; - -import androidx.annotation.NonNull; - -public class InviteRewardBean{ - private String username; - private String inviteTime; - private String type; - private String reward; - - public InviteRewardBean() { - } - - public InviteRewardBean(String username, String inviteTime, String type, String reward) { - this.username = username; - this.inviteTime = inviteTime; - this.type = type; - this.reward = reward; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getInviteTime() { - return inviteTime; - } - - public void setInviteTime(String inviteTime) { - this.inviteTime = inviteTime; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getReward() { - return reward; - } - - public void setReward(String reward) { - this.reward = reward; - } - - @NonNull - @Override - public String toString() { - return "InviteRewardBean{" + - "username='" + username + '\'' + - ", inviteTime='" + inviteTime + '\'' + - ", type='" + type + '\'' + - ", reward='" + reward + '\'' + - '}'; - } -} diff --git a/Share/src/main/java/com/yunbao/share/ui/InviteRewardPopDialog.java b/Share/src/main/java/com/yunbao/share/ui/InviteRewardPopDialog.java deleted file mode 100644 index dd3da1d48..000000000 --- a/Share/src/main/java/com/yunbao/share/ui/InviteRewardPopDialog.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.yunbao.share.ui; - -import static android.content.Context.CLIPBOARD_SERVICE; - -import android.app.Dialog; -import android.content.ClipData; -import android.content.ClipboardManager; -import android.content.Context; -import android.graphics.Color; -import android.graphics.LinearGradient; -import android.graphics.Shader; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.lxj.xpopup.XPopup; -import com.makeramen.roundedimageview.RoundedImageView; -import com.pdlive.shayu.R; -import com.yunbao.common.dialog.AbsDialogPopupWindow; -import com.yunbao.common.utils.DialogUitl; -import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; -import com.yunbao.share.adapters.InviteRewardListAdapter; -import com.yunbao.share.bean.InviteRewardBean; -import com.yunbao.share.bean.ShareBuilder; -import com.yunbao.share.adapters.ShareAppAdapter; - -import java.util.ArrayList; -import java.util.List; - -public class InviteRewardPopDialog extends AbsDialogPopupWindow { - private InviteRewardListAdapter adapter; - private RecyclerView list; - private RoundedImageView avatar; - private TextView info; - private TextView link; - private List data; - private TextView title; - private String uid; - private String anchorId; - private String anchorName; - private String anchorAvatar; - - public InviteRewardPopDialog(@NonNull Context context) { - super(context); - } - - public InviteRewardPopDialog setUid(String uid) { - this.uid = uid; - return this; - } - - public InviteRewardPopDialog setAnchorId(String anchorId) { - this.anchorId = anchorId; - return this; - } - - public InviteRewardPopDialog setAnchorName(String anchorName) { - this.anchorName = anchorName; - return this; - } - - public InviteRewardPopDialog setAnchorAvatar(String anchorAvatar) { - this.anchorAvatar = anchorAvatar; - return this; - } - - @Override - public void buildDialog(XPopup.Builder builder) { - - } - - @Override - public int bindLayoutId() { - return R.layout.dialog_share; - } - - - @Override - protected void onCreate() { - super.onCreate(); - findViewById(R.id.close).setOnClickListener(v -> dismiss()); - findViewById(R.id.share_copy).setOnClickListener(v -> copyLink()); - findViewById(R.id.share_preview).setVisibility(GONE); - findViewById(R.id.share_dialog).setBackgroundResource(R.mipmap.bg_dialog_inviet); - title = findViewById(R.id.share_title); - title.setOnClickListener(v -> copyLink()); - title.setText(R.string.dialog_invite_reward_title); - list = findViewById(R.id.share_apps_list); - avatar = findViewById(R.id.share_avatar); - info = findViewById(R.id.share_info); - link = findViewById(R.id.share_link); - adapter = new InviteRewardListAdapter(getContext()); - list.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false)); - list.setAdapter(adapter); - initData(); - title.getViewTreeObserver().addOnGlobalLayoutListener(this::setTitleColor); - } - private void setTitleColor(){ - int[] colors = { - Color.parseColor("#3377FF"), - Color.parseColor("#7F66FF"), - }; - float[] position = { - 0f, - 1.0f - }; - float height=title.getMeasuredHeight(); - LinearGradient mLinearGradient = new LinearGradient(0, 0, 0, height, colors, position, Shader.TileMode.CLAMP); - title.getPaint().setShader(mLinearGradient); - title.invalidate(); - } - private void initData() { - data = new ArrayList<>(); - data.add(new InviteRewardBean("標題", "邀請時間", "用戶等級", "獲得獎勵")); - for (int i = 0; i < 5; i++) { - data.add(new InviteRewardBean("用戶" + 1, "時間" + 1, "等級" + 1, "獎勵" + 1)); - } - adapter.setList(data); - - } - - private ShareBuilder builder(int type) { - ShareBuilder builder = ShareBuilder.builder(type); - //builder.setText(WordUtil.getString(R.string.dialog_share_info)); - builder.setLink(ShareBuilder.createInviteLink(uid)); - builder.setUid(uid); - builder.setAnchorId(anchorId); - builder.setAnchorName(anchorName); - builder.setAnchorAvatar(anchorAvatar); - return builder; - } - - private void copyLink() { - ClipboardManager cm = (ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE); - ClipData clipData = ClipData.newPlainText("text", link.getText().toString()); - cm.setPrimaryClip(clipData); - ToastUtil.show(WordUtil.getString(com.yunbao.common.R.string.copy_success)); - DialogUitl.showSimpleDialog(getContext(), ShareBuilder.createInviteLink(uid), new DialogUitl.SimpleCallback() { - @Override - public void onConfirmClick(Dialog dialog, String content) { - dialog.dismiss(); - } - }); - } -} diff --git a/Share/src/main/res/layout/item_invite_reward.xml b/Share/src/main/res/layout/item_invite_reward.xml deleted file mode 100644 index 4973964c1..000000000 --- a/Share/src/main/res/layout/item_invite_reward.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Share/src/main/res/values/strings.xml b/Share/src/main/res/values/strings.xml index 1a0b8debf..af278e2a1 100644 --- a/Share/src/main/res/values/strings.xml +++ b/Share/src/main/res/values/strings.xml @@ -12,7 +12,6 @@ Instagram 邀請好友 - 獎勵記錄 快來 PDLIVE觀看直播,認識更多有趣的朋友吧! 複製 \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java index 9f8cd1133..62d942402 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java @@ -177,8 +177,8 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter 0) { - JSONObject obj = JSON.parseObject(info[0]); - obj.put("listarray", obj.getJSONArray("giftlist")); - list = obj.getJSONArray("listarray"); - Log.i("tttts", obj.getString("giftlist") + ""); - List _list = JSON.parseArray(obj.getJSONArray("giftlist").toJSONString(), LiveGiftBean.class); - showGiftList(_list); - mGiftPackage.setTextColor(Color.parseColor("#FFFFFF")); - mCoin.setText(obj.getString("coin")); - mTvGoldCoin.setText(obj.getString("gold")); - Bus.getOn(LiveGiftDialogFragment.this); - } - } + LiveHttpUtil.getNewGiftList(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + JSONObject obj = JSON.parseObject(info[0]); + list = obj.getJSONArray("listarray"); + Log.i("tttts", obj.getString("listarray") + ""); + CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray")); - @Override - public void onFinish() { - if (mLoading != null) { - mLoading.setVisibility(View.INVISIBLE); - } + upData(); + mCoin.setText(obj.getString("coin")); + mTvGoldCoin.setText(obj.getString("gold")); + Bus.getOn(LiveGiftDialogFragment.this); } - }); - } else { - LiveHttpUtil.getNewGiftList(new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - JSONObject obj = JSON.parseObject(info[0]); - list = obj.getJSONArray("listarray"); - Log.i("tttts", obj.getString("listarray") + ""); - CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray")); + } - upData(); - mCoin.setText(obj.getString("coin")); - mTvGoldCoin.setText(obj.getString("gold")); - Bus.getOn(LiveGiftDialogFragment.this); - } + @Override + public void onFinish() { + if (mLoading != null) { + mLoading.setVisibility(View.INVISIBLE); } - - @Override - public void onFinish() { - if (mLoading != null) { - mLoading.setVisibility(View.INVISIBLE); - } - } - }); - } + } + }); } else { mLoading.setVisibility(View.INVISIBLE); upData(); @@ -496,9 +468,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On bean.setChecked(true); itemCheckOp(bean); mViewPager.setCurrentItem(i / 8); - if (isContactGift == 1) { - mLiveGiftPagerAdapter.disTouch(bean.getId()); - } } catch (Exception e) { e.printStackTrace(); }