android: Move profile name field to the bottom and use server address as hint

This commit is contained in:
Tobias Brunner
2016-05-02 18:39:17 +02:00
parent 4a58ec24fd
commit fd23ed8cf3
2 changed files with 41 additions and 16 deletions
@@ -29,7 +29,10 @@ import android.security.KeyChainException;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDialogFragment; import android.support.v7.app.AppCompatDialogFragment;
import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@@ -124,6 +127,26 @@ public class VpnProfileDetailActivity extends AppCompatActivity
mBlockIPv4 = (CheckBox)findViewById(R.id.split_tunneling_v4); mBlockIPv4 = (CheckBox)findViewById(R.id.split_tunneling_v4);
mBlockIPv6 = (CheckBox)findViewById(R.id.split_tunneling_v6); mBlockIPv6 = (CheckBox)findViewById(R.id.split_tunneling_v6);
mGateway.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
if (TextUtils.isEmpty(mGateway.getText()))
{
mName.setHint(R.string.profile_name_hint);
}
else
{
mName.setHint("(" + mGateway.getText() + ")");
}
}
});
mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() { mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2012-2015 Tobias Brunner Copyright (C) 2012-2016 Tobias Brunner
Copyright (C) 2012 Giuliano Grassi Copyright (C) 2012 Giuliano Grassi
Copyright (C) 2012 Ralf Sager Copyright (C) 2012 Ralf Sager
Hochschule fuer Technik Rapperswil HSR Hochschule fuer Technik Rapperswil
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
@@ -25,20 +25,6 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="10dp" > android:padding="10dp" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/profile_name_label" />
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="textNoSuggestions"
android:hint="@string/profile_name_hint" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -139,10 +125,25 @@
android:id="@+id/select_certificate" android:id="@+id/select_certificate"
layout="@layout/two_line_button" /> layout="@layout/two_line_button" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/profile_name_label" />
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="textNoSuggestions"
android:hint="@string/profile_use_server_hint" />
<CheckBox <CheckBox
android:id="@+id/show_advanced" android:id="@+id/show_advanced"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/profile_show_advanced_label" /> android:text="@string/profile_show_advanced_label" />
<LinearLayout <LinearLayout
@@ -198,6 +199,7 @@
android:text="@string/profile_split_tunnelingv6_title" /> android:text="@string/profile_split_tunnelingv6_title" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>