diff options
author | Raghul Jagannathan <raghul@redmart.com> | 2015-05-27 08:31:42 +0800 |
---|---|---|
committer | Raghul Jagannathan <raghul@redmart.com> | 2015-05-27 08:31:42 +0800 |
commit | d0022e053e4abfe35dac4ae2d90c6960982181fd (patch) | |
tree | a03a02dda68d9956e07759aad87cc9991d0b8b97 /app/src/main/java/de/danoeh/antennapod/view | |
parent | ba036e14990a6dd7e8a5076bdc20176532a4f417 (diff) | |
download | AntennaPod-d0022e053e4abfe35dac4ae2d90c6960982181fd.zip |
Subscription view for managing feeds and Navigation drawer feed list cleanup
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/view')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/view/SubscriptionViewItem.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/view/SubscriptionViewItem.java b/app/src/main/java/de/danoeh/antennapod/view/SubscriptionViewItem.java new file mode 100644 index 000000000..1aca68610 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/view/SubscriptionViewItem.java @@ -0,0 +1,63 @@ +package de.danoeh.antennapod.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import com.squareup.picasso.Picasso; + +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.utils.TimeUtils; + +/** + * Custom view for handling feed item. + */ +public class SubscriptionViewItem extends RelativeLayout { + + private ImageView mImageView; + private TextView mTitle; + private TextView mUnreadCountText; + private Context mContext; + + public SubscriptionViewItem(Context context) { + super(context); + init(context); + } + + public SubscriptionViewItem(Context context, AttributeSet attrs) { + super(context, attrs); + init(context); + } + + public SubscriptionViewItem(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(context); + } + + @Override + public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, widthMeasureSpec); + } + + private void init(Context context) { + mContext = context; + LayoutInflater mLayoutInflater = + (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View view = mLayoutInflater.inflate(R.layout.subscription_view, this); + mTitle = (TextView) view.findViewById(R.id.txtvTitle); + mImageView = (ImageView) view.findViewById(R.id.imgvCover); + mUnreadCountText = (TextView) view.findViewById(R.id.unread_count_text); + } + + public void setFeed(Feed feed, int unreadCount) { + Picasso.with(mContext).load(feed.getImageUri()).centerCrop().fit().into(mImageView); + mUnreadCountText.setText(unreadCount + ""); + mTitle.setText(TimeUtils.getTimeAgo(feed.getLastUpdate().getTime(), mContext)); + } + +} |