android:inputType="number|textNoSuggestions"
android:hint="@string/profile_use_default_hint" />
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:text="@string/profile_port_label" />
+
+ <EditText
+ android:id="@+id/port"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:inputType="number|textNoSuggestions"
+ android:hint="@string/profile_use_default_hint" />
+
</LinearLayout>
</LinearLayout>
<string name="profile_ca_select_certificate">Wählen Sie ein bestimmtes CA-Zertifikat</string>
<string name="profile_show_advanced_label">Erweiterte Einstellungen anzeigen</string>
<string name="profile_mtu_label">MTU:</string>
+ <string name="profile_port_label">Server Port:</string>
<string name="profile_use_default_hint">(Standardwert verwenden)</string>
<!-- Warnings/Notifications in the details view -->
<string name="alert_text_no_input_gateway">Bitte geben Sie hier die Gateway-Adresse ein</string>
<string name="profile_ca_select_certificate">Wybierz określony certyfikat CA</string>
<string name="profile_show_advanced_label">Show advanced settings</string>
<string name="profile_mtu_label">MTU:</string>
+ <string name="profile_port_label">Server port:</string>
<string name="profile_use_default_hint">(use default)</string>
<!-- Warnings/Notifications in the details view -->
<string name="alert_text_no_input_gateway">Wprowadź adres bramki</string>
<string name="profile_ca_select_certificate">Выбрать CA сертификат</string>
<string name="profile_show_advanced_label">Show advanced settings</string>
<string name="profile_mtu_label">MTU:</string>
+ <string name="profile_port_label">Server port:</string>
<string name="profile_use_default_hint">(use default)</string>
<!-- Warnings/Notifications in the details view -->
<string name="alert_text_no_input_gateway">Пожалуйста введите адрес шлюза</string>
<string name="profile_ca_select_certificate">Вибрати спеціальний сертифікат CA</string>
<string name="profile_show_advanced_label">Show advanced settings</string>
<string name="profile_mtu_label">MTU:</string>
+ <string name="profile_port_label">Server port:</string>
<string name="profile_use_default_hint">(use default)</string>
<!-- Warnings/Notifications in the details view -->
<string name="alert_text_no_input_gateway">Введіть адресу шлюза тут</string>
<string name="profile_ca_select_certificate">Select a specific CA certificate</string>
<string name="profile_show_advanced_label">Show advanced settings</string>
<string name="profile_mtu_label">MTU:</string>
+ <string name="profile_port_label">Server port:</string>
<string name="profile_use_default_hint">(use default)</string>
<!-- Warnings/Notifications in the details view -->
<string name="alert_text_no_input_gateway">Please enter the gateway address here</string>
private CheckBox mShowAdvanced;
private ViewGroup mAdvancedSettings;
private EditText mMTU;
+ private EditText mPort;
@Override
public void onCreate(Bundle savedInstanceState)
mAdvancedSettings = (ViewGroup)findViewById(R.id.advanced_settings);
mMTU = (EditText)findViewById(R.id.mtu);
+ mPort = (EditText)findViewById(R.id.port);
mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
boolean show = mShowAdvanced.isChecked();
if (!show && mProfile != null)
{
- show = mProfile.getMTU() != null;
+ show = mProfile.getMTU() != null || mProfile.getPort() != null;
}
mShowAdvanced.setVisibility(!show ? View.VISIBLE : View.GONE);
mAdvancedSettings.setVisibility(show ? View.VISIBLE : View.GONE);
mMTU.setError(String.format(getString(R.string.alert_text_out_of_range), MTU_MIN, MTU_MAX));
valid = false;
}
+ Integer port = getInteger(mPort);
+ if (port != null && (port < 1 || port > 65535))
+ {
+ mPort.setError(String.format(getString(R.string.alert_text_out_of_range), 1, 65535));
+ valid = false;
+ }
return valid;
}
String certAlias = mCheckAuto.isChecked() ? null : mCertEntry.getAlias();
mProfile.setCertificateAlias(certAlias);
mProfile.setMTU(getInteger(mMTU));
+ mProfile.setPort(getInteger(mPort));
}
/**
mUsername.setText(mProfile.getUsername());
mPassword.setText(mProfile.getPassword());
mMTU.setText(mProfile.getMTU() != null ? mProfile.getMTU().toString() : null);
+ mPort.setText(mProfile.getPort() != null ? mProfile.getPort().toString() : null);
useralias = mProfile.getUserCertificateAlias();
alias = mProfile.getCertificateAlias();
getActionBar().setTitle(mProfile.getName());