當前位置: 首頁>>代碼示例>>Java>>正文


Java Editable類代碼示例

本文整理匯總了Java中android.text.Editable的典型用法代碼示例。如果您正苦於以下問題:Java Editable類的具體用法?Java Editable怎麽用?Java Editable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Editable類屬於android.text包,在下文中一共展示了Editable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deleteLast

import android.text.Editable; //導入依賴的package包/類
/**
 * 刪除最後一個字符,用來當@的人, 已經存在時,調用
 */
public void deleteLast(int position) {
    Editable text = getText();
    if (text != null && text.length() >= position) {
        text.delete(position - 1, position);
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:10,代碼來源:ExEditText.java

示例2: onFinishInflate

import android.text.Editable; //導入依賴的package包/類
@Override protected void onFinishInflate() {
  super.onFinishInflate();
  ButterKnife.bind(this);

  titleView.setOnFocusChangeListener((v, hasFocus) -> {
    if (!hasFocus) {
      titleView.setError(Strings.isBlank(titleView.getText()) ? "Cannot be empty." : null);
    }
  });
  titleView.addTextChangedListener(new EmptyTextWatcher() {
    @Override public void afterTextChanged(Editable s) {
      if (listener != null) {
        listener.onStateChanged(!Strings.isBlank(s));
      }
    }
  });

  screenshotView.setChecked(true);
  logsView.setChecked(true);
}
 
開發者ID:rogues-dev,項目名稱:superglue,代碼行數:21,代碼來源:BugReportView.java

示例3: onClickSendButton

import android.text.Editable; //導入依賴的package包/類
@Override
public void onClickSendButton(Editable str) {
    if (!TDevice.hasInternet()) {
        AppContext.showToastShort(R.string.tip_network_error);
        return;
    }
    if (!AccountHelper.isLogin()) {
        UIHelper.showLoginActivity(getActivity());
        return;
    }
    if (TextUtils.isEmpty(str)) {
        AppContext.showToastShort(R.string.tip_comment_content_empty);
        return;
    }
    handleComment(str.toString());
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:17,代碼來源:TeamTweetDetailFragment.java

示例4: afterTextChanged

import android.text.Editable; //導入依賴的package包/類
@Override
public void afterTextChanged(Editable s) {
    int selection = mTextInput.getSelectionEnd();

    if (s != null && s.toString().contains(".")) {
        mTextInput.setText(s.toString().replace('.', ','));
        mTextInput.setSelection(selection);
    }

    if (mSpecimen != null &&
            mSpeciesId != Utils.MOOSE_ID &&
            mSpeciesId != Utils.FALLOW_DEER_ID &&
            mSpeciesId != Utils.WHITE_TAILED_DEER &&
            mSpeciesId != Utils.WILD_FOREST_DEER) {
        mSpecimen.setWeight(getWeight());
        refreshWeightRequiredIndicator();

        if (mCallback != null) {
            mCallback.onSpecimenChanged();
        }
    }
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-android,代碼行數:23,代碼來源:HarvestSpecimenView.java

示例5: afterTextChanged

import android.text.Editable; //導入依賴的package包/類
@Override
public void afterTextChanged(Editable s) {
    if (s != null && s.length() == 1) {
        if (index < 7) {// 焦點後移

            Log.d("gaolei", "index------------------" + index);
            if (index < 6) {
                EditText editText = getEditTextFromIndex(index);
                editText.clearFocus();
                getEditTextFromIndex(index + 1).requestFocusFromTouch();
            }
            currentEditIndex = index;
        } else {
            // TODO 判斷
            // handler.sendEmptyMessage(1);
        }
    } else {
        // 清除 對應 標識位
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:CodeUnlockActivity.java

示例6: testInvalidPassword

import android.text.Editable; //導入依賴的package包/類
@Test
public void testInvalidPassword() throws Resources.NotFoundException {
    Editable mockEditable = mock(Editable.class);
    int color = 50;
    String text = "message";

    when(mockEditable.toString()).thenReturn("invalidpassword");
    when(mUserAdapter.checkValidPassword("invalidpassword"))
            .thenReturn(false);
    when(mResources.getColor(R.color.red)).thenReturn(color);
    when(mContext.getString(R.string.invalid_password)).thenReturn(text);

    mPasswordTextWatcher.afterTextChanged(mockEditable);
    verify(mIcon).setImageResource(R.drawable.ic_cancel);
    verify(mText).setText(text);
    verify(mText).setTextColor(color);
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:18,代碼來源:PasswordTextWatcherTest.java

示例7: afterTextChanged

import android.text.Editable; //導入依賴的package包/類
@Override
public void afterTextChanged(Editable s) {
  if (countryFormatter == null)
    return;

  if (TextUtils.isEmpty(s))
    return;

  countryFormatter.clear();

  String number          = s.toString().replaceAll("[^\\d.]", "");
  String formattedNumber = null;

  for (int i=0;i<number.length();i++) {
    formattedNumber = countryFormatter.inputDigit(number.charAt(i));
  }

  if (formattedNumber != null && !s.toString().equals(formattedNumber)) {
    s.replace(0, s.length(), formattedNumber);
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:22,代碼來源:RegistrationActivity.java

示例8: onTextChange

import android.text.Editable; //導入依賴的package包/類
/**
 * 文本變化處理
 */
private void onTextChange(Editable s)
{
    text = s.toString();
    fillText();

    if(onInputChangeListener != null)
    {
        if(s.length() == maxLength)
        {
            onInputChangeListener.onFinished(this, text);
        }

        onInputChangeListener.onTextChanged(text.length() == maxLength, text);
    }
}
 
開發者ID:Ayvytr,項目名稱:EasyAndroid,代碼行數:19,代碼來源:NewAuthEditText.java

示例9: startImg

import android.text.Editable; //導入依賴的package包/類
private void startImg(Editable text, Attributes attributes, HtmlCompat.ImageGetter img) {
    String src = attributes.getValue("", "src");
    Drawable d = null;
    if (img != null) {
        d = img.getDrawable(src, attributes);
    }
    if (d == null) {
        Resources res = mContext.getResources();
        d = res.getDrawable(R.drawable.unknown_image);
        d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
    }
    int len = text.length();
    text.append("\uFFFC");
    text.setSpan(new ImageSpan(d, src), len, text.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
 
開發者ID:Pixplicity,項目名稱:HtmlCompat,代碼行數:17,代碼來源:HtmlToSpannedConverter.java

示例10: setupUserAutocomplete

import android.text.Editable; //導入依賴的package包/類
private void setupUserAutocomplete() {
    EditText edit = (EditText) findViewById(R.id.single);
    float elevation = 6f;
    Drawable backgroundDrawable = new ColorDrawable(Color.WHITE);
    AutocompletePresenter<User> presenter = new UserPresenter(this);
    AutocompleteCallback<User> callback = new AutocompleteCallback<User>() {
        @Override
        public boolean onPopupItemClicked(Editable editable, User item) {
            editable.clear();
            editable.append(item.getFullname());
            return true;
        }

        public void onPopupVisibilityChanged(boolean shown) {}
    };

    userAutocomplete = Autocomplete.<User>on(edit)
            .with(elevation)
            .with(backgroundDrawable)
            .with(presenter)
            .with(callback)
            .build();
}
 
開發者ID:natario1,項目名稱:Autocomplete,代碼行數:24,代碼來源:MainActivity.java

示例11: afterTextChanged

import android.text.Editable; //導入依賴的package包/類
@Override
public void afterTextChanged(Editable s) {
    if (Utils.doLog())
        Log.d(CLASSNAME,
                "afterTextChanged() >>> delayTimeSubmission = "
                        + getDelayTimeSubmission());

    if (TextUtils.isEmpty(mTextSearch.getText())) {
        if (!isClosable())
            mButtonClear.setVisibility(GONE);
    } else
        mButtonClear.setVisibility(VISIBLE);

    if (getDelayTimeSubmission() > 0)
        mAutoSubmissionHandler.postDelayed(mAutoSubmissionRunnable,
                getDelayTimeSubmission());
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:18,代碼來源:AfcSearchView.java

示例12: onClick

import android.text.Editable; //導入依賴的package包/類
@Override
public void onClick(Fragment currentFragment, final RongExtension extension) {
    String[] permissions = {Manifest.permission.RECORD_AUDIO};
    if (!PermissionCheckUtil.requestPermissions(currentFragment, permissions)) {
        return;
    }
    Recognizer recognizerView = new Recognizer(extension.getContext());
    recognizerView.setResultCallBack(new IRecognizedResult() {
        @Override
        public void onResult(String data) {
            Editable editable = extension.getInputEditText().getText();
            String str = editable.toString() + data;
            extension.getInputEditText().setText(str);
            extension.getInputEditText().setSelection(str.length());
        }

        @Override
        public void onClearClick() {
            extension.getInputEditText().setText("");
        }
    });
    extension.addPluginPager(recognizerView);
    recognizerView.startRecognize();
}
 
開發者ID:hushengjun,項目名稱:FastAndroid,代碼行數:25,代碼來源:RecognizePlugin.java

示例13: enoughToFilter

import android.text.Editable; //導入依賴的package包/類
private boolean enoughToFilter() {
    Editable s = getText();
    int end = getSelectionEnd();
    if (end < 0)
        return false;
    int start = findTokenStart();
    boolean hasAt = s.length() > start && s.charAt(start) == '@';
    updateCompletingCommandFlags();
    return (mDoThresholdSuggestions && end - start >= THRESHOLD &&
            (mDoAtSuggestions || !hasAt)) ||
            (mDoAtSuggestions && hasAt) ||
            (mDoChannelSuggestions && mChannelTypes != null && s.length() > start &&
                    mChannelTypes.contains(s.charAt(start))) ||
            isCommandNameToken() || updateCompletingCommandFlags();
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:16,代碼來源:ChatAutoCompleteEditText.java

示例14: getCharArray

import android.text.Editable; //導入依賴的package包/類
final char[] getCharArray(boolean clear) {
    Editable editable = super.getText();
    char[] chars = new char[editable.length()];
    editable.getChars(0, chars.length, chars, 0);
    if (clear) editable.clear();
    return chars;
}
 
開發者ID:tresorit,項目名稱:ZeroKit-Android-SDK,代碼行數:8,代碼來源:PasswordEditText.java

示例15: afterTextChanged

import android.text.Editable; //導入依賴的package包/類
@Override
public void afterTextChanged(final Editable s) {
    mQuery = s.toString();
    if (mQuery.isEmpty()) {
        mSearchAlgorithm.cancel(true);
        mCb.clearSearchResult();
    } else {
        mSearchAlgorithm.cancel(false);
        mSearchAlgorithm.doSearch(mQuery, mCb);
    }
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:12,代碼來源:AllAppsSearchBarController.java


注:本文中的android.text.Editable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。