Use check box instead of toggle button

pull/14/head
Tim Su 15 years ago
parent e9c0a9f23f
commit eae4a81684

@ -45,10 +45,12 @@ import android.text.style.ClickableSpan;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ToggleButton;
import com.facebook.android.AsyncFacebookRunner; import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.AsyncFacebookRunner.RequestListener; import com.facebook.android.AsyncFacebookRunner.RequestListener;
@ -158,7 +160,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
@Override @Override
public void updateDrawState(TextPaint ds) { public void updateDrawState(TextPaint ds) {
ds.setUnderlineText(true); ds.setUnderlineText(true);
ds.linkColor = Color.rgb(255, 96, 0); ds.setColor(Color.rgb(255, 96, 0));
} }
}; };
link.setSpan(linkSpan, pwLoginBase.length() + 1, link.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); link.setSpan(linkSpan, pwLoginBase.length() + 1, link.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -187,21 +189,25 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
private final OnClickListener signUpListener = new OnClickListener() { private final OnClickListener signUpListener = new OnClickListener() {
@Override @Override
public void onClick(View arg0) { public void onClick(View arg0) {
LinearLayout body = new LinearLayout(ActFmLoginActivity.this); final LinearLayout body = new LinearLayout(ActFmLoginActivity.this);
body.setOrientation(LinearLayout.VERTICAL); body.setOrientation(LinearLayout.VERTICAL);
body.setPadding(10, 0, 10, 0); body.setPadding(10, 0, 10, 0);
final EditText name = addEditField(body, R.string.actfm_ALA_name_label); final EditText name = addEditField(body, R.string.actfm_ALA_name_label);
final ToggleButton toggle = new ToggleButton(ActFmLoginActivity.this); final CheckBox toggle = new CheckBox(ActFmLoginActivity.this);
toggle.setTextOff(getString(R.string.actfm_ALA_pw_returning)); toggle.setOnCheckedChangeListener(new OnCheckedChangeListener() {
toggle.setTextOn(getString(R.string.actfm_ALA_pw_new));
toggle.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
name.setVisibility(toggle.isChecked() ? View.VISIBLE : View.GONE); int nameIndex = body.indexOfChild(name);
int visibility = isChecked ? View.VISIBLE : View.GONE;
toggle.setText(isChecked ? R.string.actfm_ALA_pw_returning :
R.string.actfm_ALA_pw_new);
body.getChildAt(nameIndex - 1).setVisibility(visibility);
body.getChildAt(nameIndex).setVisibility(visibility);
} }
}); });
toggle.setChecked(true);
body.addView(toggle, 0); body.addView(toggle, 0);
final EditText email = addEditField(body, R.string.actfm_ALA_email_label); final EditText email = addEditField(body, R.string.actfm_ALA_email_label);
@ -217,7 +223,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
password.setTransformationMethod(new PasswordTransformationMethod()); password.setTransformationMethod(new PasswordTransformationMethod());
new AlertDialog.Builder(ActFmLoginActivity.this) new AlertDialog.Builder(ActFmLoginActivity.this)
.setTitle(R.string.actfm_ALA_signup_title) .setTitle(R.string.actfm_ALA_login_title)
.setView(body) .setView(body)
.setIcon(R.drawable.icon_32) .setIcon(R.drawable.icon_32)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

@ -150,11 +150,11 @@
<!-- share login: Sharing Password Link --> <!-- share login: Sharing Password Link -->
<string name="actfm_ALA_pw_link">Sign In Here</string> <string name="actfm_ALA_pw_link">Sign In Here</string>
<!-- share login: Password New User --> <!-- share login: Password Are you a New User? -->
<string name="actfm_ALA_pw_new">New User</string> <string name="actfm_ALA_pw_new">Create a new account?</string>
<!-- share login: Password Returning User --> <!-- share login: Password Are you a Returning User? -->
<string name="actfm_ALA_pw_returning">Returning</string> <string name="actfm_ALA_pw_returning">Already have an account?</string>
<!-- share login: Name --> <!-- share login: Name -->
<string name="actfm_ALA_name_label">Name</string> <string name="actfm_ALA_name_label">Name</string>
@ -168,9 +168,6 @@
<!-- share login: Password --> <!-- share login: Password -->
<string name="actfm_ALA_password_label">Password</string> <string name="actfm_ALA_password_label">Password</string>
<!-- share login: Sign Up Title -->
<string name="actfm_ALA_signup_title">Create New Account</string>
<!-- share login: Login Title --> <!-- share login: Login Title -->
<string name="actfm_ALA_login_title">Login to Astrid.com</string> <string name="actfm_ALA_login_title">Login to Astrid.com</string>

Loading…
Cancel
Save