修复RecyclerView Bug
This commit is contained in:
parent
54d99a9fbb
commit
24c02a6d41
13
README.md
13
README.md
@ -1,11 +1,13 @@
|
||||
|
||||
### 1.0.2版本
|
||||
|
||||
#### 2022年03月18日
|
||||
|
||||
```
|
||||
1.添加取消疑难事件,标记疑难事件添加说明、疑难等级
|
||||
```
|
||||
|
||||
### 2022-7-25
|
||||
|
||||
```
|
||||
1.修复百度定位Key Bug
|
||||
2.融合通信添加Https端口配置
|
||||
@ -16,13 +18,20 @@
|
||||
```
|
||||
|
||||
### 2022-8-22
|
||||
|
||||
```
|
||||
1.修改融合通信登录时机
|
||||
2.添加单设备登录
|
||||
```
|
||||
|
||||
|
||||
### 2022-10-26
|
||||
|
||||
```
|
||||
1.添加日志浏览功能
|
||||
```
|
||||
|
||||
### 2023-5-8
|
||||
|
||||
```
|
||||
1.修复Bug RecyclerView Inconsistency detected
|
||||
```
|
@ -3,6 +3,8 @@ package com.tenlionsoft.baselib.core.widget.base;
|
||||
import android.content.Context;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.tenlionsoft.baselib.R;
|
||||
import com.tenlionsoft.baselib.utils.ConvertUtils;
|
||||
@ -10,8 +12,6 @@ import com.tenlionsoft.baselib.utils.ConvertUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* 作者 : Adam on 2018/6/15.
|
||||
* 邮箱 : itgaojian@163.com
|
||||
@ -75,10 +75,6 @@ public abstract class BaseRecyclerAdapter<T, H extends RecyclerView.ViewHolder>
|
||||
*/
|
||||
public void setData(List<T> list) {
|
||||
this.mData = list;
|
||||
// mChoose.clear();
|
||||
// for (int i = 0; i < mData.size(); i++) {
|
||||
// mChoose.add(i, false);
|
||||
// }
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.tenlionsoft.baselib.core.widget.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.tenlionsoft.baselib.utils.LogUtils;
|
||||
|
||||
public class WrapContentLinearLayoutManager extends LinearLayoutManager {
|
||||
public WrapContentLinearLayoutManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public WrapContentLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
||||
super(context, orientation, reverseLayout);
|
||||
}
|
||||
|
||||
public WrapContentLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
try {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
LogUtils.e("RecyclerView IndexOUtOfBoundsException");
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,10 @@ import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.github.promeg.pinyinhelper.Pinyin;
|
||||
@ -37,9 +41,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
@ -264,6 +265,7 @@ public class AddressListActivity extends BaseActivity {
|
||||
commonNavigator.setAdapter(new ViewPageNavigatorAdapter(this, mTitles, mVpContent));
|
||||
commonNavigator.setAdjustMode(true);
|
||||
mMiTabs.setNavigator(commonNavigator);
|
||||
mVpContent.setUserInputEnabled(false);
|
||||
UIUtil.bindViewPager2(mMiTabs, mVpContent, null);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,9 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.tengshisoft.chatmodule.R;
|
||||
@ -18,13 +21,13 @@ import com.tenlionsoft.baselib.core.db.AppDatabase;
|
||||
import com.tenlionsoft.baselib.core.db.DeptDao;
|
||||
import com.tenlionsoft.baselib.core.db.UserDao;
|
||||
import com.tenlionsoft.baselib.core.widget.base.BaseFragment;
|
||||
import com.tenlionsoft.baselib.core.widget.base.WrapContentLinearLayoutManager;
|
||||
import com.tenlionsoft.baselib.core.widget.views.TypeFaceTextView;
|
||||
import com.tenlionsoft.baselib.utils.LogUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
@ -82,7 +85,7 @@ public class DeptContactFragment extends BaseFragment {
|
||||
mSelDatas = new ArrayList<>();
|
||||
mSelDatas.add(bean1);
|
||||
mSelAdapter = new DeptChooseAdapter(mActivity, mSelDatas);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mActivity);
|
||||
WrapContentLinearLayoutManager linearLayoutManager = new WrapContentLinearLayoutManager(mActivity);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
mRlvSelDept.setLayoutManager(linearLayoutManager);
|
||||
mRlvSelDept.setAdapter(mSelAdapter);
|
||||
@ -111,9 +114,9 @@ public class DeptContactFragment extends BaseFragment {
|
||||
queryDept();
|
||||
}
|
||||
});
|
||||
|
||||
mSelAdapter.setOnItemChoose((bean12, pos) -> {
|
||||
mSelDatas = mSelDatas.subList(0, pos + 1);
|
||||
LogUtils.e("选择部门==" + (pos + 1));
|
||||
mSelAdapter.setData(mSelDatas);
|
||||
mRlvSelDept.scrollToPosition(mSelDatas.size() - 1);
|
||||
mSelDeptId = bean12.getDepartmentId();
|
||||
@ -159,9 +162,9 @@ public class DeptContactFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull Integer o) {
|
||||
mAdapter.setData(mDatas);
|
||||
if (o == 1) {
|
||||
//有数据
|
||||
mAdapter.setData(mDatas);
|
||||
refreshStateView(STATE_SUCCESS);
|
||||
} else {
|
||||
//没有数据
|
||||
|
Loading…
Reference in New Issue
Block a user