Commit 16524928 authored by Grigory Fedorov's avatar Grigory Fedorov

Merge branch 'bostrt-master' into develop

parents b2621156 72de553d
...@@ -61,7 +61,13 @@ public class AccountEditorFragment extends BaseSettingsFragment ...@@ -61,7 +61,13 @@ public class AccountEditorFragment extends BaseSettingsFragment
if (getString(R.string.account_port_key).equals(key)) { if (getString(R.string.account_port_key).equals(key)) {
try { try {
Integer.parseInt((String) newValue); int newPort = Integer.parseInt((String) newValue);
// TODO: Not IPv6 Compatible
if (newPort < 0 || newPort > 0xFFFF) {
Toast.makeText(getActivity(), getString(R.string.account_invalid_port_range),
Toast.LENGTH_LONG).show();
return false;
}
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
Toast.makeText(getActivity(), getString(R.string.account_invalid_port), Toast.makeText(getActivity(), getString(R.string.account_invalid_port),
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
...@@ -69,6 +75,22 @@ public class AccountEditorFragment extends BaseSettingsFragment ...@@ -69,6 +75,22 @@ public class AccountEditorFragment extends BaseSettingsFragment
} }
} }
if (getString(R.string.account_proxy_port_key).equals(key)) {
try {
int newPort = Integer.parseInt((String) newValue);
// TODO: Not IPv6 Compatible
if (newPort < 0 || newPort > 0xFFFF) {
Toast.makeText(getActivity(), getString(R.string.account_proxy_invalid_port_range),
Toast.LENGTH_LONG).show();
return false;
}
} catch (NumberFormatException e) {
Toast.makeText(getActivity(), getString(R.string.account_proxy_invalid_port),
Toast.LENGTH_LONG).show();
return false;
}
}
if (getString(R.string.account_tls_mode_key).equals(key) if (getString(R.string.account_tls_mode_key).equals(key)
|| getString(R.string.account_archive_mode_key).equals(key) || getString(R.string.account_archive_mode_key).equals(key)
|| getString(R.string.account_proxy_type_key).equals(key) || getString(R.string.account_proxy_type_key).equals(key)
......
...@@ -28,11 +28,14 @@ ...@@ -28,11 +28,14 @@
<string name="account_custom_summary">Use custom host settings instead of SRV record</string> <string name="account_custom_summary">Use custom host settings instead of SRV record</string>
<string name="account_enabled_summary">Check to enable account</string> <string name="account_enabled_summary">Check to enable account</string>
<string name="account_invalid_port">Port must be a number (default: 5222)</string> <string name="account_invalid_port">Port must be a number (default: 5222)</string>
<string name="account_invalid_priority">Priority value must be a number between -128 and 128 (default: 10)</string> <string name="account_invalid_port_range">Port must be between 1 and 65535 (default: 5222)</string>
<string name="account_invalid_priority">Priority value must be a number between -128 and 128 (default: 0)</string>
<string name="account_oauth">Authorization</string> <string name="account_oauth">Authorization</string>
<string name="account_oauth_invalidated">Not authorized</string> <string name="account_oauth_invalidated">Not authorized</string>
<string name="account_oauth_summary">OAuth settings</string> <string name="account_oauth_summary">OAuth settings</string>
<string name="account_proxy_host">Proxy host</string> <string name="account_proxy_host">Proxy host</string>
<string name="account_proxy_invalid_port_range">Proxy port must be between 1 and 65535 (default: 8080)</string>
<string name="account_proxy_invalid_port">Proxy port must be a number (default: 8080)</string>
<string name="account_proxy_password">Proxy password</string> <string name="account_proxy_password">Proxy password</string>
<string name="account_proxy_port">Proxy port</string> <string name="account_proxy_port">Proxy port</string>
<string name="account_proxy_type">Proxy type</string> <string name="account_proxy_type">Proxy type</string>
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
android:key="@string/account_priority_key" android:key="@string/account_priority_key"
android:title="@string/account_priority" android:title="@string/account_priority"
android:singleLine="true" android:singleLine="true"
android:numeric="signed"
android:inputType="numberSigned|phone"
android:digits="1234567890-"
/> />
<ListPreference <ListPreference
android:title="@string/account_proxy_type" android:title="@string/account_proxy_type"
...@@ -54,6 +57,9 @@ ...@@ -54,6 +57,9 @@
android:key="@string/account_proxy_port_key" android:key="@string/account_proxy_port_key"
android:title="@string/account_proxy_port" android:title="@string/account_proxy_port"
android:singleLine="true" android:singleLine="true"
android:numeric="integer"
android:inputType="number|phone"
android:digits="1234567890"
/> />
<EditTextPreference <EditTextPreference
android:key="@string/account_proxy_user_key" android:key="@string/account_proxy_user_key"
......
...@@ -67,6 +67,9 @@ ...@@ -67,6 +67,9 @@
android:title="@string/account_port" android:title="@string/account_port"
android:singleLine="true" android:singleLine="true"
android:dependency="@string/account_custom_key" android:dependency="@string/account_custom_key"
android:numeric="integer"
android:inputType="number|phone"
android:digits="1234567890"
/> />
<EditTextPreference <EditTextPreference
android:key="@string/account_resource_key" android:key="@string/account_resource_key"
...@@ -77,6 +80,9 @@ ...@@ -77,6 +80,9 @@
android:key="@string/account_priority_key" android:key="@string/account_priority_key"
android:title="@string/account_priority" android:title="@string/account_priority"
android:singleLine="true" android:singleLine="true"
android:numeric="signed"
android:inputType="numberSigned|phone"
android:digits="1234567890-"
/> />
<CheckBoxPreference <CheckBoxPreference
android:title="@string/account_sasl" android:title="@string/account_sasl"
...@@ -109,6 +115,9 @@ ...@@ -109,6 +115,9 @@
android:key="@string/account_proxy_port_key" android:key="@string/account_proxy_port_key"
android:title="@string/account_proxy_port" android:title="@string/account_proxy_port"
android:singleLine="true" android:singleLine="true"
android:numeric="integer"
android:inputType="number|phone"
android:digits="1234567890"
/> />
<EditTextPreference <EditTextPreference
android:key="@string/account_proxy_user_key" android:key="@string/account_proxy_user_key"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment