调整弹窗

This commit is contained in:
zlzw 2024-06-03 09:41:51 +08:00
parent 98095e07ee
commit b5417f90b4
19 changed files with 880 additions and 39 deletions

View File

@ -56,4 +56,15 @@ public class PrankGiftBean extends BaseModel{
public void setGiftId(String giftId) { public void setGiftId(String giftId) {
this.giftId = giftId; this.giftId = giftId;
} }
@Override
public String toString() {
return "PrankGiftBean{" +
"title='" + title + '\'' +
", name='" + name + '\'' +
", icon='" + icon + '\'' +
", num=" + num +
", giftId='" + giftId + '\'' +
'}';
}
} }

View File

@ -16,6 +16,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget; import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition; import com.bumptech.glide.request.transition.Transition;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.interfaces.OnItemClickListener;
import java.io.File; import java.io.File;
@ -226,14 +227,20 @@ public class ImgLoader {
.skipMemoryCache(SKIP_MEMORY_CACHE) .skipMemoryCache(SKIP_MEMORY_CACHE)
.into(imageView); .into(imageView);
} }
public static void displayDrawable(Context context, String url, final DrawableCallback callback) { public static void displayDrawable(Context context, String url, final DrawableCallback callback) {
displayDrawable(context, url, -1, -1, callback);
}
public static void displayDrawable(Context context, String url, int width, int height, final DrawableCallback callback) {
if (TextUtils.isEmpty(url) || !contextIsExist(context)) { if (TextUtils.isEmpty(url) || !contextIsExist(context)) {
if (callback != null) if (callback != null)
callback.onLoadFailed(); callback.onLoadFailed();
} else { } else {
Glide.with(context).asDrawable().load(url).thumbnail(thumbnail).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() { RequestBuilder<Drawable> builder = Glide.with(context).asDrawable().load(url);
if (width != -1 && height != -1) {
builder = builder.override(width, height);
}
builder.thumbnail(thumbnail).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() {
@Override @Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {

View File

@ -96,6 +96,7 @@ public class OpenAdManager {
return; return;
} }
Collections.sort(data, new AdListComparator()); Collections.sort(data, new AdListComparator());
data.clear();
list = data; list = data;
if (isShow) { if (isShow) {
if (showType == 0) { if (showType == 0) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

View File

@ -0,0 +1,79 @@
package com.yunbao.live.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.live.R;
import java.util.ArrayList;
import java.util.List;
public class ItemLivePrankGiftNumberAdapter extends RecyclerView.Adapter<ItemLivePrankGiftNumberAdapter.ViewHolder> {
List<Integer> list = new ArrayList<>();
int selectNumber;
OnSelectNumberListener onSelectNumberListener;
public void setOnSelectNumberListener(OnSelectNumberListener onSelectNumberListener) {
this.onSelectNumberListener = onSelectNumberListener;
}
public void setSelectNumber(int selectNumber) {
this.selectNumber = selectNumber;
}
public int getSelectNumber() {
return selectNumber;
}
public void setList(List<Integer> list) {
this.list = list;
notifyDataSetChanged();
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_prank_dialog_add_gift_number, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.setData(list.get(position), selectNumber);
}
@Override
public int getItemCount() {
return list.size();
}
public interface OnSelectNumberListener {
void onSelectNumber(int number);
}
public class ViewHolder extends RecyclerView.ViewHolder {
private Button button;
public ViewHolder(@NonNull View itemView) {
super(itemView);
button = itemView.findViewById(R.id.coin);
}
public void setData(int number, int selectNumber) {
button.setText(String.valueOf(number));
if (number == selectNumber) {
button.setBackgroundResource(R.drawable.bg_prank_btn_gift_add_number);
} else {
button.setBackgroundResource(R.drawable.bg_prank_coin);
}
button.setOnClickListener(view -> {
ItemLivePrankGiftNumberAdapter.this.selectNumber = number;
notifyDataSetChanged();
});
}
}
}

View File

@ -217,7 +217,7 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
JSONObject data = list.getJSONObject(i); JSONObject data = list.getJSONObject(i);
GiftTopBean giftTopBean = new GiftTopBean(); GiftTopBean giftTopBean = new GiftTopBean();
giftTopBean.setName(WordUtil.isNewZh()?data.getString("name"):data.getString("en_name")); giftTopBean.setName(WordUtil.isNewZh() ? data.getString("name") : data.getString("en_name"));
name.add(giftTopBean); name.add(giftTopBean);
} }
@ -265,17 +265,17 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
public void onClick(View view) { public void onClick(View view) {
int id = view.getId(); int id = view.getId();
if (id == R.id.btn_send) { if (id == R.id.btn_send) {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ?"輸入數量":"Input quantity", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() { DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "輸入數量" : "Input quantity", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() {
@Override @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {
try { try {
prangNum = Integer.parseInt(content); prangNum = Integer.parseInt(content);
if (prangNum <= 0) { if (prangNum <= 0) {
ToastUtil.show(WordUtil.isNewZh() ?"數量不能為0或負數":"The quantity cannot be zero or negative"); ToastUtil.show(WordUtil.isNewZh() ? "數量不能為0或負數" : "The quantity cannot be zero or negative");
return; return;
} }
if (prangNum > 999) { if (prangNum > 999) {
ToastUtil.show(WordUtil.isNewZh() ?"數量不能大於999":"The number cannot be greater than 999"); ToastUtil.show(WordUtil.isNewZh() ? "數量不能大於999" : "The number cannot be greater than 999");
return; return;
} }
mBtnSend.setText(content); mBtnSend.setText(content);
@ -285,7 +285,7 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
dialog.dismiss(); dialog.dismiss();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
ToastUtil.show(WordUtil.isNewZh() ? "輸入錯誤":"Input error"); ToastUtil.show(WordUtil.isNewZh() ? "輸入錯誤" : "Input error");
} }
} }
}); });
@ -307,29 +307,29 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene
}); });
} else if (id == R.id.gift_btn) { } else if (id == R.id.gift_btn) {
if (bean == null) { if (bean == null) {
ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物不能為空":"A trick gift can't be empty"); ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物不能為空" : "A trick gift can't be empty");
return; return;
} }
if (StringUtil.isEmpty(prangContext) || prangNum == 0) { if (StringUtil.isEmpty(prangContext) || prangNum == 0) {
ToastUtil.show(WordUtil.isNewZh() ?"整蠱內容或數量不能為空":"The content or number of pranks cannot be empty"); ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty");
return; return;
} }
if (prangNum >= 999) { if (prangNum >= 999) {
ToastUtil.show(WordUtil.isNewZh() ?"整蠱數量不能過大":"The number of pranks should not be too large"); ToastUtil.show(WordUtil.isNewZh() ? "整蠱數量不能過大" : "The number of pranks should not be too large");
return; return;
} }
if (WordUtil.isSpecialChar(prangContext)) { if (WordUtil.isSpecialChar(prangContext)) {
ToastUtil.show(WordUtil.isNewZh() ?"整蠱內容不能包含特殊字符":"The prank content must not contain special characters"); ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容不能包含特殊字符" : "The prank content must not contain special characters");
return; return;
} }
if (prangContext.length() > 6) { if (prangContext.length() > 6) {
ToastUtil.show(WordUtil.isNewZh() ?"整蠱內容過長":"The prank is too long"); ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容過長" : "The prank is too long");
return; return;
} }
if (giftBeans != null) { if (giftBeans != null) {
for (PrankGiftBean giftBean : giftBeans) { for (PrankGiftBean giftBean : giftBeans) {
if (giftBean.getGiftId().equals(bean.getId() + "")) { if (giftBean.getGiftId().equals(bean.getId() + "")) {
ToastUtil.show(WordUtil.isNewZh() ?"整蠱禮物已存在":"Prank gifts already exist"); ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物已存在" : "Prank gifts already exist");
return; return;
} }
} }

View File

@ -0,0 +1,136 @@
package com.yunbao.live.dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.bean.PrankGiftBean;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import java.util.ArrayList;
import java.util.List;
public class LivePrankAddGiftDialog extends AbsDialogPopupWindow {
private TextView prankBtn;
private ImageView backBtn;
private TextView giftText;
private TextView numberText;
private EditText contentText;
private OnItemClickListener<PrankGiftBean> onItemClickListener;
private List<PrankGiftBean> giftBeans = new ArrayList<>();
public LivePrankAddGiftDialog(@NonNull Context context) {
super(context);
}
@Override
public void buildDialog(XPopup.Builder builder) {
}
public LivePrankAddGiftDialog setGiftBeans(List<PrankGiftBean> giftBeans) {
this.giftBeans = giftBeans;
return this;
}
@Override
public int bindLayoutId() {
return R.layout.dialog_live_prank_add_gift;
}
@Override
protected void onCreate() {
super.onCreate();
initView();
}
public void setOnItemClickListener(OnItemClickListener<PrankGiftBean> onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
void initView() {
prankBtn = findViewById(R.id.prank_btn);
backBtn = findViewById(R.id.back);
giftText = findViewById(R.id.gift_text);
numberText = findViewById(R.id.number_text);
contentText = findViewById(R.id.content_text);
ViewClicksAntiShake.clicksAntiShake(giftText, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
GiftPopDialog dialog = new GiftPopDialog(mContext, new GiftPopDialog.ActionListener() {
@Override
public void onSelectGift(PrankGiftBean bean) {
if (bean != null) {
giftText.setText(bean.getName());
/*ImgLoader.displayDrawable(mContext, bean.getIcon(), DpUtil.dp2px(16), DpUtil.dp2px(16), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
giftText.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
}
@Override
public void onLoadFailed() {
}
});*/
giftText.setTag(bean);
}
}
@Override
public void onDismiss() {
}
});
dialog.setShowNumber(false);
dialog.setList(giftBeans);
dialog.showDialog();
}
});
ViewClicksAntiShake.clicksAntiShake(numberText, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new LivePrankAddGiftNumberDialog(mContext)
.setOnItemClickListener(new OnItemClickListener<Integer>() {
@Override
public void onItemClick(Integer bean, int position) {
numberText.setText(String.valueOf(bean));
numberText.setTag(bean);
}
})
.showDialog();
}
});
ViewClicksAntiShake.clicksAntiShake(prankBtn, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
PrankGiftBean bean = (PrankGiftBean) giftText.getTag();
if (bean == null) {
ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物不能為空" : "A trick gift can't be empty");
return;
}
if (numberText.getTag()==null){
ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty");
return;
}
}
});
}
}

View File

@ -0,0 +1,137 @@
package com.yunbao.live.dialog;
import android.app.Dialog;
import android.content.Context;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.bean.PrankGiftBean;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.adapter.ItemLivePrankGiftNumberAdapter;
import java.util.ArrayList;
import java.util.List;
public class LivePrankAddGiftNumberDialog extends AbsDialogPopupWindow {
private TextView prankBtn;
private ImageView backBtn;
private Button mBtnNumber;
private RecyclerView numberRecycler;
private ItemLivePrankGiftNumberAdapter mAdapter;
private OnItemClickListener<Integer> onItemClickListener;
private int giftNumber = -1;
private List<PrankGiftBean> giftBeans = new ArrayList<>();
public LivePrankAddGiftNumberDialog(@NonNull Context context) {
super(context);
}
public LivePrankAddGiftNumberDialog setOnItemClickListener(OnItemClickListener<Integer> onItemClickListener) {
this.onItemClickListener = onItemClickListener;
return this;
}
@Override
public void buildDialog(XPopup.Builder builder) {
}
@Override
public int bindLayoutId() {
return R.layout.dialog_live_prank_add_gift_number;
}
@Override
protected void onCreate() {
super.onCreate();
initView();
initData();
}
@Override
protected void onDismiss() {
super.onDismiss();
}
void initView() {
prankBtn = findViewById(R.id.prank_btn);
backBtn = findViewById(R.id.back);
numberRecycler = findViewById(R.id.numberList);
mBtnNumber = findViewById(R.id.btnNumber);
mAdapter = new ItemLivePrankGiftNumberAdapter();
numberRecycler.setAdapter(mAdapter);
mAdapter.setOnSelectNumberListener(number -> {
if (number > 0) {
giftNumber = number;
mBtnNumber.setText(R.string.live_prank_gift_dialog_number_btn);
}
});
ViewClicksAntiShake.clicksAntiShake(mBtnNumber, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "输入数量" : "Input number", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
try {
int number = Integer.parseInt(content);
if (number > 0 && number < 10000) {
mBtnNumber.setText(content);
giftNumber = number;
mAdapter.setSelectNumber(-1);
mAdapter.notifyDataSetChanged();
dialog.dismiss();
}
} catch (Exception e) {
e.printStackTrace();
mBtnNumber.setText(R.string.live_prank_gift_dialog_number_btn);
dialog.dismiss();
}
}
});
}
});
ViewClicksAntiShake.clicksAntiShake(prankBtn, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (onItemClickListener != null) {
if (mAdapter.getSelectNumber() > 0) {
giftNumber = mAdapter.getSelectNumber();
}
onItemClickListener.onItemClick(giftNumber, 0);
dismiss();
}
}
});
}
List<Integer> mList = new ArrayList<>();
void initData() {
mList.add(9999);
mList.add(3344);
mList.add(1314);
mList.add(520);
mList.add(88);
mList.add(68);
mList.add(10);
mList.add(8);
mList.add(1);
mAdapter.setList(mList);
}
}

