Remove selection tracker workaround

This commit is contained in:
M66B 2019-02-04 17:46:09 +00:00
parent 1ebf77edd1
commit 7e7eb8a8ae
1 changed files with 2 additions and 14 deletions

View File

@ -441,24 +441,12 @@ public class FragmentMessages extends FragmentBase {
@Override
public void onSelectionChanged() {
SelectionTracker tracker = selectionTracker;
if (tracker == null)
if (tracker == null) // destroyed
return;
FragmentActivity activity = getActivity();
if (activity != null) {
try {
ViewModelMessages modelMessages = ViewModelProviders.of(activity).get(ViewModelMessages.class);
if (tracker.hasSelection())
modelMessages.removeObservers(viewType, getViewLifecycleOwner());
else
modelMessages.observe(viewType, getViewLifecycleOwner(), observer);
} catch (IllegalStateException ex) {
// getViewLifecycleOwner
Log.w(ex);
}
if (activity != null)
activity.invalidateOptionsMenu();
}
if (tracker.hasSelection()) {
swipeRefresh.setEnabled(false);