Revision f3633a16 src/com/rackspacecloud/android/AddAccountActivity.java

b/src/com/rackspacecloud/android/AddAccountActivity.java
4 4
import android.os.Bundle;
5 5
import android.text.method.PasswordTransformationMethod;
6 6
import android.text.method.SingleLineTransformationMethod;
7
import android.util.Log;
7 8
import android.view.View;
8 9
import android.view.View.OnClickListener;
9 10
import android.widget.AdapterView;
......
17 18
	
18 19
	private final String[] PROVIDERS = {"Rackspace Cloud (US)", "Rackspace Cloud (UK)", "Custom"};
19 20
	private EditText usernameText;
20
	private EditText apiKeyText;
21
	private EditText passwordText;
21 22
	private EditText customServer;
22 23
	private Spinner providerSpinner;
23 24
	private String authServer;
......
28 29
        trackPageView(GoogleAnalytics.PAGE_PROVIDERS);
29 30
        setContentView(R.layout.createaccount);
30 31
        usernameText = (EditText) findViewById(R.id.username);
31
        apiKeyText = (EditText) findViewById(R.id.addaccount_apikey);
32
        passwordText = (EditText) findViewById(R.id.addaccount_apikey);
32 33
        customServer = (EditText) findViewById(R.id.custom_auth_server_edit);
33 34
        ((Button) findViewById(R.id.submit_new_account)).setOnClickListener(this);
34 35
        isHidden = true;
......
51 52
        if(state != null)
52 53
        	isHidden = state.containsKey("isHidden") && state.getBoolean("isHidden");
53 54
		if(isHidden){
54
        	apiKeyText.setTransformationMethod(new PasswordTransformationMethod());
55
        	passwordText.setTransformationMethod(new PasswordTransformationMethod());
55 56
		}
56 57
		else{
57
        	apiKeyText.setTransformationMethod(new SingleLineTransformationMethod());
58
			passwordText.setTransformationMethod(new SingleLineTransformationMethod());
58 59
		}
59 60
	}
60 61
	
......
65 66
        	@Override 
66 67
			public void onClick(View v) {
67 68
		        if (((CheckBox) v).isChecked()) {
68
		        	apiKeyText.setTransformationMethod(new SingleLineTransformationMethod());
69
		        	passwordText.setTransformationMethod(new SingleLineTransformationMethod());
69 70
		        	isHidden = false;
70 71
		        } else {
71
		        	apiKeyText.setTransformationMethod(new PasswordTransformationMethod());
72
		        	passwordText.setTransformationMethod(new PasswordTransformationMethod());
72 73
		        	isHidden = true;
73 74
		        }
74
		        apiKeyText.requestFocus();
75
		        passwordText.requestFocus();
75 76
		    }	
76 77
		});
77 78
	}
78 79
	
79 80
	private void loadProviderSpinner(){
80 81
		//set the auth server default to us
81
		authServer = "https://auth.api.rackspacecloud.com/v1.0";
82
		authServer = "https://auth.api.rackspacecloud.com/v2.0";
82 83
		providerSpinner = (Spinner) findViewById(R.id.provider_spinner);
83 84
		ArrayAdapter<String> imageAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, PROVIDERS);
84 85
		imageAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
......
86 87
		providerSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
87 88
		    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
88 89
		    	if(pos == 0){
89
					authServer = Preferences.COUNTRY_US_AUTH_SERVER;
90
					authServer = Preferences.COUNTRY_US_AUTH_SERVER_V2;
90 91
			        customServer.setEnabled(false);
91 92
				}
92 93
				else if(pos == 1){
93
					authServer = Preferences.COUNTRY_UK_AUTH_SERVER;
94
					authServer = Preferences.COUNTRY_UK_AUTH_SERVER_V2;
94 95
			        customServer.setEnabled(false);
95 96
				}
96 97
				else{
......
109 110
			Intent result = new Intent();
110 111
			Bundle b = new Bundle();
111 112
			b.putString("username", usernameText.getText().toString());
112
			b.putString("apiKey", apiKeyText.getText().toString());
113
			b.putString("apiKey", passwordText.getText().toString());
113 114
			b.putString("server", getAuthServer());
114 115
			result.putExtra("accountInfo", b);
115 116
			setResult(RESULT_OK, result);
......
129 130
	
130 131
	private boolean hasValidInput() {
131 132
    	String username = usernameText.getText().toString();
132
    	String apiKey = apiKeyText.getText().toString();
133
    	String apiKey = passwordText.getText().toString();
133 134
    	return !"".equals(username) && !"".equals(apiKey);
134 135
    }
135 136

  

Also available in: Unified diff