|
|
@ -74,19 +74,17 @@ public class MessageFragment extends BaseFragment<FragmentMessageBinding, Messag |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCreate(Bundle savedInstanceState) { |
|
|
|
public void onCreate(Bundle savedInstanceState) {; |
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
|
|
|
|
|
|
|
|
// 友盟数据提前处理用户数据
|
|
|
|
|
|
|
|
mSubscription = RxBus.getInstance().toObservableSticky(PushChatMessage.class) |
|
|
|
mSubscription = RxBus.getInstance().toObservableSticky(PushChatMessage.class) |
|
|
|
.compose(RxUtil.schedulersTransformer()) |
|
|
|
.compose(RxUtil.schedulersTransformer()) |
|
|
|
.compose(RxUtil.exceptionTransformer()) |
|
|
|
.compose(RxUtil.exceptionTransformer()) |
|
|
|
.subscribe(msg -> { |
|
|
|
.subscribe(msg -> { |
|
|
|
JSONObject jsonObject = new JSONObject(new Gson().toJson(msg)); |
|
|
|
PushChatMessage pushChatMessage = (PushChatMessage) msg; |
|
|
|
if(!TextUtils.isEmpty(jsonObject.getString("fanUserId"))) { |
|
|
|
if(!TextUtils.isEmpty(pushChatMessage.getFanUserId())) { |
|
|
|
mViewModel.judgeNewPushMsgs(jsonObject.getString("fanUserId"),jsonObject.getString("text")); |
|
|
|
mViewModel.judgeNewPushMsgs(pushChatMessage.getFanUserId(), pushChatMessage.getText()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
RxSubscriptions.add(mSubscription); |
|
|
|
RxSubscriptions.add(mSubscription); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -119,12 +117,8 @@ public class MessageFragment extends BaseFragment<FragmentMessageBinding, Messag |
|
|
|
mRecyclerView.setLayoutManager(mLayoutManager); |
|
|
|
mRecyclerView.setLayoutManager(mLayoutManager); |
|
|
|
mRecyclerView.setAdapter(mWrappedAdapter); |
|
|
|
mRecyclerView.setAdapter(mWrappedAdapter); |
|
|
|
mRecyclerView.setItemAnimator(animator); |
|
|
|
mRecyclerView.setItemAnimator(animator); |
|
|
|
// mRecyclerView.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(requireContext(), R.color.common_divider_color)));
|
|
|
|
|
|
|
|
mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView); |
|
|
|
mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView); |
|
|
|
mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView); |
|
|
|
mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView); |
|
|
|
|
|
|
|
|
|
|
|
// mRefreshLayout.setOnRefreshListener(mViewModel::refresh); // 刷新数据
|
|
|
|
|
|
|
|
// mRefreshLayout.setOnLoadMoreListener(mViewModel::loadMore); 隐藏加载更多 todo: 当联系人数据多起来之后 分页要做一下
|
|
|
|
|
|
|
|
mRefreshLayout.setEnableLoadMore(false); |
|
|
|
mRefreshLayout.setEnableLoadMore(false); |
|
|
|
mLoadingLayout.showContent(); |
|
|
|
mLoadingLayout.showContent(); |
|
|
|
mRefreshLayout.autoRefresh(); |
|
|
|
mRefreshLayout.autoRefresh(); |
|
|
@ -133,11 +127,11 @@ public class MessageFragment extends BaseFragment<FragmentMessageBinding, Messag |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onStart() { |
|
|
|
public void onStart() { |
|
|
|
super.onStart(); |
|
|
|
super.onStart(); |
|
|
|
|
|
|
|
mViewModel.setAlias(); |
|
|
|
btnClickType = true; |
|
|
|
btnClickType = true; |
|
|
|
if (mRefreshLayout != null){ |
|
|
|
if (mRefreshLayout != null){ |
|
|
|
mRefreshLayout.resetNoMoreData(); // 恢复没有数据的初始状态 等待系统销毁
|
|
|
|
mRefreshLayout.resetNoMoreData(); // 恢复没有数据的初始状态 等待系统销毁
|
|
|
|
mRefreshLayout.setOnRefreshListener(mViewModel::refresh); |
|
|
|
mRefreshLayout.setOnRefreshListener(mViewModel::refresh); |
|
|
|
// mViewModel.refresh(mRefreshLayout);
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|