navController.navigate(R.id.newTransactionFragment, b);
}
}
- public void simulateCrash(MenuItem item) {
+ public boolean onSimulateCrashMenuItemClicked(MenuItem item) {
debug("crash", "Will crash intentionally");
new AsyncCrasher().execute();
+ return true;
}
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuCompat.setGroupDividerEnabled(menu, true);
+ menu.findItem(R.id.action_simulate_save)
+ .setOnMenuItemClickListener(this::onToggleSimulateSaveMenuItemClicked);
+ menu.findItem(R.id.action_simulate_crash)
+ .setOnMenuItemClickListener(this::onSimulateCrashMenuItemClicked);
+
model.getSimulateSave()
.observe(this, state -> {
menu.findItem(R.id.action_simulate_save)
else
navController.navigate(R.id.action_newTransactionSavingFragment_Success, b);
}
- public void toggleSimulateSave(MenuItem item) {
+ public boolean onToggleSimulateSaveMenuItemClicked(MenuItem item) {
model.toggleSimulateSave();
+ return true;
}
@Override
<group android:id="@+id/new_transaction_debug_menu_items">
<item
android:id="@+id/action_simulate_crash"
- android:onClick="simulateCrash"
android:title="@string/crash_app_label"
android:titleCondensed="@string/crash_app_condensed_label"
app:showAsAction="never"
android:id="@+id/action_simulate_save"
android:checkable="true"
android:checked="false"
- android:onClick="toggleSimulateSave"
android:title="@string/simulate_save_label"
android:titleCondensed="@string/simulate_save_condensed_label"
app:showAsAction="never"