删除了一些个人主页相关的无用代码

This commit is contained in:
huangjian
2022-06-13 15:57:30 +08:00
parent a2d17c7fc4
commit 53f671d6c9
23 changed files with 1 additions and 1259 deletions

View File

@@ -524,10 +524,7 @@
android:name=".UserGuideActivity"
android:label="引导页"
android:screenOrientation="portrait" />
<activity
android:name=".ui.user.ScrollingActivity"
android:label="@string/title_activity_scrolling"
android:screenOrientation="portrait" />
<activity
android:name=".ui.search.SearchActivity"
android:screenOrientation="portrait" />

View File

@@ -1,74 +0,0 @@
package com.yizhuan.erban.ui.user;
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.user.bean.GiftWallInfo;
import java.util.List;
/**
* @author chenran
*/
public class GiftWallAdapter extends RecyclerView.Adapter<GiftWallAdapter.GiftWallHolder> {
private List<GiftWallInfo> giftWallInfoList;
private Context context;
private int mTextColor;
public GiftWallAdapter(Context context, int textColor) {
this.context = context;
mTextColor = textColor;
}
public void setGiftWallInfoList(List<GiftWallInfo> giftWallInfoList) {
this.giftWallInfoList = giftWallInfoList;
}
@Override
public GiftWallHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View item = LayoutInflater.from(parent.getContext()).
inflate(R.layout.list_item_gift_wall_info, parent, false);
return new GiftWallHolder(item, mTextColor);
}
@Override
public void onBindViewHolder(GiftWallHolder holder, int position) {
GiftWallInfo giftWallInfo = giftWallInfoList.get(position);
holder.giftName.setText(giftWallInfo.getGiftName());
holder.giftNum.setText(String.valueOf(giftWallInfo.getReciveCount()));
ImageLoadUtils.loadImage(context, giftWallInfo.getPicUrl(), holder.giftPic);
}
@Override
public int getItemCount() {
if (giftWallInfoList == null)
return 0;
else {
return giftWallInfoList.size();
}
}
class GiftWallHolder extends RecyclerView.ViewHolder {
private ImageView giftPic;
private TextView giftName;
private TextView giftNum;
GiftWallHolder(View itemView, int textColor) {
super(itemView);
giftPic = itemView.findViewById(R.id.gift_img);
giftName = itemView.findViewById(R.id.gift_name);
giftNum = itemView.findViewById(R.id.gift_num);
giftName.setTextColor(textColor);
giftNum.setTextColor(textColor);
}
}
}

View File

@@ -1,80 +0,0 @@
package com.yizhuan.erban.ui.user;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.ViewCompat;
import androidx.core.view.ViewPropertyAnimatorListener;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
public class ScrollAwareBehavior extends CoordinatorLayout.Behavior<LinearLayout> {
private static final android.view.animation.Interpolator INTERPOLATOR = new FastOutSlowInInterpolator();
private boolean mIsAnimatingOut = false;
private boolean mIsAnimatingIn = false;
public ScrollAwareBehavior(Context context, AttributeSet attrs){
super(context, attrs);
}
@Override
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull LinearLayout child, @NonNull View directTargetChild, @NonNull View target, int axes, int type) {
return (axes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
}
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull LinearLayout child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);
//向上滚动进入,向下滚动隐藏
if (dyUnconsumed > 0 && !this.mIsAnimatingOut){
//animateOut()和animateIn()都是私有方法,需要重新实现
animateOut(child);
} else if (dyUnconsumed < 0 && !mIsAnimatingIn){
animateIn(child);
}
}
private void animateOut(final LinearLayout button){
ViewCompat.animate(button).translationY(500)
.setInterpolator(INTERPOLATOR).withLayer()
.setListener(new ViewPropertyAnimatorListener() {
@Override
public void onAnimationStart(View view) {
ScrollAwareBehavior.this.mIsAnimatingOut = true;
}
@Override
public void onAnimationEnd(View view) {
ScrollAwareBehavior.this.mIsAnimatingOut = false;
}
@Override
public void onAnimationCancel(View view) {
ScrollAwareBehavior.this.mIsAnimatingOut = false;
}
}).start();
}
private void animateIn(LinearLayout button){
ViewCompat.animate(button).translationY(0)
.setInterpolator(INTERPOLATOR).withLayer().setListener(new ViewPropertyAnimatorListener() {
@Override
public void onAnimationStart(View view) {
mIsAnimatingIn = true;
}
@Override
public void onAnimationEnd(View view) {
mIsAnimatingIn = false;
}
@Override
public void onAnimationCancel(View view) {
mIsAnimatingIn = false;
}
})
.start();
}
}

