补充排行榜颜色

This commit is contained in:
zlzw 2022-11-02 17:19:45 +08:00
parent e3f9f21287
commit 8b3b0ce2ea
8 changed files with 77 additions and 25 deletions

View File

@ -202,8 +202,7 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
public void onPageSelected(int position) {
MainListActivity.this.position = position;
mDay.setChecked(true);
mDay.setTextColor(Color.parseColor("#FF82C1"));
mWeek.setTextColor(Color.parseColor("#FFFFFF"));
setRadioColor(position, mDay, mWeek);
loadPageData(position, DAY);
}
@ -214,13 +213,11 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
});
mDay.setOnClickListener(v -> {
loadPageData(position, DAY);
mDay.setTextColor(Color.parseColor("#FF82C1"));
mWeek.setTextColor(Color.parseColor("#FFFFFF"));
setRadioColor(mViewPager.getCurrentItem(),mDay,mWeek);
});
mWeek.setOnClickListener(v -> {
loadPageData(position, WEEK);
mWeek.setTextColor(Color.parseColor("#FF82C1"));
mDay.setTextColor(Color.parseColor("#FFFFFF"));
setRadioColor(mViewPager.getCurrentItem(),mWeek,mDay);
});
mBack.setOnClickListener(v -> {
finish();
@ -230,6 +227,16 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
loadPageData(0, DAY);
}
private void setRadioColor(int position, RadioButton select, RadioButton unSelect) {
if (position == 0) {
select.setTextColor(Color.parseColor("#FF82C1"));
unSelect.setTextColor(Color.parseColor("#FFFFFF"));
} else {
select.setTextColor(Color.parseColor("#7BBAFF"));
unSelect.setTextColor(Color.parseColor("#FFFFFF"));
}
}
private void loadPageData(int position, String rank) {
if (mViewHolders == null) {
return;

View File

@ -52,6 +52,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
private List<ListBean> mTopList;
private int mType;
private List<String> outRankHide = new ArrayList<>();
protected boolean isRankOne;//是否为魅力榜 第一个tab
public MainListAdapter(Context context, int type) {
@ -93,6 +94,10 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
}
public void setRankOne(boolean rankOne) {
isRankOne = rankOne;
}
@Override
public int getItemCount() {
if (mList != null && mTopList.size() > 0) {
@ -263,11 +268,16 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
} else {
mBtnFollow.doChecked(false);
mBtnFollow.setText(mFollow);
if(isRankOne){
mBtnFollow.setBackgroundResource(R.drawable.background_ff82c1);
mBtnFollow.setTextColor(Color.parseColor("#FF82C1"));
}else {
mBtnFollow.setBackgroundResource(R.drawable.background_ff7bbaff);
mBtnFollow.setTextColor(Color.parseColor("#7BBAFF"));
}
}
}
}
public void updateItem(String id, int attention) {

View File

@ -54,6 +54,7 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
public static final String MONTH = "month";
public static final String TOTAL = "total";
protected String mType;
protected boolean isRankOne;//是否为魅力榜 第一个tab
protected CommonRefreshView mRefreshView;
public MainListAdapter mAdapter;
protected OnLoadData loadData;
@ -278,8 +279,14 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
if (bean.getAttention() != 1) {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).doChecked(true);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setText("+" + WordUtil.getString(R.string.follow));
if(isRankOne) {
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).setBackgroundResource(R.drawable.background_7bbaff);
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setTextColor(Color.parseColor("#FFFFFF"));
}
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.VISIBLE);
} else {
getItem(position, mBtnFollow1, mBtnFollow2, mBtnFollow3).setVisibility(View.INVISIBLE);
}

View File

@ -27,6 +27,7 @@ public class MainListContributeViewHolder extends AbsMainListChildViewHolder {
public MainListContributeViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
isRankOne = false;
}
@Override
@ -37,6 +38,7 @@ public class MainListContributeViewHolder extends AbsMainListChildViewHolder {
public RefreshAdapter<ListBean> getAdapter() {
if (mAdapter == null) {
mAdapter = new MainListAdapter(mContext, MainListAdapter.TYPE_CONTRIBUTE);
mAdapter.setRankOne(isRankOne);
mAdapter.setOnItemClickListener(MainListContributeViewHolder.this);
}
mAdapter.setHide(outRankHide);

View File

@ -25,6 +25,7 @@ public class MainListProfitViewHolder extends AbsMainListChildViewHolder {
public MainListProfitViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
isRankOne = true;
}
@Override
@ -35,6 +36,7 @@ public class MainListProfitViewHolder extends AbsMainListChildViewHolder {
public RefreshAdapter<ListBean> getAdapter() {
if (mAdapter == null) {
mAdapter = new MainListAdapter(mContext, MainListAdapter.TYPE_PROFIT);
mAdapter.setRankOne(isRankOne);
mAdapter.setOnItemClickListener(MainListProfitViewHolder.this);
}
return mAdapter;
@ -87,5 +89,4 @@ public class MainListProfitViewHolder extends AbsMainListChildViewHolder {
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="62dp" android:height="26dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffffffff" />
<solid android:color="#ff80beff" />
<corners android:radius="14dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="68dp" android:height="28dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffff82c1" />
<corners android:radius="14dp" />
</shape>
</item>
</selector>

View File

@ -86,6 +86,7 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="50dp"
android:visibility="invisible"
android:src="@mipmap/icon_user_home_living" />
</RelativeLayout>
@ -107,7 +108,7 @@
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:text=""
android:textColor="#FFFFFF"
android:textSize="15sp" />
@ -135,7 +136,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:text=""
android:textColor="#FFFFFF"
android:textSize="12sp" />
@ -151,6 +152,7 @@
android:button="@null"
android:gravity="center"
android:text="@string/shield_gift_effect"
android:visibility="invisible"
android:textColor="@color/white"
android:textSize="11sp" />
</LinearLayout>
@ -215,6 +217,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="invisible"
android:layout_marginTop="50dp"
android:src="@mipmap/icon_user_home_living" />
@ -237,7 +240,7 @@
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:text=""
android:textColor="#FFFFFF"
android:textSize="15sp" />
@ -265,7 +268,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:text=""
android:textColor="#FFFFFF"
android:textSize="12sp" />
@ -280,6 +283,7 @@
android:background="@drawable/background_dbdbdb"
android:button="@null"
android:gravity="center"
android:visibility="invisible"
android:text="已关注"
android:textColor="@color/white"
android:textSize="11sp" />
@ -345,6 +349,7 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="50dp"
android:visibility="invisible"
android:src="@mipmap/icon_user_home_living" />
</RelativeLayout>
@ -366,7 +371,7 @@
android:lines="1"
android:maxEms="4"
android:singleLine="true"
android:text="名字"
android:text=""
android:textColor="#FFFFFF"
android:textSize="15sp" />
@ -394,7 +399,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="11111"
android:text=""
android:textColor="#FFFFFF"
android:textSize="12sp" />
@ -410,6 +415,7 @@
android:button="@null"
android:gravity="center"
android:text="已关注"
android:visibility="invisible"
android:textColor="@color/white"
android:textSize="11sp" />