Browse Source

修复部分bug

Pq 2 years ago
parent
commit
5dd0b783bb

+ 4 - 0
student/src/main/java/com/cooleshow/student/presenter/live/LiveRoomPresenter.java

@@ -529,6 +529,10 @@ public class LiveRoomPresenter extends BasePresenter<LiveRoomContract.view> impl
      * 上麦
      */
     public void joinMic() {
+        RCRTCRoom room = RCRTCEngine.getInstance().getRoom();
+        if (room == null || room.getLocalUser() == null) {
+            return;
+        }
         //连麦
         ArrayList<RCRTCOutputStream> streams = new ArrayList<>();
         streams.add(RCRTCEngine.getInstance().getDefaultAudioStream());

+ 8 - 3
student/src/main/java/com/cooleshow/student/ui/main/HotNewsFragment.java

@@ -43,6 +43,9 @@ public class HotNewsFragment extends BaseFragment<FragmentHomeHotNewsLayoutBindi
     @Override
     protected void initView(View rootView) {
         mHomeHotNewsAdapter = getAdapter();
+        EmptyViewLayout emptyViewLayout = new EmptyViewLayout(getContext());
+        emptyViewLayout.setContent(com.cooleshow.base.R.drawable.icon_empty_content, "暂无内容");
+        mHomeHotNewsAdapter.setEmptyView(emptyViewLayout);
         mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
         mViewBinding.recyclerView.setAdapter(mHomeHotNewsAdapter);
         mViewBinding.recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@@ -103,6 +106,11 @@ public class HotNewsFragment extends BaseFragment<FragmentHomeHotNewsLayoutBindi
 
     public void setData(int page, HomeHotNewsBean data) {
         if (getAdapter() != null) {
+            if (data == null) {
+                mHomeHotNewsAdapter.getData().clear();
+                mHomeHotNewsAdapter.notifyDataSetChanged();
+                return;
+            }
             if (page == 1) {
                 mHomeHotNewsAdapter.getData().clear();
                 mHomeHotNewsAdapter.notifyDataSetChanged();
@@ -136,9 +144,6 @@ public class HotNewsFragment extends BaseFragment<FragmentHomeHotNewsLayoutBindi
     private HomeHotNewsAdapter getAdapter() {
         if (mHomeHotNewsAdapter == null) {
             mHomeHotNewsAdapter = new HomeHotNewsAdapter();
-            EmptyViewLayout emptyViewLayout = new EmptyViewLayout(getContext());
-            emptyViewLayout.setContent(com.cooleshow.base.R.drawable.icon_empty_content, "暂无内容");
-            mHomeHotNewsAdapter.setEmptyView(emptyViewLayout);
         }
         return mHomeHotNewsAdapter;
     }

+ 5 - 0
student/src/main/java/com/cooleshow/student/ui/main/TalentStyleFragment.java

@@ -99,6 +99,11 @@ public class TalentStyleFragment extends BaseFragment<FragmentHomeTalentLayoutBi
 
     public void setData(int page, HomeStyleBean data) {
         if (mTalentStyleAdapter != null) {
+            if (data == null) {
+                mTalentStyleAdapter.getData().clear();
+                mTalentStyleAdapter.notifyDataSetChanged();
+                return;
+            }
             if (page == 1) {
                 mTalentStyleAdapter.getData().clear();
                 mTalentStyleAdapter.notifyDataSetChanged();