View File

@@ -1,30 +0,0 @@
package com.yizhuan.erban.ui.user;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.View;
import com.yizhuan.erban.R;
public class ScrollingActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scrolling);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
}

View File

@@ -1,227 +0,0 @@
package com.yizhuan.erban.ui.user;
import androidx.lifecycle.Observer;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.yizhuan.erban.R;
import com.yizhuan.erban.base.BaseMvpFragment;
import com.yizhuan.erban.ui.user.adapter.GiftAchievementAdapter;
import com.yizhuan.erban.ui.user.presenter.UserGiftAchievementPresenter;
import com.yizhuan.erban.ui.user.view.IUserGiftAchievement;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.user.UserInfoUiMgr;
import com.yizhuan.xchat_android_core.user.bean.GiftAchievementInfo;
import com.yizhuan.xchat_android_core.user.bean.GiftAchievementInfoSub;
import com.yizhuan.xchat_android_core.user.bean.GiftAchievementItem;
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
import com.yizhuan.xchat_android_library.utils.ListUtils;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
@CreatePresenter(UserGiftAchievementPresenter.class)
public class UserGiftAchievementFrg extends BaseMvpFragment<IUserGiftAchievement, UserGiftAchievementPresenter>
implements IUserGiftAchievement{
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
private Observer mObserver;
private long mUserId;
private Unbinder unbinder;
public static UserGiftAchievementFrg newInstance() {
return new UserGiftAchievementFrg();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mObserver = new Observer<Long>() {
@Override
public void onChanged(@Nullable Long o) {
if (o != null) {
mUserId = o;
}
}
};
UserInfoUiMgr.get().registerUid(this, mObserver);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
unbinder = ButterKnife.bind(this, mView);
return mView;
}
@Override
public void onDestroyView() {
super.onDestroyView();
UserInfoUiMgr.get().unregisterUid(mObserver);
if (unbinder != null) {
unbinder.unbind();
}
}
@Override
public void onFindViews() {
}
@Override
public void onSetListener() {
}
@Override
public void initiate() {
mAdapter = new GiftAchievementAdapter(null);
recyclerView.setLayoutManager(new GridLayoutManager(mContext, 4));
recyclerView.setAdapter(mAdapter);
mAdapter.setSpanSizeLookup(new BaseQuickAdapter.SpanSizeLookup() {
@Override
public int getSpanSize(GridLayoutManager gridLayoutManager, int position) {
List<GiftAchievementItem> list = mAdapter.getData();
if (ListUtils.isListEmpty(list))
return 4;
GiftAchievementItem userInfoItem = list.get(position);
int type = userInfoItem.getItemType();
if (type == GiftAchievementItem.TYPE_TITILE || type == GiftAchievementItem.TYPE_BLOCK_DIVIDER) {
return 4;
} else
return 1;
}
});
mAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
long currentClick = System.currentTimeMillis();
if (currentClick - lastClick > 2000) {
lastClick = currentClick;
List<GiftAchievementItem> list = adapter.getData();
if (position >=0 && position < list.size()) {
GiftAchievementItem info = list.get(position);
if (info != null && info.getItemType() == GiftAchievementItem.TYPE_ITEM) {
GiftAchievementInfoSub infoSub = (GiftAchievementInfoSub) info.getData();
if (infoSub != null && !TextUtils.isEmpty(infoSub.getTip())) {
SingleToastUtil.showToastShort(infoSub.getTip());
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_HOMEPAGE_GIFT_TIP, "有礼物提示卡片-" + infoSub.getGiftName());
} else {
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_HOMEPAGE_GIFT_NO_TIP, "无礼物提示卡片-" + infoSub.getGiftName());
}
}
}
}
}
});
Long uid = UserInfoUiMgr.get().getUid();
if (uid != null) {
mUserId = uid;
}
getMvpPresenter().getAchievementList(mUserId);
}
private long lastClick;
@Override
public int getRootLayoutId() {
return R.layout.gift_achievement_recyclerview;
}
private List<GiftAchievementItem> mList = new ArrayList<>();
private GiftAchievementAdapter mAdapter;
@Override
public void getAchievementListSuccess(List<GiftAchievementInfo> list) {
mList.clear();
if (list == null || list.size() == 0) {
if (mUserGiftNoDataListener != null) {
mUserGiftNoDataListener.noData(UserInfoGiftGroupFrg.TAG_GIFT);
}
return;
}
if (mUserGiftNoDataListener != null) {
mUserGiftNoDataListener.hasData(UserInfoGiftGroupFrg.TAG_ACHIEVEMENT);
}
for (GiftAchievementInfo info : list) {
String title;
if (AuthModel.get().getCurrentUid() == mUserId) {
title = info.getTypeName() + " (" + info.getAttainNum() + "/" + info.getTotalNum() + ")";
} else { // 客态页不显示集卡进度
title = info.getTypeName();
}
GiftAchievementItem item;
// 模块间距
if (mList.size() > 1) {
item = new GiftAchievementItem(GiftAchievementItem.TYPE_BLOCK_DIVIDER, null);
mList.add(item);
}
item = new GiftAchievementItem(GiftAchievementItem.TYPE_TITILE, title);
mList.add(item);
List<GiftAchievementInfoSub> subs = info.getGiftList();
if (subs != null && subs.size() > 0) {
for (GiftAchievementInfoSub temp : subs) {
item = new GiftAchievementItem(GiftAchievementItem.TYPE_ITEM, temp,
info.getBackgroundUrl(), info.getMaskUrl(), info.getGrayBgUrl());
mList.add(item);
}
}
}
mAdapter.setNewData(mList);
}
@Override
public void getAchievementListFail(Throwable error) {
if (mUserGiftNoDataListener != null) {
mUserGiftNoDataListener.noData(UserInfoGiftGroupFrg.TAG_GIFT);
}
}
public void setmUserGiftNoDataListener(UserGiftNoDataListener mUserGiftNoDataListener) {
this.mUserGiftNoDataListener = mUserGiftNoDataListener;
}
private UserGiftNoDataListener mUserGiftNoDataListener;
public interface UserGiftNoDataListener {
void noData(byte type);
void hasData(byte type);
}
}

View File

@@ -1,150 +0,0 @@
package com.yizhuan.erban.ui.user;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.yizhuan.erban.R;
import com.yizhuan.erban.base.BaseFragment;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
public class UserInfoGiftGroupFrg extends BaseFragment implements UserGiftAchievementFrg.UserGiftNoDataListener {
@BindView(R.id.iv_label)
ImageView ivLabel;
@BindView(R.id.tv_label_change)
TextView tvLabelChange;
@BindView(R.id.fl_gift_container)
FrameLayout flGiftContainer;
private UserInfoGiftFragment userInfoGiftFragment;
private UserGiftAchievementFrg userGiftAchievementFrg;
public static final byte TAG_ACHIEVEMENT = (byte) 1;
public static final byte TAG_GIFT = (byte) 2;
private byte tag = TAG_ACHIEVEMENT;
private Unbinder unbinder;
public static UserInfoGiftGroupFrg newInstance() {
return new UserInfoGiftGroupFrg();
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
setFragment();
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
unbinder = ButterKnife.bind(this, mView);
return mView;
}
@Override
public void initiate() {
userGiftAchievementFrg = UserGiftAchievementFrg.newInstance();
userGiftAchievementFrg.setmUserGiftNoDataListener(this);
userInfoGiftFragment = UserInfoGiftFragment.newInstance();
tag = TAG_ACHIEVEMENT;
}
private long lastClick = 0L;
@OnClick({R.id.tv_label_change})
public void onClick(View view) {
long currentClick = System.currentTimeMillis();
if (currentClick - lastClick > 500) {
lastClick = currentClick;
switch (view.getId()) {
case R.id.tv_label_change:
String temp = tvLabelChange.getText().toString();
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_HOMEPAGE_GIFT_CHANGE_TAB, "礼物页切换按钮-" + temp);
if (tag == TAG_ACHIEVEMENT) {
tag = TAG_GIFT;
} else {
tag = TAG_ACHIEVEMENT;
}
setFragment();
hasData(tag);
break;
}
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (unbinder != null) {
unbinder.unbind();
}
}
private void setFragment() {
FragmentManager manager = getChildFragmentManager();
if (tag == TAG_GIFT) {
manager.beginTransaction().replace(R.id.fl_gift_container, userInfoGiftFragment, "userInfoGiftFragment")
.commit();
} else if (tag == TAG_ACHIEVEMENT) {
manager.beginTransaction().replace(R.id.fl_gift_container, userGiftAchievementFrg, "userGiftAchievementFrg")
.commit();
}
}
@Override
public int getRootLayoutId() {
return R.layout.frg_gift_group;
}
// 礼物成就没数据
@Override
public void noData(byte o) {
tvLabelChange.setVisibility(View.GONE); // 是否显示只根据礼物成就判断
setLabel(TAG_GIFT);
tag = o;
setFragment();
}
// 礼物成就有数据
@Override
public void hasData(byte type) {
tvLabelChange.setVisibility(View.VISIBLE);
setLabel(type);
}
private void setLabel(byte type) {
if (type == TAG_GIFT) {
ivLabel.setImageResource(R.drawable.ic_gift_received);
tvLabelChange.setText("礼物成就");
} else if (type == TAG_ACHIEVEMENT) {
ivLabel.setImageResource(R.drawable.ic_gift_achievement);
tvLabelChange.setText("收到的礼物");
}
}
}

