Tidy up warnings in account setup fragments
Change-Id: I078df83dbc4afd10c0783a98bfbb23bced12489c
This commit is contained in:
parent
e28df24205
commit
219c3b5b84
|
@ -118,9 +118,8 @@ public class AccountCheckSettingsFragment extends Fragment {
|
|||
/**
|
||||
* Called when autodiscovery completes.
|
||||
* @param result autodiscovery result code - success is AUTODISCOVER_OK
|
||||
* @param hostAuth configuration data returned by AD server, or null if no data available
|
||||
*/
|
||||
public void onAutoDiscoverComplete(int result, HostAuth hostAuth);
|
||||
public void onAutoDiscoverComplete(int result);
|
||||
}
|
||||
|
||||
// Public no-args constructor needed for fragment re-instantiation
|
||||
|
@ -271,8 +270,7 @@ public class AccountCheckSettingsFragment extends Fragment {
|
|||
fm.popBackStack();
|
||||
// 3. report back to target fragment or activity
|
||||
getCallbackTarget().onAutoDiscoverComplete(
|
||||
(autoDiscoverResult != null) ? AUTODISCOVER_OK : AUTODISCOVER_NO_DATA,
|
||||
autoDiscoverResult);
|
||||
(autoDiscoverResult != null) ? AUTODISCOVER_OK : AUTODISCOVER_NO_DATA);
|
||||
break;
|
||||
default:
|
||||
// Display a normal progress message
|
||||
|
@ -349,7 +347,7 @@ public class AccountCheckSettingsFragment extends Fragment {
|
|||
Callbacks callbackTarget = getCallbackTarget();
|
||||
if (mState == STATE_AUTODISCOVER_AUTH_DIALOG) {
|
||||
// report auth error to target fragment or activity
|
||||
callbackTarget.onAutoDiscoverComplete(AUTODISCOVER_AUTHENTICATION, null);
|
||||
callbackTarget.onAutoDiscoverComplete(AUTODISCOVER_AUTHENTICATION);
|
||||
} else {
|
||||
// report check settings failure to target fragment or activity
|
||||
callbackTarget.onCheckSettingsComplete(CHECK_SETTINGS_SERVER_ERROR);
|
||||
|
|
|
@ -151,7 +151,7 @@ public abstract class AccountServerBaseFragment extends Fragment
|
|||
protected void onCreateViewSettingsMode(View view) {
|
||||
if (mSettingsMode) {
|
||||
UiUtilities.getView(view, R.id.cancel).setOnClickListener(this);
|
||||
mProceedButton = (Button) UiUtilities.getView(view, R.id.done);
|
||||
mProceedButton = UiUtilities.getView(view, R.id.done);
|
||||
mProceedButton.setOnClickListener(this);
|
||||
mProceedButton.setEnabled(false);
|
||||
}
|
||||
|
@ -336,9 +336,7 @@ public abstract class AccountServerBaseFragment extends Fragment
|
|||
|
||||
@Override
|
||||
protected Account doInBackground(Void... params) {
|
||||
Account account = Utility.findExistingAccount(mContext, mAccountId,
|
||||
mCheckHost, mCheckLogin);
|
||||
return account;
|
||||
return Utility.findExistingAccount(mContext, mAccountId, mCheckHost, mCheckLogin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -392,7 +390,7 @@ public abstract class AccountServerBaseFragment extends Fragment
|
|||
* This is overridden only by AccountSetupExchange
|
||||
*/
|
||||
@Override
|
||||
public void onAutoDiscoverComplete(int result, HostAuth hostAuth) {
|
||||
public void onAutoDiscoverComplete(int result) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
@ -411,11 +409,6 @@ public abstract class AccountServerBaseFragment extends Fragment
|
|||
return sendChanged || recvChanged;
|
||||
}
|
||||
|
||||
public boolean setHostAuthFromAutodiscover(HostAuth hostAuth) {
|
||||
// This is overridden, if necessary
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings after "OK" result from checker. Concrete classes must implement.
|
||||
* This is called from a worker thread and is allowed to perform DB operations.
|
||||
|
|
|
@ -666,7 +666,7 @@ public class AccountSetupBasics extends AccountSetupActivity
|
|||
* This is overridden only by AccountSetupExchange
|
||||
*/
|
||||
@Override
|
||||
public void onAutoDiscoverComplete(int result, HostAuth hostAuth) {
|
||||
public void onAutoDiscoverComplete(int result) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class AccountSetupIncoming extends AccountSetupActivity
|
|||
// Configure fragment
|
||||
mFragment.setCallback(this);
|
||||
|
||||
mNextButton = (Button) UiUtilities.getView(this, R.id.next);
|
||||
mNextButton = UiUtilities.getView(this, R.id.next);
|
||||
mNextButton.setOnClickListener(this);
|
||||
UiUtilities.getView(this, R.id.previous).setOnClickListener(this);
|
||||
|
||||
|
@ -164,22 +164,18 @@ public class AccountSetupIncoming extends AccountSetupActivity
|
|||
/**
|
||||
* Implements AccountCheckSettingsFragment.Callbacks
|
||||
*
|
||||
* @param result configuration data returned by AD server, or null if no data available
|
||||
* @param result Currently auth failed (bail), ok (move to next), or no data (stay here)
|
||||
*/
|
||||
public void onAutoDiscoverComplete(int result, HostAuth hostAuth) {
|
||||
public void onAutoDiscoverComplete(int result) {
|
||||
// If authentication failed, exit immediately (to re-enter credentials)
|
||||
if (result == AccountCheckSettingsFragment.AUTODISCOVER_AUTHENTICATION) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// If data was returned, populate the account & populate the UI fields and validate it
|
||||
// If data was returned, proceed to next screen
|
||||
if (result == AccountCheckSettingsFragment.AUTODISCOVER_OK) {
|
||||
boolean valid = mFragment.setHostAuthFromAutodiscover(hostAuth);
|
||||
if (valid) {
|
||||
// "click" next to launch server verification
|
||||
mFragment.onNext();
|
||||
}
|
||||
mFragment.onNext();
|
||||
}
|
||||
// Otherwise, proceed into this activity for manual setup
|
||||
}
|
||||
|
|
|
@ -86,7 +86,6 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
|
|||
private boolean mStarted;
|
||||
private boolean mLoaded;
|
||||
private String mCacheLoginCredential;
|
||||
private HostAuth mRecvAuth;
|
||||
private EmailServiceInfo mServiceInfo;
|
||||
|
||||
// Public no-args constructor needed for fragment re-instantiation
|
||||
|
@ -122,21 +121,20 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
|
|||
View view = inflater.inflate(layoutId, container, false);
|
||||
Context context = getActivity();
|
||||
|
||||
mRecvAuth = SetupData.getAccount().mHostAuthRecv;
|
||||
mServiceInfo = EmailServiceUtils.getServiceInfo(mContext, mRecvAuth.mProtocol);
|
||||
final HostAuth recvAuth = SetupData.getAccount().mHostAuthRecv;
|
||||
mServiceInfo = EmailServiceUtils.getServiceInfo(mContext, recvAuth.mProtocol);
|
||||
|
||||
mUsernameView = (EditText) UiUtilities.getView(view, R.id.account_username);
|
||||
mPasswordView = (EditText) UiUtilities.getView(view, R.id.account_password);
|
||||
mServerLabelView = (TextView) UiUtilities.getView(view, R.id.account_server_label);
|
||||
mServerView = (EditText) UiUtilities.getView(view, R.id.account_server);
|
||||
mPortView = (EditText) UiUtilities.getView(view, R.id.account_port);
|
||||
mSecurityTypeView = (Spinner) UiUtilities.getView(view, R.id.account_security_type);
|
||||
mDeletePolicyLabelView = (TextView) UiUtilities.getView(view,
|
||||
R.id.account_delete_policy_label);
|
||||
mDeletePolicyView = (Spinner) UiUtilities.getView(view, R.id.account_delete_policy);
|
||||
mUsernameView = UiUtilities.getView(view, R.id.account_username);
|
||||
mPasswordView = UiUtilities.getView(view, R.id.account_password);
|
||||
mServerLabelView = UiUtilities.getView(view, R.id.account_server_label);
|
||||
mServerView = UiUtilities.getView(view, R.id.account_server);
|
||||
mPortView = UiUtilities.getView(view, R.id.account_port);
|
||||
mSecurityTypeView = UiUtilities.getView(view, R.id.account_security_type);
|
||||
mDeletePolicyLabelView = UiUtilities.getView(view, R.id.account_delete_policy_label);
|
||||
mDeletePolicyView = UiUtilities.getView(view, R.id.account_delete_policy);
|
||||
mImapPathPrefixSectionView = UiUtilities.getView(view, R.id.imap_path_prefix_section);
|
||||
mDeviceIdSectionView = UiUtilities.getView(view, R.id.device_id_section);
|
||||
mImapPathPrefixView = (EditText) UiUtilities.getView(view, R.id.imap_path_prefix);
|
||||
mImapPathPrefixView = UiUtilities.getView(view, R.id.imap_path_prefix);
|
||||
mClientCertificateSelector = UiUtilities.getView(view, R.id.client_certificate_selector);
|
||||
|
||||
// Set up security type spinner
|
||||
|
@ -417,8 +415,7 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
|
|||
&& Utility.isPortFieldValid(mPortView);
|
||||
enableNextButton(enabled);
|
||||
|
||||
String userName = mUsernameView.getText().toString().trim();
|
||||
mCacheLoginCredential = userName;
|
||||
mCacheLoginCredential = mUsernameView.getText().toString().trim();
|
||||
|
||||
// Warn (but don't prevent) if password has leading/trailing spaces
|
||||
AccountSettingsUtils.checkPasswordSpaces(mContext, mPasswordView);
|
||||
|
@ -552,9 +549,9 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment
|
|||
* Implements AccountCheckSettingsFragment.Callbacks
|
||||
*/
|
||||
@Override
|
||||
public void onAutoDiscoverComplete(int result, HostAuth hostAuth) {
|
||||
public void onAutoDiscoverComplete(int result) {
|
||||
AccountSetupIncoming activity = (AccountSetupIncoming) getActivity();
|
||||
activity.onAutoDiscoverComplete(result, hostAuth);
|
||||
activity.onAutoDiscoverComplete(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,7 +60,7 @@ public class AccountSetupOutgoing extends Activity
|
|||
// Configure fragment
|
||||
mFragment.setCallback(this);
|
||||
|
||||
mNextButton = (Button) UiUtilities.getView(this, R.id.next);
|
||||
mNextButton = UiUtilities.getView(this, R.id.next);
|
||||
mNextButton.setOnClickListener(this);
|
||||
UiUtilities.getView(this, R.id.previous).setOnClickListener(this);
|
||||
}
|
||||
|
|
|
@ -101,12 +101,12 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
|
|||
View view = inflater.inflate(layoutId, container, false);
|
||||
Context context = getActivity();
|
||||
|
||||
mUsernameView = (EditText) UiUtilities.getView(view, R.id.account_username);
|
||||
mPasswordView = (EditText) UiUtilities.getView(view, R.id.account_password);
|
||||
mServerView = (EditText) UiUtilities.getView(view, R.id.account_server);
|
||||
mPortView = (EditText) UiUtilities.getView(view, R.id.account_port);
|
||||
mRequireLoginView = (CheckBox) UiUtilities.getView(view, R.id.account_require_login);
|
||||
mSecurityTypeView = (Spinner) UiUtilities.getView(view, R.id.account_security_type);
|
||||
mUsernameView = UiUtilities.getView(view, R.id.account_username);
|
||||
mPasswordView = UiUtilities.getView(view, R.id.account_password);
|
||||
mServerView = UiUtilities.getView(view, R.id.account_server);
|
||||
mPortView = UiUtilities.getView(view, R.id.account_port);
|
||||
mRequireLoginView = UiUtilities.getView(view, R.id.account_require_login);
|
||||
mSecurityTypeView = UiUtilities.getView(view, R.id.account_security_type);
|
||||
mRequireLoginView.setOnCheckedChangeListener(this);
|
||||
|
||||
// Note: Strings are shared with AccountSetupIncomingFragment
|
||||
|
@ -328,8 +328,7 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
|
|||
|
||||
private int getPortFromSecurityType() {
|
||||
int securityType = (Integer)((SpinnerOption)mSecurityTypeView.getSelectedItem()).value;
|
||||
int port = (securityType & HostAuth.FLAG_SSL) != 0 ? SMTP_PORT_SSL : SMTP_PORT_NORMAL;
|
||||
return port;
|
||||
return (securityType & HostAuth.FLAG_SSL) != 0 ? SMTP_PORT_SSL : SMTP_PORT_NORMAL;
|
||||
}
|
||||
|
||||
private void updatePortFromSecurityType() {
|
||||
|
|
Loading…
Reference in New Issue