Search in sources :

Example 51 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project philm by chrisbanes.

the class LoginFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_login, container, false);
    mUsername = (EditText) view.findViewById(R.id.edit_login);
    mUsername.setOnEditorActionListener(this);
    mPassword = (EditText) view.findViewById(R.id.edit_password);
    mPassword.setOnEditorActionListener(this);
    mLoginButton = (Button) view.findViewById(R.id.btn_submit);
    mLoginButton.setOnClickListener(this);
    mTypeRadioGroup = (RadioGroup) view.findViewById(R.id.rg_type);
    mTypeRadioGroup.setOnCheckedChangeListener(this);
    mEmailAutoComplete = (AutoCompleteTextView) view.findViewById(R.id.actv_email);
    mEmailAutoComplete.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            mEmailAutoComplete.showDropDown();
        }
    });
    mLoginRadioButton = (RadioButton) view.findViewById(R.id.rb_login);
    mCreateRadioButton = (RadioButton) view.findViewById(R.id.rb_create);
    mLoginRadioButton.setChecked(true);
    return view;
}
Also used : AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) View(android.view.View)

Example 52 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project GT by Tencent.

the class GTInputParamSetActivity method initAutoCompleteTV.

private void initAutoCompleteTV(ArrayList<String> vals, final AutoCompleteTextView auto) {
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.gt_drop_default_listitem, vals);
    auto.setDropDownBackgroundResource(R.drawable.btn_gray);
    auto.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            auto.showDropDown();
        }
    });
    auto.setText(vals.get(0));
    auto.setSelection(vals.get(0).length());
    auto.setAdapter(adapter);
    auto.setThreshold(1);
    auto.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (auto.getText().toString().equals("")) {
                btn_c.setVisibility(View.GONE);
            } else {
                btn_c.setVisibility(View.VISIBLE);
            }
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
    auto.setOnFocusChangeListener(new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            auto.showDropDown();
        }
    });
}
Also used : OnFocusChangeListener(android.view.View.OnFocusChangeListener) OnClickListener(android.view.View.OnClickListener) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) View(android.view.View) ArrayAdapter(android.widget.ArrayAdapter)

Example 53 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project GT by Tencent.

the class GTInputParamSetActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gt_inputparamset);
    TextView tv_cancel = (TextView) findViewById(R.id.tv_cancel_setinput);
    tv_cancel.setOnClickListener(cancel);
    TextView tv_finish = (TextView) findViewById(R.id.tv_finish_setinput);
    tv_finish.setOnClickListener(finish);
    Intent intent = getIntent();
    ip_name = intent.getStringExtra("ip_name");
    ip_client = intent.getStringExtra("ip_client");
    values = intent.getStringArrayListExtra("ip_values");
    // 将list转为linkedlist,队列类型去init autoTV
    ArrayList<String> linked_vals = new ArrayList<String>();
    for (int j = 0; j < values.size(); j++) {
        linked_vals.add(values.get(j));
    }
    TextView tv_ip_name = (TextView) findViewById(R.id.name_inputparam);
    tv_ip_name.setText(ip_name);
    autoTV = (AutoCompleteTextView) findViewById(R.id.autoTV_ipvalues);
    initAutoCompleteTV(linked_vals, autoTV);
    btn_c = (Button) findViewById(R.id.autoTV_cancel);
    btn_c.setOnClickListener(c);
}
Also used : ArrayList(java.util.ArrayList) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) Intent(android.content.Intent)

Example 54 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project actor-platform by actorapp.

the class SearchViewHacker method setText.

public static void setText(SearchView searchView, int color) {
    AutoCompleteTextView autoComplete = (AutoCompleteTextView) findView(searchView, "mQueryTextView");
    autoComplete.setTextColor(color);
// autoComplete.setHighlightColor(color);
}
Also used : AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 55 with AutoCompleteTextView

use of android.widget.AutoCompleteTextView in project Pokemap by omkarmoghe.

