心愿单添加部分功能实现
@ -190,4 +190,5 @@ dependencies {
|
||||
|
||||
api 'com.github.li-xiaojun:XPopup:2.9.1'
|
||||
|
||||
api 'com.github.shenbengit:PagerGridLayoutManager:1.1.7'
|
||||
}
|
||||
|
@ -0,0 +1,91 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.WishModel;
|
||||
import com.yunbao.common.views.DayWishItemViewHolder;
|
||||
import com.yunbao.common.views.LunarWishItemViewHolder;
|
||||
import com.yunbao.common.views.SeasonalWishItemViewHolder;
|
||||
import com.yunbao.common.views.WeekWishItemViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveNewWishAdapter extends RecyclerView.Adapter {
|
||||
private int type = 0;
|
||||
private List<WishModel> wishList = new ArrayList<>();
|
||||
|
||||
public void addData(List<WishModel> wishModelList, int type) {
|
||||
this.type = type;
|
||||
wishList.clear();
|
||||
wishList.addAll(wishModelList);
|
||||
wishList.add(null);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addGiftListModel(WishModel model) {
|
||||
wishList.add(0, model);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (type == 1) {
|
||||
View dayWish = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_day_wish, parent, false);
|
||||
return new DayWishItemViewHolder(dayWish);
|
||||
} else if (type == 2) {
|
||||
View weekWish = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_week_wish, parent, false);
|
||||
return new WeekWishItemViewHolder(weekWish);
|
||||
} else if (type == 3) {
|
||||
View lunarWish = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_lunar_wish, parent, false);
|
||||
return new LunarWishItemViewHolder(lunarWish);
|
||||
} else {
|
||||
View seasonalWish = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_seasonal_wish, parent, false);
|
||||
return new SeasonalWishItemViewHolder(seasonalWish);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (position == wishList.size()) return;
|
||||
if (holder instanceof DayWishItemViewHolder) {
|
||||
DayWishItemViewHolder dayWishItemViewHolder = (DayWishItemViewHolder) holder;
|
||||
dayWishItemViewHolder.steDayWishData(wishList.get(position), position, new DayWishItemViewHolder.DayWishItemListener() {
|
||||
@Override
|
||||
public void onDelete(int index) {
|
||||
wishList.remove(index);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(WishModel model, int index) {
|
||||
wishList.remove(index);
|
||||
wishList.add(index, model);
|
||||
notifyItemChanged(index);
|
||||
}
|
||||
});
|
||||
} else if (holder instanceof WeekWishItemViewHolder) {
|
||||
WeekWishItemViewHolder weekWishItemViewHolder = (WeekWishItemViewHolder) holder;
|
||||
} else if (holder instanceof LunarWishItemViewHolder) {
|
||||
LunarWishItemViewHolder lunarWishItemViewHolder = (LunarWishItemViewHolder) holder;
|
||||
} else if (holder instanceof SeasonalWishItemViewHolder) {
|
||||
SeasonalWishItemViewHolder seasonalWishItemViewHolder = (SeasonalWishItemViewHolder) holder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return wishList.size();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.GiftListModel;
|
||||
import com.yunbao.common.event.LiveNewWishGiftEvent;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.LiveNewWishGiftViewHolder;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveNewWishGiftAdapter extends RecyclerView.Adapter {
|
||||
private List<GiftListModel> giftListModels = new ArrayList<>();
|
||||
|
||||
public LiveNewWishGiftAdapter(List<GiftListModel> giftListModels) {
|
||||
this.giftListModels = giftListModels;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View dayWish = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_gitf_wish, parent, false);
|
||||
return new LiveNewWishGiftViewHolder(dayWish);
|
||||
}
|
||||
|
||||
private int index = -1;
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
LiveNewWishGiftViewHolder wishGiftViewHolder = (LiveNewWishGiftViewHolder) holder;
|
||||
wishGiftViewHolder.setData(giftListModels.get(position), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
index = position;
|
||||
notifyDataSetChanged();
|
||||
Bus.get().post(new LiveNewWishGiftEvent().setModel(giftListModels.get(position)));
|
||||
}
|
||||
});
|
||||
wishGiftViewHolder.onSelect(index == position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return giftListModels.size();
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveNewWishListAdapter extends FragmentStateAdapter {
|
||||
private List<Fragment> list = new ArrayList<>();
|
||||
|
||||
public LiveNewWishListAdapter(@NonNull FragmentActivity fragmentActivity, List<Fragment> list) {
|
||||
super(fragmentActivity);
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class GiftListModel extends BaseModel {
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("price")
|
||||
private String price;
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("gift_type")
|
||||
private String giftType;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public GiftListModel setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public GiftListModel setPrice(String price) {
|
||||
this.price = price;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public GiftListModel setImg(String img) {
|
||||
this.img = img;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public GiftListModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftType() {
|
||||
return giftType;
|
||||
}
|
||||
|
||||
public GiftListModel setGiftType(String giftType) {
|
||||
this.giftType = giftType;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GiftListModel{" +
|
||||
"name='" + name + '\'' +
|
||||
", price='" + price + '\'' +
|
||||
", img='" + img + '\'' +
|
||||
", id='" + id + '\'' +
|
||||
", giftType='" + giftType + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 心愿单礼物配置
|
||||
*/
|
||||
public class WishListGiftConfModel extends BaseModel {
|
||||
|
||||
@SerializedName("giftList")
|
||||
private List<GiftListModel> giftList = new ArrayList<>();
|
||||
@SerializedName("guardList")
|
||||
private List<GiftListModel> guardList = new ArrayList<>();
|
||||
@SerializedName("nobleList")
|
||||
private List<GiftListModel> nobleList = new ArrayList<>();
|
||||
|
||||
public List<GiftListModel> getGiftList() {
|
||||
return giftList;
|
||||
}
|
||||
|
||||
public WishListGiftConfModel setGiftList(List<GiftListModel> giftList) {
|
||||
this.giftList = giftList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<GiftListModel> getGuardList() {
|
||||
return guardList;
|
||||
}
|
||||
|
||||
public WishListGiftConfModel setGuardList(List<GiftListModel> guardList) {
|
||||
this.guardList = guardList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<GiftListModel> getNobleList() {
|
||||
return nobleList;
|
||||
}
|
||||
|
||||
public WishListGiftConfModel setNobleList(List<GiftListModel> nobleList) {
|
||||
this.nobleList = nobleList;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -2,11 +2,12 @@ package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WishListModel extends BaseModel {
|
||||
@SerializedName("wishList")
|
||||
private List<WishModel> wishList;
|
||||
private List<WishModel> wishList = new ArrayList<>();
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WishListModel2 extends BaseModel {
|
||||
|
||||
@SerializedName("wishlist")
|
||||
private List<List<WishModel>> wishlist;
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
|
||||
public List<List<WishModel>> getWishlist() {
|
||||
return wishlist;
|
||||
}
|
||||
|
||||
public WishListModel2 setWishlist(List<List<WishModel>> wishlist) {
|
||||
this.wishlist = wishlist;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public WishListModel2 setImg(String img) {
|
||||
this.img = img;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -22,6 +22,12 @@ public class WishModel extends BaseModel {
|
||||
private String wishlistName;
|
||||
@SerializedName("create_time")
|
||||
private String createTime;
|
||||
@SerializedName("type")
|
||||
private int type;
|
||||
@SerializedName("gift_type")
|
||||
private int giftType;
|
||||
@SerializedName("price")
|
||||
private int price;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
@ -103,4 +109,50 @@ public class WishModel extends BaseModel {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public WishModel setType(int type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getGiftType() {
|
||||
return giftType;
|
||||
}
|
||||
|
||||
public WishModel setGiftType(int giftType) {
|
||||
this.giftType = giftType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public WishModel setPrice(int price) {
|
||||
this.price = price;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int wishProgress() {
|
||||
int progress = 0;
|
||||
try {
|
||||
progress = Integer.parseInt(wishlistNum);
|
||||
} catch (NumberFormatException e) {
|
||||
progress = 0;
|
||||
}
|
||||
return progress;
|
||||
}
|
||||
public int wishCurrent(){
|
||||
int current = 0;
|
||||
try {
|
||||
current = Integer.parseInt(wishlistProgress);
|
||||
} catch (NumberFormatException e) {
|
||||
current = 0;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.GiftListModel;
|
||||
|
||||
public class LiveNewWishGiftEvent extends BaseModel {
|
||||
private GiftListModel model;
|
||||
|
||||
public GiftListModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public LiveNewWishGiftEvent setModel(GiftListModel model) {
|
||||
this.model = model;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.GiftListModel;
|
||||
|
||||
public class LiveNewWishListEvent extends BaseModel {
|
||||
private GiftListModel model;
|
||||
private int type = 0;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LiveNewWishListEvent setType(int type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GiftListModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public LiveNewWishListEvent setModel(GiftListModel model) {
|
||||
this.model = model;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.yunbao.common.fragment;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.shencoder.pagergridlayoutmanager.PagerGridLayoutManager;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.LiveNewWishGiftAdapter;
|
||||
import com.yunbao.common.bean.GiftListModel;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveNewWishGiftFragment extends BaseFragment {
|
||||
private List<GiftListModel> giftListModels;
|
||||
private RecyclerView giftList;
|
||||
private LiveNewWishGiftAdapter liveNewWishGiftAdapter;
|
||||
private TabLayout wishTab;
|
||||
|
||||
@Override
|
||||
public View createView(LayoutInflater inflater, ViewGroup container) {
|
||||
return inflater.inflate(R.layout.view_live_new_wish_gitf, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initVariables(Bundle bundle) {
|
||||
giftListModels = (List<GiftListModel>) bundle.getSerializable("GiftList");
|
||||
for (GiftListModel model : giftListModels) {
|
||||
Log.e("LiveNewWishGiftFragment", model.getName());
|
||||
}
|
||||
//
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState, View contentView) {
|
||||
wishTab = contentView.findViewById(R.id.wish_tab);
|
||||
wishTab.setSelectedTabIndicatorColor(Color.TRANSPARENT);
|
||||
wishTab.setFocusableInTouchMode(false);
|
||||
|
||||
//计算总页数
|
||||
int pagerCount = giftListModels.size() / 8;
|
||||
if (giftListModels.size() % 8 != 0) {
|
||||
++pagerCount;
|
||||
}
|
||||
|
||||
if (pagerCount > 1) {
|
||||
for (int i = 0; i < pagerCount; i++) {
|
||||
TextView wishItem = (TextView) LayoutInflater.from(getContext()).inflate(R.layout.view_tablaout_wish_item, null, false);
|
||||
TabLayout.Tab tab = wishTab.newTab().setCustomView(wishItem).setId(i);
|
||||
|
||||
wishTab.addTab(tab, i == 0);
|
||||
}
|
||||
ViewGroup tabs = (ViewGroup) wishTab.getChildAt(0);
|
||||
//设置边距,tab宽
|
||||
for (int i = 0; i < tabs.getChildCount(); i++) {
|
||||
View tab = tabs.getChildAt(i);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) tab.getLayoutParams();
|
||||
layoutParams.rightMargin = DpUtil.dp2px(5);
|
||||
layoutParams.leftMargin = DpUtil.dp2px(5);
|
||||
layoutParams.width = DpUtil.dp2px(6);
|
||||
layoutParams.height = DpUtil.dp2px(6);
|
||||
tab.setLayoutParams(layoutParams);
|
||||
wishTab.requestLayout();
|
||||
}
|
||||
wishTab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
View customView = tab.getCustomView();
|
||||
customView.setSelected(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
View customView = tab.getCustomView();
|
||||
customView.setSelected(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
wishTab.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
giftList = contentView.findViewById(R.id.gift_list);
|
||||
liveNewWishGiftAdapter = new LiveNewWishGiftAdapter(giftListModels);
|
||||
PagerGridLayoutManager layoutManager = new PagerGridLayoutManager( /*rows*/2,
|
||||
/*columns*/ 4,
|
||||
/*PagerGridLayoutManager.VERTICAL*/PagerGridLayoutManager.HORIZONTAL,
|
||||
/*reverseLayout*/ false);
|
||||
layoutManager.setHandlingSlidingConflictsEnabled(true);
|
||||
giftList.setLayoutManager(layoutManager);
|
||||
giftList.setAdapter(liveNewWishGiftAdapter);
|
||||
layoutManager.setPagerChangedListener(new PagerGridLayoutManager.PagerChangedListener() {
|
||||
@Override
|
||||
public void onPagerCountChanged(int pagerCount) {
|
||||
Log.e("LiveNewWishGiftFragment", "onPagerCountChanged-pagerCount:" + pagerCount);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPagerIndexSelected(int prePagerIndex, int currentPagerIndex) {
|
||||
Log.e("LiveNewWishGiftFragment", "onPagerIndexSelected-prePagerIndex " + prePagerIndex + ",currentPagerIndex:" + currentPagerIndex);
|
||||
if (wishTab.getVisibility() == View.VISIBLE)
|
||||
wishTab.getTabAt(currentPagerIndex).select();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadData() {
|
||||
|
||||
}
|
||||
|
||||
public static LiveNewWishGiftFragment newInstance(List<GiftListModel> giftListModels) {
|
||||
LiveNewWishGiftFragment searchRecommendFragment = new LiveNewWishGiftFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("GiftList", (Serializable) giftListModels);
|
||||
searchRecommendFragment.setArguments(bundle);
|
||||
return searchRecommendFragment;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.yunbao.common.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.LiveNewWishAdapter;
|
||||
import com.yunbao.common.bean.WishListModel;
|
||||
import com.yunbao.common.bean.WishModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.LiveNewWishGiftPopup;
|
||||
|
||||
public class LiveNewWishListFragment extends BaseFragment {
|
||||
private int type = 0;
|
||||
private RecyclerView wishList;
|
||||
private LiveNewWishAdapter liveNewWishAdapter;
|
||||
private ImageView imageView2;
|
||||
|
||||
@Override
|
||||
public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) {
|
||||
return layoutInflater.inflate(R.layout.view_live_new_wish, viewGroup, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initVariables(Bundle bundle) {
|
||||
type = bundle.getInt("type", 0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState, View contentView) {
|
||||
wishList = contentView.findViewById(R.id.wish_list);
|
||||
imageView2 = contentView.findViewById(R.id.imageView2);
|
||||
liveNewWishAdapter = new LiveNewWishAdapter();
|
||||
wishList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
wishList.setAdapter(liveNewWishAdapter);
|
||||
imageView2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new XPopup.Builder(getContext())
|
||||
.enableDrag(false)
|
||||
.asCustom(new LiveNewWishGiftPopup(getActivity(), type))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadData() {
|
||||
LiveNetManager.get(getContext()).getWishlistV2(new HttpCallback<WishListModel>() {
|
||||
@Override
|
||||
public void onSuccess(WishListModel data) {
|
||||
liveNewWishAdapter.addData(data.getWishList(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static LiveNewWishListFragment newInstance(int type) {
|
||||
LiveNewWishListFragment searchRecommendFragment = new LiveNewWishListFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("type", type);
|
||||
|
||||
searchRecommendFragment.setArguments(bundle);
|
||||
return searchRecommendFragment;
|
||||
}
|
||||
|
||||
public void addGiftListModel(WishModel model) {
|
||||
liveNewWishAdapter.addGiftListModel(model);
|
||||
}
|
||||
}
|
@ -37,6 +37,9 @@ import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
import com.yunbao.common.bean.WishListGiftConfModel;
|
||||
import com.yunbao.common.bean.WishListModel;
|
||||
import com.yunbao.common.bean.WishListModel2;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -636,4 +639,37 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<String>> delContactMsg(
|
||||
@Query("msgId") int msgId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取心愿单配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Guide.getWishlistV2")
|
||||
Observable<ResponseModel<List<WishListModel>>> getWishlistV2();
|
||||
|
||||
/**
|
||||
* 获取礼物配置
|
||||
*
|
||||
* @param type 1日心愿单,2周,3月,4季度
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Guide.getWishListGiftConf")
|
||||
Observable<ResponseModel<WishListGiftConfModel>> getWishListGiftConf(
|
||||
@Query("type") int type
|
||||
);
|
||||
|
||||
/**
|
||||
* 设置心愿单
|
||||
*
|
||||
* @param type 1日心愿单,2周,3月,4季度
|
||||
* @param list 列表json数据
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Guide.setWishlistV2")
|
||||
Observable<ResponseModel<String>> setWishlistV2(
|
||||
@Query("type") int type,
|
||||
@Query("list") String list
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,9 @@ import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
import com.yunbao.common.bean.WishListGiftConfModel;
|
||||
import com.yunbao.common.bean.WishListModel;
|
||||
import com.yunbao.common.bean.WishListModel2;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
@ -1287,6 +1290,55 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取心愿单配置
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public void getWishlistV2(HttpCallback<WishListModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getWishlistV2()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<WishListModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<WishListModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo().get(0));
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getWishListGiftConf(int type, HttpCallback<WishListGiftConfModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getWishListGiftConf(type)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<WishListGiftConfModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<WishListGiftConfModel> wishListGiftConfModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(wishListGiftConfModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -33,4 +33,30 @@ public class WordsTypeUtil {
|
||||
}
|
||||
return changeText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} num
|
||||
* @returns ---汉字
|
||||
*/
|
||||
// 转换数字为大写
|
||||
public static String numberConvertToUppercase(int number) {
|
||||
String[] upperCaseNumber = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"};
|
||||
int length = String.valueOf(number).length();
|
||||
if (length == 1) {
|
||||
return upperCaseNumber[number];
|
||||
} else if (length == 2) {
|
||||
if (number == 10) {
|
||||
return upperCaseNumber[number];
|
||||
} else if (number > 10 && number < 20) {
|
||||
return upperCaseNumber[10] + upperCaseNumber[number - 10];
|
||||
} else {
|
||||
int num1 = number / 10;
|
||||
int num2 = number - (num1 * 10);
|
||||
return upperCaseNumber[num1] + upperCaseNumber[10] + upperCaseNumber[num2];
|
||||
}
|
||||
} else {
|
||||
return String.valueOf(number);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,106 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.WishModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.WordsTypeUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
/**
|
||||
* 日心愿单
|
||||
*/
|
||||
public class DayWishItemViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView wishTab, wishlistName, wishlistProgress, wishlistNum, wishlistNum2, subtraction, addition;
|
||||
private ImageView wishIcon;
|
||||
private FrameLayout wishIconBg, tabBg,iconCancel;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
public DayWishItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
wishTab = itemView.findViewById(R.id.wish_tab);
|
||||
wishIcon = itemView.findViewById(R.id.wish_icon);
|
||||
tabBg = itemView.findViewById(R.id.tab_bg);
|
||||
wishIconBg = itemView.findViewById(R.id.wish_icon_bg);
|
||||
iconCancel = itemView.findViewById(R.id.icon_cancel);
|
||||
wishlistName = itemView.findViewById(R.id.wishlist_name);
|
||||
progressBar = itemView.findViewById(R.id.progressBar);
|
||||
wishlistProgress = itemView.findViewById(R.id.wishlist_progress);
|
||||
wishlistNum = itemView.findViewById(R.id.wishlist_num);
|
||||
wishlistNum2 = itemView.findViewById(R.id.wishlist_num2);
|
||||
subtraction = itemView.findViewById(R.id.subtraction);
|
||||
addition = itemView.findViewById(R.id.addition);
|
||||
}
|
||||
|
||||
public void steDayWishData(WishModel model, int index, DayWishItemListener listener) {
|
||||
if (model != null) {
|
||||
itemView.findViewById(R.id.hind_layout).setVisibility(View.VISIBLE);
|
||||
itemView.findViewById(R.id.wish_icon_bg).setVisibility(View.VISIBLE);
|
||||
itemView.findViewById(R.id.progress_bar).setVisibility(View.VISIBLE);
|
||||
iconCancel.setVisibility(View.VISIBLE);
|
||||
wishTab.setVisibility(View.VISIBLE);
|
||||
wishlistName.setVisibility(View.VISIBLE);
|
||||
wishTab.setText(String.format(itemView.getContext().getString(R.string.wish_number), WordsTypeUtil.numberConvertToUppercase(index + 1)));
|
||||
ImgLoader.display(itemView.getContext(), model.getWishlistIcon(), wishIcon);
|
||||
tabBg.setBackgroundResource(R.mipmap.bg_day_wish);
|
||||
wishIconBg.setBackgroundResource(R.mipmap.background_wish_item);
|
||||
wishlistName.setText(model.getWishlistName());
|
||||
progressBar.setMax(model.wishProgress());
|
||||
progressBar.setProgress(model.wishCurrent());//当前进度
|
||||
wishlistProgress.setText(model.getWishlistProgress());
|
||||
wishlistNum.setText(String.format("/%s", model.getWishlistNum()));
|
||||
wishlistNum2.setText(String.format("x%s", model.getWishlistNum()));
|
||||
ViewClicksAntiShake.clicksAntiShake(iconCancel, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (listener != null) {
|
||||
listener.onDelete(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(addition, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
int number = model.wishProgress();
|
||||
model.setWishlistNum(String.valueOf(number + 1));
|
||||
if (listener != null) {
|
||||
listener.onUpdate(model, index);
|
||||
}
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(subtraction, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
int number = model.wishProgress();
|
||||
model.setWishlistNum(String.valueOf(number - 1));
|
||||
if (listener != null) {
|
||||
listener.onUpdate(model, index);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
itemView.findViewById(R.id.hind_layout).setVisibility(View.GONE);
|
||||
itemView.findViewById(R.id.progress_bar).setVisibility(View.GONE);
|
||||
tabBg.setBackground(null);
|
||||
wishTab.setVisibility(View.GONE);
|
||||
wishlistName.setVisibility(View.GONE);
|
||||
iconCancel.setVisibility(View.GONE);
|
||||
itemView.findViewById(R.id.wish_icon_bg).setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public interface DayWishItemListener {
|
||||
void onDelete(int index);
|
||||
|
||||
void onUpdate(WishModel model, int index);
|
||||
}
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.LiveNewWishListAdapter;
|
||||
import com.yunbao.common.bean.GiftListModel;
|
||||
import com.yunbao.common.bean.WishListGiftConfModel;
|
||||
import com.yunbao.common.event.LiveNewWishGiftEvent;
|
||||
import com.yunbao.common.event.LiveNewWishListEvent;
|
||||
import com.yunbao.common.fragment.LiveNewWishGiftFragment;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveNewWishGiftPopup extends BottomPopupView {
|
||||
private TabLayout wishTab;
|
||||
private int type = 0;
|
||||
private ViewPager2 fragmentViewpager;
|
||||
private FragmentActivity mContext;
|
||||
private ArrayList<Fragment> ViewList = new ArrayList<>(); //页卡视图集合
|
||||
private GiftListModel model = null;
|
||||
private Button wishGitfButton;
|
||||
|
||||
public LiveNewWishGiftPopup(@NonNull FragmentActivity context, int type) {
|
||||
super(context);
|
||||
this.type = type;
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_live_new_wish_gitf;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initDate();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
Bus.getOff(this);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveNewWishGiftEvent(LiveNewWishGiftEvent event) {
|
||||
model = event.getModel();
|
||||
Log.e("LiveNewWishGiftPopup", model.toString());
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
fragmentViewpager = findViewById(R.id.context_layout);
|
||||
wishGitfButton = findViewById(R.id.wish_gitf_button);
|
||||
wishTab = findViewById(R.id.wish_tab);
|
||||
wishTab.setSelectedTabIndicatorColor(Color.TRANSPARENT);
|
||||
wishTab.setFocusableInTouchMode(false);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
TextView wishItem = (TextView) LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.view_tablaout_wish_item, null, false);
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
wishItem.setText(R.string.live_gift);
|
||||
wishItem.setTextColor(Color.parseColor("#FFBE41"));
|
||||
break;
|
||||
case 1:
|
||||
wishItem.setText(R.string.aristocrat);
|
||||
wishItem.setTextColor(Color.parseColor("#B6B6B6"));
|
||||
break;
|
||||
case 2:
|
||||
wishItem.setText(R.string.live_guard);
|
||||
wishItem.setTextColor(Color.parseColor("#B6B6B6"));
|
||||
break;
|
||||
}
|
||||
TabLayout.Tab tab = wishTab.newTab().setCustomView(wishItem).setId(i);
|
||||
wishTab.addTab(tab, i == 0);
|
||||
}
|
||||
ViewGroup tabs = (ViewGroup) wishTab.getChildAt(0);
|
||||
//设置边距,tab宽
|
||||
for (int i = 0; i < tabs.getChildCount() - 1; i++) {
|
||||
View tab = tabs.getChildAt(i);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) tab.getLayoutParams();
|
||||
layoutParams.setMarginEnd(DpUtil.dp2px(4));
|
||||
layoutParams.width = DpUtil.dp2px(58);
|
||||
tab.setLayoutParams(layoutParams);
|
||||
wishTab.requestLayout();
|
||||
}
|
||||
wishTab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
TextView customView = (TextView) tab.getCustomView();
|
||||
customView.setTextColor(Color.parseColor("#FFBE41"));
|
||||
fragmentViewpager.setCurrentItem(tab.getId(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
TextView customView = (TextView) tab.getCustomView();
|
||||
customView.setTextColor(Color.parseColor("#B6B6B6"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(wishGitfButton, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (model != null) {
|
||||
Bus.get().post(new LiveNewWishListEvent()
|
||||
.setModel(model)
|
||||
.setType(type));
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
LiveNetManager.get(getContext()).getWishListGiftConf(type, new HttpCallback<WishListGiftConfModel>() {
|
||||
@Override
|
||||
public void onSuccess(WishListGiftConfModel data) {
|
||||
List<GiftListModel> giftListModels = new ArrayList<>();
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
giftListModels.addAll(data.getGiftList());
|
||||
ViewList.add(LiveNewWishGiftFragment.newInstance(giftListModels));
|
||||
ViewList.add(LiveNewWishGiftFragment.newInstance(data.getNobleList()));
|
||||
ViewList.add(LiveNewWishGiftFragment.newInstance(data.getGuardList()));
|
||||
LiveNewWishListAdapter liveNewWishListAdapter = new LiveNewWishListAdapter(mContext, ViewList);
|
||||
fragmentViewpager.setAdapter(liveNewWishListAdapter);
|
||||
fragmentViewpager.setOffscreenPageLimit(1); //预加载页面数
|
||||
//禁止左右滑动,false为禁止
|
||||
fragmentViewpager.setUserInputEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.GiftListModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
/**
|
||||
* 心愿礼物配置页面
|
||||
*/
|
||||
public class LiveNewWishGiftViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView giftImg;
|
||||
private TextView giftName;
|
||||
|
||||
public LiveNewWishGiftViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
giftImg = itemView.findViewById(R.id.gift_img);
|
||||
giftName = itemView.findViewById(R.id.gift_name);
|
||||
}
|
||||
|
||||
public void setData(GiftListModel model, ViewClicksAntiShake.ViewClicksCallBack callBack) {
|
||||
ImgLoader.display(itemView.getContext(), model.getImg(), giftImg);
|
||||
giftName.setText(model.getName());
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.wish_gift), callBack);
|
||||
}
|
||||
|
||||
public void onSelect(boolean select) {
|
||||
itemView.findViewById(R.id.wish_gift).setSelected(select);
|
||||
}
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.LiveNewWishListAdapter;
|
||||
import com.yunbao.common.bean.WishModel;
|
||||
import com.yunbao.common.event.LiveNewWishListEvent;
|
||||
import com.yunbao.common.fragment.LiveNewWishListFragment;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 新版心愿单
|
||||
*/
|
||||
public class LiveNewWishListPopup extends BottomPopupView {
|
||||
private TabLayout wishTab;
|
||||
private FragmentActivity mContext;
|
||||
private ViewPager2 fragmentViewpager;
|
||||
private ArrayList<Fragment> ViewList = new ArrayList<>(); //页卡视图集合
|
||||
|
||||
private LiveNewWishListFragment dayWishFragment, zhouXinFragment, lunarWishFragment, seasonalWishFragment;
|
||||
|
||||
public LiveNewWishListPopup(@NonNull FragmentActivity context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_live_new_wish_list;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initDate();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
Bus.getOff(this);
|
||||
super.onDismiss();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveNewWishListEvent(LiveNewWishListEvent event) {
|
||||
WishModel model = new WishModel();
|
||||
model.setId(event.getModel().getId())
|
||||
.setWishlistName(event.getModel().getName())
|
||||
.setWishlistIcon(event.getModel().getImg())
|
||||
.setWishlistNum("1")
|
||||
.setWishlistProgress("0")
|
||||
.setPrice(Integer.parseInt(event.getModel().getPrice()))
|
||||
.setGiftType(Integer.parseInt(event.getModel().getGiftType()))
|
||||
.setType(event.getType());
|
||||
switch (event.getType()) {
|
||||
case 1:
|
||||
dayWishFragment.addGiftListModel(model);
|
||||
break;
|
||||
case 2:
|
||||
zhouXinFragment.addGiftListModel(model);
|
||||
break;
|
||||
case 3:
|
||||
lunarWishFragment.addGiftListModel(model);
|
||||
break;
|
||||
case 4:
|
||||
lunarWishFragment.addGiftListModel(model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
fragmentViewpager = findViewById(R.id.context_layout);
|
||||
wishTab = findViewById(R.id.wish_tab);
|
||||
wishTab.setSelectedTabIndicatorColor(Color.TRANSPARENT);
|
||||
wishTab.setFocusableInTouchMode(false);
|
||||
dayWishFragment = LiveNewWishListFragment.newInstance(1);
|
||||
zhouXinFragment = LiveNewWishListFragment.newInstance(2);
|
||||
lunarWishFragment = LiveNewWishListFragment.newInstance(3);
|
||||
seasonalWishFragment = LiveNewWishListFragment.newInstance(4);
|
||||
ViewList.add(dayWishFragment);
|
||||
ViewList.add(zhouXinFragment);
|
||||
ViewList.add(lunarWishFragment);
|
||||
ViewList.add(seasonalWishFragment);
|
||||
|
||||
LiveNewWishListAdapter liveNewWishListAdapter = new LiveNewWishListAdapter(mContext, ViewList);
|
||||
fragmentViewpager.setAdapter(liveNewWishListAdapter);
|
||||
|
||||
fragmentViewpager.setOffscreenPageLimit(1); //预加载页面数
|
||||
|
||||
//禁止左右滑动,false为禁止
|
||||
fragmentViewpager.setUserInputEnabled(false);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
TextView wishItem = (TextView) LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.view_tablaout_wish_item, null, false);
|
||||
switch (i) {
|
||||
case 0:
|
||||
wishItem.setText(R.string.day_wish);
|
||||
break;
|
||||
case 1:
|
||||
wishItem.setText(R.string.zhou_xin);
|
||||
break;
|
||||
case 2:
|
||||
wishItem.setText(R.string.lunar_wish);
|
||||
break;
|
||||
case 3:
|
||||
wishItem.setText(R.string.seasonal_wish);
|
||||
break;
|
||||
}
|
||||
TabLayout.Tab tab = wishTab.newTab().setCustomView(wishItem).setId(i);
|
||||
wishTab.addTab(tab, i == 0);
|
||||
}
|
||||
ViewGroup tabs = (ViewGroup) wishTab.getChildAt(0);
|
||||
//设置边距,tab宽
|
||||
for (int i = 0; i < tabs.getChildCount() - 1; i++) {
|
||||
View tab = tabs.getChildAt(i);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) tab.getLayoutParams();
|
||||
layoutParams.setMarginEnd(DpUtil.dp2px(6));
|
||||
layoutParams.width = DpUtil.dp2px(83);
|
||||
tab.setLayoutParams(layoutParams);
|
||||
wishTab.requestLayout();
|
||||
}
|
||||
wishTab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
View customView = tab.getCustomView();
|
||||
customView.setSelected(true);
|
||||
fragmentViewpager.setCurrentItem(tab.getId(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
View customView = tab.getCustomView();
|
||||
customView.setSelected(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class LunarWishItemViewHolder extends RecyclerView.ViewHolder {
|
||||
public LunarWishItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class SeasonalWishItemViewHolder extends RecyclerView.ViewHolder {
|
||||
public SeasonalWishItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class WeekWishItemViewHolder extends RecyclerView.ViewHolder {
|
||||
public WeekWishItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
13
common/src/main/res/drawable/background_wilsh_gitf.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="false">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="#FFBE41" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
17
common/src/main/res/drawable/background_wilsh_tab.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
<gradient android:endColor="#FFC657" android:startColor="#FA57FF" />
|
||||
<stroke android:width="1dp" android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_selected="false">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
<solid android:color="#AC73F5" />
|
||||
<stroke android:width="1dp" android:color="#F4B1FF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
15
common/src/main/res/drawable/background_wilsh_tab_gift.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
<solid android:color="#FFFFFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_selected="false">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="6dp" />
|
||||
<solid android:color="#92919F" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
8
common/src/main/res/drawable/background_wish_item.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#5B3EDF" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="#FFFFFF" />
|
||||
</shape>
|
6
common/src/main/res/drawable/bg_wish_gitf_button.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="11dp" />
|
||||
<solid android:color="#ED6B41" />
|
||||
|
||||
</shape>
|
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 187 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 535 B |
44
common/src/main/res/drawable/progress_wishlist2.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!--背景色从左到右色值,渐变-->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5.5dip" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:centerColor="#B68BFC"
|
||||
android:centerY="0.75"
|
||||
android:endColor="#B68BFC"
|
||||
android:startColor="#B68BFC" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!--缓冲区的进度-->
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5.5dip" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:centerColor="#FFE062"
|
||||
android:centerY="0.75"
|
||||
android:endColor="#FFE062"
|
||||
android:startColor="#FFE062" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
<!--进度条从左到右色值,渐变-->
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dip" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="#ffcb00"
|
||||
android:startColor="#fcff00" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
44
common/src/main/res/layout/dialog_live_new_wish_gitf.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="304dp"
|
||||
android:background="@mipmap/img_lu_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/wish_tab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:background="@null"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabMode="scrollable"
|
||||
app:tabRippleColor="@color/transparent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/wish_gitf_button"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="18dp"
|
||||
android:background="@drawable/bg_wish_gitf_button"
|
||||
android:text="@string/aristocrat_determine"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/context_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="15dp" />
|
||||
</LinearLayout>
|
29
common/src/main/res/layout/dialog_live_new_wish_list.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="580dp"
|
||||
android:background="@drawable/bg_xyd"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/wish_tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="160dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:background="@null"
|
||||
android:minWidth="83dp"
|
||||
app:tabBackground="@drawable/background_wilsh_tab"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabMaxWidth="100dp"
|
||||
app:tabMode="scrollable"
|
||||
app:tabRippleColor="@color/transparent" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/context_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
134
common/src/main/res/layout/item_day_wish.xml
Normal file
@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tab_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="119dp"
|
||||
android:layout_marginStart="11dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="11dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:background="@drawable/bg_wish_gitf_button">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/icon_cancel"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="19dp">
|
||||
|
||||
<ImageView
|
||||
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="end"
|
||||
android:background="@mipmap/icon_cancel" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wish_tab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/wish_icon_bg"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="11dp"
|
||||
android:layout_marginTop="40dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wish_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="3dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wishlist_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="85dp"
|
||||
android:layout_marginTop="49dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="85dp"
|
||||
android:layout_marginTop="78dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="11dp"
|
||||
android:max="100"
|
||||
android:progress="30"
|
||||
android:progressDrawable="@drawable/progress_wishlist2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wishlist_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="9dp"
|
||||
android:text="2"
|
||||
android:textColor="#FFE062"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wishlist_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="/20"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/hind_layout"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="77dp"
|
||||
android:layout_marginEnd="19dp"
|
||||
android:background="@drawable/bg_xyd_number"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtraction"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="-"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wishlist_num2"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="x23"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addition"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="+"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
24
common/src/main/res/layout/item_gitf_wish.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/wish_gift"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/background_wilsh_gitf"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gift_img"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="香水玫瑰"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
38
common/src/main/res/layout/item_lunar_wish.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="125dp"
|
||||
android:layout_margin="4dp"
|
||||
android:background="@mipmap/bg_lunar_wish">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="19dp"
|
||||
android:background="@mipmap/icon_cancel" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="心願二"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="11dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:background="@drawable/background_wish_item">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wish_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="3dp" />
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
38
common/src/main/res/layout/item_seasonal_wish.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="142dp"
|
||||
android:layout_margin="4dp"
|
||||
android:background="@mipmap/bg_seasonal_wish">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_cancel"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="17dp"
|
||||
android:layout_marginEnd="19dp"
|
||||
android:background="@mipmap/icon_cancel" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:text="心願二"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="11dp"
|
||||
android:layout_marginTop="53dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wish_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="3dp" />
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
38
common/src/main/res/layout/item_week_wish.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="119dp"
|
||||
android:layout_margin="4dp"
|
||||
android:background="@mipmap/bg_day_wish">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="19dp"
|
||||
android:background="@mipmap/icon_cancel" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="心願二"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="11dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:background="@drawable/background_wish_item">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wish_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="3dp" />
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
35
common/src/main/res/layout/view_live_new_wish.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="117dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/bg_xyd_add_item"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:scaleType="centerInside" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/wish_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tvDone"
|
||||
android:layout_width="275dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="22dp"
|
||||
android:background="@drawable/bg_xyd_button" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
29
common/src/main/res/layout/view_live_new_wish_gitf.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/gift_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="35dp" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/wish_tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@null"
|
||||
app:tabBackground="@drawable/background_wilsh_tab_gift"
|
||||
app:tabGravity="center"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabMode="scrollable"
|
||||
app:tabRippleColor="@color/transparent" />
|
||||
|
||||
</FrameLayout>
|
9
common/src/main/res/layout/view_tablaout_wish_item.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp">
|
||||
|
||||
</TextView>
|
BIN
common/src/main/res/mipmap-xxhdpi/background_wish_item.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/bg_day_wish.png
Normal file
After Width: | Height: | Size: 184 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/bg_lunar_wish.png
Normal file
After Width: | Height: | Size: 549 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/bg_seasonal_wish.png
Normal file
After Width: | Height: | Size: 636 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_cancel.png
Normal file
After Width: | Height: | Size: 729 B |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
@ -748,7 +748,6 @@
|
||||
<string name="theguardianof">成爲%s的守護</string>
|
||||
|
||||
|
||||
|
||||
<string name="wallet_gold_name">我的%1$s:</string>
|
||||
<string name="charge_explain">充值説明</string>
|
||||
<string name="register_tip_1">注冊即代表同意</string>
|
||||
@ -1089,7 +1088,13 @@
|
||||
<string name="enjoy_a_lot">開通貴族,尊享超多特權!</string>
|
||||
<string name="say_something3">說點什麽吧...</string>
|
||||
<string name="come_hint">%s 来了</string>
|
||||
|
||||
<string name="day_wish">日心願</string>
|
||||
<string name="zhou_xin">周心願</string>
|
||||
<string name="lunar_wish">月心願</string>
|
||||
<string name="seasonal_wish">季心願</string>
|
||||
<string name="wish_number">心願%s</string>
|
||||
<string name="aristocrat">貴族</string>
|
||||
<string name="aristocrat_determine">確定</string>
|
||||
<string name="layout_live_anchor_say_ready_title">女神說</string>
|
||||
|
||||
|
||||
|
@ -42,6 +42,7 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
@ -50,6 +51,7 @@ import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.MicUserBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.dialog.NotCancelableDialog;
|
||||
import com.yunbao.common.event.LiveRobotMessageEvent;
|
||||
import com.yunbao.common.event.LoginInvalidEvent;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
@ -69,6 +71,8 @@ import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.InputCustomPopup;
|
||||
import com.yunbao.common.views.LiveNewWishListPopup;
|
||||
import com.yunbao.common.views.LiveRobotSettingCustomPopup;
|
||||
import com.yunbao.faceunity.FaceManager;
|
||||
import com.yunbao.live.R;
|
||||
@ -568,10 +572,15 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
* 打开心愿单窗口
|
||||
*/
|
||||
public void openWishListWindow() {
|
||||
LiveNewWishListDialogFragment fragment = new LiveNewWishListDialogFragment();
|
||||
if (mContext instanceof LiveRyAnchorActivity) {
|
||||
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment");
|
||||
}
|
||||
// LiveNewWishListDialogFragment fragment = new LiveNewWishListDialogFragment();
|
||||
// if (mContext instanceof LiveRyAnchorActivity) {
|
||||
// fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment");
|
||||
// }
|
||||
new XPopup.Builder(mContext)
|
||||
.enableDrag(false)
|
||||
.asCustom(new LiveNewWishListPopup(LiveRyAnchorActivity.this))
|
||||
|
||||
.show();
|
||||
}
|
||||
|
||||
//打开相机前执行
|
||||
|
@ -49,6 +49,7 @@ import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.AbsViewHolder;
|
||||
import com.yunbao.common.views.LiveClarityCustomPopup;
|
||||
import com.yunbao.common.views.LiveNewWishListPopup;
|
||||
import com.yunbao.common.views.LiveOpenCustomPopup;
|
||||
import com.yunbao.common.views.LiveRobotSettingCustomPopup;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
@ -612,12 +613,16 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
* 打开心愿单窗口
|
||||
*/
|
||||
public void openWishListWindow() {
|
||||
LiveNewWishListDialogFragment fragment = new LiveNewWishListDialogFragment();
|
||||
|
||||
if (mContext instanceof LiveRyAnchorActivity) {
|
||||
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "RY");
|
||||
|
||||
}
|
||||
// LiveNewWishListDialogFragment fragment = new LiveNewWishListDialogFragment();
|
||||
//
|
||||
// if (mContext instanceof LiveRyAnchorActivity) {
|
||||
// fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "RY");
|
||||
//
|
||||
// }
|
||||
new XPopup.Builder(mContext)
|
||||
.enableDrag(false)
|
||||
.asCustom(new LiveNewWishListPopup((LiveRyAnchorActivity) mContext))
|
||||
.show();
|
||||
}
|
||||
|
||||
public void openAnchorSayDialog() {
|
||||
|
@ -44,6 +44,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.SizeUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
@ -1791,7 +1792,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mHotText.setGravity(Gravity.CENTER);
|
||||
mHourRank.setGravity(Gravity.CENTER);
|
||||
setHourRankData(info.get(0).getRank());
|
||||
hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en);
|
||||
hotPic.setImageResource(R.drawable.icon_time_new);
|
||||
hourPic.setImageResource(R.drawable.icon_heat_new);
|
||||
hotPic.setLayoutParams(params);
|
||||
hourPic.setLayoutParams(params);
|
||||
@ -4344,7 +4345,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
});
|
||||
enterRoomLeave.post(() -> {
|
||||
enterRoomLeave.setVisibility(View.VISIBLE);
|
||||
TranslateAnimation animationTranslate = new TranslateAnimation(enterRoomLeave.getMeasuredWidth(), 0, 0, 0);
|
||||
TranslateAnimation animationTranslate = new TranslateAnimation(DeviceUtils.getScreenWidth((Activity) mContext), 0, 0, 0);
|
||||
AnimationSet animationSet1 = new AnimationSet(true);
|
||||
animationSet1.addAnimation(animationTranslate);
|
||||
animationSet1.setFillAfter(true);
|
||||
|
@ -172,8 +172,7 @@
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/live_gift_send_lian"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lian_text"
|
||||
|
@ -17,7 +17,7 @@
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
|