android.widget.EditText#setOnClickListener ( )源码实例Demo

下面列出了android.widget.EditText#setOnClickListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: styT   文件: MeiziActivity.java
private void initView() {

        editText = (EditText) findViewById(R.id.mainEditText10);
        listView = (ListView) findViewById(R.id.api_id_views_listview);
        itemAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_activated_1, ContantValue.viewItem);
        listView.setAdapter(itemAdapter);
        listView.setOnItemClickListener(this);

        editText.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String comment = editText.getText().toString().trim();
                if (TextUtils.isEmpty(comment)) {
                    //a.setError("内容不能为空");
                    return;
                }

                ToastUtil.show(MeiziActivity.this, "复制成功", Toast.LENGTH_SHORT);
                ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                manager.setText(comment);
            }
        });
    }
 
源代码2 项目: letv   文件: BasicActivity.java
protected void beautyEditText(final EditText mEditText, String hintStr, TextWatcher mTextWatcher) {
    mEditText.setHint(hintStr);
    mEditText.setHintTextColor(Color.parseColor("#1e0d0d0d"));
    mEditText.setTextColor(Color.parseColor("#0d0d0d"));
    SDKUtils.setBackground(mEditText, this.crMgmt.getDrawable("uac_input", true));
    mEditText.setTextSize(16.0f);
    if (mTextWatcher != null) {
        mEditText.addTextChangedListener(mTextWatcher);
    }
    mEditText.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mEditText.setSelection(mEditText.length());
            mEditText.requestFocus();
            mEditText.setFocusable(true);
        }
    });
}
 
源代码3 项目: talk-android   文件: MaterialSearchView.java
private void initiateView() {
    LayoutInflater.from(mContext).inflate(R.layout.search_view, this, true);
    mSearchLayout = findViewById(R.id.search_layout);

    mSearchTopBar = (RelativeLayout) mSearchLayout.findViewById(R.id.search_top_bar);
    mSuggestionsListView = (ListView) mSearchLayout.findViewById(R.id.suggestion_list);
    mSearchSrcTextView = (EditText) mSearchLayout.findViewById(R.id.searchTextView);
    mBackBtn = (ImageButton) mSearchLayout.findViewById(R.id.action_up_btn);
    mEmptyBtn = (ImageButton) mSearchLayout.findViewById(R.id.action_empty_btn);
    mTintView = mSearchLayout.findViewById(R.id.transparent_view);

    mSearchSrcTextView.setOnClickListener(mOnClickListener);
    mBackBtn.setOnClickListener(mOnClickListener);
    mEmptyBtn.setOnClickListener(mOnClickListener);
    mTintView.setOnClickListener(mOnClickListener);

    allowVoiceSearch = false;

    initSearchView();

    mSuggestionsListView.setVisibility(GONE);
}
 
源代码4 项目: DynamicCalendar   文件: BasicActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_basic);
    mImageGenerator = new ImageGenerator(this);
    mDateEditText = (EditText) findViewById(R.id.txtDateEntered);
    mDisplayGeneratedImage = (ImageView) findViewById(R.id.imgGenerated);

    mImageGenerator.setIconSize(50, 50);
    mImageGenerator.setDateSize(30);
    mImageGenerator.setMonthSize(10);

    mImageGenerator.setDatePosition(42);
    mImageGenerator.setMonthPosition(14);

    mImageGenerator.setDateColor(Color.parseColor("#3c6eaf"));
    mImageGenerator.setMonthColor(Color.WHITE);

    mImageGenerator.setStorageToSDCard(true);

    // Pop up Date picker on pressing the editText
    mDateEditText.setOnClickListener(setDate);


}
 
源代码5 项目: restcomm-android-sdk   文件: MessageActivity.java
@Override
protected void onCreate(Bundle savedInstanceState)
{
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_message);

   Toolbar toolbar = (Toolbar) findViewById(R.id.message_toolbar);
   setSupportActionBar(toolbar);
   toolbar.setTitle(getTitle());

   ActionBar actionBar = getSupportActionBar();
   if (actionBar != null) {
      // Show the Up button in the action bar.
      actionBar.setDisplayHomeAsUpEnabled(true);
   }

   listFragment = (MessageFragment) getSupportFragmentManager().findFragmentById(R.id.message_list);

   alertDialog = new AlertDialog.Builder(MessageActivity.this, R.style.SimpleAlertStyle).create();

   btnSend = (ImageButton) findViewById(R.id.button_send);
   btnSend.setOnClickListener(this);
   txtMessage = (EditText) findViewById(R.id.text_message);
   txtMessage.setOnClickListener(this);
   lblOngoingCall = findViewById(R.id.resume_call);
   lblOngoingCall.setOnClickListener(this);

   fullPeer = getIntent().getStringExtra(RCDevice.EXTRA_DID);
   // keep on note of the current peer we are texting with
   currentPeer = getIntent().getStringExtra(RCDevice.EXTRA_DID).replaceAll("^sip.?:", "").replaceAll("@.*$", "");
   setTitle(currentPeer);
}
 
源代码6 项目: SearchPreference   文件: SearchPreference.java
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    EditText searchText = (EditText) holder.findViewById(R.id.search);
    searchText.setFocusable(false);
    searchText.setInputType(InputType.TYPE_NULL);
    searchText.setOnClickListener(this);

    if (hint != null) {
        searchText.setHint(hint);
    }

    holder.findViewById(R.id.search_card).setOnClickListener(this);
    holder.itemView.setOnClickListener(this);
    holder.itemView.setBackgroundColor(0x0);
}
 
源代码7 项目: SSForms   文件: FormAdapter.java
private void setDatePickerInputLayout(final EditText editText, final int position, final LinearLayout layoutRow) {
    editText.setFocusableInTouchMode(false);

    editText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            editText.requestFocus();
            InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
        }
    });

    layoutRow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            clickedPosition = position;
            DatePickerDialog datePickerDialog = new DatePickerDialog(mContext,
                    date,
                    mCalendarCurrentDate.get(Calendar.YEAR),
                    mCalendarCurrentDate.get(Calendar.MONTH),
                    mCalendarCurrentDate.get(Calendar.DAY_OF_MONTH));

            // this could be used to set a minimum date
            // datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);

            // display the picker
            datePickerDialog.show();
        }
    });

}
 
源代码8 项目: AssistantBySDK   文件: RealTimeUpdateSearchBox.java
private void init(AttributeSet attrs, int defStyle) {
    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(
            attrs, R.styleable.lingju, defStyle, 0);
    LayoutInflater.from(getContext()).inflate(R.layout.search_online_box, this);
    mLlRoot = findViewById(R.id.ll_root);
    edit = (EditText) findViewById(R.id.sob_search_edit);
    stateBt = (ImageButton) findViewById(R.id.sob_state_bt);
    animate = AnimationUtils.loadAnimation(getContext(), R.anim.start_up_loading);
    animate.setInterpolator(new LinearInterpolator());
    drawable = (LevelListDrawable) stateBt.getDrawable();
    edit.addTextChangedListener(searhWatcher);
    edit.setOnEditorActionListener(editorActionListener);
    edit.setOnClickListener(editorClickListener);
    stateBt.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (stateBt.getVisibility() == View.VISIBLE && drawable.getLevel() == 1) {
                edit.setText("");
                stateBt.setVisibility(View.INVISIBLE);
            }
        }
    });
    edit.setHint(a.getString(R.styleable.lingju_hint));
    // edit.setHintTextColor(getResources().getColor(R.color.navi_search_box_color));
    edit.setHintTextColor(a.getColor(R.styleable.lingju_hintColor, getResources().getColor(R.color.navi_search_box_color)));
    edit.setTextColor(a.getColor(R.styleable.lingju_textColor, getResources().getColor(R.color.ksw_md_solid_disable)));
    mLlRoot.setBackgroundColor(a.getColor(R.styleable.lingju_search_background, getResources().getColor(R.color.green_style)));
    //edit.setTextSize(a.getFloat(com.android.internal.R.styleable.TextView_textSize,12));

    a.recycle();
}
 
