mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Fixed selecting key on some Android versions
This commit is contained in:
parent
ad2a7a9fa4
commit
2944c65b18
1 changed files with 15 additions and 1 deletions
|
@ -82,7 +82,9 @@ import androidx.core.content.FileProvider;
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.lifecycle.Lifecycle;
|
import androidx.lifecycle.Lifecycle;
|
||||||
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
import androidx.lifecycle.OnLifecycleEvent;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
@ -937,11 +939,23 @@ public class Helper {
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (owner.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
if (owner.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
|
||||||
if (alias == null)
|
if (alias == null)
|
||||||
intf.onNothingSelected();
|
intf.onNothingSelected();
|
||||||
else
|
else
|
||||||
intf.onSelected(alias);
|
intf.onSelected(alias);
|
||||||
|
} else {
|
||||||
|
owner.getLifecycle().addObserver(new LifecycleObserver() {
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_START)
|
||||||
|
public void onStart() {
|
||||||
|
owner.getLifecycle().removeObserver(this);
|
||||||
|
if (alias == null)
|
||||||
|
intf.onNothingSelected();
|
||||||
|
else
|
||||||
|
intf.onSelected(alias);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue