mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Implement delete functionality of EditProfileActivity
This commit is contained in:
parent
97f3d9e2c6
commit
7bc4f19cf0
2 changed files with 20 additions and 6 deletions
|
@ -153,8 +153,17 @@ public class EditProfileActivity extends AegisActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void finish(boolean delete) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.putExtra("KeyProfile", _profile);
|
||||||
|
intent.putExtra("delete", delete);
|
||||||
|
setResult(RESULT_OK, intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean onDelete() {
|
private boolean onDelete() {
|
||||||
return false;
|
finish(true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean onSave() {
|
private boolean onSave() {
|
||||||
|
@ -200,10 +209,7 @@ public class EditProfileActivity extends AegisActivity {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent();
|
finish(false);
|
||||||
intent.putExtra("KeyProfile", _profile);
|
|
||||||
setResult(RESULT_OK, intent);
|
|
||||||
finish();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,15 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_keyProfileView.replaceKey(profile);
|
_keyProfileView.replaceKey(profile);
|
||||||
saveDatabase();
|
|
||||||
|
// because of what's explained in the comment above, we had to replace the key before we can delete it
|
||||||
|
// this is an ugly solution and should be improved at some point
|
||||||
|
// TODO: make _db.removeKey and _db.replaceKey -> _db.updateKey work with id's instead of instances
|
||||||
|
if (data.getBooleanExtra("delete", false)) {
|
||||||
|
deleteProfile(profile);
|
||||||
|
} else {
|
||||||
|
saveDatabase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue