package com.hifivesoccer.activities;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;

import com.hifivesoccer.R;
import com.hifivesoccer.utils.ServerHandler;
import com.hifivesoccer.utils.SharedPref;
import com.hifivesoccer.utils.Token;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

public class SubscribeActivity extends AppActivity {
    private static final String TAG = SubscribeActivity.class.getSimpleName();

    private final Context context = this;
    private final ServerHandler server = ServerHandler.getInstance(context);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_subscribe);
    }

    public void toggleVisibility(View view) {

        EditText editText = (EditText) findViewById(R.id.act_subscribe_password);
        CheckBox checkBox = (CheckBox) findViewById(R.id.togglePasswordVisibility);

        int start = editText.getSelectionStart();
        int end = editText.getSelectionEnd();

        if (checkBox.isChecked()) {
            editText.setTransformationMethod(null);
        }
        else {
            editText.setTransformationMethod(new PasswordTransformationMethod());
        }

        editText.setSelection(start, end);
    }

    public void onClickSubscribe(View view) {

        final String username = getEditTextValue(R.id.act_subscribe_name);
        final String email = getEditTextValue(R.id.act_subscribe_email);
        final String password = getEditTextValue(R.id.act_subscribe_password);

        if (!email.isEmpty() && !password.isEmpty()) {

            JSONObject json = new JSONObject();
            try {
                json.put("email", email);
                json.put("username", username);
                json.put("password", password);
            } catch (JSONException e){
                Log.e(TAG, e.toString());
            }

            server.authenticate(json, (Activity) context);

        } else {
            Toast toast = Toast.makeText(this, R.string.from_empty, Toast.LENGTH_SHORT);
            toast.show();
        }

    }

    public void onClickLogin(View view) {

        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
        finish();

    }
}

@@ -1068,16 +1068,382 @@
 scribe);
+%0A%0A        // Auto-complete suggestions user account emails%0A        ArrayList%3CString%3E accountsEmails = getUserAccountEmail();%0A        setAutoCompleteText(R.id.act_subscribe_email, accountsEmails);%0A%0A        EditText passwordField = (EditText) findViewById(R.id.act_subscribe_password);%0A        passwordField.setTransformationMethod(new PasswordTransformationMethod());
 %0A    %7D%0A%0A

Make password field on signup activity hidden by default