完成排行榜页面

This commit is contained in:
zlzw 2022-11-02 14:27:38 +08:00
parent 1623743b26
commit b48ceea571
8 changed files with 703 additions and 971 deletions

View File

@ -22,9 +22,9 @@ public class ViewClicksAntiShake {
/**
* 防抖
*/
public static void clicksAntiShake(View view, ViewClicksCallBack callBack) {
public static void clicksAntiShake(int duration, View view, ViewClicksCallBack callBack) {
RxView.clicks(view)
.throttleFirst(800, TimeUnit.MILLISECONDS)
.throttleFirst(duration, TimeUnit.MILLISECONDS)
.subscribe(new Observer<Unit>() {
@Override
public void onSubscribe(Disposable d) {
@ -48,4 +48,8 @@ public class ViewClicksAntiShake {
}
});
}
public static void clicksAntiShake(View view, ViewClicksCallBack callBack) {
clicksAntiShake(800, view, callBack);
}
}

View File

@ -33,6 +33,7 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil;
@ -45,6 +46,7 @@ import com.yunbao.main.http.MainHttpUtil;
import com.yunbao.main.views.AbsMainListChildViewHolder;
import com.yunbao.main.views.MainListContributeViewHolder;
import com.yunbao.main.views.MainListProfitViewHolder;
import com.yunbao.main.views.MyClipPagerTitleView;
import net.lucode.hackware.magicindicator.MagicIndicator;
import net.lucode.hackware.magicindicator.ViewPagerHelper;
@ -82,11 +84,10 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
private ViewPager mViewPager;
private List<String> outRankHide = new ArrayList<>();
public MainListAdapter mAdapter;
private View mBackgroundLayout;
private RadioButton mDay, mWeek;
private int position;
private ImageView mBack;
private HeadView hv;
public static void forward(Context context, int p) {
context.startActivity(new Intent(context, MainListActivity.class).putExtra("p", p));
@ -131,14 +132,15 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
ClipPagerTitleView clipPagerTitleView = new ClipPagerTitleView(context);
MyClipPagerTitleView clipPagerTitleView = new MyClipPagerTitleView(context);
clipPagerTitleView.setText(titles[index]);
clipPagerTitleView.setTextColor(Color.parseColor("#B6B6B6"));
clipPagerTitleView.setClipColor(Color.parseColor("#F8F8F8"));
clipPagerTitleView.setTextColor(Color.parseColor("#FFFFFF"));
clipPagerTitleView.setClipColor(Color.parseColor("#FFFFFF"));
clipPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mIndicator.onPageSelected(index);
mViewPager.setCurrentItem(index);
}
});
@ -148,18 +150,14 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
@Override
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator indicator = new LinePagerIndicator(context);
float navigatorHeight = context.getResources().getDimension(R.dimen.common_navigator_height);
float borderWidth = UIUtil.dip2px(context, 1);
float lineHeight = navigatorHeight - 2 * borderWidth;
indicator.setLineHeight(lineHeight);
indicator.setRoundRadius(lineHeight / 2);
indicator.setYOffset(borderWidth);
//选中的背景颜色
indicator.setColors(Color.parseColor("#FFBE41"));
indicator.setLineWidth(DpUtil.dp2px(14));
indicator.setMode(LinePagerIndicator.MODE_EXACTLY);
indicator.setColors(Color.parseColor("#FFFFFF"));
return indicator;
}
});
mIndicator.setNavigator(commonNavigator);
//默认选择第几个
mIndicator.onPageSelected(getIntent().getIntExtra("p", 0));
//加载数据
@ -185,10 +183,10 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
private void initView() {
mType = DAY;
mViewPager = (ViewPager) findViewById(R.id.viewPager);
mBackgroundLayout = findViewById(R.id.bg_layout);
mBack = findViewById(R.id.btn_back);
mDay = findViewById(R.id.btn_day);
mWeek = findViewById(R.id.btn_week);
hv = new HeadView(findViewById(R.id.rootView));
mViewPager.setOffscreenPageLimit(PAGE_COUNT - 1);
mViewPager.setAdapter(new ViewPagerAdapter(mViewList));
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@ -204,11 +202,6 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
mDay.setTextColor(Color.parseColor("#FF82C1"));
mWeek.setTextColor(Color.parseColor("#FFFFFF"));
loadPageData(position, DAY);
if (position == 0) {
mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour_top);
} else {
mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour2_top);
}
}
@Override
@ -226,6 +219,9 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
mWeek.setTextColor(Color.parseColor("#FF82C1"));
mDay.setTextColor(Color.parseColor("#FFFFFF"));
});
mBack.setOnClickListener(v -> {
finish();
});
ViewPagerHelper.bind(mIndicator, mViewPager);
mViewPager.setCurrentItem(getIntent().getIntExtra("p", 0));
loadPageData(0, DAY);
@ -243,8 +239,7 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
return;
}
if (position == 0) {
MainListProfitViewHolder mProfitViewHolder = new MainListProfitViewHolder(mContext, parent);
vh = mProfitViewHolder;
vh = new MainListProfitViewHolder(mContext, parent);
} else if (position == 1) {
MainListContributeViewHolder mContributeViewHolder = new MainListContributeViewHolder(mContext, parent);
mContributeViewHolder.setHide(outRankHide);
@ -260,15 +255,7 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
}
}
if (vh != null) {
vh.setType(rank);
vh.setOnLoadDataListener(new AbsMainListChildViewHolder.OnLoadData() {
@Override
public void onData(List<ListBean> list) {
hv.setData(list.get(0), 0);
hv.setData(list.get(1), 1);
hv.setData(list.get(2), 2);
}
});
vh.setType(position, rank);
}
}
@ -294,166 +281,5 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
}
class HeadView {
View mItem1;
View mItem2;
View mItem3;
GifImageView liveing1;
GifImageView liveing2;
GifImageView liveing3;
ImageView mAvatar1;
ImageView mAvatar2;
ImageView mAvatar3;
TextView mName1;
TextView mName2;
TextView mName3;
TextView mVotes1;
TextView mVotes2;
TextView mVotes3;
ImageView mSex1;
ImageView mSex2;
ImageView mSex3;
ImageView mLevel1;
ImageView mLevel2;
ImageView mLevel3;
MyRadioButton mBtnFollow1;
MyRadioButton mBtnFollow2;
MyRadioButton mBtnFollow3;
SVGAImageView svga1;
SVGAImageView svga2;
SVGAImageView svga3;
public HeadView(View itemView) {
mItem1 = itemView.findViewById(R.id.item_1);
mItem2 = itemView.findViewById(R.id.item_2);
mItem3 = itemView.findViewById(R.id.item_3);
liveing1 = itemView.findViewById(R.id.liveing1);
liveing2 = itemView.findViewById(R.id.liveing2);
liveing3 = itemView.findViewById(R.id.liveing3);
mAvatar1 = (ImageView) itemView.findViewById(R.id.avatar_1);
mAvatar2 = (ImageView) itemView.findViewById(R.id.avatar_2);
mAvatar3 = (ImageView) itemView.findViewById(R.id.avatar_3);
mName1 = (TextView) itemView.findViewById(R.id.name_1);
mName2 = (TextView) itemView.findViewById(R.id.name_2);
mName3 = (TextView) itemView.findViewById(R.id.name_3);
mVotes1 = (TextView) itemView.findViewById(R.id.votes_1);
mVotes2 = (TextView) itemView.findViewById(R.id.votes_2);
mVotes3 = (TextView) itemView.findViewById(R.id.votes_3);
mSex1 = (ImageView) itemView.findViewById(R.id.sex_1);
mSex2 = (ImageView) itemView.findViewById(R.id.sex_2);
mSex3 = (ImageView) itemView.findViewById(R.id.sex_3);
mLevel1 = (ImageView) itemView.findViewById(R.id.level_1);
mLevel2 = (ImageView) itemView.findViewById(R.id.level_2);
mLevel3 = (ImageView) itemView.findViewById(R.id.level_3);
mBtnFollow1 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_1);
mBtnFollow2 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_2);
mBtnFollow3 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_3);
svga1 = (SVGAImageView) itemView.findViewById(R.id.svga1);
svga2 = (SVGAImageView) itemView.findViewById(R.id.svga2);
svga3 = (SVGAImageView) itemView.findViewById(R.id.svga3);
}
public void setData(ListBean bean, int position) {
if (bean == null) {
return;
}
Log.i("排行榜", bean.toString() + " | position = " + position);
setVisibility(View.GONE, -1, svga1, svga2, svga3);
if (bean.getDress_head() != null) {
if (bean.getDress_head().contains("svga")) {
setVisibility(View.VISIBLE, position, svga1, svga2, svga3);
try {
new SVGAParser(mContext).parse(new URL(bean.getDress_head()), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
getItem(position, svga1, svga2, svga3).setImageDrawable(drawable);
SVGAViewUtils.playEndClear(getItem(position, svga1, svga2, svga3), false);
}
@Override
public void onError() {
}
});
} catch (MalformedURLException e) {
e.printStackTrace();
}
} else {
Log.e("eee", bean.getDress_head());
ImgLoader.display(mContext, bean.getDress_head(), getItem(position, svga1, svga2, svga3));
}
}
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTag(bean);
setVisibility(View.INVISIBLE, position, liveing1, liveing2, liveing3);
if (bean.getIslive() == 1) {
setVisibility(View.VISIBLE, position, liveing1, liveing2, liveing3);
}
setVisibility(bean.isHide() ? View.GONE : View.VISIBLE, position, mBtnFollow1, mBtnFollow2, mBtnFollow3);
if (bean.getAttention() != 1) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).doChecked(true);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setText("+" + WordUtil.getString(R.string.follow));
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setBackgroundResource(R.drawable.background_ffff79c2);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTextColor(Color.parseColor("#FFFFFF"));
} else {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.INVISIBLE);
}
getItem(position, mVotes1, mVotes2, mVotes3).setText(bean.getTotalCoinFormat());
if (bean.isHide()) {
getItem(position, mName1, mName2, mName3).setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, getItem(position, mAvatar1, mAvatar2, mAvatar3));
getItem(position, mSex1, mSex2, mSex3).setVisibility(View.GONE);
getItem(position, mVotes1, mVotes2, mVotes3).setVisibility(View.GONE);
} else {
ImgLoader.display(mContext, bean.getAvatarThumb(), getItem(position, mAvatar1, mAvatar2, mAvatar3));
getItem(position, mName1, mName2, mName3).setText(bean.getUserNiceName());
getItem(position, mSex1, mSex2, mSex3).setVisibility(View.VISIBLE);
getItem(position, svga1, svga2, svga3).setVisibility(View.VISIBLE);
}
getItem(position, mSex1, mSex2, mSex3).setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setOnClickListener(v -> {
ViewClicksAntiShake.clicksAntiShake(v, () -> {
if (!canClick()) {
return;
}
CommonHttpUtil.setAttention(bean.getUid(), new CommonCallback<Integer>() {
@Override
public void callback(Integer bean) {
if(bean!=null&&bean==1){
getItem(position,mBtnFollow1,mBtnFollow2,mBtnFollow3).setVisibility(View.INVISIBLE);
}
Log.i("测试", "callback: "+bean);
}
});
});
});
getItem(position, mItem1, mItem2, mItem3).setOnClickListener(v -> {
ViewClicksAntiShake.clicksAntiShake(v, () -> {
if (bean.isHide()) {
ToastUtil.show(R.string.can_not_go);
} else {
RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
}
});
});
}
private <T> T getItem(int position, T... views) {
return views[position];
}
private void setVisibility(int type, int position, View... views) {
if (position == -1) {
for (View view : views) {
view.setVisibility(type);
}
} else {
views[position].setVisibility(type);
}
}
}
}

