changeset 34:75d86b7fd3f0 tn5250

make hostlist and pubkeylist consistent
author Carl Byington <carl@five-ten-sg.com>
date Tue, 10 Jun 2014 15:18:04 -0700
parents 2a8b52dbc104
children 9925ea1aa279
files src/com/five_ten_sg/connectbot/HostListActivity.java
diffstat 1 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/HostListActivity.java	Tue Jun 10 13:33:06 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/HostListActivity.java	Tue Jun 10 15:18:04 2014 -0700
@@ -97,11 +97,11 @@
         public void onServiceConnected(ComponentName className, IBinder service) {
             bound = ((TerminalManager.TerminalBinder) service).getService();
             // update our listview binder to find the service
-            HostListActivity.this.updateList();
+            updateList();
         }
         public void onServiceDisconnected(ComponentName className) {
             bound = null;
-            HostListActivity.this.updateList();
+            updateList();
         }
     };
 
@@ -146,7 +146,7 @@
             }
         }
         else if (requestCode == REQUEST_EDIT) {
-            this.updateList();
+            updateList();
         }
     }
 
@@ -174,21 +174,21 @@
         boolean agreed = prefs.getBoolean(PreferenceConstants.EULA, false);
 
         if (!agreed) {
-            this.startActivityForResult(new Intent(this, WizardActivity.class), REQUEST_EULA);
+            startActivityForResult(new Intent(this, WizardActivity.class), REQUEST_EULA);
         }
 
-        this.makingShortcut = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())
+        makingShortcut = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())
                               || Intent.ACTION_PICK.equals(getIntent().getAction());
         // connect with hosts database and populate list
-        this.hostdb = new HostDatabase(this);
-        ListView list = this.getListView();
-        this.sortedByColor = prefs.getBoolean(PreferenceConstants.SORT_BY_COLOR, false);
-        //this.list.setSelector(R.drawable.highlight_disabled_pressed);
-        list.setOnItemClickListener(new OnItemClickListener() {
+        hostdb = new HostDatabase(this);
+        updateList();
+        sortedByColor = prefs.getBoolean(PreferenceConstants.SORT_BY_COLOR, false);
+        registerForContextMenu(getListView());
+        getListView().setOnItemClickListener(new OnItemClickListener() {
 
             public synchronized void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                 // launch off to console details
-                HostBean host = (HostBean) parent.getAdapter().getItem(position);
+                HostBean host = (HostBean) getListView().getItemAtPosition(position);
                 Uri uri = host.getUri();
                 Intent contents = new Intent(Intent.ACTION_VIEW, uri);
                 contents.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
@@ -205,11 +205,10 @@
                 }
                 else {
                     // otherwise just launch activity to show this host
-                    HostListActivity.this.startActivity(contents);
+                    startActivity(contents);
                 }
             }
         });
-        this.registerForContextMenu(list);
         quickconnect = (TextView) this.findViewById(R.id.front_quickconnect);
         quickconnect.setVisibility(makingShortcut ? View.GONE : View.VISIBLE);
         quickconnect.setOnKeyListener(new OnKeyListener() {