mirror of https://github.com/M66B/FairEmail.git
Another ugly workaround
This commit is contained in:
parent
4f25de33f0
commit
a5bc07c4c3
|
@ -441,7 +441,7 @@ public class FragmentMessages extends FragmentBase {
|
|||
@Override
|
||||
public void onSelectionChanged() {
|
||||
SelectionTracker tracker = selectionTracker;
|
||||
if (tracker == null)
|
||||
if (tracker == null) // destroyed
|
||||
return;
|
||||
|
||||
FragmentActivity activity = getActivity();
|
||||
|
@ -476,6 +476,8 @@ public class FragmentMessages extends FragmentBase {
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (selectionPredicate != null)
|
||||
selectionPredicate.destroy();
|
||||
selectionTracker = null;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
|
|
@ -25,10 +25,12 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
public class SelectionPredicateMessage extends SelectionTracker.SelectionPredicate<Long> {
|
||||
private boolean enabled;
|
||||
private boolean destroyed;
|
||||
private RecyclerView recyclerView;
|
||||
|
||||
SelectionPredicateMessage(RecyclerView recyclerView) {
|
||||
this.enabled = true;
|
||||
this.destroyed = false;
|
||||
this.recyclerView = recyclerView;
|
||||
}
|
||||
|
||||
|
@ -36,6 +38,10 @@ public class SelectionPredicateMessage extends SelectionTracker.SelectionPredica
|
|||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
this.destroyed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSetStateForKey(@NonNull Long key, boolean nextState) {
|
||||
if (!enabled)
|
||||
|
@ -66,6 +72,6 @@ public class SelectionPredicateMessage extends SelectionTracker.SelectionPredica
|
|||
|
||||
@Override
|
||||
public boolean canSelectMultiple() {
|
||||
return true;
|
||||
return !destroyed;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue