Example usage for android.view.inputmethod EditorInfo IME_ACTION_UNSPECIFIED

List of usage examples for android.view.inputmethod EditorInfo IME_ACTION_UNSPECIFIED

Introduction

In this page you can find the example usage for android.view.inputmethod EditorInfo IME_ACTION_UNSPECIFIED.

Prototype

int IME_ACTION_UNSPECIFIED

To view the source code for android.view.inputmethod EditorInfo IME_ACTION_UNSPECIFIED.

Click Source Link

Document

Bits of #IME_MASK_ACTION : no specific action has been associated with this editor, let the editor come up with its own if it can.

Usage

From source file:com.wolkabout.hexiwear.view.Input.java

@AfterViews
void init() {//from   w ww . j a va  2s .  com
    setHint(hint);
    text.setCompoundDrawablesWithIntrinsicBounds(drawable, 0, 0, 0);
    text.setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxLength) });
    text.setInputType(type.flag);
    text.setTextColor(textColor);

    if (!TextUtils.isEmpty(defaultText)) {
        text.setText(defaultText);
    }

    if (type == Type.PASSWORD) {
        text.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }

    if (!TextUtils.isEmpty(actionLabel)) {
        text.setImeActionLabel(actionLabel, EditorInfo.IME_ACTION_UNSPECIFIED);
    }
}

From source file:com.maxleapmobile.gitmaster.ui.activity.SearchActivity.java

private void initToolBar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/*from w  ww.  ja va  2 s  .c  om*/
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    mSearchEdit = (EditText) findViewById(R.id.search);
    mSearchEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_UNSPECIFIED) {
                String keyWord = mSearchEdit.getText().toString();
                if (!keyWord.isEmpty()) {
                    mKeyWord = keyWord;
                    hideSoftKeyBoard(mSearchEdit);
                    performSearch();
                }
                return true;
            }
            return false;
        }
    });
}

From source file:org.xbmc.kore.ui.SendTextDialogFragment.java

/**
 * Create the dialog//from  w  ww. j  a v a  2s.c o m
 * @param savedInstanceState Saved state
 * @return Created dialog
 */
@Override
@SuppressWarnings("InflateParams")
public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    final String title = getArguments().getString(TITLE_KEY, getString(R.string.send_text));
    View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_send_text, null);

    textToSend = (EditText) dialogView.findViewById(R.id.text_to_send);
    finishAfterSend = (CheckBox) dialogView.findViewById(R.id.send_text_done);

    builder.setTitle(title).setView(dialogView)
            .setPositiveButton(R.string.send, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {

                    mListener.onSendTextFinished(textToSend.getText().toString(), finishAfterSend.isChecked());
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mListener.onSendTextCancel();
                }
            });

    final Dialog dialog = builder.create();
    textToSend.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            }
        }
    });
    textToSend.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                onSendTextFinished();
            } // handles enter key on external keyboard, issue #99
            else if (actionId == EditorInfo.IME_ACTION_UNSPECIFIED
                    && (event != null && event.getAction() == KeyEvent.ACTION_DOWN
                            && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
                onSendTextFinished();
            }
            dialog.dismiss();
            return false;
        }

        private void onSendTextFinished() {
            mListener.onSendTextFinished(textToSend.getText().toString(), finishAfterSend.isChecked());
        }
    });
    return dialog;
}

From source file:org.xbmc.kore.ui.generic.SendTextDialogFragment.java

/**
 * Create the dialog//from   ww  w.ja  va  2 s  .  co m
 * @param savedInstanceState Saved state
 * @return Created dialog
 */
@NonNull
@Override
@SuppressWarnings("InflateParams")
public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    final String title = getArguments().getString(TITLE_KEY, getString(R.string.send_text));
    View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_send_text, null);

    textToSend = (EditText) dialogView.findViewById(R.id.text_to_send);
    finishAfterSend = (CheckBox) dialogView.findViewById(R.id.send_text_done);

    builder.setTitle(title).setView(dialogView)
            .setPositiveButton(R.string.send, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {

                    mListener.onSendTextFinished(textToSend.getText().toString(), finishAfterSend.isChecked());
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mListener.onSendTextCancel();
                }
            });

    final Dialog dialog = builder.create();
    textToSend.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            }
        }
    });
    textToSend.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                onSendTextFinished();
            } // handles enter key on external keyboard, issue #99
            else if (actionId == EditorInfo.IME_ACTION_UNSPECIFIED
                    && (event != null && event.getAction() == KeyEvent.ACTION_DOWN
                            && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
                onSendTextFinished();
            }
            dialog.dismiss();
            return false;
        }

        private void onSendTextFinished() {
            mListener.onSendTextFinished(textToSend.getText().toString(), finishAfterSend.isChecked());
        }
    });
    return dialog;
}

From source file:com.popdeem.sdk.uikit.fragment.PDUITagFriendsFragment.java

@Nullable
@Override//  ww  w.ja v a2s.c  om
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_pd_tag_friends, container, false);

    mTaggedNames = getArguments().getStringArrayList("names");
    mTaggedIds = getArguments().getStringArrayList("ids");

    mProgress = (ProgressBar) view.findViewById(R.id.pd_progress_bar);
    mTaggedFriendsTextView = (TextView) view.findViewById(R.id.pd_tagged_friends_text_view);

    view.findViewById(R.id.pd_tagged_friends_text_view).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mConfirmCallback.taggedFriendsUpdated(mTaggedNames, mTaggedIds);
            getActivity().getSupportFragmentManager().popBackStack(PDUITagFriendsFragment.class.getSimpleName(),
                    FragmentManager.POP_BACK_STACK_INCLUSIVE);
        }
    });

    final EditText searchEditText = (EditText) view.findViewById(R.id.pd_tag_friends_search_edit_text);
    searchEditText.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) {
            mAdapter.getFilter().filter(s);
        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    });
    searchEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_UNSPECIFIED) {
                PDUIUtils.hideKeyboard(getActivity(), searchEditText);
                return true;
            }
            return false;
        }
    });

    mAdapter = new PDUITaggableFriendsListViewAdapter(getActivity(), R.layout.item_pd_taggable_friend, friends);
    mAdapter.setCallback(mFriendsCheckBoxChangedCallback);

    ListView listView = (ListView) view.findViewById(R.id.pd_tag_friends_list_view);
    listView.setAdapter(mAdapter);

    updateTaggedFriendsButton();
    makeTaggableFriendsRequest();

    return view;
}

From source file:com.mozilla.simplepush.simplepushdemoapp.MainActivity.java

/** Initialize the app from the saved state
 *
 * @param savedInstanceState The previously stored instance
 *//*from   w w w.  j  a va2  s . c  o  m*/
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Properties config;
    try {
        config = loadProperties();
        SENDER_ID = config.getProperty("sender_id");
        if (SENDER_ID == null) {
            Log.e(TAG, "sender_id not definied in configuration file. Aborting");
            return;
        }
    } catch (IOException x) {
        Log.e(TAG, "Could not load properties");
        return;
    }
    setContentView(R.layout.activity_main);

    // Set the convenience globals.
    mDisplay = (TextView) findViewById(R.id.display);
    hostUrl = (EditText) findViewById(R.id.host_edit);
    pingData = (EditText) findViewById(R.id.message);
    sendButton = (Button) findViewById(R.id.send);
    connectButton = (Button) findViewById(R.id.connect);

    context = getApplicationContext();
    // Check that GCM is available on this device.
    if (checkPlayServices()) {
        gcm = GoogleCloudMessaging.getInstance(this);
        regid = getRegistrationId(context);
    } else {
        Log.i(TAG, "No valid Google Play Services APK found");
    }

    // detect the "enter/submit" key for the editor views.
    hostUrl.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            // yes, be very careful about this, else you can send multiple actions.
            if (actionId == EditorInfo.IME_ACTION_SEND || (actionId == EditorInfo.IME_ACTION_UNSPECIFIED
                    && event.getKeyCode() == KeyEvent.KEYCODE_ENTER
                    && event.getAction() == KeyEvent.ACTION_DOWN)) {
                registerInBackground();
                handled = true;
            }
            return handled;
        }
    });

    pingData.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_SEND || (actionId == EditorInfo.IME_ACTION_UNSPECIFIED
                    && event.getKeyCode() == KeyEvent.KEYCODE_ENTER
                    && event.getAction() == KeyEvent.ACTION_DOWN)) {
                SendNotification(getMessage());
                handled = true;
            }
            return handled;
        }
    });
}

From source file:com.doodle.android.chips.ChipsView.java

private void init() {
    mDensity = getResources().getDisplayMetrics().density;

    mChipsContainer = new RelativeLayout(getContext());
    addView(mChipsContainer);//from ww  w  .  jav a2 s.  co m

    // Dummy item to prevent AutoCompleteTextView from receiving focus
    LinearLayout linearLayout = new LinearLayout(getContext());
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(0, 0);
    linearLayout.setLayoutParams(params);
    linearLayout.setFocusable(true);
    linearLayout.setFocusableInTouchMode(true);

    mChipsContainer.addView(linearLayout);

    mEditText = new ChipsEditText(getContext(), this);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.topMargin = (int) (SPACING_TOP * mDensity);
    layoutParams.bottomMargin = (int) (SPACING_BOTTOM * mDensity) + mVerticalSpacing;
    mEditText.setLayoutParams(layoutParams);
    mEditText.setMinHeight((int) (CHIP_HEIGHT * mDensity));
    mEditText.setPadding(0, 0, 0, 0);
    mEditText.setLineSpacing(mVerticalSpacing, (CHIP_HEIGHT * mDensity) / mEditText.getLineHeight());
    mEditText.setBackgroundColor(Color.argb(0, 0, 0, 0));
    mEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_UNSPECIFIED);
    mEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
            | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    mEditText.setHint(mChipsHintText);

    mChipsContainer.addView(mEditText);

    mRootChipsLayout = new ChipsVerticalLinearLayout(getContext(), mVerticalSpacing);
    mRootChipsLayout.setOrientation(LinearLayout.VERTICAL);
    mRootChipsLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    mRootChipsLayout.setPadding(0, (int) (SPACING_TOP * mDensity), 0, 0);
    mChipsContainer.addView(mRootChipsLayout);

    initListener();

    if (isInEditMode()) {
        // preview chips
        LinearLayout editModeLinLayout = new LinearLayout(getContext());
        editModeLinLayout.setOrientation(LinearLayout.HORIZONTAL);
        mChipsContainer.addView(editModeLinLayout);

        View view = new Chip("Test Chip", null, new Contact(null, null, "Test", "asd@asd.de", null)).getView();
        view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        editModeLinLayout.addView(view);

        View view2 = new Chip("Indelible", null, new Contact(null, null, "Test", "asd@asd.de", null), true)
                .getView();
        view2.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        editModeLinLayout.addView(view2);
    }
}

From source file:com.waz.zclient.ui.cursor.CursorLayout.java

/**
 * EditText callback when user sent text.
 *///from   w ww .j a  va2 s .com
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_SEND || (actionId != EditorInfo.IME_ACTION_UNSPECIFIED
            && event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER
            && event.getAction() == KeyEvent.ACTION_DOWN)) {

        if (isEditingMessage()) {
            onApproveEditMessage();
            return true;
        }

        String sendText = textView.getText().toString();
        if (TextUtils.isEmpty(sendText)) {
            return false;
        }
        if (cursorCallback != null) {
            cursorCallback.onMessageSubmitted(sendText);
        }
        return true;
    }
    return false;
}

From source file:com.rong.xposed.headsoff.PerAppWhiteList.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    boolean handled = false;

    if (EditorInfo.IME_ACTION_DONE == actionId || EditorInfo.IME_ACTION_UNSPECIFIED == actionId) {
        onClick(btnAdd);//from   w ww.j a  va2 s  .com
        handled = true;
    }

    return handled;
}

From source file:com.ccxt.whl.activity.ChatActivity.java

/**
 * initView//w w w  . j  a  v a 2  s  .c om
 */
protected void initView() {
    recordingContainer = findViewById(R.id.recording_container);
    micImage = (ImageView) findViewById(R.id.mic_image);
    recordingHint = (TextView) findViewById(R.id.recording_hint);
    listView = (ListView) findViewById(R.id.list);
    mEditTextContent = (PasteEditText) findViewById(R.id.et_sendmessage);
    buttonSetModeKeyboard = findViewById(R.id.btn_set_mode_keyboard);
    edittext_layout = (RelativeLayout) findViewById(R.id.edittext_layout);
    buttonSetModeVoice = findViewById(R.id.btn_set_mode_voice);
    buttonSend = findViewById(R.id.btn_send);
    buttonPressToSpeak = findViewById(R.id.btn_press_to_speak);
    expressionViewpager = (ViewPager) findViewById(R.id.vPager);
    expressionContainer = (LinearLayout) findViewById(R.id.ll_face_container);
    btnContainer = (LinearLayout) findViewById(R.id.ll_btn_container);
    locationImgview = (ImageView) findViewById(R.id.btn_location);
    iv_emoticons_normal = (ImageView) findViewById(R.id.iv_emoticons_normal);
    iv_emoticons_checked = (ImageView) findViewById(R.id.iv_emoticons_checked);
    loadmorePB = (ProgressBar) findViewById(R.id.pb_load_more);
    btnMore = (Button) findViewById(R.id.btn_more);
    iv_emoticons_normal.setVisibility(View.VISIBLE);
    iv_emoticons_checked.setVisibility(View.INVISIBLE);
    more = findViewById(R.id.more);
    edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_normal);

    // ?,
    micImages = new Drawable[] { getResources().getDrawable(R.drawable.record_animate_01),
            getResources().getDrawable(R.drawable.record_animate_02),
            getResources().getDrawable(R.drawable.record_animate_03),
            getResources().getDrawable(R.drawable.record_animate_04),
            getResources().getDrawable(R.drawable.record_animate_05),
            getResources().getDrawable(R.drawable.record_animate_06),
            getResources().getDrawable(R.drawable.record_animate_07),
            getResources().getDrawable(R.drawable.record_animate_08),
            getResources().getDrawable(R.drawable.record_animate_09),
            getResources().getDrawable(R.drawable.record_animate_10),
            getResources().getDrawable(R.drawable.record_animate_11),
            getResources().getDrawable(R.drawable.record_animate_12),
            getResources().getDrawable(R.drawable.record_animate_13),
            getResources().getDrawable(R.drawable.record_animate_14), };
    // list
    reslist = getExpressionRes(35);
    // ?viewpager
    List<View> views = new ArrayList<View>();
    View gv1 = getGridChildView(1);
    View gv2 = getGridChildView(2);
    views.add(gv1);
    views.add(gv2);
    expressionViewpager.setAdapter(new ExpressionPagerAdapter(views));
    edittext_layout.requestFocus();
    voiceRecorder = new VoiceRecorder(micImageHandler);
    buttonPressToSpeak.setOnTouchListener(new PressToSpeakListen());
    mEditTextContent.setOnFocusChangeListener(new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_active);
            } else {
                edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_normal);
            }

        }
    });
    mEditTextContent.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            edittext_layout.setBackgroundResource(R.drawable.input_bar_bg_active);
            more.setVisibility(View.GONE);
            iv_emoticons_normal.setVisibility(View.VISIBLE);
            iv_emoticons_checked.setVisibility(View.INVISIBLE);
            expressionContainer.setVisibility(View.GONE);
            btnContainer.setVisibility(View.GONE);
        }
    });
    // ?
    mEditTextContent.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (!TextUtils.isEmpty(s)) {
                btnMore.setVisibility(View.GONE);
                buttonSend.setVisibility(View.VISIBLE);
            } else {
                btnMore.setVisibility(View.VISIBLE);
                buttonSend.setVisibility(View.GONE);
            }
        }

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

        @Override
        public void afterTextChanged(Editable s) {

        }
    });
    AseoZdpAseo.initType(this, AseoZdpAseo.SCREEN_TYPE);
    mEditTextContent.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
            // TODO Auto-generated method stub
            if (arg1 == EditorInfo.IME_ACTION_UNSPECIFIED) {
                //String s = mEditTextContent.getText().toString();
                //sendText(s);
                //mEditTextContent.setText("");
                //Toast.makeText(ChatActivity.this, "", Toast.LENGTH_SHORT).show();
            }

            return false;
        }

    });

}