Эх сурвалжийг харах

Fix code review

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 жил өмнө
parent
commit
a9f48ad4da

+ 14 - 9
app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.java

@@ -20,6 +20,7 @@
 
 package com.nextcloud.talk.controllers;
 
+import android.app.Activity;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -161,16 +162,20 @@ public class ConversationInfoController extends BaseController {
     }
 
     private void setupAdapter() {
-        if (adapter == null && getActivity() != null) {
-            adapter = new FlexibleAdapter<>(recyclerViewItems, getActivity(), true);
-        }
+        Activity activity;
+
+        if ((activity = getActivity()) != null) {
+            if (adapter == null) {
+                adapter = new FlexibleAdapter<>(recyclerViewItems, activity, true);
+            }
 
-        if (recyclerView != null && getActivity() != null) {
-            SmoothScrollLinearLayoutManager layoutManager =
-                    new SmoothScrollLinearLayoutManager(getActivity());
-            recyclerView.setLayoutManager(layoutManager);
-            recyclerView.setHasFixedSize(true);
-            recyclerView.setAdapter(adapter);
+            if (recyclerView != null) {
+                SmoothScrollLinearLayoutManager layoutManager =
+                        new SmoothScrollLinearLayoutManager(activity);
+                recyclerView.setLayoutManager(layoutManager);
+                recyclerView.setHasFixedSize(true);
+                recyclerView.setAdapter(adapter);
+            }
         }
     }