src/org/gege/caldavsyncadapter/authenticator/AuthenticatorActivity.java

changeset 9
bcc778a42b8c
parent 8
ec8af0e3fbc2
equal deleted inserted replaced
1:bc172d9c65b7 2:b0aaec0356ca
31 import android.content.pm.PackageManager.NameNotFoundException; 31 import android.content.pm.PackageManager.NameNotFoundException;
32 import android.os.AsyncTask; 32 import android.os.AsyncTask;
33 import android.os.Build; 33 import android.os.Build;
34 import android.os.Bundle; 34 import android.os.Bundle;
35 import android.text.Editable; 35 import android.text.Editable;
36 import android.text.InputType;
36 import android.text.TextUtils; 37 import android.text.TextUtils;
37 import android.text.TextWatcher; 38 import android.text.TextWatcher;
38 import android.util.Log; 39 import android.util.Log;
39 import android.view.KeyEvent; 40 import android.view.KeyEvent;
40 import android.view.Menu; 41 import android.view.Menu;
41 import android.view.View; 42 import android.view.View;
42 import android.view.inputmethod.EditorInfo; 43 import android.view.inputmethod.EditorInfo;
43 import android.widget.CheckBox; 44 import android.widget.CheckBox;
45 import android.widget.CompoundButton;
44 import android.widget.EditText; 46 import android.widget.EditText;
45 import android.widget.TextView; 47 import android.widget.TextView;
46 import android.widget.Toast; 48 import android.widget.Toast;
47 49
48 import org.apache.http.conn.HttpHostConnectException; 50 import org.apache.http.conn.HttpHostConnectException;
107 private EditText mURLView; 109 private EditText mURLView;
108 110
109 private String mAccountname; 111 private String mAccountname;
110 private EditText mAccountnameView; 112 private EditText mAccountnameView;
111 113
114 private CheckBox showPassword;
115
112 public AuthenticatorActivity() { 116 public AuthenticatorActivity() {
113 super(); 117 super();
114 118
115 } 119 }
116 120
124 128
125 // Set up the login form. 129 // Set up the login form.
126 mUser = getIntent().getStringExtra(EXTRA_EMAIL); 130 mUser = getIntent().getStringExtra(EXTRA_EMAIL);
127 mUserView = (EditText) findViewById(R.id.user); 131 mUserView = (EditText) findViewById(R.id.user);
128 mUserView.setText(mUser); 132 mUserView.setText(mUser);
133 mUserView.requestFocus();
129 134
130 mContext = getBaseContext(); 135 mContext = getBaseContext();
131 136
132 mPasswordView = (EditText) findViewById(R.id.password); 137 mPasswordView = (EditText) findViewById(R.id.password);
133 mPasswordView 138 mPasswordView
141 } 146 }
142 return false; 147 return false;
143 } 148 }
144 }); 149 });
145 150
151 showPassword = (CheckBox) findViewById(R.id.showPassword);
152 showPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
153 @Override
154 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
155 if(isChecked) {
156 mPasswordView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
157 } else {
158 mPasswordView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
159 }
160 }
161 });
146 162
147 mURLView = (EditText) findViewById(R.id.url); 163 mURLView = (EditText) findViewById(R.id.url);
148 // if the URL start with "https" show the option to disable SSL host verification 164 // if the URL start with "https" show the option to disable SSL host verification
149 mURLView.addTextChangedListener(new TextWatcher() { 165 mURLView.addTextChangedListener(new TextWatcher() {
150 @Override 166 @Override

mercurial