当前位置: 首页>>代码示例>>Java>>正文


Java Editable.length方法代码示例

本文整理汇总了Java中android.text.Editable.length方法的典型用法代码示例。如果您正苦于以下问题:Java Editable.length方法的具体用法?Java Editable.length怎么用?Java Editable.length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.text.Editable的用法示例。


在下文中一共展示了Editable.length方法的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: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    if (mPossiblyNotMultiline) {
        boolean found = false;
        for (int i = s.length() - 1; i >= 0; --i) {
            if (s.charAt(i) == '\n') {
                found = true;
                break;
            }
        }
        if (!found) {
            mMultiline = false;
            int pos = mEditText.getSelectionStart();
            mEditText.setInputType(mEditText.getInputType()
                    & (~InputType.TYPE_TEXT_FLAG_MULTI_LINE));
            mEditText.setSelection(pos);
        }
    }
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:20,代码来源:AutoMultilineTextListener.java

示例3: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    SpannableStringBuilder spannableString = (SpannableStringBuilder) s;
    int startPos = -1, endPos;
    char curChar;
    String keyword;
    setUpColorSpan(s);
    resultKeyWordSet.clear();
    for (int i = 0; i < s.length(); i++) {
        curChar = s.charAt(i);
        endPos = i ;
        if (curChar == Constants.TAG_FLAG_CHAR) {
            keyword = spannableString.subSequence(startPos == -1 ? i : startPos + 1, endPos).toString();
            if (isFlagChanged(startPos, i)
                    && nameList.contains(keyword)) {
                s.setSpan(new ForegroundColorSpan(textColor), startPos, endPos + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
                resultKeyWordSet.add(keyword);
            }
            startPos = i;
        }
    }
    if(null!=callback){
        callback.onUpdate(resultKeyWordSet);
    }

}
 
开发者ID:hosle,项目名称:HTagEditor,代码行数:27,代码来源:RichTextWatcher.java

示例4: onTextChange

import android.text.Editable; //导入方法依赖的package包/类
/**
 * 默认的文本变化监听器文本变化时调用此方法,{@link #addDefaultTextChangeListener()}
 */
private void onTextChange(Editable s)
{
    string = s.toString();
    for(int i = 0; i < s.length(); i++)
    {
        fillTextByIndex(i);
    }

    for(int i = s.length(); i < textLength; i++)
    {
        list.get(i).setText("");
    }

    if(onInputFinishedListener != null)
    {
        if(s.length() == textLength)
        {
            onInputFinishedListener.onFinish(this, string);
        }

        onInputFinishedListener.onTextChanged(string.length() == textLength, string);
    }
}
 
开发者ID:Ayvytr,项目名称:EasyAndroid,代码行数:27,代码来源:AuthEditText.java

示例5: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    if (isActionInProgress()) return;
    setActionInProgress(true);
    boolean hasHiddenNewLine = s.length() > 0 && s.charAt(0) == NEWLINE;
    if (mHasHiddenNewline && !hasHiddenNewLine && !isFirst()) {
        // An hidden newline was removed! Pass stuff back.
        // This might make us empty, and eventually, delete us.
        LOG.w(logPrefix(), "afterTextChanged:",
                "we had a hidden newline, but not anymore.",
                "Passing \"isFirst line\" back.");
        previous().acceptSpace(0);
    }
    setActionInProgress(false);
}
 
开发者ID:natario1,项目名称:ViewPrinter,代码行数:16,代码来源:AutoSplitTextHelper.java

示例6: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable editable) {
    //文本内容为空时, 解决光标不显示的BUG
    if (editable.length() > 0) {
        setMovementMethod(LinkMovementMethod.getInstance());
    } else {
        setMovementMethod(getDefaultMovementMethod());
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:10,代码来源:ExEditText.java

示例7: start

import android.text.Editable; //导入方法依赖的package包/类
/**
 * Mark the opening tag by using private classes
 */
private void start(Editable output, Object mark) {
    int len = output.length();
    output.setSpan(mark, len, len, Spannable.SPAN_MARK_MARK);

    if (HtmlTextView.DEBUG) {
        Log.d(HtmlTextView.TAG, "len: " + len);
    }
}
 
开发者ID:RanKKI,项目名称:PSNine,代码行数:12,代码来源:HtmlTagHandler.java

示例8: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    if (s.length() > 0) {
        mAddressDelete.setVisibility(View.VISIBLE);
    } else {
        mAddressDelete.setVisibility(View.INVISIBLE);
    }
}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:9,代码来源:WebViewActivity.java

示例9: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    if (s.length() == 0) {
        clear.setVisibility(View.GONE);
    } else {
        clear.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:Yuanhongliang,项目名称:HLOLI,代码行数:9,代码来源:SearchActivity.java

示例10: endCode

import android.text.Editable; //导入方法依赖的package包/类
private void endCode(Editable output, XMLReader xmlReader) {
    output.append(" ");
    int code_end = output.length();
    output.setSpan(new ForegroundColorSpan(Color.parseColor("#f44336")), code_start, code_end, Spannable.SPAN_MARK_MARK);
    output.setSpan(new BackgroundColorSpan(Color.parseColor("#ffebee")), code_start, code_end, Spannable.SPAN_MARK_MARK);
    //output.append(" ");
}
 
开发者ID:GitaiQAQ,项目名称:AboutView,代码行数:8,代码来源:BaseCustomTagHandler.java

示例11: removeTasksBetweenIndexes

import android.text.Editable; //导入方法依赖的package包/类
private static List<SttTaskWithParserInfo> removeTasksBetweenIndexes(Editable editable, int indexSomewhereInLineStart, int indexSomewhereInLineEnd) {
    int len = editable.length();
    final SttCommander.SttTasksInTextRange found = SttCommander.get()
            .findTasksBetweenIndex(editable.toString(), indexSomewhereInLineStart, indexSomewhereInLineEnd);

    // Finally delete
    if (found.startIndex >= 0 && found.startIndex < len && found.endIndex >= 0 && found.endIndex <= len) {
        editable.delete(found.startIndex, found.endIndex);
        return found.tasks;
    } else {
        return new ArrayList<>();
    }
}
 
开发者ID:gsantner,项目名称:markor,代码行数:14,代码来源:TodoTxtTextModuleActions.java

示例12: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    if (s.length() > 0) {
        mServerAuthPassReset.setVisibility(View.GONE);
        mServerAuthPassCtr.setPasswordVisibilityToggleEnabled(true);
    } else {
        mServerAuthPassReset.setVisibility(View.VISIBLE);
        mServerAuthPassCtr.setPasswordVisibilityToggleEnabled(false);
    }
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:11,代码来源:EditServerActivity.java

示例13: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable editable) {
    if (editable.length() == 0) {
        enterChatView1.setImageResource(R.drawable.ic_chat_send);
    } else {
        enterChatView1.setImageResource(R.drawable.ic_chat_send_active);
    }
}
 
开发者ID:timstableford,项目名称:P-BrainAndroid,代码行数:9,代码来源:MainActivity.java

示例14: afterTextChanged

import android.text.Editable; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    ImageButton btnSend = (ImageButton) findViewById(R.id.btnSendMsg);
    if(s.length() > 0) {
        btnSend.setEnabled(true);
    } else {
        btnSend.setEnabled(false);
    }
}
 
开发者ID:Thizizmyname,项目名称:MyPlace,代码行数:10,代码来源:MessageActivity.java

示例15: 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


注:本文中的android.text.Editable.length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。