]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
OI Safe: added better state handling in CategoryEdit and PassEdit
authorrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Sun, 4 Oct 2009 00:09:44 +0000 (00:09 +0000)
committerrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Sun, 4 Oct 2009 00:09:44 +0000 (00:09 +0000)
git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2314 72b678ce-9140-0410-bee8-679b907dd61a

src/org/openintents/safe/AskPassword.java
src/org/openintents/safe/CategoryEdit.java
src/org/openintents/safe/CategoryList.java
src/org/openintents/safe/IntentHandler.java
src/org/openintents/safe/PassEdit.java
src/org/openintents/safe/PassList.java
src/org/openintents/safe/PassView.java
src/org/openintents/safe/Passwords.java

index 25489296cefc710c8b0b02aaffc6c93cb55f0180..29045ad05a5cd0c13732b1ef05fb18a176edf223 100644 (file)
@@ -53,7 +53,7 @@ import android.widget.Toast;
  */
 public class AskPassword extends Activity {
 
-       private boolean debug = true;
+       private boolean debug = false;
        private static String TAG = "AskPassword";
        public static String EXTRA_IS_LOCAL = "org.openintents.safe.bundle.EXTRA_IS_REMOTE";
 
index 25832dd69f615d6b48131fac814213e7b150c54a..12592e0a8d7e010883a27bc23583343e98d92ec4 100644 (file)
@@ -42,10 +42,11 @@ public class CategoryEdit extends Activity {
 
     private EditText nameText;
     private Long RowId;
+       boolean populated = false;
 
     Intent frontdoor;
     private Intent restartTimerIntent=null;
-
+    
     BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
         public void onReceive(Context context, Intent intent) {
             if (intent.getAction().equals(CryptoIntents.ACTION_CRYPTO_LOGGED_OUT)) {
@@ -99,7 +100,6 @@ public class CategoryEdit extends Activity {
                });
     }
 
-
     @Override
     protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
@@ -110,6 +110,16 @@ public class CategoryEdit extends Activity {
        }
     }
 
+       @Override
+       protected void onRestoreInstanceState(Bundle inState) {
+               super.onRestoreInstanceState(inState);
+
+               if (debug) Log.d(TAG,"onRestoreInstanceState("+inState+")");
+               // because the various EditText automatically handle state
+               // when we come back there is no need to re-populate
+               populated=true;
+       }
+
     @Override
     protected void onPause() {
                super.onPause();
@@ -127,7 +137,6 @@ public class CategoryEdit extends Activity {
                super.onResume();
                if (debug) Log.d(TAG, "onResume");
                if (!CategoryList.isSignedIn()) {
-                       Intent frontdoor = new Intent(this, FrontDoor.class);
                        startActivity(frontdoor);               
                        return;
                }
@@ -161,6 +170,9 @@ public class CategoryEdit extends Activity {
      */
     private void populateFields() {
        if (debug) Log.d(TAG, "populateFields");
+               if (populated) {
+                       return;
+               }
                if ((RowId != null) && (RowId > 0)) {
                    CategoryEntry catEntry = Passwords.getCategoryEntry(RowId);
                    if (catEntry==null) {
@@ -168,6 +180,7 @@ public class CategoryEdit extends Activity {
                    }
                    nameText.setText(catEntry.plainName);
                }
+               populated=true;
     }
 
     @Override
index 65be2fff6ba972f6fa7e23114616312522c7a752..0c0a9d1d0d592eec91e1281ad0fa51350a6ab7df 100644 (file)
@@ -68,7 +68,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
  */
 public class CategoryList extends ListActivity {
 
-       private static boolean debug = true;
+       private static boolean debug = false;
     private static final String TAG = "CategoryList";
 
     // Menu Item order
index a49f1a06b09d24de085b9de07f8481c3f1dadb69..c0f2fe284a3ca03ec2eab973cdefd6dabf491c8b 100644 (file)
@@ -49,7 +49,7 @@ import android.widget.Toast;
  */\r
 public class IntentHandler extends Activity {\r
 \r
-       private static final boolean debug = true;\r
+       private static final boolean debug = false;\r
        private static String TAG = "IntentHandler";\r
        \r
        private static final int REQUEST_CODE_ASK_PASSWORD = 1;\r
index 243efa77a694a57fd5314a2ec0e4ab1c5a44d441..0dcffadcd3fc4b0ae9ea6a1682a386499dd28fc4 100644 (file)
@@ -47,7 +47,7 @@ import android.widget.Toast;
  */
 public class PassEdit extends Activity {
 
-       private static boolean debug = true;
+       private static boolean debug = false;
        private static String TAG = "PassEdit";
 
        public static final int REQUEST_GEN_PASS = 10;
@@ -206,9 +206,9 @@ public class PassEdit extends Activity {
                if (debug) Log.d(TAG,"onResume()");
 
                if (CategoryList.isSignedIn()==false) {
-                       if (Passwords.isCryptoInitialized()) {
-                               saveState();
-                       }
+//                     if (Passwords.isCryptoInitialized()) {
+//                             saveState();
+//                     }
                        startActivity(frontdoor);
                        return;
                }
@@ -407,19 +407,6 @@ public class PassEdit extends Activity {
                }  
        }
        
-       /**
-        * Get the text from an EditText field.
-        * 
-        * @param e EditText to retrieve text from.
-        * @return The field's text.  If e==null returns null.
-        */
-       private String getTextFromField(EditText e) {
-               if (e==null) {
-                       return null;
-               }
-               return e.getText().toString();
-       }
-
        @Override
        public void onUserInteraction() {
                super.onUserInteraction();
index 8da645af3b3f138a036bd0b094e05cc3a009e0b1..866fc551e8a7cfe6f5cdd044fb6fce19f1b09d27 100644 (file)
@@ -61,7 +61,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
  */
 public class PassList extends ListActivity {
 
-       private static final boolean debug = true;
+       private static final boolean debug = false;
     private static final String TAG = "PassList";
 
     // Menu Item order
index ef000b98743b502a5c62028623d032d9d766736c..aa6a5d29bb30127e6f8f5a7ac5e8c587771270ae 100644 (file)
@@ -50,7 +50,7 @@ import android.widget.Toast;
  */
 public class PassView extends Activity implements View.OnClickListener {
 
-       private static boolean debug = true;
+       private static boolean debug = false;
        private static String TAG = "PassView";
 
        public static final int EDIT_PASSWORD_INDEX = Menu.FIRST;
index b8e3d3269d2eb3c82542b283d2686d73027d1f43..0b8beb621737b93341516e3f1f70d3e461e7204f 100644 (file)
@@ -40,7 +40,7 @@ import android.widget.Toast;
  */
 public class Passwords {
 
-       private static final boolean debug = true;
+       private static final boolean debug = false;
     private static final String TAG = "Passwords";
 
        private static HashMap<Long, PassEntry> passEntries=null;