View File

@@ -1,95 +0,0 @@
package com.yizhuan.erban.ui.user.adapter;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yizhuan.erban.R;
import com.yizhuan.erban.common.widget.RectRoundImageView;
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
import com.yizhuan.xchat_android_core.user.bean.GiftAchievementInfoSub;
import com.yizhuan.xchat_android_core.user.bean.GiftAchievementItem;
import java.util.List;
public class GiftAchievementAdapter extends BaseMultiItemQuickAdapter<GiftAchievementItem, BaseViewHolder> {
/**
* Same as QuickAdapter#QuickAdapter(Context,int) but with
* some initialization data.
*
* @param data A new list is created out of this one to avoid mutable list
*/
public GiftAchievementAdapter(List<GiftAchievementItem> data) {
super(data);
addItemType(GiftAchievementItem.TYPE_TITILE, R.layout.layout_gift_achievement_title);
addItemType(GiftAchievementItem.TYPE_ITEM, R.layout.item_gift_achievement);
addItemType(GiftAchievementItem.TYPE_BLOCK_DIVIDER, R.layout.layout_divider_achievement);
}
@Override
protected void convert(BaseViewHolder helper, GiftAchievementItem item) {
if (item == null) {
return;
}
switch (item.getItemType()) {
case GiftAchievementItem.TYPE_TITILE:
setTitle(helper, item);
break;
case GiftAchievementItem.TYPE_ITEM:
setItem(helper, item);
break;
}
}
private void setTitle(BaseViewHolder helper, GiftAchievementItem item) {
String title = (String) item.getData();
helper.setText(R.id.tv_gift_achievement_title, title);
}
private void setItem(BaseViewHolder helper, GiftAchievementItem item) {
if (item == null) {
return;
}
GiftAchievementInfoSub infoSub = (GiftAchievementInfoSub) item.getData();
if (infoSub == null) {
return;
}
// 礼物
RectRoundImageView rrivGift = helper.getView(R.id.rriv_gift);
ImageLoadUtilsV2.loadImage(rrivGift, infoSub.getPicUrl());
// 背景
ImageView bg = helper.getView(R.id.iv_bg_achievement);
// 蒙层
ImageView mask = helper.getView(R.id.iv_mask);
if (infoSub.isStatus() && !TextUtils.isEmpty(item.getmMaskUrl())) {
ImageLoadUtilsV2.loadImage(mask, item.getmMaskUrl());
// 未点亮状态
mask.setVisibility(View.VISIBLE);
ImageLoadUtilsV2.loadImage(bg, item.getmGrayBgUrl());
helper.setTextColor(R.id.tv_gift_name, ContextCompat.getColor(mContext, R.color.color_common_text_light_gray));
} else {
// 点亮状态
mask.setVisibility(View.GONE);
ImageLoadUtilsV2.loadImage(bg, item.getmBgUrl());
helper.setTextColor(R.id.tv_gift_name, ContextCompat.getColor(mContext, R.color.color_common_text_gray));
}
helper.setText(R.id.tv_gift_name, infoSub.getGiftName());
helper.setText(R.id.tv_gift_num, infoSub.getGiftSum() + "");
helper.setGone(R.id.iv_achievement_tips, !TextUtils.isEmpty(infoSub.getTip()));
helper.addOnClickListener(R.id.cl_container_gift_achievement);
}
}

