Search in sources :

Example 16 with OnEditorActionListener

use of android.widget.TextView.OnEditorActionListener in project AndroidChromium by JackyAndroid.

the class PassphraseDialogFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.sync_enter_passphrase, null);
    TextView promptText = (TextView) v.findViewById(R.id.prompt_text);
    promptText.setText(getPromptText());
    TextView resetText = (TextView) v.findViewById(R.id.reset_text);
    resetText.setText(getResetText());
    resetText.setMovementMethod(LinkMovementMethod.getInstance());
    resetText.setVisibility(View.VISIBLE);
    mVerifyingTextView = (TextView) v.findViewById(R.id.verifying);
    mPassphraseEditText = (EditText) v.findViewById(R.id.passphrase);
    mPassphraseEditText.setHint(R.string.sync_enter_custom_passphrase_hint);
    mPassphraseEditText.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                handleSubmit();
            }
            return false;
        }
    });
    // Create a new background Drawable for the passphrase EditText to use when the user has
    // entered an invalid potential password.
    // https://crbug.com/602943 was caused by modifying the Drawable from getBackground()
    // without taking a copy.
    mOriginalBackground = mPassphraseEditText.getBackground();
    mErrorBackground = mOriginalBackground.getConstantState().newDrawable();
    mErrorBackground.mutate().setColorFilter(ApiCompatibilityUtils.getColor(getResources(), R.color.input_underline_error_color), PorterDuff.Mode.SRC_IN);
    final AlertDialog d = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme).setView(v).setPositiveButton(R.string.submit, new Dialog.OnClickListener() {

        @Override
        public void onClick(DialogInterface d, int which) {
        // We override the onclick. This is a hack to not dismiss the dialog after
        // click of OK and instead dismiss it after confirming the passphrase
        // is correct.
        }
    }).setNegativeButton(R.string.cancel, this).setTitle(R.string.sign_in_google_account).create();
    d.getDelegate().setHandleNativeActionModesEnabled(false);
    d.setOnShowListener(new DialogInterface.OnShowListener() {

        @Override
        public void onShow(DialogInterface dialog) {
            Button b = d.getButton(AlertDialog.BUTTON_POSITIVE);
            b.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View view) {
                    handleSubmit();
                }
            });
        }
    });
    return d;
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) View(android.view.View) TextView(android.widget.TextView) KeyEvent(android.view.KeyEvent) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.content.DialogInterface.OnClickListener) TextView(android.widget.TextView) OnEditorActionListener(android.widget.TextView.OnEditorActionListener)

Example 17 with OnEditorActionListener

use of android.widget.TextView.OnEditorActionListener in project newsrob by marianokamp.

the class SubscribeFeedActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.subscribe_feed);
    progressMonitor = findViewById(R.id.progress);
    listView = (ListView) findViewById(R.id.discovered_feeds_list);
    empty = findViewById(R.id.empty);
    query = (EditText) findViewById(R.id.query);
    Button searchButton = (Button) findViewById(R.id.search_button);
    searchButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            initiateSearch();
        }
    });
    query.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            initiateSearch();
            return true;
        }
    });
    // TEXT & SUBJECT are available per se
    if (getIntent().hasExtra(Intent.EXTRA_TEXT)) {
        query.setText(getIntent().getStringExtra(Intent.EXTRA_TEXT));
        searchButton.performClick();
    }
}
Also used : KeyEvent(android.view.KeyEvent) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 18 with OnEditorActionListener

use of android.widget.TextView.OnEditorActionListener in project greenDAO by greenrobot.

the class NoteActivity method setUpViews.

protected void setUpViews() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerViewNotes);
    //noinspection ConstantConditions
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    notesAdapter = new NotesAdapter(noteClickListener);
    recyclerView.setAdapter(notesAdapter);
    addNoteButton = findViewById(R.id.buttonAdd);
    //noinspection ConstantConditions
    addNoteButton.setEnabled(false);
    editText = (EditText) findViewById(R.id.editTextNote);
    editText.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                addNote();
                return true;
            }
            return false;
        }
    });
    editText.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            boolean enable = s.length() != 0;
            addNoteButton.setEnabled(enable);
        }

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

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
}
Also used : KeyEvent(android.view.KeyEvent) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) RecyclerView(android.support.v7.widget.RecyclerView) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) TextView(android.widget.TextView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 19 with OnEditorActionListener

use of android.widget.TextView.OnEditorActionListener in project android-delicious by lexs.

the class LoginActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    usernameView = (EditText) findViewById(R.id.username);
    passwordView = (EditText) findViewById(R.id.password);
    // Enable user to press enter when done
    passwordView.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                handleLogin();
                return true;
            } else {
                return false;
            }
        }
    });
    View loginButton = findViewById(R.id.login);
    loginButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            handleLogin();
        }
    });
    errorDrawable = DeliciousApplication.getErrorDrawable();
    // Do we already have an account?
    if (DeliciousAccount.get(this) != null) {
        Toast.makeText(this, R.string.toast_account_exists, Toast.LENGTH_SHORT).show();
        finish();
    }
}
Also used : KeyEvent(android.view.KeyEvent) OnClickListener(android.view.View.OnClickListener) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView)

Example 20 with OnEditorActionListener

use of android.widget.TextView.OnEditorActionListener in project KeepScore by nolanlawson.

the class DialogHelper method showAdditionalDeltasDialog.

public static void showAdditionalDeltasDialog(boolean positive, final ResultListener<Integer> resultListener, final Context context) {
    LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = layoutInflater.inflate(R.layout.delta_popup, null);
    prepareDeltaView(view, context);
    final EditText editText = (EditText) view.findViewById(android.R.id.edit);
    // highlight by
    editText.setSelection(0, editText.getText().length());
    // default for
    // easier
    // deletion
    final AlertDialog adlg = new AlertDialog.Builder(context).setCancelable(true).setTitle(positive ? R.string.title_add : R.string.title_subtract).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (resultListener != null) {
                if (!doCalculation(editText))
                    return;
                int result = IntegerUtil.parseIntOrZero(editText.getText());
                resultListener.onResult(result);
            }
            dialog.dismiss();
        }
    }).setNeutralButton(R.string.button_customize, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            Intent intent = new Intent(context, SettingsActivity.class);
            intent.putExtra(SettingsActivity.EXTRA_SCROLL_TO_CONFIGURATIONS, true);
            context.startActivity(intent);
        }
    }).setNegativeButton(android.R.string.cancel, null).setView(view).create();
    editText.setOnEditorActionListener(new OnEditorActionListener() {

        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_UNSPECIFIED) {
                if (!doCalculation(editText))
                    return true;
                if (resultListener != null) {
                    int result = IntegerUtil.parseIntOrZero(editText.getText());
                    resultListener.onResult(result);
                }
                adlg.dismiss();
                return true;
            }
            return false;
        }
    });
    adlg.show();
}
Also used : EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) View(android.view.View) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) PlayerColorView(com.nolanlawson.keepscore.widget.PlayerColorView) KeyEvent(android.view.KeyEvent) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) OnEditorActionListener(android.widget.TextView.OnEditorActionListener) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView)

Aggregations

OnEditorActionListener (android.widget.TextView.OnEditorActionListener)37 KeyEvent (android.view.KeyEvent)32 TextView (android.widget.TextView)32 View (android.view.View)28 DialogInterface (android.content.DialogInterface)13 LayoutInflater (android.view.LayoutInflater)13 EditText (android.widget.EditText)13 OnClickListener (android.view.View.OnClickListener)12 AlertDialog (android.app.AlertDialog)11 Context (android.content.Context)11 OnClickListener (android.content.DialogInterface.OnClickListener)11 Intent (android.content.Intent)9 Test (org.junit.Test)6 ContentResolver (android.content.ContentResolver)5 Button (android.widget.Button)4 InjectView (roboguice.inject.InjectView)4 Handler (android.os.Handler)3 AlertDialog (android.support.v7.app.AlertDialog)3 InputMethodManager (android.view.inputmethod.InputMethodManager)3 AutoCompleteTextView (android.widget.AutoCompleteTextView)3