Fixed back to unselect

This commit is contained in:
M66B 2019-06-23 16:05:36 +02:00
parent 6a0c23d012
commit 494162f97d
2 changed files with 9 additions and 3 deletions

View File

@ -170,10 +170,16 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (backHandled())
return;
super.onBackPressed();
}
protected boolean backHandled() {
for (IBackPressedListener listener : backPressedListeners) for (IBackPressedListener listener : backPressedListeners)
if (listener.onBackPressed()) if (listener.onBackPressed())
return; return true;
super.onBackPressed(); return false;
} }
public interface IBackPressedListener { public interface IBackPressedListener {

View File

@ -539,7 +539,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
int count = getSupportFragmentManager().getBackStackEntryCount(); int count = getSupportFragmentManager().getBackStackEntryCount();
if (exit || count > 1) if (exit || count > 1)
super.onBackPressed(); super.onBackPressed();
else { else if (!backHandled()) {
exit = true; exit = true;
Toast.makeText(this, R.string.app_exit, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.app_exit, Toast.LENGTH_SHORT).show();
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {