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