View File

@ -45,12 +45,8 @@ import pl.droidsonroids.gif.GifImageView;
public class MainListAdapter extends RefreshAdapter<ListBean> {
public static final int TYPE_PROFIT = 1;//收益榜
public static final int TYPE_CONTRIBUTE = 0;//贡献榜
private static final int HEAD = 0;
private static final int NORMAL = 1;
private String mCoinName;
private String mFollow;
private String mFollowing;
private View.OnClickListener mFollowClickListener1;
private View.OnClickListener mFollowClickListener2;
private View.OnClickListener mItemClickListener;
private List<ListBean> mTopList;
@ -61,15 +57,10 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
public MainListAdapter(Context context, int type) {
super(context);
mType = type;
CommonAppConfig appConfig = CommonAppConfig.getInstance();
mCoinName = type == TYPE_PROFIT ? appConfig.getVotesName() : appConfig.getCoinName();
mTopList = new ArrayList<>();
mFollow = (WordUtil.getString(R.string.follow));
mFollowing = WordUtil.getString(R.string.following);
mItemClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewClicksAntiShake.clicksAntiShake(v, () -> {
mItemClickListener = v -> ViewClicksAntiShake.clicksAntiShake(v, () -> {
Object tag = v.getTag();
if (tag != null && mOnItemClickListener != null) {
ListBean model = (ListBean) tag;
@ -81,29 +72,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
}
});
}
};
mFollowClickListener1 = new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewClicksAntiShake.clicksAntiShake(v, () -> {
if (!canClick()) {
return;
}
Object tag = v.getTag();
if (tag != null) {
final ListBean bean = (ListBean) tag;
CommonHttpUtil.setAttention(bean.getUid(), null);
}
});
}
};
mFollowClickListener2 = new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewClicksAntiShake.clicksAntiShake(v, () -> {
mFollowClickListener2 = v -> ViewClicksAntiShake.clicksAntiShake(v, () -> {
if (!canClick()) {
return;
}
@ -123,9 +92,6 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
});
}
};
}
@Override
public int getItemCount() {
@ -200,307 +166,6 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
((Vh) vh).setData(mList.get(position), position, payload);
}
class HeadVh extends RecyclerView.ViewHolder {
View mItem1;
View mItem2;
View mItem3;
GifImageView liveing1;
GifImageView liveing2;
GifImageView liveing3;
ImageView mAvatar1;
ImageView mAvatar2;
ImageView mAvatar3;
TextView mName1;
TextView mName2;
TextView mName3;
TextView mVotes1;
TextView mVotes2;
TextView mVotes3;
ImageView mSex1;
ImageView mSex2;
ImageView mSex3;
ImageView mLevel1;
ImageView mLevel2;
ImageView mLevel3;
MyRadioButton mBtnFollow1;
MyRadioButton mBtnFollow2;
MyRadioButton mBtnFollow3;
SVGAImageView svga1;
SVGAImageView svga2;
SVGAImageView svga3;
public HeadVh(View itemView) {
super(itemView);
mItem1 = itemView.findViewById(R.id.item_1);
mItem2 = itemView.findViewById(R.id.item_2);
mItem3 = itemView.findViewById(R.id.item_3);
liveing1 = itemView.findViewById(R.id.liveing1);
liveing2 = itemView.findViewById(R.id.liveing2);
liveing3 = itemView.findViewById(R.id.liveing3);
mItem1.setOnClickListener(mItemClickListener);
mItem2.setOnClickListener(mItemClickListener);
mItem3.setOnClickListener(mItemClickListener);
mAvatar1 = (ImageView) itemView.findViewById(R.id.avatar_1);
mAvatar2 = (ImageView) itemView.findViewById(R.id.avatar_2);
mAvatar3 = (ImageView) itemView.findViewById(R.id.avatar_3);
mName1 = (TextView) itemView.findViewById(R.id.name_1);
mName2 = (TextView) itemView.findViewById(R.id.name_2);
mName3 = (TextView) itemView.findViewById(R.id.name_3);
mVotes1 = (TextView) itemView.findViewById(R.id.votes_1);
mVotes2 = (TextView) itemView.findViewById(R.id.votes_2);
mVotes3 = (TextView) itemView.findViewById(R.id.votes_3);
mSex1 = (ImageView) itemView.findViewById(R.id.sex_1);
mSex2 = (ImageView) itemView.findViewById(R.id.sex_2);
mSex3 = (ImageView) itemView.findViewById(R.id.sex_3);
mLevel1 = (ImageView) itemView.findViewById(R.id.level_1);
mLevel2 = (ImageView) itemView.findViewById(R.id.level_2);
mLevel3 = (ImageView) itemView.findViewById(R.id.level_3);
mBtnFollow1 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_1);
mBtnFollow2 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_2);
mBtnFollow3 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_3);
mBtnFollow1.setOnClickListener(mFollowClickListener1);
mBtnFollow2.setOnClickListener(mFollowClickListener1);
mBtnFollow3.setOnClickListener(mFollowClickListener1);
svga1 = (SVGAImageView) itemView.findViewById(R.id.svga1);
svga2 = (SVGAImageView) itemView.findViewById(R.id.svga2);
svga3 = (SVGAImageView) itemView.findViewById(R.id.svga3);
}
void setData(Object payload) {
int topSize = mTopList.size();
if (topSize > 0) {
ListBean bean = mTopList.get(0);
svga1.setVisibility(View.GONE);
if (bean.getDress_head() != null) {
if (bean.getDress_head().contains("svga")) {
svga1.setVisibility(View.VISIBLE);
try {
new SVGAParser(mContext).parse(new URL(bean.getDress_head()), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga1.setImageDrawable(drawable);
SVGAViewUtils.playEndClear(svga1, false);
}
@Override
public void onError() {
}
});
} catch (MalformedURLException e) {
e.printStackTrace();
}
} else {
Log.e("eee", bean.getDress_head());
ImgLoader.display(mContext, bean.getDress_head(), svga1);
}
}
mItem1.setVisibility(View.GONE);
if (payload == null) {
mItem1.setTag(bean);
mItem1.setVisibility(View.VISIBLE);
if (bean.isHide()) {
mName1.setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, mAvatar1);
mSex1.setVisibility(View.GONE);
svga1.setVisibility(View.GONE);
} else {
ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar1);
mName1.setText(bean.getUserNiceName());
mSex1.setVisibility(View.VISIBLE);
svga1.setVisibility(View.VISIBLE);
}
mVotes1.setText(bean.getTotalCoinFormat());
mSex1.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
LevelBean levelBean = null;
if (mType == TYPE_PROFIT) {
levelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor());
} else {
levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
}
if (levelBean != null) {
ImgLoader.display(mContext, levelBean.getThumb(), mLevel1);
}
}
mBtnFollow1.setTag(bean);
liveing1.setVisibility(View.INVISIBLE);
if (bean.getIslive() == 1) {
liveing1.setVisibility(View.VISIBLE);
} else {
liveing1.setVisibility(View.INVISIBLE);
}
mBtnFollow1.setVisibility(bean.isHide() ? View.GONE : View.VISIBLE);
if (bean.getAttention() == 1) {
mBtnFollow1.doChecked(true);
mBtnFollow1.setText(mFollowing);
mBtnFollow1.setBackgroundResource(R.drawable.background_dbdbdb);
mBtnFollow1.setTextColor(Color.parseColor("#FFFFFF"));
} else {
mBtnFollow1.doChecked(false);
mBtnFollow1.setText(mFollow);
mBtnFollow1.setBackgroundResource(R.drawable.background_yellow);
mBtnFollow1.setTextColor(Color.parseColor("#FFFFFF"));
}
}
if (topSize > 1) {
ListBean bean = mTopList.get(1);
svga2.setVisibility(View.GONE);
if (bean.getDress_head() != null) {
if (bean.getDress_head().contains("svga")) {
svga2.setVisibility(View.VISIBLE);
try {
new SVGAParser(mContext).parse(new URL(bean.getDress_head()), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga2.setImageDrawable(drawable);
SVGAViewUtils.playEndClear(svga2, false);
}
@Override
public void onError() {
}
});
} catch (MalformedURLException e) {
e.printStackTrace();
}
} else {
Log.e("eee", bean.getDress_head());
ImgLoader.display(mContext, bean.getDress_head(), svga2);
}
}
mItem2.setVisibility(View.GONE);
if (payload == null) {
mItem2.setVisibility(View.VISIBLE);
mItem2.setTag(bean);
if (bean.isHide()) {
mName2.setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, mAvatar2);
mSex2.setVisibility(View.GONE);
} else {
ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar2);
mName2.setText(bean.getUserNiceName());
mSex2.setVisibility(View.VISIBLE);
}
mVotes2.setText(bean.getTotalCoinFormat() + " ");
mSex2.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
LevelBean levelBean = null;
if (mType == TYPE_PROFIT) {
levelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor());
} else {
levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
}
if (levelBean != null) {
ImgLoader.display(mContext, levelBean.getThumb(), mLevel2);
}
}
mBtnFollow2.setTag(bean);
liveing2.setVisibility(View.INVISIBLE);
if (bean.getIslive() == 1) {
liveing2.setVisibility(View.VISIBLE);
} else {
liveing2.setVisibility(View.INVISIBLE);
}
mBtnFollow2.setVisibility(bean.isHide() ? View.GONE : View.VISIBLE);
svga2.setVisibility(bean.isHide() ? View.GONE : View.VISIBLE);
if (bean.getAttention() == 1) {
mBtnFollow2.doChecked(true);
mBtnFollow2.setText(mFollowing);
mBtnFollow2.setBackgroundResource(R.drawable.background_dbdbdb);
mBtnFollow2.setTextColor(Color.parseColor("#FFFFFF"));
} else {
mBtnFollow2.doChecked(false);
mBtnFollow2.setText(mFollow);
mBtnFollow2.setBackgroundResource(R.drawable.background_yellow);
mBtnFollow2.setTextColor(Color.parseColor("#FFFFFF"));
}
}
if (topSize > 2) {
ListBean bean = mTopList.get(2);
if (bean.getDress_head() != null) {
svga3.setVisibility(View.GONE);
if (bean.getDress_head().contains("svga")) {
svga3.setVisibility(View.VISIBLE);
try {
new SVGAParser(mContext).parse(new URL(bean.getDress_head()), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga3.setImageDrawable(drawable);
SVGAViewUtils.playEndClear(svga3, false);
}
@Override
public void onError() {
}
});
} catch (MalformedURLException e) {
e.printStackTrace();
}
} else {
Log.e("eee", bean.getDress_head());
ImgLoader.display(mContext, bean.getDress_head(), svga3);
}
}
mItem3.setVisibility(View.GONE);
if (payload == null) {
mItem3.setVisibility(View.VISIBLE);
mItem3.setTag(bean);
if (bean.isHide()) {
mName3.setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, mAvatar3);
mSex3.setVisibility(View.GONE);
} else {
ImgLoader.display(mContext, bean.getAvatarThumb(), mAvatar3);
mName3.setText(bean.getUserNiceName());
mSex3.setVisibility(View.VISIBLE);
}
mVotes3.setText(bean.getTotalCoinFormat() + " ");
mSex3.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
LevelBean levelBean = null;
if (mType == TYPE_PROFIT) {
levelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor());
} else {
levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
}
if (levelBean != null) {
ImgLoader.display(mContext, levelBean.getThumb(), mLevel3);
}
}
mBtnFollow3.setTag(bean);
liveing3.setVisibility(View.INVISIBLE);
if (bean.getIslive() == 1) {
liveing3.setVisibility(View.VISIBLE);
} else {
liveing3.setVisibility(View.INVISIBLE);
}
mBtnFollow3.setVisibility(bean.isHide() ? View.GONE : View.VISIBLE);
svga3.setVisibility(bean.isHide() ? View.GONE : View.VISIBLE);
if (bean.getAttention() == 1) {
mBtnFollow3.doChecked(true);
mBtnFollow3.setText(mFollowing);
mBtnFollow3.setBackgroundResource(R.drawable.background_dbdbdb);
mBtnFollow3.setTextColor(Color.parseColor("#FFFFFF"));
} else {
mBtnFollow3.doChecked(false);
mBtnFollow3.setText(mFollow);
mBtnFollow3.setBackgroundResource(R.drawable.background_yellow);
mBtnFollow3.setTextColor(Color.parseColor("#FFFFFF"));
}
}
}
}
class Vh extends RecyclerView.ViewHolder {
TextView mOrder;

View File

@ -4,22 +4,42 @@ import android.content.Context;
import androidx.recyclerview.widget.LinearLayoutManager;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.custom.MyRadioButton;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.main.R;
import com.yunbao.main.adapter.MainListAdapter;
import com.yunbao.main.bean.ListBean;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import pl.droidsonroids.gif.GifImageView;
/**
* Created by cxf on 2019/2/23.
*/
@ -35,6 +55,8 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
public MainListAdapter mAdapter;
protected OnLoadData loadData;
protected List<ListBean> list;
private HeadView hv;
private View mBackgroundLayout;
public AbsMainListChildViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
@ -49,8 +71,16 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
@Override
public void init() {
mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView);
mBackgroundLayout = findViewById(R.id.bg_layout);
hv = new HeadView(findViewById(R.id.rootView));
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_list);
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
loadData = list -> {
Log.i("测试", "onData: " + list.size());
hv.setData(list.get(0), 0);
hv.setData(list.get(1), 1);
hv.setData(list.get(2), 2);
};
}
@Override
@ -97,23 +127,180 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
}
}
public void setOnLoadDataListener(OnLoadData loadData) {
this.loadData = loadData;
if (list != null && !list.isEmpty()) {
loadData.onData(list);
}
}
public void setType(String type) {
public void setType(int position, String type) {
if (type != null) {
this.mType = type;
}
if (mRefreshView != null) {
mRefreshView.initData();
}
if (position == 0) {
mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour_top);
} else {
mBackgroundLayout.setBackgroundResource(R.mipmap.bg_glamour2_top);
}
}
public interface OnLoadData {
void onData(List<ListBean> list);
}
class HeadView {
View mItem1;
View mItem2;
View mItem3;
GifImageView liveing1;
GifImageView liveing2;
GifImageView liveing3;
ImageView mAvatar1;
ImageView mAvatar2;
ImageView mAvatar3;
TextView mName1;
TextView mName2;
TextView mName3;
TextView mVotes1;
TextView mVotes2;
TextView mVotes3;
ImageView mSex1;
ImageView mSex2;
ImageView mSex3;
ImageView mLevel1;
ImageView mLevel2;
ImageView mLevel3;
MyRadioButton mBtnFollow1;
MyRadioButton mBtnFollow2;
MyRadioButton mBtnFollow3;
SVGAImageView svga1;
SVGAImageView svga2;
SVGAImageView svga3;
public HeadView(View itemView) {
mItem1 = itemView.findViewById(R.id.item_1);
mItem2 = itemView.findViewById(R.id.item_2);
mItem3 = itemView.findViewById(R.id.item_3);
liveing1 = itemView.findViewById(R.id.liveing1);
liveing2 = itemView.findViewById(R.id.liveing2);
liveing3 = itemView.findViewById(R.id.liveing3);
mAvatar1 = (ImageView) itemView.findViewById(R.id.avatar_1);
mAvatar2 = (ImageView) itemView.findViewById(R.id.avatar_2);
mAvatar3 = (ImageView) itemView.findViewById(R.id.avatar_3);
mName1 = (TextView) itemView.findViewById(R.id.name_1);
mName2 = (TextView) itemView.findViewById(R.id.name_2);
mName3 = (TextView) itemView.findViewById(R.id.name_3);
mVotes1 = (TextView) itemView.findViewById(R.id.votes_1);
mVotes2 = (TextView) itemView.findViewById(R.id.votes_2);
mVotes3 = (TextView) itemView.findViewById(R.id.votes_3);
mSex1 = (ImageView) itemView.findViewById(R.id.sex_1);
mSex2 = (ImageView) itemView.findViewById(R.id.sex_2);
mSex3 = (ImageView) itemView.findViewById(R.id.sex_3);
mLevel1 = (ImageView) itemView.findViewById(R.id.level_1);
mLevel2 = (ImageView) itemView.findViewById(R.id.level_2);
mLevel3 = (ImageView) itemView.findViewById(R.id.level_3);
mBtnFollow1 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_1);
mBtnFollow2 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_2);
mBtnFollow3 = (MyRadioButton) itemView.findViewById(R.id.btn_follow_3);
svga1 = (SVGAImageView) itemView.findViewById(R.id.svga1);
svga2 = (SVGAImageView) itemView.findViewById(R.id.svga2);
svga3 = (SVGAImageView) itemView.findViewById(R.id.svga3);
}
public void setData(ListBean bean, int position) {
if (bean == null) {
return;
}
Log.i("排行榜", bean.toString() + " | position = " + position);
setVisibility(View.GONE, -1, svga1, svga2, svga3);
if (bean.getDress_head() != null) {
if (bean.getDress_head().contains("svga")) {
setVisibility(View.VISIBLE, position, svga1, svga2, svga3);
try {
new SVGAParser(mContext).parse(new URL(bean.getDress_head()), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
getItem(position, svga1, svga2, svga3).setImageDrawable(drawable);
SVGAViewUtils.playEndClear(getItem(position, svga1, svga2, svga3), false);
}
@Override
public void onError() {
}
});
} catch (MalformedURLException e) {
e.printStackTrace();
}
} else {
Log.e("eee", bean.getDress_head());
ImgLoader.display(mContext, bean.getDress_head(), getItem(position, svga1, svga2, svga3));
}
}
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTag(bean);
setVisibility(View.INVISIBLE, position, liveing1, liveing2, liveing3);
if (bean.getIslive() == 1) {
setVisibility(View.VISIBLE, position, liveing1, liveing2, liveing3);
}
setVisibility(bean.isHide() ? View.GONE : View.VISIBLE, position, mBtnFollow1, mBtnFollow2, mBtnFollow3);
if (bean.getAttention() != 1) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).doChecked(true);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setText("+" + WordUtil.getString(R.string.follow));
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setBackgroundResource(R.drawable.background_ffff79c2);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTextColor(Color.parseColor("#FFFFFF"));
} else {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.INVISIBLE);
}
getItem(position, mVotes1, mVotes2, mVotes3).setText(bean.getTotalCoinFormat());
if (bean.isHide()) {
getItem(position, mName1, mName2, mName3).setText(R.string.mystery_man);
ImgLoader.display(mContext, R.mipmap.hide, getItem(position, mAvatar1, mAvatar2, mAvatar3));
getItem(position, mSex1, mSex2, mSex3).setVisibility(View.GONE);
getItem(position, mVotes1, mVotes2, mVotes3).setVisibility(View.GONE);
} else {
ImgLoader.display(mContext, bean.getAvatarThumb(), getItem(position, mAvatar1, mAvatar2, mAvatar3));
getItem(position, mName1, mName2, mName3).setText(bean.getUserNiceName());
getItem(position, mSex1, mSex2, mSex3).setVisibility(View.VISIBLE);
getItem(position, svga1, svga2, svga3).setVisibility(View.VISIBLE);
}
getItem(position, mSex1, mSex2, mSex3).setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setOnClickListener(v -> {
CommonHttpUtil.setAttention(bean.getUid(), new CommonCallback<Integer>() {
@Override
public void callback(Integer bean) {
if (bean != null && bean == 1) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.INVISIBLE);
}
Log.i("测试", "callback: " + bean);
}
});
});
getItem(position, mItem1, mItem2, mItem3).setOnClickListener(v -> {
ViewClicksAntiShake.clicksAntiShake(v, () -> {
if (bean.isHide()) {
ToastUtil.show(R.string.can_not_go);
} else {
RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
}
});
});
}
private <T> T getItem(int position, T... views) {
return views[position];
}
private void setVisibility(int type, int position, View... views) {
if (position == -1) {
for (View view : views) {
view.setVisibility(type);
}
} else {
views[position].setVisibility(type);
}
}
}
}