源代码9 项目: DynamicCalendar   文件: TypeFaceActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_type_face);
    mImageGenerator = new ImageGenerator(this);
    mDateEditText = (EditText) findViewById(R.id.txtDateEntered);
    mDisplayGeneratedImage = (ImageView) findViewById(R.id.imgGenerated);

    mImageGenerator.setIconSize(50, 50);
    mImageGenerator.setDateSize(30);
    mImageGenerator.setMonthSize(10);

    mImageGenerator.setDatePosition(42);
    mImageGenerator.setMonthPosition(14);

    mImageGenerator.setDateColor(Color.parseColor("#009688"));
    mImageGenerator.setMonthColor(Color.WHITE);

    mImageGenerator.setStorageToSDCard(true);

    mImageGenerator.setDateTypeFace("Roboto-Light.ttf");
    mImageGenerator.setMonthTypeFace("Ubuntu-R.ttf");

    // Pop up Date picker on pressing the editText
    mDateEditText.setOnClickListener(setDate);


}
 
源代码10 项目: Color-picker-library   文件: editsUtils.java
static void initializeEditTextTouchListeners(EditText... editTexts) {

        for (final EditText edt : editTexts) {
            edt.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {

                    edt.getText().clear();
                }
            });
        }
    }
 
源代码11 项目: CoolChat   文件: ChatActivity.java
private void initViews() {
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    LinearLayoutManager layoutManager = new LinearLayoutManager(ChatActivity.this);
    //layoutManager.setStackFromEnd(true);
    recyclerView.setLayoutManager(layoutManager);
    adapter = new ChatAdapter(ChatActivity.this, chatListData);
    recyclerView.setAdapter(adapter);
    edit_input = (EditText) findViewById(R.id.edit_input);
    edit_input.addTextChangedListener(textWatcher);
    edit_input.setOnClickListener(this);
    text_unread_msg = (TextView) findViewById(R.id.text_unread_msg);

    layout_multi = (LinearLayout) findViewById(R.id.layout_multi);
    imgbtn_send = (ImageButton) findViewById(R.id.imgbtn_send);
    imgbtn_send.setClickable(false);

    checkbox_audio = (CheckBox) findViewById(R.id.checkbox_audio);
    checkbox_emoji = (CheckBox) findViewById(R.id.checkbox_emoji);
    checkbox_gallery = (CheckBox) findViewById(R.id.checkbox_gallery);
    checkbox_video = (CheckBox) findViewById(R.id.checkbox_video);
    checkbox_more = (CheckBox) findViewById(R.id.checkbox_more);

    checkbox_audio.setOnCheckedChangeListener(this);
    checkbox_emoji.setOnCheckedChangeListener(this);
    checkbox_video.setOnCheckedChangeListener(this);
    checkbox_gallery.setOnCheckedChangeListener(this);
    checkbox_more.setOnCheckedChangeListener(this);

    text_unread_msg.setOnClickListener(this);
    imgbtn_send.setOnClickListener(this);

    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            initMoreChatData(chatType, chatId);
        }
    });
}
 
源代码12 项目: LLApp   文件: SearchView.java
private void initViews() {
    etInput = (EditText) findViewById(R.id.search_et_input);
    ivDelete = (ImageView) findViewById(R.id.search_iv_delete);
    btnBack = (Button) findViewById(R.id.search_btn_back);
    lvTips = (ListView) findViewById(R.id.search_lv_tips);

    lvTips.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            //set edit text
            String text = lvTips.getAdapter().getItem(i).toString();
            etInput.setText(text);
            etInput.setSelection(text.length());
            //hint list view gone and result list view show
            lvTips.setVisibility(View.GONE);
            notifyStartSearching(text);
        }
    });

    ivDelete.setOnClickListener(this);
    btnBack.setOnClickListener(this);

    etInput.addTextChangedListener(new EditChangedListener());
    etInput.setOnClickListener(this);
    etInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                lvTips.setVisibility(GONE);
                notifyStartSearching(etInput.getText().toString());
            }
            return true;
        }
    });
}
 
源代码13 项目: android-credentials   文件: PhoneNumberActivity.java
PhoneNumberUi(View root, String activityTitle) {
    title = (TextView) root.findViewById(R.id.phone_number_title);
    phoneField = (EditText) root.findViewById(R.id.phone_number_field);
    submit = (Button) root.findViewById(R.id.phone_number_submit);
    phoneFocus = new FocusControl(phoneField);

    title.setText(activityTitle);
    submit.setOnClickListener(this);
    phoneField.setOnClickListener(this);
    setSubmitEnabled(true);
}
 
源代码14 项目: test-samples   文件: HY_Hybrid.java
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.hy_layout);

    inputMethodManager = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);

    fl_urlPanel = (FrameLayout) findViewById(R.id.hy_fl_urlPanel);
    wv_webView = (WebView) findViewById(R.id.hy_wv_webview);
    pb_loading = (ProgressBar) findViewById(R.id.hy_pb_loading);
    et_url = (EditText) findViewById(R.id.hy_et_url);
    ib_loadUrl = (ImageButton) findViewById(R.id.hy_ib_loadUrl);
    ib_navigateBackward = (ImageButton) findViewById(R.id.hy_ib_navigateBack);
    ib_navigateForward = (ImageButton) findViewById(R.id.hy_ib_navigateForward);

    et_url.setOnClickListener(this);
    ib_loadUrl.setOnClickListener(this);
    ib_navigateBackward.setOnClickListener(this);
    ib_navigateForward.setOnClickListener(this);

    et_url.setOnFocusChangeListener(this.onFocusChangeListener);

    // setting WebView
    {
        WebSettings webSettings = wv_webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        wv_webView.setWebViewClient(this.webViewClient);
    }

    // enable WebView debugging - for Appium to be able to switch to WebView context
    setWebContentsDebuggingEnabled(true);

    // don't auto-pop keyboard
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    // setting presets
    setNavigationButtons();

    ib_loadUrl.performClick();

}
 
源代码15 项目: commcare-android   文件: StringWidget.java
public StringWidget(Context context, FormEntryPrompt prompt, boolean secret, boolean inCompactGroup) {
    super(context, prompt, inCompactGroup);
    mAnswer = (EditText)LayoutInflater.from(getContext()).inflate(getAnswerLayout(), this, false);
    mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontSize);
    mAnswer.setOnClickListener(this);

    mAnswer.addTextChangedListener(this);

    //Let's see if we can figure out a constraint for this string
    try {
        addAnswerFilter(new InputFilter.LengthFilter(guessMaxStringLength(prompt)));
    } catch (UnpivotableExpressionException e) {
        //expected if there isn't a constraint that does this
    }

    this.secret = secret;

    if (!secret) {
        // capitalize the first letter of the sentence
        mAnswer.setKeyListener(new TextKeyListener(Capitalize.SENTENCES, false));
    }
    setTextInputType(mAnswer);

    if (!secret) {
        mAnswer.setSingleLine(false);
    }

    if (prompt != null) {
        mReadOnly = prompt.isReadOnly();
        IAnswerData value = prompt.getAnswerValue();
        if (value != null) {
            mAnswer.setText(value.getDisplayText());
        }

        if (mReadOnly) {
            if (value == null) {
                mAnswer.setText("---");
            }
            mAnswer.setBackgroundDrawable(null);
            mAnswer.setFocusable(false);
            mAnswer.setClickable(false);
        }
    }

    if (isInCompactMode()) {
        addToCompactLayout(mAnswer);
    } else {
        addView(mAnswer);
    }
}
 
