Removed back workaround to solve side effects

pull/214/head
M66B 1 year ago
parent 93809c0a26
commit b88bbffb65

@ -41,7 +41,6 @@ import android.os.SystemClock;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@ -824,18 +823,6 @@ 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;
}
return super.onOptionsItemSelected(item);
}
public void performBack() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
// https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/Activity.java#3896

@ -74,15 +74,6 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
handle(intent, false);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int itemId = item.getItemId();
if (itemId == android.R.id.home &&
getSupportFragmentManager().getBackStackEntryCount() > 0)
return false; // Delegate to fragment
return super.onOptionsItemSelected(item);
}
@Override
public void onBackStackChanged() {
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {

@ -1895,7 +1895,11 @@ public class FragmentAccount extends FragmentBase {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_delete) {
int itemId = item.getItemId();
if (itemId == android.R.id.home) {
onSave(true);
return true;
} else if (itemId == R.id.menu_delete) {
onMenuDelete();
return true;
}

@ -443,7 +443,11 @@ public class FragmentFolder extends FragmentBase {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_delete) {
int itemId = item.getItemId();
if (itemId == android.R.id.home) {
onSave(true);
return true;
} else if (itemId == R.id.menu_delete) {
onMenuDelete();
return true;
}

@ -1449,7 +1449,11 @@ public class FragmentIdentity extends FragmentBase {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_delete) {
int itemId = item.getItemId();
if (itemId == android.R.id.home) {
onSave(true);
return true;
} else if (itemId == R.id.menu_delete) {
onMenuDelete();
return true;
}

Loading…
Cancel
Save