Java 类android.text.style.DynamicDrawableSpan 实例源码

项目:EasyEmoji    文件:EmojiconTextView.java   
private void init(AttributeSet attrs) {
    mEmojiconTextSize = (int) getTextSize();
    if (attrs == null) {
        mEmojiconSize = (int) getTextSize();
    } else {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
        mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
        mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
        mTextStart = a.getInteger(R.styleable.Emojicon_emojiconTextStart, 0);
        mTextLength = a.getInteger(R.styleable.Emojicon_emojiconTextLength, -1);
        mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
        a.recycle();
    }
    addTextChangedListener(new EmojiTextWatcher(getContext(),mEmojiconSize,mEmojiconAlignment,mEmojiconTextSize,mUseSystemDefault));
    setText(getText());
}
项目:react-native-udesk    文件:EmojiconSpan.java   
public EmojiconSpan(Context context, Drawable drawable,
        int textSize) {
    super(DynamicDrawableSpan.ALIGN_BASELINE);
    mContext = context;
    mDrawable = drawable;
    mWidth = mHeight = mSize = 2 * textSize;
    mTextSize = textSize;

    if (mDrawable != null) {
        mHeight = mSize;
        mWidth = mHeight * mDrawable.getIntrinsicWidth()
                / mDrawable.getIntrinsicHeight();
        mTop = (mTextSize - mHeight) / 2;
        mDrawable.setBounds(0, mTop, mWidth, mTop + mHeight);
    }
}
项目:Emojix    文件:EmojixTextWatcher.java   
public EmojixTextWatcher(TextView textView) {
    this.textView = textView;

    SpannableString s = new SpannableString(textView.getText());
    if (!TextUtils.isEmpty(s)) {
        float textSize = textView.getTextSize();

        EmojiconHandler.addEmojis(textView.getContext(), s, (int) textSize,
                DynamicDrawableSpan.ALIGN_BASELINE, (int) textSize, 0, -1);

        textView.setText(s, TextView.BufferType.EDITABLE);

        if (textView instanceof EditText) {
            EditText editText = (EditText) textView;
            editText.setSelection(s.length());
        }
    }
}
项目:RichEditText    文件:RichEditText.java   
/**
 * use local uri to insert a image
 *
 * @param uri image uri
 */
public void insertImage(Uri uri) {
    String path = UriUtils.getValidPath(getContext(), uri);
    Bitmap bitmap = bitmapCreator.getBitmapByDiskPath(path);

    SpannableString ss = new SpannableString(path);

    //construct a Drawable and set Bounds
    Drawable mDrawable = new BitmapDrawable(getContext().getResources(), bitmap);
    int width = mDrawable.getIntrinsicWidth();
    int height = mDrawable.getIntrinsicHeight();
    mDrawable.setBounds(0, 0, width > 0 ? width : 0, height > 0 ? height : 0);

    ImageSpan span = new ImageSpan(mDrawable, path, DynamicDrawableSpan.ALIGN_BOTTOM);
    ss.setSpan(span, 0, path.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

    int start = this.getSelectionStart();

    getEditableText().insert(start, ss);//insert the imageSpan
    setSelection(start + ss.length());  //set selection start position
}
项目:RickText    文件:RichTextView.java   
private void init(Context context, AttributeSet attrs) {
    if (isInEditMode())
        return;

    if (attrs != null) {
        TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.RichTextView);
        needNumberShow = array.getBoolean(R.styleable.RichTextView_needNumberShow, false);
        needUrlShow = array.getBoolean(R.styleable.RichTextView_needUrlShow, false);
        atColor = array.getColor(R.styleable.RichTextView_atColor, Color.BLUE);
        topicColor = array.getColor(R.styleable.RichTextView_topicColor, Color.BLUE);
        linkColor = array.getColor(R.styleable.RichTextView_linkColor, Color.BLUE);
        emojiSize = array.getInteger(R.styleable.RichTextView_emojiSize, 0);
        emojiVerticalAlignment = array.getInteger(R.styleable.RichTextView_emojiVerticalAlignment, DynamicDrawableSpan.ALIGN_BOTTOM);
        array.recycle();
    }
}
项目:RickText    文件:CenteredImageSpan.java   
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom,
                 Paint paint) {

    if (mVerticalAlignment == DynamicDrawableSpan.ALIGN_BASELINE || mVerticalAlignment == DynamicDrawableSpan.ALIGN_BOTTOM) {
        super.draw(canvas, text, start, end, x, top, y, bottom, paint);
        return;
    }

    Drawable b = getDrawable();
    canvas.save();
    int transY = 0;
    //获得将要显示的文本高度-图片高度除2等居中位置+top(换行情况)
    transY = ((bottom - top) - b.getBounds().bottom) / 2 + top;
    //偏移画布后开始绘制
    canvas.translate(x, transY);
    b.draw(canvas);
    canvas.restore();
}
项目:wATLlib    文件:TextLayout.java   
public void release() {
    mText = null;
    mReleased = true;
    if (lines != null)
        lines.clear();
    lineSpan = null;
    chars = null;
    for (int i = 0; i < mDynamicDrawableSpanSparseArray.size(); i++) {
        int key = mDynamicDrawableSpanSparseArray.keyAt(i);
        DynamicDrawableSpan span = mDynamicDrawableSpanSparseArray.get(key);
        Drawable dr = span.getDrawable();
        if (dr != null && dr instanceof LazyDrawable) {
            ((LazyDrawable) dr).Unload();
        }
    }
    mDynamicDrawableSpanSparseArray.clear();
}
项目:vuze-remote-for-android    文件:SideFilterAdapter.java   
@Override
public void onBindFlexibleViewHolder(SideFilterViewHolder holder,
        int position) {
    SideFilterInfo item = getItem(position);
    if (item.letters.equals(FilterConstants.LETTERS_BS)) {
        Drawable drawableCompat = AndroidUtilsUI.getDrawableWithBounds(context,
                R.drawable.ic_backspace_white_24dp);
        ImageSpan imageSpan = new ImageSpan(drawableCompat,
                DynamicDrawableSpan.ALIGN_BOTTOM);
        SpannableStringBuilder ss = new SpannableStringBuilder(",");
        ss.setSpan(imageSpan, 0, 1, 0);
        holder.tvText.setText(ss);
    } else {
        holder.tvText.setText(item.letters);

        int resID = item.letters.length() > 1
                ? android.R.style.TextAppearance_Small
                : android.R.style.TextAppearance_Large;
        holder.tvText.setTextAppearance(context, resID);
        holder.tvText.setTextColor(
                ContextCompat.getColor(context, R.color.login_text_color));
    }
    if (holder.tvCount != null) {
        holder.tvCount.setText(item.count > 0 ? String.valueOf(item.count) : "");
    }
}
项目:XmppTest    文件:EmojiTextView.java   
private DynamicDrawableSpan getDynamicImageSpan(String content) {
    String idStr = EmojiUtil.getInstance().getFaceId(content);
    Resources resources = getContext().getResources();
    int id = resources.getIdentifier(EmojiUtil.DYNAMIC_FACE_PREFIX + idStr,
            "drawable", getContext().getPackageName());
    if (id > 0) {
        try {
            AnimatedImageSpan imageSpan = new AnimatedImageSpan(
                    new AnimatedGifDrawable(getResources(),
                            Math.round(getTextSize()) + 10, getResources()
                                    .openRawResource(id),
                            new AnimatedGifDrawable.UpdateListener() {
                                @Override
                                public void update() {
                                    // update the textview
                                    EmojiTextView.this.postInvalidate();
                                }
                            }));
            return imageSpan;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return null;
}
项目:XmppTest    文件:EmojiEditText.java   
private DynamicDrawableSpan getDynamicImageSpan(String content) {
    String idStr = EmojiUtil.getInstance().getFaceId(content);
    Resources resources = getContext().getResources();
    int id = resources.getIdentifier(
            EmojiUtil.DYNAMIC_FACE_PREFIX + idStr, "drawable",
            getContext().getPackageName());
    if (id > 0) {
        try {
            AnimatedImageSpan imageSpan = new AnimatedImageSpan(
                    new AnimatedGifDrawable(getResources(),
                            Math.round(getTextSize()) + 10, getResources()
                                    .openRawResource(id), null));
            return imageSpan;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return null;
}
项目:GitHub    文件:BetterImageSpan.java   
/**
 * A helper function to allow dropping in BetterImageSpan as a replacement to ImageSpan,
 * and allowing for center alignment if passed in.
 */
public static final @BetterImageSpanAlignment
int normalizeAlignment(int alignment) {
  switch (alignment) {
    case DynamicDrawableSpan.ALIGN_BOTTOM:
      return ALIGN_BOTTOM;
    case ALIGN_CENTER:
      return ALIGN_CENTER;
    case DynamicDrawableSpan.ALIGN_BASELINE:
    default:
      return ALIGN_BASELINE;
  }
}
项目:EasyEmoji    文件:EmojiconEditText.java   
private void init(AttributeSet attrs) {
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
    mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
    mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
    mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
    a.recycle();
    mEmojiconTextSize = (int) getTextSize();
    addTextChangedListener(new EmojiTextWatcher(getContext(),mEmojiconSize,mEmojiconAlignment,mEmojiconTextSize,mUseSystemDefault));
    setText(getText());
}
项目:EasyEmoji    文件:EmojiconMultiAutoCompleteTextView.java   
private void init(AttributeSet attrs) {
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
    mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
    mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
    mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
    a.recycle();
    mEmojiconTextSize = (int) getTextSize();
    setText(getText());
}
项目:MyFire    文件:FavortListAdapter.java   
private SpannableString setImageSpan(){
    String text = "  ";
    SpannableString imgSpanText = new SpannableString(text);
    imgSpanText.setSpan(new ImageSpan(AppApplication.getAppContext(), R.drawable.dianzansmal, DynamicDrawableSpan.ALIGN_BASELINE),
            0 , 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return imgSpanText;
}
项目:TestChat    文件:LikerTextView.java   
private SpannableString setImageSpan(List<String> list) {
        SpannableString spannableString = new SpannableString("..");
        if (list != null && list.contains(UserManager.getInstance().getCurrentUser().getObjectId())) {
                spannableString.setSpan(new ImageSpan(getContext(), R.drawable.ic_favorite_deep_orange_a700_24dp, DynamicDrawableSpan.ALIGN_BASELINE), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        } else {
                spannableString.setSpan(new ImageSpan(getContext(), R.drawable.ic_favorite_border_deep_orange_a700_24dp, DynamicDrawableSpan.ALIGN_BASELINE), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        return spannableString;
}
项目:Hitalk    文件:PraiseListView.java   
private SpannableString setImageSpan(){
    String text = "  ";
    SpannableString imgSpanText = new SpannableString(text);
    imgSpanText.setSpan(new ImageSpan(HiTalkApplication.mAppContext, R.drawable.icon_praise, DynamicDrawableSpan.ALIGN_BASELINE),
            0 , 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return imgSpanText;
}
项目:qmui    文件:EmojiconSpan.java   
public EmojiconSpan(Context context, int resourceId, int size, int textSize) {
    super(DynamicDrawableSpan.ALIGN_BASELINE);
    mContext = context;
    mResourceId = resourceId;
    mWidth = mHeight = mSize = size;
    mTextSize = textSize;
}
项目:Pocket-Plays-for-Twitch    文件:ChatAdapter.java   
public ChatAdapter(ChatRecyclerView aRecyclerView, Activity aContext, ChatAdapterCallback aCallback) {
    messages = new ArrayList<>();
    mRecyclerView = aRecyclerView;
    context = aContext;
    mCallback = aCallback;
    settings = new Settings(context);
    linkPattern = Pattern.compile("((http|https|ftp)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?\\/?([a-zA-Z0\u200C123456789\\-\\._\\?\\,\\'\\/\\\\\\+&amp;%\\$#\\=~])*[^\\.\\,\\)\\(\\s])");

    emoteAlignment = DynamicDrawableSpan.ALIGN_BASELINE;
    imageMod = new ImageSpan(context, R.drawable.ic_moderator, emoteAlignment);
    imageTurbo = new ImageSpan(context, R.drawable.ic_twitch_turbo, emoteAlignment);
    isNightTheme = settings.getTheme().equals(context.getString(R.string.night_theme_name)) || settings.getTheme().equals(context.getString(R.string.true_night_theme_name));
}
项目:QMUI_Android    文件:EmojiconSpan.java   
public EmojiconSpan(Context context, int resourceId, int size, int textSize) {
    super(DynamicDrawableSpan.ALIGN_BASELINE);
    mContext = context;
    mResourceId = resourceId;
    mWidth = mHeight = mSize = size;
    mTextSize = textSize;
}
项目:react-native-udesk    文件:EmojiconSpan.java   
public EmojiconSpan(Context context, int resourceId, int size, int textSize) {
    super(DynamicDrawableSpan.ALIGN_BASELINE);
    mContext = context;
    mResourceId = resourceId;
    mWidth = mHeight = mSize = size;
    mTextSize = textSize;
}
项目:emoticon-keyboard    文件:EmojiconEditText.java   
private void init(AttributeSet attrs) {
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
    mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
    mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
    mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
    a.recycle();
    mEmojiconTextSize = (int) getTextSize();
    setText(getText());
}
项目:emoticon-keyboard    文件:EmojiconMultiAutoCompleteTextView.java   
private void init(AttributeSet attrs) {
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
    mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
    mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
    mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
    a.recycle();
    mEmojiconTextSize = (int) getTextSize();
    setText(getText());
}
项目:emoticon-keyboard    文件:EmojiconTextView.java   
private void init(AttributeSet attrs) {
    mEmojiconTextSize = (int) getTextSize();
    if (attrs == null) {
        mEmojiconSize = (int) getTextSize();
    } else {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
        mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
        mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
        mTextStart = a.getInteger(R.styleable.Emojicon_emojiconTextStart, 0);
        mTextLength = a.getInteger(R.styleable.Emojicon_emojiconTextLength, -1);
        mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
        a.recycle();
    }
    setText(getText());
}
项目:android-expression    文件:ExpressionEditText.java   
private void init(AttributeSet attrs) {
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Expression);
    mExpressionSize = (int) a.getDimension(R.styleable.Expression_expressionSize, getTextSize());
    mExpressionAlignment = a.getInt(R.styleable.Expression_expressionAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
    a.recycle();
    mExpressionTextSize = (int) getTextSize();
    setText(getText());
}
项目:android-expression    文件:ExpressionTextView.java   
private void init(AttributeSet attrs) {
    mExpressionTextSize = (int) getTextSize();
    if (attrs == null) {
        mExpressionSize = (int) getTextSize();
    } else {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Expression);
        mExpressionSize = (int) a.getDimension(R.styleable.Expression_expressionSize, getTextSize());
        mExpressionAlignment = a.getInt(R.styleable.Expression_expressionAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
        a.recycle();
    }
    setText(getText());
}
项目:ChatApp-Android    文件:EmojiconEditText.java   
private void init(AttributeSet attrs){
  TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
  emojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
  emojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan
          .ALIGN_BASELINE);
  a.recycle();
  emojiconTextSize = (int) getTextSize();
  setText(getText());
}
项目:ChatApp-Android    文件:EmojiconMultiAutoCompleteTextView.java   
private void init(AttributeSet attrs){
  TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
  emojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
  emojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan
          .ALIGN_BASELINE);
  a.recycle();
  emojiconTextSize = (int) getTextSize();
  setText(getText());
}
项目:ChatApp-Android    文件:EmojiconTextView.java   
private void init(AttributeSet attrs){
  emojiconTextSize = (int) getTextSize();
  if (attrs == null)
    emojiconSize = emojiconTextSize;
  else{
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
    emojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
    emojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment,
            DynamicDrawableSpan.ALIGN_BASELINE);
    textStart = a.getInteger(R.styleable.Emojicon_emojiconTextStart, 0);
    textLength = a.getInteger(R.styleable.Emojicon_emojiconTextLength, -1);
    a.recycle();
  }
  setText(getText());
}
项目:emoji-keyboard    文件:EmojiTextView.java   
private void init(AttributeSet attrs) {
    this.mEmojiTextSize = (int) this.getTextSize();
    if (attrs == null) {
        this.mEmojiSize = (int) this.getTextSize();
    } else {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emoji);
        this.mEmojiSize = (int) a.getDimension(R.styleable.Emoji_emojiSize, getTextSize());
        this.mEmojiAlignment = a.getInt(R.styleable.Emoji_emojiAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
        this.mTextStart = a.getInteger(R.styleable.Emoji_emojiTextStart, 0);
        this.mTextLength = a.getInteger(R.styleable.Emoji_emojiTextLength, -1);
        this.mUseSystemDefault = a.getBoolean(R.styleable.Emoji_emojiUseSystemDefault, false);
        a.recycle();
    }
    this.setText(getText());
}
项目:emoji-keyboard    文件:EmojiEditText.java   
private void init(Context context, AttributeSet attrs) {
    this.mContext = context;
    this.initFocusListener();
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emoji);
    this.mEmojiconSize = (int) a.getDimension(R.styleable.Emoji_emojiSize, getTextSize());
    this.mEmojiconAlignment = a.getInt(R.styleable.Emoji_emojiAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
    this.mUseSystemDefault = a.getBoolean(R.styleable.Emoji_emojiUseSystemDefault, false);
    a.recycle();
    this.mEmojiconTextSize = (int) getTextSize();
    setText(getText());
}
项目:Emojix    文件:EmojixTextWatcher.java   
@Override
public void afterTextChanged(Editable s) {
    if (start >= 0) {
        float textSize = textView.getTextSize();
        int pos = start;

        start = -2;
        EmojiconHandler.addEmojis(textView.getContext(), s, (int) textSize,
                DynamicDrawableSpan.ALIGN_BASELINE, (int) textSize, pos, count);
        start = -1;
    }
}
项目:FriendCircleDemo    文件:FavoriteListAdapter.java   
private SpannableString setImageSpan() {
    String text = "  ";
    SpannableString imgSpanText = new SpannableString(text);
    imgSpanText.setSpan(new ImageSpan(mListView.getContext(), R.drawable.im_ic_dig_tips, DynamicDrawableSpan.ALIGN_BASELINE),
            0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return imgSpanText;
}
项目:emojicon-master    文件:EmojiconEditText.java   
private void init(AttributeSet attrs) {
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
    mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
    mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
    mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
    a.recycle();
    mEmojiconTextSize = (int) getTextSize();
    setText(getText());
}
项目:emojicon-master    文件:EmojiconMultiAutoCompleteTextView.java   
private void init(AttributeSet attrs) {
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
    mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
    mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
    mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
    a.recycle();
    mEmojiconTextSize = (int) getTextSize();
    setText(getText());
}
项目:emojicon-master    文件:EmojiconTextView.java   
private void init(AttributeSet attrs) {
    mEmojiconTextSize = (int) getTextSize();
    if (attrs == null) {
        mEmojiconSize = (int) getTextSize();
    } else {
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
        mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
        mEmojiconAlignment = a.getInt(R.styleable.Emojicon_emojiconAlignment, DynamicDrawableSpan.ALIGN_BASELINE);
        mTextStart = a.getInteger(R.styleable.Emojicon_emojiconTextStart, 0);
        mTextLength = a.getInteger(R.styleable.Emojicon_emojiconTextLength, -1);
        mUseSystemDefault = a.getBoolean(R.styleable.Emojicon_emojiconUseSystemDefault, false);
        a.recycle();
    }
    setText(getText());
}
项目:youkes_vr    文件:EmojiconSpan.java   
public EmojiconSpan(Context context, int resourceId, int size, int textSize) {
    super(DynamicDrawableSpan.ALIGN_BASELINE);
    mContext = context;
    mResourceId = resourceId;
    mWidth = mHeight = mSize = size;
    mTextSize = textSize;
}
项目:umeng_community_android    文件:EmojiSpan.java   
public EmojiSpan(Context context, int resourceId, int size, int textSize) {
    super(DynamicDrawableSpan.ALIGN_BASELINE);
    mContext = context;
    mResourceId = resourceId;
    mWidth = mHeight = mSize = size;
    mTextSize = textSize;
}
项目:AndroidGeek    文件:EmojiSpan.java   
public EmojiSpan(Context context, int resourceId, int size, int textSize) {
    super(DynamicDrawableSpan.ALIGN_BASELINE);
    mContext = context;
    mResourceId = resourceId;
    mWidth = mHeight = mSize = size;
    mTextSize = textSize;
}
项目:wATLlib    文件:SpannedSerializator.java   
/**
 *
 * @param span
 * @param dos
 */

private void writeImageSpanData(DynamicDrawableSpan span, DataOutputStream dos) {
    Drawable d = span.getDrawable();
    Bitmap bitmap;
    if (d instanceof BitmapDrawable) {
        bitmap = ((BitmapDrawable)d).getBitmap();
    } else {
        bitmap = Bitmap.createBitmap(d.getIntrinsicWidth(), d.getIntrinsicHeight(), Bitmap.Config.RGB_565);
        Canvas canvas = new Canvas(bitmap);
        d.draw(canvas);
    }
    bitmap.compress(Bitmap.CompressFormat.JPEG, 90,dos);
    bitmap.recycle();
}
项目:wATLlib    文件:SpannedSerializator.java   
/**
 * by default - reads drawable from stream
 * @param dis
 * @return
 * @throws IOException
 */
protected DynamicDrawableSpan readDynamicDrawableSpan(DataInputStream dis) throws IOException, ReadError {

    // final BitmapDrawable drawable = new BitmapDrawable(null,readImageSpanData(dis));
    // DynamicDrawableSpan dds = new ImageSpan(drawable,vA);
    return readImageSpanData(dis);
}