当前位置: 首页>>代码示例>>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;未经允许,请勿转载。