}
@Override
protected void initProfile() {
- String profileUUID = getIntent().getStringExtra("profile_uuid");
+ long profileId = getIntent().getLongExtra("profile_id", 0);
- if (profileUUID != null) {
- mProfile = Data.getProfile(profileUUID);
+ if (profileId != 0) {
+ mProfile = Data.getProfile(profileId);
if (mProfile == null)
finish();
Data.setCurrentProfile(mProfile);
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
}
@Override
public boolean onRow(@NonNull Cursor cursor) {
- final String profileUUID = cursor.getString(0);
+ final long profileId = cursor.getLong(0);
final int transactionId = cursor.getInt(1);
- runOnUiThread(() -> model.loadTransactionIntoModel(profileUUID, transactionId));
+ runOnUiThread(() -> model.loadTransactionIntoModel(profileId, transactionId));
return false; // limit 1, by the way
}
@Override
}
@Override
public boolean onRow(@NonNull Cursor cursor) {
- final String profileUUID = cursor.getString(0);
+ final long profileId = cursor.getLong(0);
final int transactionId = cursor.getInt(1);
- runOnUiThread(() -> model.loadTransactionIntoModel(profileUUID,
+ runOnUiThread(() -> model.loadTransactionIntoModel(profileId,
transactionId));
return false;
}