View File

@@ -1,47 +0,0 @@
package com.yizhuan.erban.ui.user.adapter;
import android.widget.ImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
import static com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo.STATUS_OFF_SHELF;
import static com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo.STATUS_OUT_OF_DATE;
/**
* <p> </p>
*
* @author jiahui
* date 2018/3/5
*/
public class MyCarAdapter extends BaseQuickAdapter<CarInfo, BaseViewHolder> {
public MyCarAdapter() {
super(R.layout.user_info_my_car_item);
}
@Override
protected void convert(BaseViewHolder helper, CarInfo item) {
int resId = -1;
if (item.getStatus() == STATUS_OUT_OF_DATE) {
resId = R.drawable.ic_car_expire;
} else if (item.getStatus() == STATUS_OFF_SHELF) {
resId = R.drawable.ic_car_down;
}
helper.setVisible(R.id.user_info_car_flag,
item.getStatus() == STATUS_OUT_OF_DATE || item.getStatus() == STATUS_OFF_SHELF)
// .setVisible(R.id.car_user_gray_view, item.getStatus() == STATUS_OFF_SHELF)
.addOnClickListener(R.id.user_info_car_pic)
;
if (resId != -1) {
helper.setImageResource(R.id.user_info_car_flag, resId);
}
ImageView carPic = helper.getView(R.id.user_info_car_pic);
ImageLoadUtils.loadImage(mContext, item.getPic(), carPic);
}
}

View File

@@ -1,47 +0,0 @@
package com.yizhuan.erban.ui.user.adapter;
import android.graphics.Color;
import android.widget.ImageView;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.magic.bean.MagicInfo;
/**
* <p> </p>
*
* @author jiahui
* date 2018/3/5
*/
public class MyMagicWallAdapter extends BaseQuickAdapter<MagicInfo, BaseViewHolder> {
private boolean isNoble;
public MyMagicWallAdapter() {
super(R.layout.user_info_my_magic_item);
}
public boolean isNoble() {
return isNoble;
}
public void setNoble(boolean noble) {
isNoble = noble;
}
@Override
protected void convert(BaseViewHolder helper, MagicInfo item) {
// 魔法图片
ImageView ivMagicItem = helper.getView(R.id.iv_user_info_magic_pic);
ImageLoadUtils.loadImage(mContext, item.getIcon(), ivMagicItem);
// 魔法名字
TextView tvMagicName = helper.getView(R.id.tv_magic_item_name);
tvMagicName.setText(item.getName());
tvMagicName.setTextColor(isNoble ? Color.parseColor("#999999") : Color.BLACK);
// 魔法数量
TextView tvMagicNumber = helper.getView(R.id.tv_magic_item_number);
tvMagicNumber.setText(String.valueOf(item.getAmount()));
}
}

View File

@@ -1,31 +0,0 @@
package com.yizhuan.erban.ui.user.adapter;
import android.widget.ImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.user.bean.RadishWallInfo;
public class RadishWallAdapter extends BaseQuickAdapter<RadishWallInfo, BaseViewHolder> {
public RadishWallAdapter() {
super(R.layout.user_info_my_magic_item);
}
@Override
protected void convert(BaseViewHolder helper, RadishWallInfo item) {
if (item == null)
return;
// 图片
ImageView ivMagicItem = helper.getView(R.id.iv_user_info_magic_pic);
ImageLoadUtils.loadImage(mContext, item.getPicUrl(), ivMagicItem);
// 名字
helper.setText(R.id.tv_magic_item_name, item.getGiftName());
// 数量
helper.setText(R.id.tv_magic_item_number, "" + item.getReceiveCount());
}
}

View File

