diff options
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/org/connectbot/PubkeyListActivity.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/app/src/main/java/org/connectbot/PubkeyListActivity.java b/app/src/main/java/org/connectbot/PubkeyListActivity.java index a2cc170..8910abf 100644 --- a/app/src/main/java/org/connectbot/PubkeyListActivity.java +++ b/app/src/main/java/org/connectbot/PubkeyListActivity.java @@ -88,7 +88,6 @@ public class PubkeyListActivity extends ListActivity implements EventListener { private static final String ANDEXPLORER_TITLE = "explorer_title"; private static final String MIME_TYPE_ANDEXPLORER_FILE = "vnd.android.cursor.dir/lysesoft.andexplorer.file"; - protected PubkeyDatabase pubkeydb; private List<PubkeyBean> pubkeys; protected ClipboardManager clipboard; @@ -120,7 +119,6 @@ public class PubkeyListActivity extends ListActivity implements EventListener { bindService(new Intent(this, TerminalManager.class), connection, Context.BIND_AUTO_CREATE); - pubkeydb = PubkeyDatabase.get(this); updateList(); } @@ -129,8 +127,6 @@ public class PubkeyListActivity extends ListActivity implements EventListener { super.onStop(); unbindService(connection); - - pubkeydb = null; } @Override @@ -323,7 +319,8 @@ public class PubkeyListActivity extends ListActivity implements EventListener { public boolean onMenuItemClick(MenuItem item) { // toggle onstart status pubkey.setStartup(!pubkey.isStartup()); - pubkeydb.savePubkey(pubkey); + PubkeyDatabase pubkeyDb = PubkeyDatabase.get(PubkeyListActivity.this); + pubkeyDb.savePubkey(pubkey); updateList(); return true; } @@ -397,7 +394,8 @@ public class PubkeyListActivity extends ListActivity implements EventListener { .setPositiveButton(android.R.string.ok, null) .create().show(); else { - pubkeydb.savePubkey(pubkey); + PubkeyDatabase pubkeyDb = PubkeyDatabase.get(PubkeyListActivity.this); + pubkeyDb.savePubkey(pubkey); updateList(); } } catch (Exception e) { @@ -422,7 +420,8 @@ public class PubkeyListActivity extends ListActivity implements EventListener { public boolean onMenuItemClick(MenuItem item) { // toggle confirm use pubkey.setConfirmUse(!pubkey.isConfirmUse()); - pubkeydb.savePubkey(pubkey); + PubkeyDatabase pubkeyDb = PubkeyDatabase.get(PubkeyListActivity.this); + pubkeyDb.savePubkey(pubkey); updateList(); return true; } @@ -438,11 +437,13 @@ public class PubkeyListActivity extends ListActivity implements EventListener { public void onClick(DialogInterface dialog, int which) { // dont forget to remove from in-memory - if (loaded) + if (loaded) { bound.removeKey(pubkey.getNickname()); + } // delete from backend database and update gui - pubkeydb.deletePubkey(pubkey); + PubkeyDatabase pubkeyDb = PubkeyDatabase.get(PubkeyListActivity.this); + pubkeyDb.deletePubkey(pubkey); updateList(); } }) @@ -455,9 +456,8 @@ public class PubkeyListActivity extends ListActivity implements EventListener { } protected void updateList() { - if (pubkeydb == null) return; - - pubkeys = pubkeydb.allPubkeys(); + PubkeyDatabase pubkeyDb = PubkeyDatabase.get(PubkeyListActivity.this); + pubkeys = pubkeyDb.allPubkeys(); PubkeyAdapter adapter = new PubkeyAdapter(this, pubkeys); this.setListAdapter(adapter); @@ -488,7 +488,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { } /** - * @param name + * @param file */ private void readKeyFromFile(File file) { PubkeyBean pubkey = new PubkeyBean(); @@ -537,8 +537,8 @@ public class PubkeyListActivity extends ListActivity implements EventListener { } // write new value into database - pubkeydb = PubkeyDatabase.get(this); - pubkeydb.savePubkey(pubkey); + PubkeyDatabase pubkeyDb = PubkeyDatabase.get(this); + pubkeyDb.savePubkey(pubkey); updateList(); } catch (Exception e) { |