mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-27 12:26:55 -08:00
Implement Delete Groups and Entry. Refactor background code out of activities.
This commit is contained in:
1 parent
abc50f7298
commit
8ef498338a
24 files changed
+697
-244
No files matched your search
@@ -21,7 +21,7 @@ package com.keepassdroid;
|
||||
|
||||
import org.phoneid.keepassj2me.PwEntry;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@@ -29,11 +29,13 @@ import android.view.View;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.keepass.KeePass;
|
||||
import com.android.keepass.R;
|
||||
import com.keepassdroid.database.DeleteEntry;
|
||||
|
||||
public class PwEntryView extends ClickView {
|
||||
|
||||
private Activity mAct;
|
||||
private GroupBaseActivity mAct;
|
||||
private PwEntry mPw;
|
||||
private TextView mTv;
|
||||
private int mPos;
|
||||
@@ -41,7 +43,7 @@ public class PwEntryView extends ClickView {
|
||||
private static final int MENU_EDIT = Menu.FIRST;
|
||||
private static final int MENU_DELETE = Menu.FIRST + 1;
|
||||
|
||||
public PwEntryView(Activity act, PwEntry pw, int pos) {
|
||||
public PwEntryView(GroupBaseActivity act, PwEntry pw, int pos) {
|
||||
super(act);
|
||||
mAct = act;
|
||||
mPw = pw;
|
||||
@@ -70,11 +72,18 @@ public class PwEntryView extends ClickView {
|
||||
EntryActivity.Launch(mAct, mPw, mPos);
|
||||
|
||||
}
|
||||
|
||||
private void deleteEntry() {
|
||||
DeleteEntry task = new DeleteEntry(KeePass.db, mPw, mAct, new Handler());
|
||||
ProgressTask pt = new ProgressTask(mAct, task, mAct.new RefreshTask());
|
||||
pt.run();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateMenu(ContextMenu menu, ContextMenuInfo menuInfo) {
|
||||
menu.add(0, MENU_EDIT, 0, R.string.menu_edit);
|
||||
//menu.add(0, MENU_DELETE, 0, R.string.menu_delete);
|
||||
menu.add(0, MENU_DELETE, 0, R.string.menu_delete);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,6 +94,10 @@ public class PwEntryView extends ClickView {
|
||||
launchEntry();
|
||||
return true;
|
||||
|
||||
case MENU_DELETE:
|
||||
deleteEntry();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user