Removed TODO, reimplemented delete repo.
This commit is contained in:
parent
4fdc23569b
commit
41e0919c6f
@ -1,9 +0,0 @@
|
||||
Highlight repo list items on check
|
||||
|
||||
Implement add/delete actions
|
||||
|
||||
Only allow delete when multiple items are selected (disable edit action)
|
||||
|
||||
Change text view to Delete repositories if multiple selected?
|
||||
|
||||
Create view to show repository details? Maybe this is for a subsequent patch...
|
@ -186,13 +186,41 @@ public class ManageRepo extends ListActivity {
|
||||
boolean wasChanged = data.getBooleanExtra(RepoDetailsActivity.ACTION_IS_CHANGED, false);
|
||||
|
||||
if (wasDeleted) {
|
||||
refreshList();
|
||||
int repoId = data.getIntExtra(RepoDetailsActivity.DATA_REPO_ID, 0);
|
||||
remove(repoId);
|
||||
} else if (wasEnabled || wasDisabled || wasChanged) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DB.Repo getRepoById(int repoId) {
|
||||
for (int i = 0; i < getListAdapter().getCount(); i ++) {
|
||||
DB.Repo repo = (DB.Repo)getListAdapter().getItem(i);
|
||||
if (repo.id == repoId) {
|
||||
return repo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void remove(int repoId) {
|
||||
DB.Repo repo = getRepoById(repoId);
|
||||
if (repo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<DB.Repo> reposToRemove = new ArrayList<DB.Repo>(1);
|
||||
reposToRemove.add(repo);
|
||||
try {
|
||||
DB db = DB.getDB();
|
||||
db.doDisableRepos(reposToRemove, true);
|
||||
} finally {
|
||||
DB.releaseDB();
|
||||
}
|
||||
refreshList();
|
||||
}
|
||||
|
||||
protected List<Repo> getRepos() {
|
||||
List<Repo> repos = null;
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user