android: Move profile name field to the bottom and use server address as hint
[strongswan.git] / src / frontends / android / app / src / main / java / org / strongswan / android / ui / VpnProfileDetailActivity.java
index bcc226b..9271191 100644 (file)
@@ -29,7 +29,10 @@ import android.security.KeyChainException;
 import android.support.v7.app.AlertDialog;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.app.AppCompatDialogFragment;
+import android.text.Editable;
 import android.text.Html;
+import android.text.TextUtils;
+import android.text.TextWatcher;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -124,6 +127,26 @@ public class VpnProfileDetailActivity extends AppCompatActivity
                mBlockIPv4 = (CheckBox)findViewById(R.id.split_tunneling_v4);
                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() {
                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id)