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