改回联系方式礼物接口,仅显示热门分类下的礼物
This commit is contained in:
parent
73c8db8fb4
commit
ba5a80fb1d
@ -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<InviteRewardListAdapter.RewardViewHolder> {
|
||||
private Context mContext;
|
||||
private List<InviteRewardBean> list;
|
||||
|
||||
public InviteRewardListAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setList(List<InviteRewardBean> 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));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -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<InviteRewardBean> 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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingBottom="14dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/divider">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle=""
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="TextView" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout3" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -12,7 +12,6 @@
|
||||
<string name="dialog_share_app_instagram" translatable="false">Instagram</string>
|
||||
|
||||
<string name="dialog_invite_title">邀請好友</string>
|
||||
<string name="dialog_invite_reward_title" translatable="false">獎勵記錄</string>
|
||||
<string name="dialog_invite_info">快來 PDLIVE觀看直播,認識更多有趣的朋友吧!</string>
|
||||
<string name="dialog_share_copy">複製</string>
|
||||
</resources>
|
@ -177,8 +177,8 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter<LiveAnchor
|
||||
}
|
||||
})
|
||||
.setShowNumber(false)
|
||||
.setOldGiftList(true)
|
||||
.setTitle(WordUtil.getString(R.string.live_anchor_edit_call_me_select_gift))
|
||||
.setHideGiftType(true)
|
||||
.showDialog()
|
||||
;
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
|
||||
private String title;
|
||||
private TextView mTitle;
|
||||
private boolean isOldGiftList = false;
|
||||
private boolean hideGiftType=false;
|
||||
|
||||
|
||||
public GiftPopDialog(@NonNull Context context) {
|
||||
@ -133,6 +134,9 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
|
||||
if (!StringUtil.isEmpty(title)) {
|
||||
mTitle.setText(title);
|
||||
}
|
||||
if(hideGiftType){
|
||||
findViewById(R.id.gift_tab_layout).setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public GiftPopDialog(Context mContext, GiftPopDialog.ActionListener actionListener) {
|
||||
@ -165,6 +169,11 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
|
||||
return this;
|
||||
}
|
||||
|
||||
public GiftPopDialog setHideGiftType(boolean hideGiftType) {
|
||||
this.hideGiftType = hideGiftType;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
if (isOldGiftList) {
|
||||
LiveHttpUtil.getGiftList(new HttpCallback() {
|
||||
|
@ -301,7 +301,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
by = bundle.getString("by");
|
||||
isContactGift = bundle.getBoolean("isContactGift", false) ? 1 : 0;
|
||||
if (isContactGift == 1) {
|
||||
mViewPager.setTouch(false);
|
||||
findViewById(R.id.gift_tab_layout).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
@ -352,32 +351,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
}
|
||||
}
|
||||
if (list == null) {
|
||||
if (isContactGift == 1) {
|
||||
LiveHttpUtil.getGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
obj.put("listarray", obj.getJSONArray("giftlist"));
|
||||
list = obj.getJSONArray("listarray");
|
||||
Log.i("tttts", obj.getString("giftlist") + "");
|
||||
List<LiveGiftBean> _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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (mLoading != null) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
LiveHttpUtil.getNewGiftList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
@ -401,7 +374,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user