|
|
|
@ -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);
|
|
|
|
|