Revision 006434d8 src/com/rackspacecloud/android/ListAccountsActivity.java

b/src/com/rackspacecloud/android/ListAccountsActivity.java
46 46

  
47 47
public class ListAccountsActivity extends ListActivity{
48 48

  
49
	private ArrayList<Account> accounts;
49
	private final int PASSWORD_PROMPT = 123;
50 50
	private final String FILENAME = "accounts.data";
51
	private Intent tabViewIntent;
51
	
52 52
	private boolean authenticating;
53
	private ArrayList<Account> accounts;
54
	private Intent tabViewIntent;
53 55
	private ProgressDialog dialog;
54 56
	private Context context;
55
	private final int PASSWORD_PROMPT = 123;
57
	
58
	//need to store if the user has successfully logged in
59
	private boolean loggedIn;
56 60

  
57 61

  
58 62
	public void onCreate(Bundle savedInstanceState) {
......
69 73
	protected void onSaveInstanceState(Bundle outState) {
70 74
		super.onSaveInstanceState(outState);
71 75
		outState.putBoolean("authenticating", authenticating);
76
		outState.putBoolean("loggedIn", loggedIn);
72 77
		//need to set authenticating back to true because it is set to false
73 78
		//in hideDialog()
74 79
		if(authenticating){
......
80 85
	
81 86
	@Override
82 87
	protected void onRestoreInstanceState(Bundle state) {
88
		if (state != null && state.containsKey("loggedIn")){
89
			loggedIn = state.getBoolean("loggedIn");
90
		}
91
		else{
92
			loggedIn = false;
93
		}
83 94
		if (state != null && state.containsKey("authenticating") && state.getBoolean("authenticating")) {
84 95
    		showDialog();
85 96
    	} else {
......
123 134
	private void verifyPassword(){
124 135
		PasswordManager pwManager = new PasswordManager(getSharedPreferences(
125 136
				Preferences.SHARED_PREFERENCES_NAME, MODE_PRIVATE));
126
		if(pwManager.hasPassword()){
137
		if(pwManager.hasPassword() && !loggedIn){
127 138
			createCustomDialog(PASSWORD_PROMPT);
128 139
		}
129 140
	}
......
153 164
					if(!rightPassword(passwordText.getText().toString())){
154 165
						passwordText.setText("");
155 166
						showToast("Password was incorrect.");
167
						loggedIn = false;
156 168
					}
157 169
					else{
158 170
						dialog.dismiss();
171
						loggedIn = true;
159 172
					}
160 173
				}
161 174
				

Also available in: Unified diff