public void setupViewOptions() {
    setTextSize(adapter.getTextSize());
    mediaPreview.setStyle(adapter.getMediaPreviewStyle());
    //        profileImageView.setStyle(adapter.getProfileImageStyle());

    final boolean nameFirst = adapter.isNameFirst();
    nameView.setNameFirst(nameFirst);
    quotedNameView.setNameFirst(nameFirst);

    final int favIcon, favStyle, favColor;
    final Context context = adapter.getContext();
    if (adapter.shouldUseStarsForLikes()) {
      favIcon = R.drawable.ic_action_star;
      favStyle = LikeAnimationDrawable.Style.FAVORITE;
      favColor = ContextCompat.getColor(context, R.color.highlight_favorite);
    } else {
      favIcon = R.drawable.ic_action_heart;
      favStyle = LikeAnimationDrawable.Style.LIKE;
      favColor = ContextCompat.getColor(context, R.color.highlight_like);
    }
    final Drawable icon = ContextCompat.getDrawable(context, favIcon);
    final LikeAnimationDrawable drawable =
        new LikeAnimationDrawable(
            icon, favoriteCountView.getTextColors().getDefaultColor(), favColor, favStyle);
    drawable.mutate();
    favoriteIconView.setImageDrawable(drawable);
    timeView.setShowAbsoluteTime(adapter.isShowAbsoluteTime());

    favoriteIconView.setActivatedColor(favColor);
  }
Esempio n. 2
0
 public NameView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
   super(context, attrs, defStyleAttr);
   setEllipsize(TextUtils.TruncateAt.END);
   final TypedArray a =
       context.obtainStyledAttributes(attrs, R.styleable.NameView, defStyleAttr, 0);
   setPrimaryTextColor(a.getColor(R.styleable.NameView_nv_primaryTextColor, 0));
   setSecondaryTextColor(a.getColor(R.styleable.NameView_nv_secondaryTextColor, 0));
   if (mTwoLine = a.getBoolean(R.styleable.NameView_nv_twoLine, false)) {
     setSingleLine(false);
     setMaxLines(2);
   } else {
     setSingleLine(true);
   }
   mPrimaryTextStyle = new StyleSpan(a.getInt(R.styleable.NameView_nv_primaryTextStyle, 0));
   mSecondaryTextStyle = new StyleSpan(a.getInt(R.styleable.NameView_nv_secondaryTextStyle, 0));
   a.recycle();
   setNameFirst(true);
   if (isInEditMode()) {
     setName("Name");
     setScreenName("@screenname");
     updateText();
   }
 }