當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。