update
This commit is contained in:
parent
703f542abf
commit
1623743b26
@ -8,6 +8,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RadioButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
@ -26,17 +27,24 @@ import com.yunbao.common.custom.CommonRefreshView;
|
|||||||
import com.yunbao.common.custom.MyRadioButton;
|
import com.yunbao.common.custom.MyRadioButton;
|
||||||
import com.yunbao.common.event.FollowEvent;
|
import com.yunbao.common.event.FollowEvent;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.utils.CommonIconUtil;
|
import com.yunbao.common.utils.CommonIconUtil;
|
||||||
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.SVGAViewUtils;
|
import com.yunbao.common.utils.SVGAViewUtils;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.adapter.MainListAdapter;
|
import com.yunbao.main.adapter.MainListAdapter;
|
||||||
import com.yunbao.main.bean.ListBean;
|
import com.yunbao.main.bean.ListBean;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
import com.yunbao.main.views.AbsMainListChildViewHolder;
|
import com.yunbao.main.views.AbsMainListChildViewHolder;
|
||||||
|
import com.yunbao.main.views.MainListContributeViewHolder;
|
||||||
|
import com.yunbao.main.views.MainListProfitViewHolder;
|
||||||
|
|
||||||
import net.lucode.hackware.magicindicator.MagicIndicator;
|
import net.lucode.hackware.magicindicator.MagicIndicator;
|
||||||
import net.lucode.hackware.magicindicator.ViewPagerHelper;
|
import net.lucode.hackware.magicindicator.ViewPagerHelper;
|
||||||
@ -73,8 +81,10 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
|
|||||||
private MagicIndicator mIndicator;
|
private MagicIndicator mIndicator;
|
||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
private List<String> outRankHide = new ArrayList<>();
|
private List<String> outRankHide = new ArrayList<>();
|
||||||
protected CommonRefreshView mRefreshView;
|
|
||||||
public MainListAdapter mAdapter;
|
public MainListAdapter mAdapter;
|
||||||
|
private View mBackgroundLayout;
|
||||||
|
private RadioButton mDay, mWeek;
|
||||||
|
private int position;
|
||||||
|
|
||||||
private HeadView hv;
|
private HeadView hv;
|
||||||
|
|
||||||
@ -96,7 +106,7 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void main() {
|
protected void main() {
|
||||||
initView();
|
|
||||||
mViewList = new ArrayList<>();
|
mViewList = new ArrayList<>();
|
||||||
for (int i = 0; i < PAGE_COUNT; i++) {
|
for (int i = 0; i < PAGE_COUNT; i++) {
|
||||||
FrameLayout frameLayout = new FrameLayout(mContext);
|
FrameLayout frameLayout = new FrameLayout(mContext);
|
||||||
@ -169,15 +179,16 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
|
|||||||
Log.e("MainListActivity", error);
|
Log.e("MainListActivity", error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
initView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
mType = DAY;
|
mType = DAY;
|
||||||
mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView);
|
|
||||||
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_list);
|
|
||||||
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
|
||||||
hv = new HeadView(findViewById(R.id.rootView));
|
|
||||||
mViewPager = (ViewPager) findViewById(R.id.viewPager);
|
mViewPager = (ViewPager) findViewById(R.id.viewPager);
|
||||||
|
mBackgroundLayout = findViewById(R.id.bg_layout);
|
||||||
|
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.setOffscreenPageLimit(PAGE_COUNT - 1);
|
||||||
mViewPager.setAdapter(new ViewPagerAdapter(mViewList));
|
mViewPager.setAdapter(new ViewPagerAdapter(mViewList));
|
||||||
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
@ -188,7 +199,16 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
loadPageData(position);
|
MainListActivity.this.position = position;
|
||||||
|
mDay.setChecked(true);
|
||||||
|
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
|
@Override
|
||||||
@ -196,64 +216,62 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
mDay.setOnClickListener(v -> {
|
||||||
|
loadPageData(position, DAY);
|
||||||
|
mDay.setTextColor(Color.parseColor("#FF82C1"));
|
||||||
|
mWeek.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
|
});
|
||||||
|
mWeek.setOnClickListener(v -> {
|
||||||
|
loadPageData(position, WEEK);
|
||||||
|
mWeek.setTextColor(Color.parseColor("#FF82C1"));
|
||||||
|
mDay.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
|
});
|
||||||
ViewPagerHelper.bind(mIndicator, mViewPager);
|
ViewPagerHelper.bind(mIndicator, mViewPager);
|
||||||
mViewPager.setCurrentItem(getIntent().getIntExtra("p", 0));
|
mViewPager.setCurrentItem(getIntent().getIntExtra("p", 0));
|
||||||
initData();
|
loadPageData(0, DAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadPageData(int position) {
|
private void loadPageData(int position, String rank) {
|
||||||
|
if (mViewHolders == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AbsMainListChildViewHolder vh = mViewHolders[position];
|
||||||
|
if (vh == null) {
|
||||||
|
if (mViewList != null && position < mViewList.size()) {
|
||||||
|
FrameLayout parent = mViewList.get(position);
|
||||||
|
if (parent == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (position == 0) {
|
||||||
|
MainListProfitViewHolder mProfitViewHolder = new MainListProfitViewHolder(mContext, parent);
|
||||||
|
vh = mProfitViewHolder;
|
||||||
|
} else if (position == 1) {
|
||||||
|
MainListContributeViewHolder mContributeViewHolder = new MainListContributeViewHolder(mContext, parent);
|
||||||
|
mContributeViewHolder.setHide(outRankHide);
|
||||||
|
vh = mContributeViewHolder;
|
||||||
|
}
|
||||||
|
if (vh == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mViewHolders[position] = vh;
|
||||||
|
vh.addToParent();
|
||||||
|
vh.subscribeActivityLifeCycle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private void initData() {
|
if (vh != null) {
|
||||||
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<ListBean>() {
|
vh.setType(rank);
|
||||||
|
vh.setOnLoadDataListener(new AbsMainListChildViewHolder.OnLoadData() {
|
||||||
@Override
|
@Override
|
||||||
public RefreshAdapter<ListBean> getAdapter() {
|
public void onData(List<ListBean> list) {
|
||||||
if (mAdapter == null) {
|
|
||||||
mAdapter = new MainListAdapter(mContext, MainListAdapter.TYPE_PROFIT);
|
|
||||||
mAdapter.setOnItemClickListener(MainListActivity.this);
|
|
||||||
}
|
|
||||||
return mAdapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void loadData(int p, com.yunbao.common.http.HttpCallback callback) {
|
|
||||||
if (mType != null && !mType.isEmpty()) {
|
|
||||||
MainHttpUtil.profitList(mType, p, callback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ListBean> processData(String[] info) {
|
|
||||||
List<ListBean> list = JSON.parseArray(Arrays.toString(info), ListBean.class);
|
|
||||||
hv.setData(list.get(0), 0);
|
hv.setData(list.get(0), 0);
|
||||||
hv.setData(list.get(1), 1);
|
hv.setData(list.get(1), 1);
|
||||||
hv.setData(list.get(2), 2);
|
hv.setData(list.get(2), 2);
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRefreshSuccess(List<ListBean> list, int listCount) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRefreshFailure() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadMoreSuccess(List<ListBean> loadItemList, int loadItemCount) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadMoreFailure() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mRefreshView.initData();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadData() {
|
public void loadData() {
|
||||||
|
|
||||||
@ -333,6 +351,8 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
|
|||||||
svga1 = (SVGAImageView) itemView.findViewById(R.id.svga1);
|
svga1 = (SVGAImageView) itemView.findViewById(R.id.svga1);
|
||||||
svga2 = (SVGAImageView) itemView.findViewById(R.id.svga2);
|
svga2 = (SVGAImageView) itemView.findViewById(R.id.svga2);
|
||||||
svga3 = (SVGAImageView) itemView.findViewById(R.id.svga3);
|
svga3 = (SVGAImageView) itemView.findViewById(R.id.svga3);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(ListBean bean, int position) {
|
public void setData(ListBean bean, int position) {
|
||||||
@ -393,6 +413,32 @@ public class MainListActivity extends AbsActivity implements OnItemClickListener
|
|||||||
getItem(position, svga1, svga2, svga3).setVisibility(View.VISIBLE);
|
getItem(position, svga1, svga2, svga3).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
getItem(position, mSex1, mSex2, mSex3).setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
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) {
|
private <T> T getItem(int position, T... views) {
|
||||||
|
@ -22,6 +22,7 @@ import com.yunbao.common.bean.LevelBean;
|
|||||||
import com.yunbao.common.custom.MyRadioButton;
|
import com.yunbao.common.custom.MyRadioButton;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.CommonHttpUtil;
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.utils.CommonIconUtil;
|
import com.yunbao.common.utils.CommonIconUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.SVGAViewUtils;
|
import com.yunbao.common.utils.SVGAViewUtils;
|
||||||
@ -53,7 +54,6 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
|
|||||||
private View.OnClickListener mFollowClickListener2;
|
private View.OnClickListener mFollowClickListener2;
|
||||||
private View.OnClickListener mItemClickListener;
|
private View.OnClickListener mItemClickListener;
|
||||||
private List<ListBean> mTopList;
|
private List<ListBean> mTopList;
|
||||||
private HeadVh mHeadVh;
|
|
||||||
private int mType;
|
private int mType;
|
||||||
private List<String> outRankHide = new ArrayList<>();
|
private List<String> outRankHide = new ArrayList<>();
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
|
|||||||
CommonAppConfig appConfig = CommonAppConfig.getInstance();
|
CommonAppConfig appConfig = CommonAppConfig.getInstance();
|
||||||
mCoinName = type == TYPE_PROFIT ? appConfig.getVotesName() : appConfig.getCoinName();
|
mCoinName = type == TYPE_PROFIT ? appConfig.getVotesName() : appConfig.getCoinName();
|
||||||
mTopList = new ArrayList<>();
|
mTopList = new ArrayList<>();
|
||||||
mFollow = ("+" + WordUtil.getString(R.string.follow));
|
mFollow = (WordUtil.getString(R.string.follow));
|
||||||
mFollowing = WordUtil.getString(R.string.following);
|
mFollowing = WordUtil.getString(R.string.following);
|
||||||
mItemClickListener = new View.OnClickListener() {
|
mItemClickListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -111,7 +111,14 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
|
|||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
final int position = (int) tag;
|
final int position = (int) tag;
|
||||||
final ListBean bean = mList.get(position);
|
final ListBean bean = mList.get(position);
|
||||||
CommonHttpUtil.setAttention(bean.getUid(), null);
|
CommonHttpUtil.setAttention(bean.getUid(), new CommonCallback<Integer>() {
|
||||||
|
@Override
|
||||||
|
public void callback(Integer bean) {
|
||||||
|
if (bean != null && bean == 1) {
|
||||||
|
v.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -587,11 +594,12 @@ public class MainListAdapter extends RefreshAdapter<ListBean> {
|
|||||||
mBtnFollow.setText(mFollowing);
|
mBtnFollow.setText(mFollowing);
|
||||||
mBtnFollow.setBackgroundResource(R.drawable.background_dbdbdb);
|
mBtnFollow.setBackgroundResource(R.drawable.background_dbdbdb);
|
||||||
mBtnFollow.setTextColor(Color.parseColor("#FFFFFF"));
|
mBtnFollow.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
|
mBtnFollow.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
mBtnFollow.doChecked(false);
|
mBtnFollow.doChecked(false);
|
||||||
mBtnFollow.setText(mFollow);
|
mBtnFollow.setText(mFollow);
|
||||||
mBtnFollow.setBackgroundResource(R.drawable.background_yellow);
|
mBtnFollow.setBackgroundResource(R.drawable.background_ff7bbaff);
|
||||||
mBtnFollow.setTextColor(Color.parseColor("#FFFFFF"));
|
mBtnFollow.setTextColor(Color.parseColor("#7BBAFF"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.yunbao.main.views;
|
package com.yunbao.main.views;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -16,6 +18,8 @@ import com.yunbao.main.R;
|
|||||||
import com.yunbao.main.adapter.MainListAdapter;
|
import com.yunbao.main.adapter.MainListAdapter;
|
||||||
import com.yunbao.main.bean.ListBean;
|
import com.yunbao.main.bean.ListBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cxf on 2019/2/23.
|
* Created by cxf on 2019/2/23.
|
||||||
*/
|
*/
|
||||||
@ -29,6 +33,8 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
|
|||||||
protected String mType;
|
protected String mType;
|
||||||
protected CommonRefreshView mRefreshView;
|
protected CommonRefreshView mRefreshView;
|
||||||
public MainListAdapter mAdapter;
|
public MainListAdapter mAdapter;
|
||||||
|
protected OnLoadData loadData;
|
||||||
|
protected List<ListBean> list;
|
||||||
|
|
||||||
public AbsMainListChildViewHolder(Context context, ViewGroup parentView) {
|
public AbsMainListChildViewHolder(Context context, ViewGroup parentView) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
@ -45,10 +51,6 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
|
|||||||
mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView);
|
mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView);
|
||||||
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_list);
|
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_list);
|
||||||
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
findViewById(R.id.btn_day).setOnClickListener(this);
|
|
||||||
findViewById(R.id.btn_week).setOnClickListener(this);
|
|
||||||
findViewById(R.id.btn_month).setOnClickListener(this);
|
|
||||||
findViewById(R.id.btn_total).setOnClickListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,10 +88,6 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
|
|||||||
type = DAY;
|
type = DAY;
|
||||||
} else if (i == R.id.btn_week) {
|
} else if (i == R.id.btn_week) {
|
||||||
type = WEEK;
|
type = WEEK;
|
||||||
} else if (i == R.id.btn_month) {
|
|
||||||
type = MONTH;
|
|
||||||
} else if (i == R.id.btn_total) {
|
|
||||||
type = TOTAL;
|
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(type) && !type.equals(mType)) {
|
if (!TextUtils.isEmpty(type) && !type.equals(mType)) {
|
||||||
mType = type;
|
mType = type;
|
||||||
@ -99,4 +97,23 @@ 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) {
|
||||||
|
if (type != null) {
|
||||||
|
this.mType = type;
|
||||||
|
}
|
||||||
|
if (mRefreshView != null) {
|
||||||
|
mRefreshView.initData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnLoadData {
|
||||||
|
void onData(List<ListBean> list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.custom.CommonRefreshView;
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.main.adapter.MainListAdapter;
|
import com.yunbao.main.adapter.MainListAdapter;
|
||||||
import com.yunbao.main.bean.ListBean;
|
import com.yunbao.main.bean.ListBean;
|
||||||
import com.yunbao.main.http.MainHttpConsts;
|
import com.yunbao.main.http.MainHttpConsts;
|
||||||
@ -51,7 +52,11 @@ public class MainListContributeViewHolder extends AbsMainListChildViewHolder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ListBean> processData(String[] info) {
|
public List<ListBean> processData(String[] info) {
|
||||||
return JSON.parseArray(Arrays.toString(info), ListBean.class);
|
list=JSON.parseArray(Arrays.toString(info), ListBean.class);
|
||||||
|
if (loadData != null) {
|
||||||
|
loadData.onData(list);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.custom.CommonRefreshView;
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.main.adapter.MainListAdapter;
|
import com.yunbao.main.adapter.MainListAdapter;
|
||||||
import com.yunbao.main.bean.ListBean;
|
import com.yunbao.main.bean.ListBean;
|
||||||
import com.yunbao.main.http.MainHttpConsts;
|
import com.yunbao.main.http.MainHttpConsts;
|
||||||
@ -48,7 +49,11 @@ public class MainListProfitViewHolder extends AbsMainListChildViewHolder {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ListBean> processData(String[] info) {
|
public List<ListBean> processData(String[] info) {
|
||||||
return JSON.parseArray(Arrays.toString(info), ListBean.class);
|
list = JSON.parseArray(Arrays.toString(info), ListBean.class);
|
||||||
|
if (loadData != null) {
|
||||||
|
loadData.onData(list);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
9
main/src/main/res/drawable/background_ff7bbaff.xml
Normal file
9
main/src/main/res/drawable/background_ff7bbaff.xml
Normal 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="#ff7bbaff" />
|
||||||
|
<corners android:radius="14dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/rootView"
|
android:id="@+id/rootView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -8,9 +8,13 @@
|
|||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/bg_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="421dp"
|
android:layout_height="421dp"
|
||||||
android:background="@mipmap/bg_glamour_top">
|
android:background="@mipmap/bg_glamour_top"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<net.lucode.hackware.magicindicator.MagicIndicator
|
<net.lucode.hackware.magicindicator.MagicIndicator
|
||||||
android:id="@+id/indicator"
|
android:id="@+id/indicator"
|
||||||
@ -72,7 +76,7 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="29dp"
|
android:layout_marginBottom="28dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/item_2"
|
app:layout_constraintBottom_toBottomOf="@+id/item_2"
|
||||||
@ -199,7 +203,7 @@
|
|||||||
android:layout_height="152dp"
|
android:layout_height="152dp"
|
||||||
android:layout_marginStart="25dp"
|
android:layout_marginStart="25dp"
|
||||||
android:layout_marginEnd="15dp"
|
android:layout_marginEnd="15dp"
|
||||||
android:layout_marginBottom="100dp"
|
android:layout_marginBottom="70dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
@ -328,7 +332,7 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="25dp"
|
android:layout_marginEnd="25dp"
|
||||||
android:layout_marginBottom="90dp"
|
android:layout_marginBottom="60dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
@ -453,15 +457,17 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.viewpager.widget.ViewPager
|
<androidx.viewpager.widget.ViewPager
|
||||||
android:id="@+id/viewPager"
|
android:id="@+id/viewPager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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.viewpager.widget.ViewPager>
|
||||||
|
|
||||||
<com.yunbao.common.custom.CommonRefreshView
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:id="@+id/refreshView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</LinearLayout>
|
|
@ -3,85 +3,13 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="#00FFFFFF"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
>
|
>
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_marginTop="70dp"
|
|
||||||
>
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/btn_day"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="26dp"
|
|
||||||
android:background="@drawable/bg_list_btn"
|
|
||||||
android:button="@null"
|
|
||||||
android:checked="true"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/main_list_day"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/btn_week"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="26dp"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:background="@drawable/bg_list_btn"
|
|
||||||
android:button="@null"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/main_list_week"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/btn_month"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="26dp"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:background="@drawable/bg_list_btn"
|
|
||||||
android:button="@null"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/main_list_month"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:visibility="gone"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/btn_total"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="26dp"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:background="@drawable/bg_list_btn"
|
|
||||||
android:button="@null"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/main_list_all"
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:visibility="gone"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<com.yunbao.common.custom.CommonRefreshView
|
<com.yunbao.common.custom.CommonRefreshView
|
||||||
android:id="@+id/refreshView"
|
android:id="@+id/refreshView"
|
||||||
|
android:background="@drawable/background_white_up"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
/>
|
/>
|
||||||
|
BIN
main/src/main/res/mipmap-xxhdpi/bg_glamour2_top.png
Normal file
BIN
main/src/main/res/mipmap-xxhdpi/bg_glamour2_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 KiB |
Loading…
Reference in New Issue
Block a user