源代码16 项目: odyssey   文件: SaveDialog.java
/**
 * Create the dialog to save an object of the current type.
 */
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    // read arguments to identify type of the object which should be saved
    Bundle mArgs = getArguments();
    final OBJECTTYPE type = OBJECTTYPE.values()[mArgs.getInt(ARG_OBJECTTYPE)];

    String dialogTitle = "";
    String editTextDefaultTitle = "";

    if (type != null) {
        // set textfield titles according to type
        switch (type) {
            case PLAYLIST:
                dialogTitle = getString(R.string.dialog_save_playlist);
                editTextDefaultTitle = getString(R.string.default_playlist_title);
                break;
            case BOOKMARK:
                dialogTitle = getString(R.string.dialog_create_bookmark);
                editTextDefaultTitle = getString(R.string.default_bookmark_title);
                break;
        }
    }

    // create edit text for title
    final EditText editTextTitle = new EditText(builder.getContext());
    editTextTitle.setText(editTextDefaultTitle);
    // Add a listener that just removes the text on first clicking
    editTextTitle.setOnClickListener(v -> {
        if (!mFirstClick) {
            editTextTitle.setText("");
            mFirstClick = true;
        }
    });
    builder.setView(editTextTitle);

    builder.setMessage(dialogTitle).setPositiveButton(R.string.dialog_action_save, (dialog, id) -> {
        // accept title and call callback method
        String objectTitle = editTextTitle.getText().toString();
        mSaveCallback.onSaveObject(objectTitle, type);
    }).setNegativeButton(R.string.dialog_action_cancel, (dialog, id) -> {
        // User cancelled the dialog dont save object
        getDialog().cancel();
    });
    // Create the AlertDialog object and return it
    return builder.create();
}
 
源代码17 项目: fake-call-lollipop   文件: ScheduleCallActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_schedule_call);

    callType = (RadioGroup)findViewById(R.id.callTypeRadioGroup);

    voiceInput = (EditText)findViewById(R.id.voiceFileInput);

    voiceInput.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

            intent.setType("audio/*");

            startActivityForResult(intent, FILE_SELECT);

        }
    });

}
 
源代码18 项目: MaterialQQLite   文件: ChatActivity.java
@SuppressLint("NewApi")
    private void initView() {
    //    m_txtName = (TextView)findViewById(R.id.chat_txtName);
        m_lvMsg = (ListView)findViewById(R.id.chat_lvMsg);
        swipeRefreshLayout_chat= (PullRefreshLayout) findViewById(R.id.swipeRefreshLayout_chat);
        m_btnFace = (ImageButton)findViewById(R.id.chat_btnFace);
    //    m_btnMore = (ImageButton)findViewById(R.id.chat_btnMore);
        m_edtMsg = (EditText) findViewById(R.id.chat_edtMsg);
        m_btnSend = (Button) findViewById(R.id.chat_btnSend);
        m_faceBar = findViewById(R.id.chat_facebar);
        m_vpFace = (ViewPager)findViewById(R.id.chat_vpFace);
        m_dotBar = (LinearLayout) findViewById(R.id.chat_dotbar);



        m_btnFace.setOnClickListener(this);
        m_edtMsg.setOnClickListener(this);
        m_btnSend.setOnClickListener(this);

        if (m_nType != IS_GROUP)
          //  m_txtName.setText(m_strBuddyName);
            m_txtName=m_strBuddyName;
        else
         //   m_txtName.setText(m_strGroupName);
        m_txtName=m_strGroupName;

        initChatMsgListView();	// 初始化聊天消息列表框
        initFaceBar();			// 初始化表情栏

        m_nCurFacePage = 0;
        m_vpFace.setCurrentItem(1);

        toolbar = (Toolbar) findViewById(R.id.toolbar_chat);
        toolbar.setNavigationIcon(R.drawable.qqicon);
        toolbar.setTitle(m_txtName);

        setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        chat_inputbar= (LinearLayout) findViewById(R.id.chat_inputbar);

        toolbar.setBackgroundColor(color_theme);
        chat_inputbar.setBackgroundColor(color_theme);

        // 去除 ListView 上下边界蓝色或黄色阴影
//		ListView actualListView = m_lvMsg.getRefreshableView();
//		if (Integer.parseInt(Build.VERSION.SDK) >= 9) {
//			actualListView.setOverScrollMode(View.OVER_SCROLL_NEVER);
//        }
    }
 
源代码19 项目: android-card-form   文件: CardForm.java
private void setListeners(EditText editText) {
    editText.setOnFocusChangeListener(this);
    editText.setOnClickListener(this);
    editText.addTextChangedListener(this);
}
 
源代码20 项目: codeexamples-android   文件: List12.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    setContentView(R.layout.list_12);
    
    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mStrings);
    
    setListAdapter(mAdapter);
    
    mUserText = (EditText) findViewById(R.id.userText);

    mUserText.setOnClickListener(this);
    mUserText.setOnKeyListener(this);
}