Merge "Convert manual setup to a checkbox" into ub-mail-master
This commit is contained in:
commit
44020f5e40
@ -54,12 +54,10 @@
|
||||
android:inputType="textEmailAddress"
|
||||
android:imeOptions="actionNext" />
|
||||
</LinearLayout>
|
||||
<Button
|
||||
<CheckBox
|
||||
android:id="@+id/manual_setup"
|
||||
android:layout_below="@+id/email_input"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="@dimen/setup_buttons_padding_top"
|
||||
android:layout_marginRight="@dimen/setup_buttons_padding_right"
|
||||
style="@style/accountSetupButton"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/account_setup_basics_manual_setup_action" />
|
||||
</RelativeLayout>
|
||||
|
@ -41,13 +41,11 @@
|
||||
android:layout_below="@+id/instructions"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<Button
|
||||
<CheckBox
|
||||
android:id="@+id/manual_setup"
|
||||
android:layout_below="@+id/account_email"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="@dimen/setup_buttons_padding_top"
|
||||
android:layout_marginRight="@dimen/setup_buttons_padding_right"
|
||||
style="@style/accountSetupButton"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/account_setup_basics_manual_setup_action" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -23,18 +23,18 @@ import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.android.email.R;
|
||||
import com.android.email.activity.UiUtilities;
|
||||
import com.android.emailcommon.mail.Address;
|
||||
|
||||
public class AccountSetupBasicsFragment extends AccountSetupFragment implements
|
||||
View.OnClickListener {
|
||||
public class AccountSetupBasicsFragment extends AccountSetupFragment {
|
||||
private EditText mEmailView;
|
||||
private CheckBox mManualSetupView;
|
||||
|
||||
public interface Callback extends AccountSetupFragment.Callback {
|
||||
void onBasicsManualSetupButton();
|
||||
}
|
||||
|
||||
public static AccountSetupBasicsFragment newInstance() {
|
||||
@ -50,8 +50,7 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment implements
|
||||
false);
|
||||
|
||||
mEmailView = UiUtilities.getView(view, R.id.account_email);
|
||||
final View manualSetupButton = UiUtilities.getView(view, R.id.manual_setup);
|
||||
manualSetupButton.setOnClickListener(this);
|
||||
mManualSetupView = UiUtilities.getView(view, R.id.manual_setup);
|
||||
|
||||
final TextWatcher textWatcher = new TextWatcher() {
|
||||
@Override
|
||||
@ -89,14 +88,6 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment implements
|
||||
callback.setNextButtonEnabled(emailValid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.manual_setup) {
|
||||
Callback callback = (Callback) getActivity();
|
||||
callback.onBasicsManualSetupButton();
|
||||
}
|
||||
}
|
||||
|
||||
public void setEmail(final String email) {
|
||||
mEmailView.setText(email);
|
||||
}
|
||||
@ -104,4 +95,8 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment implements
|
||||
public String getEmail() {
|
||||
return mEmailView.getText().toString().trim();
|
||||
}
|
||||
|
||||
public boolean isManualSetup() {
|
||||
return mManualSetupView.isChecked();
|
||||
}
|
||||
}
|
||||
|
@ -117,8 +117,6 @@ public class AccountSetupFinal extends AccountSetupActivity
|
||||
private static final int STATE_CREDENTIALS = 1;
|
||||
// Show the user some interstitial message after credential entry
|
||||
private static final int STATE_CREDENTIALS_POST = 2;
|
||||
// User chose the "Manual Setup" button
|
||||
private static final int STATE_DIVERT_TO_MANUAL = 3;
|
||||
// Account is a pre-configured account, run the checker
|
||||
private static final int STATE_CHECKING_PRECONFIGURED = 4;
|
||||
// Account is not pre-configured, query user for account type
|
||||
@ -505,12 +503,23 @@ public class AccountSetupFinal extends AccountSetupActivity
|
||||
switch (mState) {
|
||||
case STATE_BASICS:
|
||||
onBasicsComplete();
|
||||
mState = STATE_CREDENTIALS;
|
||||
updateHeadline();
|
||||
updateContentFragment(true /* addToBackstack */);
|
||||
break;
|
||||
case STATE_DIVERT_TO_MANUAL:
|
||||
if (shouldDivertToManual()) {
|
||||
// Alternate entry to the debug options screen (for devices without a physical
|
||||
// keyboard):
|
||||
// Username: d@d.d
|
||||
if (ENTER_DEBUG_SCREEN) {
|
||||
if ("d@d.d".equals(mSetupData.getEmail())) {
|
||||
AccountSettings.actionSettingsWithDebug(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mSkipAutoDiscover = true;
|
||||
mState = STATE_TYPE;
|
||||
} else {
|
||||
mSkipAutoDiscover = false;
|
||||
mState = STATE_CREDENTIALS;
|
||||
}
|
||||
updateHeadline();
|
||||
updateContentFragment(true /* addToBackstack */);
|
||||
break;
|
||||
@ -671,32 +680,17 @@ public class AccountSetupFinal extends AccountSetupActivity
|
||||
mNextButton.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBasicsManualSetupButton() {
|
||||
final AccountSetupBasicsFragment basicsFragment =
|
||||
(AccountSetupBasicsFragment) getContentFragment();
|
||||
final String email = basicsFragment.getEmail();
|
||||
mSetupData.setEmail(email);
|
||||
|
||||
// Alternate entry to the debug options screen (for devices without a physical keyboard:
|
||||
// Username: d@d.d
|
||||
if (ENTER_DEBUG_SCREEN) {
|
||||
if ("d@d.d".equals(mSetupData.getEmail())) {
|
||||
AccountSettings.actionSettingsWithDebug(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
mState = STATE_DIVERT_TO_MANUAL;
|
||||
mSkipAutoDiscover = true;
|
||||
proceed();
|
||||
}
|
||||
|
||||
private void onBasicsComplete() {
|
||||
final AccountSetupBasicsFragment f = (AccountSetupBasicsFragment) getContentFragment();
|
||||
final String email = f.getEmail();
|
||||
mSetupData.setEmail(email);
|
||||
}
|
||||
|
||||
private boolean shouldDivertToManual() {
|
||||
final AccountSetupBasicsFragment f = (AccountSetupBasicsFragment) getContentFragment();
|
||||
return f.isManualSetup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCredentialsComplete(Bundle results) {
|
||||
proceed();
|
||||
|
Loading…
Reference in New Issue
Block a user