android: Extend GUI so the server port can be entered
This commit is contained in:
@@ -165,6 +165,20 @@
|
|||||||
android:inputType="number|textNoSuggestions"
|
android:inputType="number|textNoSuggestions"
|
||||||
android:hint="@string/profile_use_default_hint" />
|
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>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
<string name="profile_ca_select_certificate">Wählen Sie ein bestimmtes CA-Zertifikat</string>
|
<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_show_advanced_label">Erweiterte Einstellungen anzeigen</string>
|
||||||
<string name="profile_mtu_label">MTU:</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>
|
<string name="profile_use_default_hint">(Standardwert verwenden)</string>
|
||||||
<!-- Warnings/Notifications in the details view -->
|
<!-- Warnings/Notifications in the details view -->
|
||||||
<string name="alert_text_no_input_gateway">Bitte geben Sie hier die Gateway-Adresse ein</string>
|
<string name="alert_text_no_input_gateway">Bitte geben Sie hier die Gateway-Adresse ein</string>
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
<string name="profile_ca_select_certificate">Wybierz określony certyfikat CA</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_show_advanced_label">Show advanced settings</string>
|
||||||
<string name="profile_mtu_label">MTU:</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>
|
<string name="profile_use_default_hint">(use default)</string>
|
||||||
<!-- Warnings/Notifications in the details view -->
|
<!-- Warnings/Notifications in the details view -->
|
||||||
<string name="alert_text_no_input_gateway">Wprowadź adres bramki</string>
|
<string name="alert_text_no_input_gateway">Wprowadź adres bramki</string>
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
<string name="profile_ca_select_certificate">Выбрать CA сертификат</string>
|
<string name="profile_ca_select_certificate">Выбрать CA сертификат</string>
|
||||||
<string name="profile_show_advanced_label">Show advanced settings</string>
|
<string name="profile_show_advanced_label">Show advanced settings</string>
|
||||||
<string name="profile_mtu_label">MTU:</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>
|
<string name="profile_use_default_hint">(use default)</string>
|
||||||
<!-- Warnings/Notifications in the details view -->
|
<!-- Warnings/Notifications in the details view -->
|
||||||
<string name="alert_text_no_input_gateway">Пожалуйста введите адрес шлюза</string>
|
<string name="alert_text_no_input_gateway">Пожалуйста введите адрес шлюза</string>
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
<string name="profile_ca_select_certificate">Вибрати спеціальний сертифікат CA</string>
|
<string name="profile_ca_select_certificate">Вибрати спеціальний сертифікат CA</string>
|
||||||
<string name="profile_show_advanced_label">Show advanced settings</string>
|
<string name="profile_show_advanced_label">Show advanced settings</string>
|
||||||
<string name="profile_mtu_label">MTU:</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>
|
<string name="profile_use_default_hint">(use default)</string>
|
||||||
<!-- Warnings/Notifications in the details view -->
|
<!-- Warnings/Notifications in the details view -->
|
||||||
<string name="alert_text_no_input_gateway">Введіть адресу шлюза тут</string>
|
<string name="alert_text_no_input_gateway">Введіть адресу шлюза тут</string>
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
<string name="profile_ca_select_certificate">Select a specific CA certificate</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_show_advanced_label">Show advanced settings</string>
|
||||||
<string name="profile_mtu_label">MTU:</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>
|
<string name="profile_use_default_hint">(use default)</string>
|
||||||
<!-- Warnings/Notifications in the details view -->
|
<!-- Warnings/Notifications in the details view -->
|
||||||
<string name="alert_text_no_input_gateway">Please enter the gateway address here</string>
|
<string name="alert_text_no_input_gateway">Please enter the gateway address here</string>
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ public class VpnProfileDetailActivity extends Activity
|
|||||||
private CheckBox mShowAdvanced;
|
private CheckBox mShowAdvanced;
|
||||||
private ViewGroup mAdvancedSettings;
|
private ViewGroup mAdvancedSettings;
|
||||||
private EditText mMTU;
|
private EditText mMTU;
|
||||||
|
private EditText mPort;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
@@ -117,6 +118,7 @@ public class VpnProfileDetailActivity extends Activity
|
|||||||
mAdvancedSettings = (ViewGroup)findViewById(R.id.advanced_settings);
|
mAdvancedSettings = (ViewGroup)findViewById(R.id.advanced_settings);
|
||||||
|
|
||||||
mMTU = (EditText)findViewById(R.id.mtu);
|
mMTU = (EditText)findViewById(R.id.mtu);
|
||||||
|
mPort = (EditText)findViewById(R.id.port);
|
||||||
|
|
||||||
mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() {
|
mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -342,7 +344,7 @@ public class VpnProfileDetailActivity extends Activity
|
|||||||
boolean show = mShowAdvanced.isChecked();
|
boolean show = mShowAdvanced.isChecked();
|
||||||
if (!show && mProfile != null)
|
if (!show && mProfile != null)
|
||||||
{
|
{
|
||||||
show = mProfile.getMTU() != null;
|
show = mProfile.getMTU() != null || mProfile.getPort() != null;
|
||||||
}
|
}
|
||||||
mShowAdvanced.setVisibility(!show ? View.VISIBLE : View.GONE);
|
mShowAdvanced.setVisibility(!show ? View.VISIBLE : View.GONE);
|
||||||
mAdvancedSettings.setVisibility(show ? View.VISIBLE : View.GONE);
|
mAdvancedSettings.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
@@ -408,6 +410,12 @@ public class VpnProfileDetailActivity extends Activity
|
|||||||
mMTU.setError(String.format(getString(R.string.alert_text_out_of_range), MTU_MIN, MTU_MAX));
|
mMTU.setError(String.format(getString(R.string.alert_text_out_of_range), MTU_MIN, MTU_MAX));
|
||||||
valid = false;
|
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;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,6 +444,7 @@ public class VpnProfileDetailActivity extends Activity
|
|||||||
String certAlias = mCheckAuto.isChecked() ? null : mCertEntry.getAlias();
|
String certAlias = mCheckAuto.isChecked() ? null : mCertEntry.getAlias();
|
||||||
mProfile.setCertificateAlias(certAlias);
|
mProfile.setCertificateAlias(certAlias);
|
||||||
mProfile.setMTU(getInteger(mMTU));
|
mProfile.setMTU(getInteger(mMTU));
|
||||||
|
mProfile.setPort(getInteger(mPort));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -459,6 +468,7 @@ public class VpnProfileDetailActivity extends Activity
|
|||||||
mUsername.setText(mProfile.getUsername());
|
mUsername.setText(mProfile.getUsername());
|
||||||
mPassword.setText(mProfile.getPassword());
|
mPassword.setText(mProfile.getPassword());
|
||||||
mMTU.setText(mProfile.getMTU() != null ? mProfile.getMTU().toString() : null);
|
mMTU.setText(mProfile.getMTU() != null ? mProfile.getMTU().toString() : null);
|
||||||
|
mPort.setText(mProfile.getPort() != null ? mProfile.getPort().toString() : null);
|
||||||
useralias = mProfile.getUserCertificateAlias();
|
useralias = mProfile.getUserCertificateAlias();
|
||||||
alias = mProfile.getCertificateAlias();
|
alias = mProfile.getCertificateAlias();
|
||||||
getActionBar().setTitle(mProfile.getName());
|
getActionBar().setTitle(mProfile.getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user