Fix: icon not shown for first element in list

This commit is contained in:
nazar-kutz 2021-04-16 22:36:29 +03:00
parent adbc331fce
commit 54069a1106

View file

@ -62,6 +62,7 @@ public abstract class SelectionBottomSheet extends MenuBottomSheetDialogFragment
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View mainView = super.onCreateView(inflater, parent, savedInstanceState); View mainView = super.onCreateView(inflater, parent, savedInstanceState);
createSelectionListIfPossible();
notifyUiInitialized(); notifyUiInitialized();
return mainView; return mainView;
} }
@ -109,7 +110,6 @@ public abstract class SelectionBottomSheet extends MenuBottomSheetDialogFragment
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT)); ViewGroup.LayoutParams.WRAP_CONTENT));
listContainer.setOrientation(LinearLayout.VERTICAL); listContainer.setOrientation(LinearLayout.VERTICAL);
fillInSelectionList();
return new SimpleBottomSheetItem.Builder().setCustomView(listContainer).create(); return new SimpleBottomSheetItem.Builder().setCustomView(listContainer).create();
} }
@ -148,7 +148,7 @@ public abstract class SelectionBottomSheet extends MenuBottomSheetDialogFragment
if (!Algorithms.isEmpty(allItems)) { if (!Algorithms.isEmpty(allItems)) {
this.allItems.clear(); this.allItems.clear();
this.allItems.addAll(allItems); this.allItems.addAll(allItems);
fillInSelectionList(); createSelectionListIfPossible();
} }
} }
@ -160,7 +160,7 @@ public abstract class SelectionBottomSheet extends MenuBottomSheetDialogFragment
this.applySelectionListener = onApplySelectionListener; this.applySelectionListener = onApplySelectionListener;
} }
private void fillInSelectionList() { private void createSelectionListIfPossible() {
if (listContainer != null && allItems != null) { if (listContainer != null && allItems != null) {
recreateList(); recreateList();
} }