the class LoginActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mNianticManager = NianticManager.getInstance();
    mGoogleManager = GoogleManager.getInstance();
    mPref = new PokemapSharedPreferences(this);
    setContentView(R.layout.activity_login);
    mNianticAuthListener = new NianticManager.AuthListener() {

        @Override
        public void authSuccessful() {
            finishLogin();
        }

        @Override
        public void authFailed(String message, String provider) {
            switch(provider) {
                case LoginInfo.PROVIDER_PTC:
                    showPTCLoginFailed();
                    break;
                case LoginInfo.PROVIDER_GOOGLE:
                    showGoogleLoginFailed();
                    break;
            }
            Log.d(TAG, "authFailed() called with: message = [" + message + "]");
        }
    };
    mNianticLoginListener = new NianticManager.LoginListener() {

        @Override
        public void authSuccessful(String authToken) {
            Log.d(TAG, "authSuccessful() called with: authToken = [" + authToken + "]");
            PtcLoginInfo info = new PtcLoginInfo(authToken, mUsernameView.getText().toString(), mPasswordView.getText().toString());
            mPref.setLoginInfo(info);
            mNianticManager.setLoginInfo(LoginActivity.this, info, mNianticAuthListener);
        }

        @Override
        public void authFailed(String message) {
            Log.e(TAG, "Failed to authenticate. authFailed() called with: message = [" + message + "]");
            showPTCLoginFailed();
        }
    };
    mGoogleLoginListener = new GoogleManager.LoginListener() {

        @Override
        public void authSuccessful(String authToken, String refreshToken) {
            GoogleLoginInfo info = new GoogleLoginInfo(authToken, refreshToken);
            Log.d(TAG, "authSuccessful() called with: authToken = [" + authToken + "]");
            mPref.setLoginInfo(info);
            mNianticManager.setLoginInfo(LoginActivity.this, info, mNianticAuthListener);
        }

        @Override
        public void authFailed(String message) {
            Log.d(TAG, "Failed to authenticate. authFailed() called with: message = [" + message + "]");
            showGoogleLoginFailed();
        }

        @Override
        public void authRequested(GoogleService.AuthRequest body) {
        //Do nothing
        }
    };
    findViewById(R.id.txtDisclaimer).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            new AlertDialog.Builder(LoginActivity.this).setTitle(getString(R.string.login_warning_title)).setMessage(Html.fromHtml(getString(R.string.login_warning))).setPositiveButton(android.R.string.ok, null).show();
        }
    });
    // Set up the triggerAutoLogin form.
    mUsernameView = (AutoCompleteTextView) findViewById(R.id.username);
    mPasswordView = (EditText) findViewById(R.id.password);
    mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            if (id == R.id.login || id == EditorInfo.IME_NULL) {
                validatePTCLoginForm();
                return true;
            }
            return false;
        }
    });
    LoginInfo loginInfo = mPref.getLoginInfo();
    if (loginInfo != null && loginInfo instanceof PtcLoginInfo) {
        mUsernameView.setText(((PtcLoginInfo) loginInfo).getUsername());
        mPasswordView.setText(((PtcLoginInfo) loginInfo).getPassword());
    }
    Button signInButton = (Button) findViewById(R.id.email_sign_in_button);
    signInButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            validatePTCLoginForm();
        }
    });
    mLoginFormView = findViewById(R.id.login_form);
    mProgressView = findViewById(R.id.login_progress);
    SignInButton signInButtonGoogle = (SignInButton) findViewById(R.id.sign_in_button);
    signInButtonGoogle.setSize(SignInButton.SIZE_WIDE);
    signInButtonGoogle.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            GoogleAuthActivity.startForResult(LoginActivity.this, REQUEST_USER_AUTH);
        }
    });
    triggerAutoLogin();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) LoginInfo(com.omkarmoghe.pokemap.models.login.LoginInfo) PtcLoginInfo(com.omkarmoghe.pokemap.models.login.PtcLoginInfo) GoogleLoginInfo(com.omkarmoghe.pokemap.models.login.GoogleLoginInfo) PtcLoginInfo(com.omkarmoghe.pokemap.models.login.PtcLoginInfo) GoogleLoginInfo(com.omkarmoghe.pokemap.models.login.GoogleLoginInfo) PokemapSharedPreferences(com.omkarmoghe.pokemap.controllers.app_preferences.PokemapSharedPreferences) View(android.view.View) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) KeyEvent(android.view.KeyEvent) SignInButton(com.google.android.gms.common.SignInButton) NianticManager(com.omkarmoghe.pokemap.controllers.net.NianticManager) Button(android.widget.Button) SignInButton(com.google.android.gms.common.SignInButton) GoogleService(com.omkarmoghe.pokemap.controllers.net.GoogleService) OnClickListener(android.view.View.OnClickListener) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) GoogleManager(com.omkarmoghe.pokemap.controllers.net.GoogleManager)

Aggregations

AutoCompleteTextView (android.widget.AutoCompleteTextView)106 View (android.view.View)62 TextView (android.widget.TextView)44 ArrayAdapter (android.widget.ArrayAdapter)38 Button (android.widget.Button)27 EditText (android.widget.EditText)21 OnClickListener (android.view.View.OnClickListener)20 KeyEvent (android.view.KeyEvent)19 AdapterView (android.widget.AdapterView)17 Intent (android.content.Intent)16 ImageView (android.widget.ImageView)14 Editable (android.text.Editable)10 TextWatcher (android.text.TextWatcher)10 ArrayList (java.util.ArrayList)9 Dialog (android.app.Dialog)8 ListView (android.widget.ListView)8 Spinner (android.widget.Spinner)8 DialogInterface (android.content.DialogInterface)7 InputMethodManager (android.view.inputmethod.InputMethodManager)7 SuppressLint (android.annotation.SuppressLint)6