update 自由PK 注释
This commit is contained in:
parent
afed0c8833
commit
a1d9b1f75b
@ -24,11 +24,11 @@ import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
private static final int HEAD = 0;
|
||||
private static final int ITEM = 2;
|
||||
|
||||
public RandomPkRecyclerAdapter(Context context) {
|
||||
public FreePkRecyclerAdapter(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
@ -26,10 +26,9 @@ import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordsTypeUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.RandomPkRecyclerAdapter;
|
||||
import com.yunbao.live.adapter.FreePkRecyclerAdapter;
|
||||
import com.yunbao.live.bean.LivePkBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
@ -45,7 +44,6 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
private static final int TAB_STATUS_FOLLOW = 2;
|
||||
|
||||
private static final String TAG = "自由PK";
|
||||
private int mLiveUid;
|
||||
private TabLayout tabLayout;
|
||||
private View reset;
|
||||
private CommonRefreshView mRecyclerView;
|
||||
@ -53,7 +51,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
private EditText mSearch;
|
||||
private TextView freePkNum;
|
||||
private ImageView mClear;
|
||||
private RandomPkRecyclerAdapter adapter;
|
||||
private FreePkRecyclerAdapter adapter;
|
||||
private DataHelper helper;
|
||||
private int tabStatus;
|
||||
|
||||
@ -83,10 +81,6 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
public void setLiveUid(int mLiveUid) {
|
||||
this.mLiveUid = mLiveUid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
@ -133,7 +127,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
private void initRecycler() {
|
||||
helper = new DataHelper();
|
||||
helper.setStatus(DataHelper.LIST_MODEL_LIST);
|
||||
adapter = new RandomPkRecyclerAdapter(mContext);
|
||||
adapter = new FreePkRecyclerAdapter(mContext);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mRecyclerView.setDataHelper(helper);
|
||||
mRecyclerView.initData();
|
||||
@ -142,7 +136,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
adapter.setOnItemClickListener(new OnItemClickListener<RandomPkUserBean>() {
|
||||
@Override
|
||||
public void onItemClick(RandomPkUserBean bean, int position) {
|
||||
if (position == -1) {
|
||||
if (position == -1) {//-1是退出对话框,其他重刷数据
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
@ -233,8 +227,8 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
}
|
||||
|
||||
public class DataHelper implements CommonRefreshView.DataHelper<RandomPkUserBean> {
|
||||
private final static int LIST_MODEL_LIST = 0;
|
||||
private final static int LIST_MODEL_FOLLOW = 1;
|
||||
private final static int LIST_MODEL_LIST = 0;//搜索列表
|
||||
private final static int LIST_MODEL_FOLLOW = 1;//关注列表
|
||||
private int status;
|
||||
private String searchKey;
|
||||
|
||||
@ -242,6 +236,10 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
* @param key
|
||||
*/
|
||||
public void search(String key) {
|
||||
if (StringUtil.isEmpty(key)) {
|
||||
adapter.getList().clear();
|
||||
@ -298,7 +296,7 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
|
||||
return list;
|
||||
}
|
||||
List<LivePkBean> beans = JSON.parseArray(Arrays.toString(info), LivePkBean.class);
|
||||
list.add(null);
|
||||
list.add(null);//因为有个Head头部,所以数据全部下移一位
|
||||
for (LivePkBean bean : beans) {
|
||||
RandomPkUserBean userBean = new RandomPkUserBean();
|
||||
userBean.setId(bean.getUid());
|
||||
|
@ -233,7 +233,9 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开始匹配
|
||||
*/
|
||||
private void randomPk() {
|
||||
if (mRandomPkSwitch.getTag() == null || !(boolean) mRandomPkSwitch.getTag()) {
|
||||
ToastUtil.show("未开启随机PK开关");
|
||||
@ -262,6 +264,9 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复按钮状态
|
||||
*/
|
||||
private void resetPkBtn() {
|
||||
mPkBtnDesc.setVisibility(View.GONE);
|
||||
mPkBtnTitle.setText(R.string.random_pk_info_btn_start);
|
||||
|
Loading…
Reference in New Issue
Block a user