Fix code review

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-12-11 13:17:01 +01:00
parent 252d93503c
commit a9f48ad4da

View file

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