mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-22 15:55:57 +00:00
Wire activity/fragment back
This commit is contained in:
parent
8d69651fb6
commit
5526eb435b
2 changed files with 16 additions and 0 deletions
|
@ -750,6 +750,9 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
// Delegate to fragment first
|
||||
if (super.onOptionsItemSelected(item))
|
||||
return true;
|
||||
performBack();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import android.os.Handler;
|
|||
import android.os.ResultReceiver;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
@ -315,6 +316,18 @@ public class FragmentBase extends Fragment {
|
|||
lbm.unregisterReceiver(receiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
activity.getOnBackPressedDispatcher().onBackPressed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
EntityLog.log(getContext(), "Result class=" + this.getClass().getSimpleName() +
|
||||
|
|
Loading…
Reference in a new issue