修复直播间点击三个点--更多设置--举报闪退的问题(网速慢一点的情况下)
This commit is contained in:
parent
0646c2c6a7
commit
d79dba045d
@ -80,16 +80,18 @@ public class LiveReportActivity extends AbsActivity implements LiveReportAdapter
|
|||||||
mRecyclerView.setHasFixedSize(true);
|
mRecyclerView.setHasFixedSize(true);
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
mKeyBoardHeightUtil = new KeyBoardHeightUtil(mContext, findViewById(android.R.id.content), this);
|
mKeyBoardHeightUtil = new KeyBoardHeightUtil(mContext, findViewById(android.R.id.content), this);
|
||||||
|
mAdapter = new LiveReportAdapter(mContext);
|
||||||
|
if (mRecyclerView != null) {
|
||||||
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
|
}
|
||||||
LiveHttpUtil.getLiveReportList(new HttpCallback() {
|
LiveHttpUtil.getLiveReportList(new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
List<LiveReportBean> list = JSON.parseArray(Arrays.toString(info), LiveReportBean.class);
|
List<LiveReportBean> list = JSON.parseArray(Arrays.toString(info), LiveReportBean.class);
|
||||||
mAdapter = new LiveReportAdapter(mContext, list);
|
|
||||||
mAdapter.setActionListener(LiveReportActivity.this);
|
mAdapter.setActionListener(LiveReportActivity.this);
|
||||||
if (mRecyclerView != null) {
|
mAdapter.setData(list);
|
||||||
mRecyclerView.setAdapter(mAdapter);
|
|
||||||
}
|
|
||||||
if (mKeyBoardHeightUtil != null) {
|
if (mKeyBoardHeightUtil != null) {
|
||||||
mKeyBoardHeightUtil.start();
|
mKeyBoardHeightUtil.start();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.yunbao.live.adapter;
|
package com.yunbao.live.adapter;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -52,14 +54,92 @@ public class LiveReportAdapter extends RecyclerView.Adapter {
|
|||||||
private int photoIndex = 0;
|
private int photoIndex = 0;
|
||||||
private File mFile1, mFile2, mFile3;
|
private File mFile1, mFile2, mFile3;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public LiveReportAdapter(Context context, List<LiveReportBean> list) {
|
public LiveReportAdapter(Context context, List<LiveReportBean> list) {
|
||||||
mContext = context;
|
/* mContext = context;
|
||||||
mList = list;
|
mList = list;
|
||||||
mInflater = LayoutInflater.from(context);
|
mInflater = LayoutInflater.from(context);
|
||||||
mCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_1);
|
mCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_1);
|
||||||
mUnCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_0);
|
mUnCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_0);
|
||||||
mCheckedPosition = -1;
|
mCheckedPosition = -1;
|
||||||
|
imageUtilInit();*/
|
||||||
|
mOnClickListener = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Object tag = v.getTag();
|
||||||
|
if (tag == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int position = (int) tag;
|
||||||
|
LiveReportBean bean = mList.get(position - 1);
|
||||||
|
if (mCheckedPosition == position) {
|
||||||
|
bean.setChecked(false);
|
||||||
|
notifyItemChanged(position, Constants.PAYLOAD);
|
||||||
|
mCheckedPosition = -1;
|
||||||
|
mCurVideoReportBean = null;
|
||||||
|
} else {
|
||||||
|
if (mCheckedPosition >= 0) {
|
||||||
|
mList.get(mCheckedPosition - 1).setChecked(false);
|
||||||
|
notifyItemChanged(mCheckedPosition, Constants.PAYLOAD);
|
||||||
|
}
|
||||||
|
bean.setChecked(true);
|
||||||
|
notifyItemChanged(position, Constants.PAYLOAD);
|
||||||
|
mCheckedPosition = position;
|
||||||
|
mCurVideoReportBean = bean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mReportListener = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (v.getId() == R.id.btn_report){
|
||||||
|
if (mFootVh != null) {
|
||||||
|
mFootVh.submit();
|
||||||
|
}
|
||||||
|
}else if (v.getId() == R.id.photo1){
|
||||||
|
photoIndex = 0;
|
||||||
|
if (mFootVh != null) {
|
||||||
|
mFootVh.showAddPhoto();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (v.getId() == R.id.photo2){
|
||||||
|
photoIndex = 1;
|
||||||
|
if (mFootVh != null) {
|
||||||
|
mFootVh.showAddPhoto();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (v.getId() == R.id.photo3){
|
||||||
|
photoIndex = 2;
|
||||||
|
if (mFootVh != null) {
|
||||||
|
mFootVh.showAddPhoto();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setActionListener(ActionListener actionListener) {
|
||||||
|
mActionListener = actionListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
public void setData(List<LiveReportBean> list) {
|
||||||
|
mList = list;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveReportAdapter(Activity context) {
|
||||||
|
this.mContext = context;
|
||||||
|
mInflater = LayoutInflater.from(context);
|
||||||
|
mCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_1);
|
||||||
|
mUnCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_0);
|
||||||
|
mCheckedPosition = -1;
|
||||||
imageUtilInit();
|
imageUtilInit();
|
||||||
|
|
||||||
mOnClickListener = new View.OnClickListener() {
|
mOnClickListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -196,7 +276,7 @@ public class LiveReportAdapter extends RecyclerView.Adapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return mList.size() + 2;
|
return mList == null ? 0 : mList.size() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
class HeadVh extends RecyclerView.ViewHolder {
|
class HeadVh extends RecyclerView.ViewHolder {
|
||||||
@ -272,7 +352,4 @@ public class LiveReportAdapter extends RecyclerView.Adapter {
|
|||||||
void onReportClick(LiveReportBean bean, String text,File file1,File file2,File file3);
|
void onReportClick(LiveReportBean bean, String text,File file1,File file2,File file3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActionListener(ActionListener actionListener) {
|
|
||||||
mActionListener = actionListener;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user