Java 类android.widget.TextView.BufferType 实例源码

项目:chromium-for-android-56-debug-video    文件:SuggestionView.java   
/**
 * Sets a description line for the omnibox suggestion.
 *
 * @param str The description text.
 * @param isUrl Whether this text is a URL (as opposed to a normal string).
 */
private void showDescriptionLine(Spannable str, boolean isUrl) {
    TextView textLine = mContentsView.mTextLine2;
    if (textLine.getVisibility() != VISIBLE) {
        textLine.setVisibility(VISIBLE);
    }
    textLine.setText(str, BufferType.SPANNABLE);

    // Force left-to-right rendering for URLs. See UrlBar constructor for details.
    if (isUrl) {
        textLine.setTextColor(URL_COLOR);
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_LTR);
    } else {
        textLine.setTextColor(getStandardFontColor());
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_INHERIT);
    }
}
项目:sctalk    文件:IMUIHelper.java   
public static void setTextHilighted(TextView textView, String text,SearchElement searchElement) {
    textView.setText(text);
    if (textView == null
            || TextUtils.isEmpty(text)
            || searchElement ==null) {
        return;
    }

    int startIndex = searchElement.startIndex;
    int endIndex = searchElement.endIndex;
    if (startIndex < 0 || endIndex > text.length()) {
        return;
    }
    // 开始高亮处理
    int color =  Color.rgb(69, 192, 26);
    textView.setText(text, BufferType.SPANNABLE);
    Spannable span = (Spannable) textView.getText();
    span.setSpan(new ForegroundColorSpan(color), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
项目:droidfan    文件:StatusUtils.java   
public static void setStatus(final TextView textView, final String text) {
        final String htmlText = text + " ";
//        LogUtil.v(TAG, "setStatus:htmlText:" + htmlText);
        final HashMap<String, String> mentions = findMentions(htmlText);
//        LogUtil.v(TAG, "setStatus:mentions:" + mentions);
        final String plainText = Html.fromHtml(htmlText).toString();
//        LogUtil.v(TAG, "setStatus:plainText:" + plainText);
        final SpannableString spannable = new SpannableString(plainText);
        Linkify.addLinks(spannable, Linkify.WEB_URLS);
        linkifyUsers(spannable, mentions);
        linkifyTags(spannable);
        removeUnderLines(spannable);
//        LogUtil.v(TAG, "setStatus:finalText:" + spannable);
        textView.setText(spannable, BufferType.SPANNABLE);
        textView.setMovementMethod(LinkMovementMethod.getInstance());
    }
项目:droidfan    文件:StatusUtils.java   
public static void setItemStatus(final TextView textView, final String text) {
    final String htmlText = text + " ";
    final List<String> highlightWords = findHighlightWords(htmlText);
    final String plainText = Html.fromHtml(htmlText).toString();
    final SpannableString spannable = new SpannableString(plainText);
    Linkify.addLinks(spannable, Linkify.WEB_URLS);
    final Matcher m = PATTERN_USER.matcher(spannable);
    while (m.find()) {
        int start = m.start(1);
        int end = m.end(1);
        if (start >= 0 && start < end) {
            spannable.setSpan(new ForegroundColorSpan(AppContext.getContext().getResources().getColor(R.color.colorPrimary)), start, end,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
    }
    linkifyTags(spannable);
    removeUnderLines(spannable);
    applyHighlightSpan(spannable, highlightWords);
    textView.setText(spannable, BufferType.SPANNABLE);
}
项目:AndroidChromium    文件:SuggestionView.java   
/**
 * Sets a description line for the omnibox suggestion.
 *
 * @param str The description text.
 * @param isUrl Whether this text is a URL (as opposed to a normal string).
 */
private void showDescriptionLine(Spannable str, boolean isUrl) {
    TextView textLine = mContentsView.mTextLine2;
    if (textLine.getVisibility() != VISIBLE) {
        textLine.setVisibility(VISIBLE);
    }
    textLine.setText(str, BufferType.SPANNABLE);

    // Force left-to-right rendering for URLs. See UrlBar constructor for details.
    if (isUrl) {
        textLine.setTextColor(URL_COLOR);
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_LTR);
    } else {
        textLine.setTextColor(getStandardFontColor());
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_INHERIT);
    }
}
项目:C.    文件:SpacingTextView.java   
/**
 * 字距为任何字符串(技术上,一个简单的方法为CharSequence不使用)的TextView
 */
private void applyLetterSpacing() {
    if (this == null || this.originalText == null) return;
    StringBuilder builder = new StringBuilder();
    for(int i = 0; i < originalText.length(); i++) {
        String c = ""+ originalText.charAt(i);
        builder.append(c.toLowerCase());
        if(i+1 < originalText.length()) {
            builder.append("\u00A0");
        }
    }
    SpannableString finalText = new SpannableString(builder.toString());
    if(builder.toString().length() > 1) {
        for(int i = 1; i < builder.toString().length(); i+=2) {
            finalText.setSpan(new ScaleXSpan((letterSpacing+1)/10), i, i+1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
    }
    super.setText(finalText, BufferType.SPANNABLE);
}
项目:neveshtanak-Deprecated-    文件:App.java   
public static void fontAndReshape(TextView tv) {
    String text = "";

    if (tv.getText() instanceof SpannedString) {
        text = ((SpannedString) tv.getText()).toString();
    } else if (tv.getText() instanceof SpannableString) {
        text = ((SpannableString) tv.getText()).toString();
    } else {
        text = (String) tv.getText();
    }

    if (tv instanceof StyledTextView)
        ((StyledTextView) tv).setPlainText(text, BufferType.NORMAL);
    else if (tv instanceof StyledButton)
        ((StyledButton) tv).setPlainText(text, BufferType.NORMAL);
    else if (tv instanceof StyledEditText)
        ((StyledEditText) tv).setPlainText(text, BufferType.NORMAL);

    tv.setTypeface(getFont("Yekan"));
    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);

}
项目:365browser    文件:SuggestionView.java   
/**
 * Sets a description line for the omnibox suggestion.
 *
 * @param str The description text.
 * @param isUrl Whether this text is a URL (as opposed to a normal string).
 */
private void showDescriptionLine(Spannable str, boolean isUrl) {
    TextView textLine = mContentsView.mTextLine2;
    if (textLine.getVisibility() != VISIBLE) {
        textLine.setVisibility(VISIBLE);
    }
    textLine.setText(str, BufferType.SPANNABLE);

    // Force left-to-right rendering for URLs. See UrlBar constructor for details.
    if (isUrl) {
        textLine.setTextColor(URL_COLOR);
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_LTR);
    } else {
        textLine.setTextColor(getStandardFontColor());
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_INHERIT);
    }
}
项目:sophia    文件:SearchResultsAdapter.java   
public View getView(final int position, View convertView, ViewGroup parent) {
View row = convertView;
       ViewHolder holder;

if (row == null) {
    row = inflater.inflate(R.layout.search_results_row, null);
           holder = new ViewHolder();
           holder.bookName = (TextView)row.findViewById(R.id.search_result_row_book);
           holder.chapterNumber = (TextView)row.findViewById(R.id.search_result_row_chapter);
           holder.verseNumber = (TextView)row.findViewById(R.id.search_result_row_verse_number);
           holder.verseText = (TextView)row.findViewById(R.id.search_result_row_verse_text);
           row.setTag(holder);
}
       else
           holder = (ViewHolder)row.getTag();

final Verse entry = (Verse)super.getItem(position);

//Log.d(TAG, "Verse: " + entry.number + " - " + entry.text);
holder.bookName.setText(bookNameLookupMap.get(entry.bookId));
holder.chapterNumber.setText("Chapter " + entry.chapter);
holder.verseNumber.setText("[" + entry.number + "]");
holder.verseText.setText(highlightSearchString(entry.text), BufferType.SPANNABLE);

return row;
   }
项目:android-openvpn-settings    文件:HtmlDialog.java   
private static Dialog makeDialog(Context context, int title, Spanned message)
{
    TextView textView = new TextView(context);
    textView.setText(message, BufferType.SPANNABLE );
    textView.setMovementMethod( LinkMovementMethod.getInstance() );

    ScrollView scrollView = new ScrollView(context);
    scrollView.addView( textView );

    final Dialog dialog = new AlertDialog.Builder(context).
    setTitle( title ).
    setView( scrollView ).
    setNeutralButton( "OK", null ).
    setCancelable(true).
    setIcon( android.R.drawable.ic_dialog_info).
    create();
    return dialog;
}
项目:MedtronicUploader    文件:DexcomG4Activity.java   
public void onServiceConnected(ComponentName className, IBinder service) {
    bService = service;
    mService = new Messenger(service);
    try {
        Message msg = Message.obtain(null, MedtronicConstants.MSG_REGISTER_CLIENT);
        msg.replyTo = mMessenger;
        mService.send(msg);
    } catch (RemoteException e) {

         StringBuffer sb1 = new StringBuffer("");
         sb1.append("EXCEPTION!!!!!! "+ e.getMessage()+" "+e.getCause());
         for (StackTraceElement st : e.getStackTrace()){
             sb1.append(st.toString()).append("\n");
         }
         Log.e(TAG,"Error Registering Client Service Connection\n"+sb1.toString());
        if (ISDEBUG){
            display.setText(display.getText()+"Error Registering Client Service Connection\n", BufferType.EDITABLE);
        }
        // In this case the service has crashed before we could even do anything with it
    }
}
项目:LostAndFound    文件:LoginScreen.java   
private void initViews() {

    SpannableString spannable = new SpannableString(getString(R.string.app_name));
    spannable.setSpan(new ForegroundColorSpan(Color.rgb(99, 194, 208)), 0, 4, 0);
    spannable.setSpan(new ForegroundColorSpan(Color.rgb(255, 255, 255)), 5, 7, 1);
    spannable.setSpan(new ForegroundColorSpan(Color.rgb(255, 212, 0)), 7,spannable.length(), 2);

    final TextView appTitle = (TextView) findViewById(R.id.login_app_tittle);
    appTitle.setText(spannable, BufferType.SPANNABLE);

    btnLoginFacebook = (ImageButton) findViewById(R.id.loginFbBtn);
    btnLogin = (ImageButton) findViewById(R.id.loginBtn);
    btnGuest = (ImageButton) findViewById(R.id.loginGuestBtn); 
    btnRegister = (Button) findViewById(R.id.register);
    mTwitterBtn = (ImageButton) findViewById(R.id.loginTwBtn);
    etUsername = (EditText) findViewById(R.id.etLoginUser);
    etPassowrd = (EditText)findViewById(R.id.etLoginPassword);

    btnLogin.setOnClickListener(this);
    btnLoginFacebook.setOnClickListener(this);
    btnRegister.setOnClickListener(this);
    btnGuest.setOnClickListener(this);
    mTwitterBtn.setOnClickListener(this);

}
项目:omnisearch    文件:OmniSearchHome.java   
void addOrRemoveAppView(final ISearchableElement searchableElement, final Match match) {
    final View appView = searchableElement.getViewDetails().getSearchResultView();
    final boolean matches = match.isMatches();
    ViewDetails viewDetails = searchableElement.getViewDetails();
    final TextView primaryTextDisplay = viewDetails.getPrimaryTextDisplay();
    runOnUiThread(new Runnable(){
        @Override
        public void run() {
            if(matches){
                if(appView.getParent() == null){
                        searchResultsView.addView(appView);
                    searchResultsCount++;
                }
            } else {
                if(appView.getParent() == searchResultsView){
                    searchResultsView.removeView(appView);
                    searchResultsCount--;
                }
            }
            searchCountText.setText(String.valueOf(searchResultsCount));
            primaryTextDisplay.setText(match.getMatchedSpan(),BufferType.SPANNABLE);
        }
    });
}
项目:yyox    文件:ServicePriceActivity.java   
@Override
    public void priceFee(String totalCostStr) {
//        mFreight_money.setText("RMB:"+totalCostStr);

        SpannableString styledText = new SpannableString("RMB"+totalCostStr);
        styledText.setSpan(new AbsoluteSizeSpan(15,true), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        styledText.setSpan(new AbsoluteSizeSpan(20,true), 3, ("RMB"+totalCostStr).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        mFreight_money.setText(styledText, BufferType.SPANNABLE);
    }
项目:KTalk    文件:EaseChatRowText.java   
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
项目:Tribe    文件:EaseChatRowText.java   
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
项目:Tribe    文件:EaseChatRowText.java   
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
项目:OSchina_resources_android    文件:Tweet.java   
public void setLikeUsers(Context contet, TextView likeUser, boolean limit) {
    // 构造多个超链接的html, 通过选中的位置来获取用户名
    if (getLikeCount() > 0 && getLikeUser() != null
            && !getLikeUser().isEmpty()) {
        likeUser.setVisibility(View.VISIBLE);
        likeUser.setMovementMethod(LinkMovementMethod.getInstance());
        likeUser.setFocusable(false);
        likeUser.setLongClickable(false);
        likeUser.setText(addClickablePart(contet, limit), BufferType.SPANNABLE);
    } else {
        likeUser.setVisibility(View.GONE);
        likeUser.setText("");
    }
    likeUser.setVisibility(View.GONE);
}
项目:FanChat    文件:EaseChatRowText.java   
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
项目:boohee_v5.6    文件:EmojiconTextView.java   
public void setText(CharSequence text, BufferType type) {
    try {
        if (!TextUtils.isEmpty(text)) {
            SpannableStringBuilder builder = new SpannableStringBuilder(text);
            EmojiconHandler.addEmojis(getContext(), builder, this.mEmojiconSize, this
                    .mTextStart, this.mTextLength, this.mUseSystemDefault);
            text = builder;
        }
        super.setText(text, type);
    } catch (IndexOutOfBoundsException e) {
        setText(text.toString());
    }
}
项目:boohee_v5.6    文件:NewBadgeView.java   
public void setText(CharSequence text, BufferType type) {
    if (isHideOnNull() && (text == null || text.toString().equalsIgnoreCase("0"))) {
        setVisibility(8);
    } else {
        setVisibility(0);
    }
    super.setText(text, type);
}
项目:boohee_v5.6    文件:LinkUtils.java   
public static void autoLink(TextView view, final OnClickListener listener, String patternStr) {
    String text = view.getText().toString();
    if (!TextUtils.isEmpty(text)) {
        Pattern pattern;
        Spannable spannable = new SpannableString(text);
        if (TextUtils.isEmpty(patternStr)) {
            pattern = URL_PATTERN;
        } else {
            pattern = Pattern.compile(patternStr);
        }
        Matcher matcher = pattern.matcher(text);
        while (matcher.find()) {
            spannable.setSpan(new SensibleUrlSpan(matcher.group(1), pattern, listener),
                    matcher.start(1), matcher.end(1), 33);
        }
        view.setText(spannable, BufferType.SPANNABLE);
        final SensibleLinkMovementMethod method = new SensibleLinkMovementMethod();
        view.setMovementMethod(method);
        if (listener != null) {
            view.setOnClickListener(new android.view.View.OnClickListener() {
                public void onClick(View v) {
                    if (!method.isLinkClicked()) {
                        listener.onClicked();
                    }
                }
            });
        }
    }
}
项目:GCSApp    文件:EaseChatRowRedPacket.java   
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
项目:JianshuApp    文件:SubscriptionAdapter.java   
@Override
public void enableLoadmore(boolean enable) {
    if (isEnableLoadmore() == enable) {
        return;
    }

    super.enableLoadmore(enable);

    if (!enable) {
        // 显示footer
        if (mFooterView == null) {
            mFooterView = View.inflate(ActivityLifcycleManager.get().current(), LAYOUT_ID_FOOTER, null);
            TextView tvEnd = (TextView) mFooterView.findViewById(R.id.txt_end);
            tvEnd.setMovementMethod(LinkMovementMethod.getInstance());
            String txtEnd = AppUtils.getContext().getString(R.string.to_discover_more_zuthor_and_collection);
            SpannableStringBuilder ssb = new SpannableStringBuilder(txtEnd);
            int startIndex = txtEnd.indexOf("更");
            int endIndex = txtEnd.length();
            if (startIndex > -1) {
                ssb.setSpan(new ClickableSpanNoUnderLine() {
                    public void onClick(View widget) {
                        if (ThrottleUtils.valid(widget)) {
                            AddSubscribeActivity.launch();
                        }
                    }
                }, startIndex, endIndex, 0);
                tvEnd.setText(ssb, BufferType.SPANNABLE);
            }
        }

        if (mFooterView.getParent() == null) {
            addFooterView(mFooterView);
        }
    } else {
        removeFooterView(mFooterView);
    }
}
项目:TAG    文件:MessageAdapter.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = SmileUtils.getSmiledText(context, txtBody.getMessage());
    holder.tv.setText(span, BufferType.SPANNABLE);
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });
    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: //发送中
            holder.pb.setVisibility(View.VISIBLE);
            break;
        default:
            sendMsgInBackground(message, holder);
        }
    }
}
项目:TAG    文件:MessageAdapter_0907.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = SmileUtils.getSmiledText(context, txtBody.getMessage());
    holder.tv.setText(span, BufferType.SPANNABLE);
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });
    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL:
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: //发送中
            holder.pb.setVisibility(View.VISIBLE);
            break;
        default:
            sendMsgInBackground(message, holder);
        }
    }
}
项目:600SeriesAndroidUploader    文件:MainActivity.java   
@Override
public void onReceive(Context context, Intent intent) {
    String message = intent.getStringExtra(MedtronicCnlIntentService.Constants.EXTENDED_DATA);
    Log.i(TAG, "Message Receiver: " + message);

    synchronized (messages) {
        while (messages.size() > 398) {
            messages.poll();
        }
        messages.add(new StatusMessage(message));
    }

    StringBuilder sb = new StringBuilder();
    for (StatusMessage msg : messages) {
        if (sb.length() > 0)
            sb.append("\n");
        sb.append(msg);
    }

    mTextViewLog.setText(sb.toString(), BufferType.EDITABLE);

    // auto scroll status log
    if ((mScrollView.getChildAt(0).getBottom() < mScrollView.getHeight()) || ((mScrollView.getChildAt(0).getBottom() - mScrollView.getScrollY() - mScrollView.getHeight()) < (mScrollView.getHeight() / 3))) {
        mScrollView.post(new Runnable() {
            public void run() {
                mScrollView.fullScroll(View.FOCUS_DOWN);
            }
        });
    }
}
项目:600SeriesAndroidUploader    文件:MainActivity.java   
public void clearMessages() {
    synchronized (messages) {
        messages.clear();
    }

    mTextViewLog.setText("", BufferType.EDITABLE);
}
项目:MeifuGO    文件:EaseChatRowText.java   
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
项目:Hyphenate-EaseUI-Android    文件:EaseChatRowText.java   
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
项目:info_demo    文件:MessageAdapter.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = HXSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    holder.tv.setText(span, BufferType.SPANNABLE);
    // 设置长按事件监听
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });

    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS: // 发送成功
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL: // 发送失败
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: // 发送中
            holder.pb.setVisibility(View.VISIBLE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        default:
            // 发送消息
            sendMsgInBackground(message, holder);
        }
    }
}
项目:Vafrinn    文件:SuggestionView.java   
/**
 * Sets a description line for the omnibox suggestion.
 *
 * @param str The description text.
 */