View File

@ -0,0 +1,25 @@
package com.yunbao.main.views;
import android.content.Context;
import com.yunbao.common.utils.DpUtil;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ClipPagerTitleView;
public class MyClipPagerTitleView extends ClipPagerTitleView {
public MyClipPagerTitleView(Context context) {
super(context);
}
@Override
public void onSelected(int index, int totalCount) {
super.onSelected(index, totalCount);
setTextSize(DpUtil.dp2px(20));
}
@Override
public void onDeselected(int index, int totalCount) {
super.onDeselected(index, totalCount);
setTextSize(DpUtil.dp2px(16));
}
}

View File

@ -6,16 +6,37 @@
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</androidx.viewpager.widget.ViewPager>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bg_layout"
android:layout_width="match_parent"
android:layout_height="421dp"
android:background="@mipmap/bg_glamour_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/btn_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="377dp"
app:layout_constraintBottom_toBottomOf="@+id/indicator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/indicator"
app:srcCompat="@mipmap/icon_back_white" />
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/indicator"
android:layout_width="wrap_content"
@ -23,15 +44,13 @@
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:layout_marginBottom="50dp"
android:background="@drawable/background_f8f8f8"
app:layout_constraintBottom_toTopOf="@+id/item_1"
android:layout_marginTop="59dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -71,403 +90,8 @@
</RadioGroup>
<LinearLayout
android:id="@+id/item_1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="28dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="@+id/item_2"
app:layout_constraintEnd_toStartOf="@+id/item_3"
app:layout_constraintStart_toEndOf="@+id/item_2">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_1"
android:layout_width="60dp"
android:layout_height="60dp"
android:scaleType="centerCrop"
app:riv_oval="true" />
</RelativeLayout>
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga1"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp" />
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/liveing1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="50dp"
android:src="@mipmap/icon_user_home_living" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/name_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:textColor="#FFFFFF"
android:textSize="15sp" />
<ImageView
android:id="@+id/sex_1"
android:layout_width="12dp"
android:layout_height="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@mipmap/diamond" />
<TextView
android:id="@+id/votes_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<com.yunbao.common.custom.MyRadioButton
android:id="@+id/btn_follow_1"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@drawable/background_dbdbdb"
android:button="@null"
android:gravity="center"
android:text="@string/shield_gift_effect"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/item_2"
android:layout_width="0dp"
android:layout_height="152dp"
android:layout_marginStart="25dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="70dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/item_1"
app:layout_constraintStart_toStartOf="parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_2"
android:layout_width="66dp"
android:layout_height="66dp"
android:scaleType="centerCrop"
app:riv_border_color="#B6B6B6"
app:riv_border_width="2dp"
app:riv_oval="true" />
</RelativeLayout>
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga2"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp" />
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/liveing2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="50dp"
android:src="@mipmap/icon_user_home_living" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/name_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:textColor="#FFFFFF"
android:textSize="15sp" />
<ImageView
android:id="@+id/sex_2"
android:layout_width="12dp"
android:layout_height="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@mipmap/diamond" />
<TextView
android:id="@+id/votes_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<com.yunbao.common.custom.MyRadioButton
android:id="@+id/btn_follow_2"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@drawable/background_dbdbdb"
android:button="@null"
android:gravity="center"
android:text="已关注"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/item_3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="25dp"
android:layout_marginBottom="60dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/item_1">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_3"
android:layout_width="66dp"
android:layout_height="66dp"
android:scaleType="centerCrop"
app:riv_border_color="#B6B6B6"
app:riv_border_width="2dp"
app:riv_oval="true" />
</RelativeLayout>
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga3"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp" />
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/liveing3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="50dp"
android:src="@mipmap/icon_user_home_living" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/name_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:textColor="#FFFFFF"
android:textSize="15sp" />
<ImageView
android:id="@+id/sex_3"
android:layout_width="12dp"
android:layout_height="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@mipmap/diamond" />
<TextView
android:id="@+id/votes_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<com.yunbao.common.custom.MyRadioButton
android:id="@+id/btn_follow_3"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@drawable/background_dbdbdb"
android:button="@null"
android:gravity="center"
android:text="已关注"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="-15dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bg_layout">
</androidx.viewpager.widget.ViewPager>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,17 +1,418 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FFFFFF"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bg_layout"
android:layout_width="match_parent"
android:layout_height="421dp"
android:background="@mipmap/bg_glamour_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="@+id/item_1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="40dp"
android:gravity="center"
android:orientation="vertical"
>
app:layout_constraintBottom_toBottomOf="@+id/item_2"
app:layout_constraintEnd_toStartOf="@+id/item_3"
app:layout_constraintStart_toEndOf="@+id/item_2">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_1"
android:layout_width="60dp"
android:layout_height="60dp"
android:scaleType="centerCrop"
app:riv_oval="true" />
</RelativeLayout>
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga1"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp" />
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/liveing1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="50dp"
android:src="@mipmap/icon_user_home_living" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/name_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:textColor="#FFFFFF"
android:textSize="15sp" />
<ImageView
android:id="@+id/sex_1"
android:layout_width="12dp"
android:layout_height="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@mipmap/diamond" />
<TextView
android:id="@+id/votes_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<com.yunbao.common.custom.MyRadioButton
android:id="@+id/btn_follow_1"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@drawable/background_dbdbdb"
android:button="@null"
android:gravity="center"
android:text="@string/shield_gift_effect"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/item_2"
android:layout_width="0dp"
android:layout_height="152dp"
android:layout_marginStart="25dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="70dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/item_1"
app:layout_constraintStart_toStartOf="parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_2"
android:layout_width="66dp"
android:layout_height="66dp"
android:scaleType="centerCrop"
app:riv_border_color="#B6B6B6"
app:riv_border_width="2dp"
app:riv_oval="true" />
</RelativeLayout>
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga2"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp" />
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/liveing2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="50dp"
android:src="@mipmap/icon_user_home_living" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/name_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:textColor="#FFFFFF"
android:textSize="15sp" />
<ImageView
android:id="@+id/sex_2"
android:layout_width="12dp"
android:layout_height="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@mipmap/diamond" />
<TextView
android:id="@+id/votes_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<com.yunbao.common.custom.MyRadioButton
android:id="@+id/btn_follow_2"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@drawable/background_dbdbdb"
android:button="@null"
android:gravity="center"
android:text="已关注"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/item_3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="25dp"
android:layout_marginBottom="60dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/item_1">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar_3"
android:layout_width="66dp"
android:layout_height="66dp"
android:scaleType="centerCrop"
app:riv_border_color="#B6B6B6"
app:riv_border_width="2dp"
app:riv_oval="true" />
</RelativeLayout>
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga3"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp" />
<RelativeLayout
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/liveing3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="50dp"
android:src="@mipmap/icon_user_home_living" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/name_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:textColor="#FFFFFF"
android:textSize="15sp" />
<ImageView
android:id="@+id/sex_3"
android:layout_width="12dp"
android:layout_height="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@mipmap/diamond" />
<TextView
android:id="@+id/votes_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<com.yunbao.common.custom.MyRadioButton
android:id="@+id/btn_follow_3"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@drawable/background_dbdbdb"
android:button="@null"
android:gravity="center"
android:text="已关注"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.yunbao.common.custom.CommonRefreshView
android:id="@+id/refreshView"
android:background="@drawable/background_white_up"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
android:layout_height="0dp"
android:layout_marginTop="-15dp"
android:background="@drawable/background_white_up"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bg_layout" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B