@@ -1,117 +0,0 @@
package com.yizhuan.erban.ui.user.dialog;
import android.content.Context;
import androidx.recyclerview.widget.LinearLayoutManager;
import android.view.View;
import com.yizhuan.erban.R;
import com.yizhuan.erban.BR;
import com.yizhuan.erban.treasure_box.widget.dialog.BaseBindingDialog;
import com.yizhuan.erban.base.BaseActivity;
import com.yizhuan.erban.bindadapter.BaseAdapter;
import com.yizhuan.erban.bindadapter.BindingViewHolder;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.databinding.DialogLiveTagBinding;
import com.yizhuan.erban.databinding.ItemLiveTagDialogBinding;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.LiveTagInfo;
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
import java.util.List;
@ActLayoutRes(R.layout.dialog_live_tag)
public class LiveTagDialog extends BaseBindingDialog<DialogLiveTagBinding> implements View.OnClickListener {
private final List<LiveTagInfo.LiveSkillVoListBean> listBeans;
private long liveId;
public LiveTagDialog(Context context, List<LiveTagInfo.LiveSkillVoListBean> listBeans) {
super(context);
this.listBeans = listBeans;
}
@Override
protected void init() {
binding.setClick(this);
binding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
LiveTagAdapter adapter = new LiveTagAdapter(R.layout.item_live_tag_dialog, BR.tagInfo);
adapter.setOnItemClickListener((adapt, view, position) -> {
liveId = adapter.getItem(position).getLiveId();
adapter.setSelect(position);
adapter.notifyDataSetChanged();
});
for (int i = 0; i < listBeans.size(); i++) {
LiveTagInfo.LiveSkillVoListBean listBean = listBeans.get(i);
if (listBean.getHasUse() == 1) {
liveId = listBean.getLiveId();
adapter.setSelect(i);
break;
}
}
binding.recyclerView.setAdapter(adapter);
adapter.setNewData(listBeans);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_delete:
closeDialog();
((BaseActivity) context).getDialogManager().showOkCancelDialog("删除的标签需重新认证", true, new DialogManager.OkCancelDialogListener() {
@Override
public void onCancel() {
}
@Override
public void onOk() {
UserModel.get().useOrDelete(liveId, 1)
.subscribe(s -> {
UserModel.get().updateCurrentUserInfo().subscribe();
SingleToastUtil.showToast("删除成功");
});
}
});
break;
case R.id.tv_used:
UserModel.get().useOrDelete(liveId, 2)
.subscribe(s -> {
UserModel.get().updateCurrentUserInfo().subscribe();
SingleToastUtil.showToast("使用成功");
closeDialog();
});
break;
}
}
private static class LiveTagAdapter extends BaseAdapter<LiveTagInfo.LiveSkillVoListBean> {
private int select = -1;
public int getSelect() {
return select;
}
public void setSelect(int select) {
this.select = select;
}
public LiveTagAdapter(int layoutResId, int brid) {
super(layoutResId, brid);
}
@Override
protected void convert(BindingViewHolder helper, LiveTagInfo.LiveSkillVoListBean item) {
super.convert(helper, item);
ItemLiveTagDialogBinding binding = (ItemLiveTagDialogBinding) helper.getBinding();
if (select == helper.getAdapterPosition()) {
binding.ivSelect.setVisibility(View.VISIBLE);
} else {
binding.ivSelect.setVisibility(View.GONE);
}
}
}
}

View File

@@ -1,34 +0,0 @@
package com.yizhuan.erban.ui.user.presenter;
import com.yizhuan.erban.base.BaseMvpPresenter;
import com.yizhuan.erban.ui.user.view.IUserGiftAchievement;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.GiftAchievementInfo;
import java.util.List;
import io.reactivex.functions.BiConsumer;
public class UserGiftAchievementPresenter extends BaseMvpPresenter<IUserGiftAchievement> {
@SuppressWarnings("CheckResult")
public void getAchievementList(long targetUid) {
UserModel.get()
.getAchievementList(targetUid)
.compose(bindToLifecycle()).subscribe(new BiConsumer<List<GiftAchievementInfo>, Throwable>() {
@Override
public void accept(List<GiftAchievementInfo> list, Throwable throwable) throws Exception {
if (throwable != null) {
if (mMvpView != null) {
mMvpView.getAchievementListFail(throwable);
}
} else {
if (mMvpView != null) {
mMvpView.getAchievementListSuccess(list);
}
}
}
});
}
}

View File

@@ -1,11 +0,0 @@
package com.yizhuan.erban.ui.user.view;
import com.yizhuan.xchat_android_core.user.bean.GiftAchievementInfo;
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
import java.util.List;
public interface IUserGiftAchievement extends IMvpBaseView {
void getAchievementListSuccess(List<GiftAchievementInfo> list);
void getAchievementListFail(Throwable error);
}

View File

@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.yizhuan.erban.ui.user.ScrollingActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/MyMaterialTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
/>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/MyMaterialTheme.PopupOverlay" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<include
android:id="@+id/content_scrolling"
layout="@layout/content_scrolling" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end"
app:srcCompat="@android:drawable/ic_dialog_email" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.yizhuan.erban.ui.user.ScrollingActivity"
tools:showIn="@layout/activity_scrolling">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:text="@string/large_text" />
</androidx.core.widget.NestedScrollView>