private void showDescriptionLine(Spannable str, int textColor) {
    if (mContentsView.mTextLine2.getVisibility() != VISIBLE) {
        mContentsView.mTextLine2.setVisibility(VISIBLE);
    }
    mContentsView.mTextLine2.setTextColor(textColor);
    mContentsView.mTextLine2.setText(str, BufferType.SPANNABLE);
}
项目:Vafrinn    文件:SuggestionView.java   
/**
 * Sets both lines of the Omnibox suggestion based on an Answers in Suggest result.
 *
 * @param answer The answer to be displayed.
 */
private void setAnswer(SuggestionAnswer answer) {
    float density = getResources().getDisplayMetrics().density;

    SuggestionAnswer.ImageLine firstLine = answer.getFirstLine();
    mContentsView.mTextLine1.setTextSize(AnswerTextBuilder.getMaxTextHeightSp(firstLine));
    Spannable firstLineText = AnswerTextBuilder.buildSpannable(
            firstLine, mContentsView.mTextLine1.getPaint().getFontMetrics(), density);
    mContentsView.mTextLine1.setText(firstLineText, BufferType.SPANNABLE);

    SuggestionAnswer.ImageLine secondLine = answer.getSecondLine();
    mContentsView.mTextLine2.setTextSize(AnswerTextBuilder.getMaxTextHeightSp(secondLine));
    Spannable secondLineText = AnswerTextBuilder.buildSpannable(
            secondLine, mContentsView.mTextLine2.getPaint().getFontMetrics(), density);
    mContentsView.mTextLine2.setText(secondLineText, BufferType.SPANNABLE);

    if (secondLine.hasImage()) {
        mContentsView.mAnswerImage.setVisibility(VISIBLE);

        float textSize = mContentsView.mTextLine2.getTextSize();
        int imageSize = (int) (textSize * ANSWER_IMAGE_SCALING_FACTOR);
        mContentsView.mAnswerImage.getLayoutParams().height = imageSize;
        mContentsView.mAnswerImage.getLayoutParams().width = imageSize;
        mContentsView.mAnswerImageMaxSize = imageSize;

        String url = "https:" + secondLine.getImage().replace("\\/", "/");
        AnswersImage.requestAnswersImage(
                mLocationBar.getCurrentTab().getProfile(),
                url,
                new AnswersImage.AnswersImageObserver() {
                    @Override
                    public void onAnswersImageChanged(Bitmap bitmap) {
                        mContentsView.mAnswerImage.setImageBitmap(bitmap);
                    }
                });
    }
}
项目:nono-android    文件:EaseChatRowText.java   
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
项目:FMTech    文件:SetupWizardNavBar.java   
public void setText(CharSequence paramCharSequence, TextView.BufferType paramBufferType)
{
  if (getId() == 2131755301) {
    paramCharSequence = "";
  }
  super.setText(paramCharSequence, paramBufferType);
}
项目:FMTech    文件:CountdownButton.java   
public void setText(CharSequence paramCharSequence, TextView.BufferType paramBufferType)
{
  if ((this.mCapitalizeButtonText) && (!TextUtils.isEmpty(paramCharSequence)))
  {
    Locale localLocale = getResources().getConfiguration().locale;
    paramCharSequence = paramCharSequence.toString().toUpperCase(localLocale);
  }
  super.setText(paramCharSequence, paramBufferType);
}
项目:juzidian    文件:SearchResultItemView.java   
public void setDictionaryEntry(final DictionaryEntry entry) {
    final String pinyinDisplay = this.createPinyinDisplay(entry);
    final String englishDefinitionDisplay = this.createEnglishDefinitionDisplay(entry);
    this.chineseTextView.setText(entry.getSimplified() + " " + pinyinDisplay, BufferType.SPANNABLE);
    final Spannable chineseSpannable = (Spannable) this.chineseTextView.getText();
    final int pinyinStartIndex = entry.getSimplified().length();
    chineseSpannable.setSpan(SPAN_SIZE_HANZI, 0, pinyinStartIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    this.definitionTextView.setText(englishDefinitionDisplay);
}
项目:easeui    文件:EaseChatRowText.java   
@Override
public void onSetUpView() {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 判断是不是阅后即焚的消息
    if (message.getBooleanAttribute(EaseConstant.EASE_ATTR_READFIRE, false) && message.direct == Direct.RECEIVE) {
        contentView.setText(
                String.format(context.getString(R.string.readfire_message_content), txtBody.getMessage().length()));
    } else {
        // 设置内容
        contentView.setText(span, BufferType.SPANNABLE);
    }
    handleTextMessage();
}
项目:MedtronicUploader    文件:DexcomG4Activity.java   
public void onServiceDisconnected(ComponentName className) {
    // This is called when the connection with the service has been unexpectedly disconnected - process crashed.
    mService = null;
    bService = null;
    Log.i(TAG,"Service Disconnected\n");
    if (ISDEBUG){
        display.setText(display.getText()+"Service Disconnected\n", BufferType.EDITABLE);
    }
}
项目:school_shop    文件:MessageAdapter.java   
/**
 * 文本消息
 * 
 * @param message
 * @param holder
 * @param position
 */
private void handleTextMessage(EMMessage message, ViewHolder holder, final int position) {
    TextMessageBody txtBody = (TextMessageBody) message.getBody();
    Spannable span = SmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    holder.tv.setText(span, BufferType.SPANNABLE);
    // 设置长按事件监听
    holder.tv.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            activity.startActivityForResult(
                    (new Intent(activity, ContextMenu.class)).putExtra("position", position).putExtra("type",
                            EMMessage.Type.TXT.ordinal()), ChatActivity.REQUEST_CODE_CONTEXT_MENU);
            return true;
        }
    });

    if (message.direct == EMMessage.Direct.SEND) {
        switch (message.status) {
        case SUCCESS: // 发送成功
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        case FAIL: // 发送失败
            holder.pb.setVisibility(View.GONE);
            holder.staus_iv.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS: // 发送中
            holder.pb.setVisibility(View.VISIBLE);
            holder.staus_iv.setVisibility(View.GONE);
            break;
        default:
            // 发送消息
            sendMsgInBackground(message, holder);
        }
    }
}