mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-31 15:20:09 -05:00
Restore TCP port value in incoming/outgoing server settings screens
Special thanks to zjw for the detailed analysis of this bug: https://github.com/k9mail/k-9/pull/193
This commit is contained in:
parent
1ac666bbd1
commit
6af48bd262
@ -160,18 +160,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
mAuthTypeView.setAdapter(authTypesAdapter);
|
mAuthTypeView.setAdapter(authTypesAdapter);
|
||||||
|
|
||||||
/*
|
|
||||||
* Updates the port when the user changes the security type. This allows
|
|
||||||
* us to show a reasonable default which the user can change.
|
|
||||||
*/
|
|
||||||
mSecurityTypeView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
updatePortFromSecurityType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) { /* unused */ }
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calls validateFields() which enables or disables the Next button
|
* Calls validateFields() which enables or disables the Next button
|
||||||
* based on the fields' validity.
|
* based on the fields' validity.
|
||||||
@ -294,12 +282,33 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
throw new Exception("Unknown account type: " + mAccount.getStoreUri());
|
throw new Exception("Unknown account type: " + mAccount.getStoreUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Select currently configured security type
|
||||||
for (int i = 0; i < CONNECTION_SECURITY_TYPES.length; i++) {
|
for (int i = 0; i < CONNECTION_SECURITY_TYPES.length; i++) {
|
||||||
if (CONNECTION_SECURITY_TYPES[i] == settings.connectionSecurity) {
|
if (CONNECTION_SECURITY_TYPES[i] == settings.connectionSecurity) {
|
||||||
SpinnerOption.setSpinnerOptionValue(mSecurityTypeView, i);
|
SpinnerOption.setSpinnerOptionValue(mSecurityTypeView, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Updates the port when the user changes the security type. This allows
|
||||||
|
* us to show a reasonable default which the user can change.
|
||||||
|
*
|
||||||
|
* Note: It's important that we set the listener *after* an initial option has been
|
||||||
|
* selected by the code above. Otherwise the listener might be called after
|
||||||
|
* onCreate() has been processed and the current port value set later in this
|
||||||
|
* method is overridden with the default port for the selected security type.
|
||||||
|
*/
|
||||||
|
mSecurityTypeView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position,
|
||||||
|
long id) {
|
||||||
|
updatePortFromSecurityType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) { /* unused */ }
|
||||||
|
});
|
||||||
|
|
||||||
mCompressionMobile.setChecked(mAccount.useCompression(Account.TYPE_MOBILE));
|
mCompressionMobile.setChecked(mAccount.useCompression(Account.TYPE_MOBILE));
|
||||||
mCompressionWifi.setChecked(mAccount.useCompression(Account.TYPE_WIFI));
|
mCompressionWifi.setChecked(mAccount.useCompression(Account.TYPE_WIFI));
|
||||||
mCompressionOther.setChecked(mAccount.useCompression(Account.TYPE_OTHER));
|
mCompressionOther.setChecked(mAccount.useCompression(Account.TYPE_OTHER));
|
||||||
|
@ -137,19 +137,6 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||||||
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
mAuthTypeView.setAdapter(authTypesAdapter);
|
mAuthTypeView.setAdapter(authTypesAdapter);
|
||||||
|
|
||||||
/*
|
|
||||||
* Updates the port when the user changes the security type. This allows
|
|
||||||
* us to show a reasonable default which the user can change.
|
|
||||||
*/
|
|
||||||
mSecurityTypeView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
updatePortFromSecurityType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calls validateFields() which enables or disables the Next button
|
* Calls validateFields() which enables or disables the Next button
|
||||||
* based on the fields' validity.
|
* based on the fields' validity.
|
||||||
@ -223,13 +210,33 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Select currently configured security type
|
||||||
for (int i = 0; i < smtpSchemes.length; i++) {
|
for (int i = 0; i < smtpSchemes.length; i++) {
|
||||||
if (smtpSchemes[i].equals(uri.getScheme())) {
|
if (smtpSchemes[i].equals(uri.getScheme())) {
|
||||||
SpinnerOption.setSpinnerOptionValue(mSecurityTypeView, i);
|
SpinnerOption.setSpinnerOptionValue(mSecurityTypeView, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Updates the port when the user changes the security type. This allows
|
||||||
|
* us to show a reasonable default which the user can change.
|
||||||
|
*
|
||||||
|
* Note: It's important that we set the listener *after* an initial option has been
|
||||||
|
* selected by the code above. Otherwise the listener might be called after
|
||||||
|
* onCreate() has been processed and the current port value set later in this
|
||||||
|
* method is overridden with the default port for the selected security type.
|
||||||
|
*/
|
||||||
|
mSecurityTypeView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position,
|
||||||
|
long id) {
|
||||||
|
updatePortFromSecurityType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) { /* unused */ }
|
||||||
|
});
|
||||||
|
|
||||||
if (uri.getHost() != null) {
|
if (uri.getHost() != null) {
|
||||||
mServerView.setText(uri.getHost());
|
mServerView.setText(uri.getHost());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user