View File

@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="click"
type="android.view.View.OnClickListener" />
</data>
<LinearLayout
android:layout_width="309dp"
android:layout_height="233dp"
android:orientation="vertical"
android:gravity="center_horizontal"
android:background="@drawable/shape_white_20dp_round">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="35dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="选择使用后,会在资料卡、主麦位显示"
android:textColor="#ff333333"
android:textSize="14sp"
android:layout_marginTop="25dp"
android:layout_marginBottom="25dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="23dp">
<TextView
android:id="@+id/tv_delete"
android:layout_width="120dp"
android:layout_height="38dp"
android:text="删除"
android:gravity="center"
shape_color="@{@color/color_fd6964}"
shape_radius="@{20}"
android:onClick="@{click}"
android:layout_marginRight="17dp"
android:textColor="#fffffffe"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_used"
android:layout_width="120dp"
android:layout_height="38dp"
android:text="使用"
android:gravity="center"
shape_color="@{@color/color_ffb606}"
shape_radius="@{20}"
android:onClick="@{click}"
android:textColor="#fffffffe"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</layout>

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/iv_label"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginStart="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_gift_received"/>
<TextView
android:id="@+id/tv_label_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/ic_gift_change"
android:gravity="center_vertical"
android:layout_marginEnd="14dp"
android:visibility="gone"
app:layout_constraintTop_toTopOf="@id/iv_label"
app:layout_constraintBottom_toBottomOf="@id/iv_label"
app:layout_constraintEnd_toEndOf="parent"
tools:text="礼物成就"
tools:visibility="visible"/>
<FrameLayout
android:id="@+id/fl_gift_container"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_label"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recycler_view"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

View File

@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/cl_container_gift_achievement"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/iv_bg_achievement"
android:layout_width="83dp"
android:layout_height="83dp"
tools:src="@drawable/ic_temp_achievement"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.yizhuan.erban.common.widget.RectRoundImageView
android:id="@+id/rriv_gift"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="16.5dp"
tools:src="@color/color_common_text_light_gray"
app:borderRadius="17.5dp"
app:type="round"
app:layout_constraintStart_toStartOf="@id/iv_bg_achievement"
app:layout_constraintEnd_toEndOf="@id/iv_bg_achievement"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_mask"
android:layout_width="83dp"
android:layout_height="83dp"
android:visibility="gone"
tools:visibility="visible"
tools:src="@drawable/ic_temp_achievement"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_achievement_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_achievement_tips"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintTop_toTopOf="@id/iv_bg_achievement"
app:layout_constraintEnd_toEndOf="@id/iv_bg_achievement"/>
<TextView
android:id="@+id/tv_gift_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_13"
android:textColor="@color/color_common_text_gray"
tools:text="史诗"
app:layout_constraintStart_toStartOf="@id/iv_bg_achievement"
app:layout_constraintEnd_toEndOf="@id/iv_bg_achievement"
app:layout_constraintTop_toBottomOf="@id/iv_bg_achievement"/>
<TextView
android:id="@+id/tv_gift_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_13"
android:textColor="@color/color_common_text_light_gray"
tools:text="10"
app:layout_constraintStart_toStartOf="@id/iv_bg_achievement"
app:layout_constraintEnd_toEndOf="@id/iv_bg_achievement"
app:layout_constraintTop_toBottomOf="@id/tv_gift_name"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<View
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="24dp"/>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tv_gift_achievement_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:textColor="@color/color_common_text_content"
android:textSize="@dimen/dp_15"
tools:text="史诗"/>

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="90dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_user_info_magic_pic"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
tools:background="#ff0" />
<TextView
android:id="@+id/tv_magic_item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/color_333333"
android:textSize="14sp"
tools:text="鸡蛋" />
<TextView
android:id="@+id/tv_magic_item_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/color_999999"
android:textSize="13sp"
tools:text="13" />
</LinearLayout>

View File

@@ -12,8 +12,6 @@
<string name="gift_action">礼物</string>
<string name="decoration_action">装扮</string>
<string name="title_activity_scrolling">ScrollingActivity</string>
<string name="hint_login_account">手机号</string>
<string name="hint_login_account_2">请输入您的手机号/兔兔ID</string>