View File

@ -7,6 +7,7 @@ import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -27,6 +28,7 @@ import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.ViewUtils;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -39,7 +41,7 @@ import java.util.Locale;
public class LivePrankDialogFragment extends AbsDialogFragment implements View.OnClickListener { public class LivePrankDialogFragment extends AbsDialogFragment implements View.OnClickListener {
private TabLayout mTabLayout; private TabLayout mTabLayout;
private View mTurntableConfigLayout; private View mTurntableConfigLayout, mGiftConfigLayout;
private TextView mPrankBtn; private TextView mPrankBtn;
private ImageView mTurntableConfigImageView; private ImageView mTurntableConfigImageView;
private TextView mCoinTextView; private TextView mCoinTextView;
@ -48,7 +50,15 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
private LivePrankRecyclerAdapter recyclerAdapter; private LivePrankRecyclerAdapter recyclerAdapter;
private String mLiveUid; private String mLiveUid;
private PrankHttpTurntableBean bean = new PrankHttpTurntableBean(); private PrankHttpTurntableBean bean = new PrankHttpTurntableBean();
private List<PrankGiftBean> giftBeans; private List<PrankGiftBean> giftBeans = new ArrayList<>();
private TextView giftSwitch1TitleText;
private TextView giftSwitch1DescText;
private ImageView giftSwitch1Btn;
private TextView giftTypeNowText;
private TextView giftTypeTodoText;
private TextView giftTypeNowSwitchText;
private Button mBtnAddGift;
public void setmLiveUid(String mLiveUid) { public void setmLiveUid(String mLiveUid) {
this.mLiveUid = mLiveUid; this.mLiveUid = mLiveUid;
@ -85,11 +95,13 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
initView(); initView();
initTab(); initTab();
initTurntableData(); initTurntableData();
initGiftConfigLayoutView();
} }
private void initView() { private void initView() {
mTabLayout = (TabLayout) findViewById(R.id.prank_tabLayout); mTabLayout = (TabLayout) findViewById(R.id.prank_tabLayout);
mTurntableConfigLayout = findViewById(R.id.turntable_layout); mTurntableConfigLayout = findViewById(R.id.turntable_layout);
mGiftConfigLayout = findViewById(R.id.gift_layout);
mTurntableConfigImageView = (ImageView) findViewById(R.id.switch1_btn); mTurntableConfigImageView = (ImageView) findViewById(R.id.switch1_btn);
mCoinTextView = (TextView) findViewById(R.id.switch2_btn); mCoinTextView = (TextView) findViewById(R.id.switch2_btn);
mPrankRecyclerView = (RecyclerView) findViewById(R.id.prank_config); mPrankRecyclerView = (RecyclerView) findViewById(R.id.prank_config);
@ -108,6 +120,10 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
recyclerAdapter.setOnItemClickListener(new OnItemClickListener<String>() { recyclerAdapter.setOnItemClickListener(new OnItemClickListener<String>() {
@Override @Override
public void onItemClick(String bean, int position) { public void onItemClick(String bean, int position) {
if (position == -2) {
showGiftDialog();
return;
}
if (recyclerAdapter.getViewTypeOfList()) { if (recyclerAdapter.getViewTypeOfList()) {
switch (position) { switch (position) {
case 1: case 1:
@ -238,7 +254,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
} }
if ((int) tab.getTag() == 0) { if ((int) tab.getTag() == 0) {
mTurntableConfigLayout.setVisibility(View.VISIBLE); mTurntableConfigLayout.setVisibility(View.VISIBLE);
mGiftConfigLayout.setVisibility(View.GONE);
mPrankRecyclerView.setVisibility(View.VISIBLE); mPrankRecyclerView.setVisibility(View.VISIBLE);
mBtnAddGift.setVisibility(View.GONE);
mGiftNotDate.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.GONE);
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE); recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE);
mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save); mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save);
@ -253,6 +271,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
initTurntableData(); initTurntableData();
} else { } else {
mTurntableConfigLayout.setVisibility(View.GONE); mTurntableConfigLayout.setVisibility(View.GONE);
mGiftConfigLayout.setVisibility(View.VISIBLE);
mBtnAddGift.setVisibility(View.VISIBLE);
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT);
mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_gift_set); mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_gift_set);
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
@ -279,6 +300,47 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
}); });
} }
private void showGiftDialog() {
new LivePrankAddGiftDialog(mContext).setGiftBeans(giftBeans).showDialog();
}
private void initGiftConfigLayoutView() {
giftSwitch1TitleText = (TextView) findViewById(R.id.gift_switch1_title_text);
giftSwitch1DescText = (TextView) findViewById(R.id.gift_switch1_desc_text);
giftSwitch1Btn = (ImageView) findViewById(R.id.gift_switch1_btn);
giftTypeNowText = (TextView) findViewById(R.id.gift_type_now_text);
giftTypeTodoText = (TextView) findViewById(R.id.gift_type_todo);
giftTypeNowSwitchText = (TextView) findViewById(R.id.gift_type_now_switch);
mBtnAddGift = (Button) findViewById(R.id.gift_add_btn);
ViewClicksAntiShake.clicksAntiShake(giftSwitch1Btn, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (giftSwitch1Btn.getTag().equals("true")) {
giftSwitch1Btn.setTag("false");
giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off);
} else {
giftSwitch1Btn.setTag("true");
giftSwitch1Btn.setImageResource(R.mipmap.special_icon_on);
}
}
});
ViewClicksAntiShake.clicksAntiShake(giftTypeNowSwitchText, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
CharSequence tmp = giftTypeNowText.getText();
giftTypeNowText.setText(giftTypeNowSwitchText.getText());
giftTypeNowSwitchText.setText(tmp);
}
});
ViewClicksAntiShake.clicksAntiShake(mBtnAddGift, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
showGiftDialog();
}
});
}
private void initTurntableData() { private void initTurntableData() {
LiveNetManager.get(mContext).getAnchorPrankTurntable(mLiveUid, new HttpCallback<PrankHttpTurntableBean>() { LiveNetManager.get(mContext).getAnchorPrankTurntable(mLiveUid, new HttpCallback<PrankHttpTurntableBean>() {
@Override @Override
@ -312,17 +374,23 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, new HttpCallback<List<PrankGiftBean>>() { LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, new HttpCallback<List<PrankGiftBean>>() {
@Override @Override
public void onSuccess(List<PrankGiftBean> data) { public void onSuccess(List<PrankGiftBean> data) {
if (!data.isEmpty()) { if (data.size() < 6) {
mGiftNotDate.setVisibility(View.GONE); mBtnAddGift.setVisibility(View.VISIBLE);
mPrankRecyclerView.setVisibility(View.VISIBLE); } else {
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT); mBtnAddGift.setVisibility(View.GONE);
giftBeans = data; }
recyclerAdapter.setList(data); mGiftNotDate.setVisibility(View.GONE);
recyclerAdapter.notifyDataSetChanged(); mPrankRecyclerView.setVisibility(View.VISIBLE);
recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT);
giftBeans = data;
recyclerAdapter.setList(data);
recyclerAdapter.notifyDataSetChanged();
/*if (!data.isEmpty()) {
} else { } else {
mPrankRecyclerView.setVisibility(View.GONE); mPrankRecyclerView.setVisibility(View.GONE);
mGiftNotDate.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE);
} }*/
} }
@Override @Override

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="93dp" android:height="28dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#fff6b600" android:endColor="#fff6b600" android:angle="90" />
<corners android:topLeftRadius="6dp" android:topRightRadius="6dp" android:bottomLeftRadius="6dp" android:bottomRightRadius="6dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="229dp" android:height="53dp">
<shape android:shape="rectangle">
<solid android:color="#7F7F7F" />
<corners android:topLeftRadius="8dp" android:topRightRadius="8dp" android:bottomLeftRadius="8dp" android:bottomRightRadius="8dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,173 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="330dp"
android:background="#000002">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/live_prank_gift_add_title"
android:textColor="#FFFFFF"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/prank_btn"
android:layout_width="67dp"
android:layout_height="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_live_prank_turntable_save"
android:gravity="center"
android:text="@string/alive_prank_gift_add_gift_content_sub"
android:textAllCaps="false"
android:textColor="#FFF"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/back"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginStart="16dp"
android:layout_marginTop="18dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_back" />
<LinearLayout
android:id="@+id/gift_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="16dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="16dp"
android:gravity="center"
android:text="@string/live_prank_gift_add_gift"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<TextView
android:id="@+id/gift_text"
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_gravity="center"
android:background="@drawable/bg_prank_coin"
android:drawableEnd="@mipmap/ic_prank_gift_add_gift_to"
android:ems="10"
android:gravity="start|center"
android:hint="@string/diamonds_every_time_requirement_of_hint"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#8C8C8C"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/prank_turntable_title" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="16dp"
android:gravity="center"
android:text="@string/live_prank_gift_add_gift_number"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<TextView
android:id="@+id/number_text"
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_gravity="center"
android:background="@drawable/bg_prank_coin"
android:drawableEnd="@mipmap/ic_prank_gift_add_gift_to"
android:ems="10"
android:gravity="start|center"
android:hint="@string/live_prank_gift_add_gift_number_select"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#8C8C8C"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/prank_turntable_title" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="16dp"
android:gravity="center"
android:text="@string/live_prank_gift_add_gift_content"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<EditText
android:id="@+id/content_text"
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_gravity="center"
android:background="@drawable/bg_prank_coin"
android:ems="10"
android:gravity="start|center"
android:hint="@string/live_prank_gift_add_gift_contnet_select"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#8C8C8C"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/prank_turntable_title" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,88 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="330dp"
android:background="#000002">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/alive_prank_gift_dialog_number_title"
android:textColor="#FFFFFF"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/prank_btn"
android:layout_width="67dp"
android:layout_height="24dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_live_prank_turntable_save"
android:gravity="center"
android:text="@string/alive_prank_gift_add_gift_content_sub"
android:textAllCaps="false"
android:textColor="#FFF"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/back"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginStart="16dp"
android:layout_marginTop="18dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/icon_back" />
<LinearLayout
android:id="@+id/gift_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/gift_add_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/numberList"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="3"
tools:listitem="@layout/item_prank_dialog_add_gift_number" />
</LinearLayout>
<Button
android:id="@+id/btnNumber"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:background="@drawable/bg_prank_gift_add_item"
android:text="@string/live_prank_gift_dialog_number_btn"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools">
<Button
android:id="@+id/coin"
android:layout_width="93dp"
android:layout_height="28dp"
android:background="@drawable/bg_prank_coin"
tools:baclground="@drawable/bg_prank_btn_gift_add_number"
android:text="123"
android:layout_marginBottom="20dp"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>

View File

@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<ScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
@ -20,7 +21,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:orientation="vertical" android:orientation="vertical"
android:visibility="visible"> android:visibility="visible"
tools:visibility="gone">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/turntable_config_layout" android:id="@+id/turntable_config_layout"
@ -105,6 +107,57 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/gift_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/gift_config_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/gift_switch1_title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/live_prank_switch"
android:textColor="#FFFFFF"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/gift_switch1_desc_text"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/live_prank_switch_info"
android:textColor="#B3B3B3"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gift_switch1_title_text" />
<ImageView
android:id="@+id/gift_switch1_btn"
android:layout_width="47dp"
android:layout_height="23dp"
android:layout_marginEnd="12dp"
android:tag="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/special_icon_off" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -112,41 +165,72 @@
<TextView <TextView
android:id="@+id/gift_type_now_text" android:id="@+id/gift_type_now_text"
android:layout_width="wrap_content" android:layout_width="0dp"
android:text="@string/live_prank_dialog_gift_type_number"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="@string/live_prank_dialog_gift_type_achieved"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView
android:id="@+id/gift_type_todo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginStart="10dp"
android:text="@string/live_prank_dialog_gift_type_todo"
android:textColor="#DDDDDD"
android:textSize="10sp" />
<TextView <TextView
android:id="@+id/gift_type_now_switch" android:id="@+id/gift_type_now_switch"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="@string/live_prank_dialog_gift_type_number"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:textColor="#FFFFFF" android:layout_marginEnd="16dp"
android:textSize="14sp" /> android:drawableEnd="@mipmap/ic_prank_gift_switch"
android:text="@string/live_prank_dialog_gift_type_number"
android:textColor="#DDDDDD"
android:textSize="10sp"
app:drawableEndCompat="@mipmap/ic_prank_gift_switch" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/prank_config" android:id="@+id/prank_config"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="0dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="10dp" /> android:layout_marginEnd="10dp"
android:layout_weight="1" />
<Button
android:id="@+id/gift_add_btn"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_prank_gift_add_item"
android:text="@string/live_prank_add_gift"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<TextView <TextView
android:id="@+id/gift_prank_not_date" android:id="@+id/gift_prank_not_date"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="250dp" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center" android:gravity="center"
android:text="@string/prank_content_yet_hint" android:text="@string/live_prank_gift_tips"
android:textColor="#BFBFBF" android:textColor="#747474"
android:visibility="gone" /> android:visibility="visible" />
</LinearLayout> </LinearLayout>
</ScrollView> </androidx.core.widget.NestedScrollView>
</LinearLayout> </LinearLayout>

View File

@ -119,6 +119,13 @@
<string name="live_rad_pack_join_fans_group_click_tip">Join the fan group to open</string> <string name="live_rad_pack_join_fans_group_click_tip">Join the fan group to open</string>
<string name="live_prank_dialog_save">Clear</string> <string name="live_prank_dialog_save">Clear</string>
<string name="live_prank_dialog_clear">Save</string> <string name="live_prank_dialog_clear">Save</string>
<string name="live_prank_dialog_gift_type_todo">Switch to</string>
<string name="live_prank_dialog_gift_type_number">Highest combo</string> <string name="live_prank_dialog_gift_type_number">Highest combo</string>
<string name="live_prank_dialog_gift_type_achieved">Quantity achieved</string> <string name="live_prank_dialog_gift_type_achieved">Quantity achieved</string>
<string name="live_prank_switch">gift trick switch</string>
<string name="live_prank_switch_info">After closing, the user cannot see the gift trick</string>
<string name="live_prank_add_gift">+ Add gift trick</string>
<string name="live_prank_gift_tips">You can add up to 6, and it is recommended to add 4.</string>
<string name="alive_prank_gift_add_gift_content_sub">Confirm</string>
</resources> </resources>

View File

@ -117,6 +117,21 @@
<string name="live_rad_pack_join_fans_group_click_tip">加入粉絲團可開啟</string> <string name="live_rad_pack_join_fans_group_click_tip">加入粉絲團可開啟</string>
<string name="live_prank_dialog_save">保存設置</string> <string name="live_prank_dialog_save">保存設置</string>
<string name="live_prank_dialog_clear">清除設置</string> <string name="live_prank_dialog_clear">清除設置</string>
<string name="live_prank_dialog_gift_type_todo"> </string>
<string name="live_prank_dialog_gift_type_number">禮物數達成</string> <string name="live_prank_dialog_gift_type_number">禮物數達成</string>
<string name="live_prank_dialog_gift_type_achieved">連擊數最高</string> <string name="live_prank_dialog_gift_type_achieved">連擊數最高</string>
<string name="live_prank_switch">禮物整蠱開關</string>
<string name="live_prank_switch_info">開閉後用戶無法看到禮物整蠱</string>
<string name="live_prank_add_gift">+ 添加禮物整蠱</string>
<string name="live_prank_gift_tips">最多可添加6個建議添加4個</string>
<string name="live_prank_gift_add_title">添加禮物</string>
<string name="live_prank_gift_add_gift">整蠱禮物</string>
<string name="live_prank_gift_add_gift_select">選擇禮物</string>
<string name="live_prank_gift_add_gift_number">禮物數量</string>
<string name="live_prank_gift_add_gift_number_select">填寫個數</string>
<string name="live_prank_gift_add_gift_content">整蠱內容</string>
<string name="live_prank_gift_add_gift_contnet_select">請輸入整蠱內容,例如一支舞蹈</string>
<string name="alive_prank_gift_add_gift_content_sub">確定</string>
<string name="alive_prank_gift_dialog_number_title">禮物數量</string>
<string name="live_prank_gift_dialog_number_btn">+ 設置其他數量(最多9999)</string>
</resources> </resources>