[fix] 偶现崩溃
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.mogo.module.v2x.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
class V2XLinearLayoutManager extends LinearLayoutManager {
|
||||
public V2XLinearLayoutManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public V2XLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
||||
super(context, orientation, reverseLayout);
|
||||
}
|
||||
|
||||
public V2XLinearLayoutManager(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) {
|
||||
Log.d("V2XLinearLayoutManager", "崩溃信息--"+e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,8 +68,8 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
recyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.share_item_padding)));
|
||||
adapter = new V2XShareEventAdapter(getActivity(), dataArrayList, this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
LinearLayoutManager linearLayoutManager =
|
||||
new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
V2XLinearLayoutManager linearLayoutManager =
|
||||
new V2XLinearLayoutManager(getActivity(), V2XLinearLayoutManager.VERTICAL, false);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
loadingView = mRootView.findViewById(R.id.network_loading_imageview);
|
||||
}
|
||||
@@ -112,6 +112,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
}
|
||||
}
|
||||
} else if (result instanceof V2XShareEventItem) {
|
||||
Log.d("V2XShareEventsFragment","onSuccess--loadSuccessWithShareEventList");
|
||||
loadSuccessWithShareEventList(result);
|
||||
}
|
||||
}
|
||||
@@ -120,6 +121,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
public void onFail(String msg) {
|
||||
if (dataArrayList.size() > 0) {
|
||||
dataArrayList.clear();
|
||||
Log.d("V2XShareEventsFragment","onFail--clear");
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
loadingView.stopWithError(msg, View.VISIBLE);
|
||||
|
||||
Reference in New Issue
Block a user