Improved status indicators of feeditemlist items

This commit is contained in:
daniel oeh 2013-02-12 00:56:51 +01:00
parent 5e001760d6
commit 235c073938
3 changed files with 166 additions and 123 deletions

View File

@ -1,114 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="4dp" >
<View
android:id="@+id/vStatusLabel"
android:layout_width="5dip"
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:layout_toLeftOf="@+id/butAction"
android:ellipsize="end"
android:maxLines="2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium" />
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvItemname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
android:visibility="gone" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro" />
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvInPlaylist"
android:padding="2dp" />
<ImageView
android:id="@id/imgvInPlaylist"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloaded"
android:padding="2dp"
android:src="?attr/stat_playlist"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloaded"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloading"
android:padding="2dp"
android:src="?attr/av_download"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloading"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@id/butAction"
android:padding="2dp"
android:src="?attr/navigation_refresh"
android:visibility="visible" />
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/txtvPublished"
android:maxLines="2"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro" />
<ImageButton
android:id="@id/butAction"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="?attr/borderless_button"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingLeft="24dp"
android:paddingRight="8dp"
android:paddingTop="16dp"
android:scaleType="fitEnd"
android:src="?attr/spinner_button" />
<TextView
android:id="@+id/statusUnread"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:background="@color/status_unread"
android:visibility="invisible" />
android:gravity="center"
android:minWidth="@dimen/status_indicator_width"
android:text="@string/new_label"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="@dimen/text_size_micro"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="4dp" >
<ImageView
android:id="@+id/statusPlaying"
android:layout_width="@dimen/status_indicator_width"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:background="@color/status_playing"
android:gravity="center"
android:padding="2dp"
android:src="@drawable/av_play_dark" />
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:maxLines="2"
android:ellipsize="end"
android:layout_toLeftOf="@+id/butAction"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium" />
<TextView
android:id="@+id/statusInProgress"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:background="@color/status_progress"
android:gravity="center"
android:minWidth="@dimen/status_indicator_width"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="@dimen/text_size_micro"
android:textStyle="bold" />
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvItemname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
android:visibility="gone" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro" />
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvInPlaylist" />
<ImageView
android:id="@id/imgvInPlaylist"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloaded"
android:src="?attr/stat_playlist"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloaded"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloading"
android:src="?attr/av_download"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloading"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@id/butAction"
android:src="?attr/navigation_refresh"
android:visibility="visible" />
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/txtvPublished"
android:maxLines="2"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro" />
<ImageButton
android:id="@id/butAction"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="?attr/borderless_button"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingLeft="24dp"
android:paddingRight="8dp"
android:paddingTop="16dp"
android:scaleType="fitEnd"
android:src="?attr/spinner_button" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -25,7 +25,7 @@
<color name="download_failed_red">#CC0000</color>
<color name="status_unread">#E099CC00</color>
<color name="status_progress">#E033B5E5</color>
<color name="status_playing">#EE5F52</color>
<color name="status_playing">#E0EE5F52</color>
<color name="overlay_dark">#262C31</color>
<color name="overlay_light">#DDDDDD</color>

View File

@ -68,8 +68,12 @@ public class FeedItemlistAdapter extends AbstractFeedItemlistAdapter {
holder.feedtitle = (TextView) convertView
.findViewById(R.id.txtvFeedname);
}
holder.statusLabel = (View) convertView
.findViewById(R.id.vStatusLabel);
holder.statusPlaying = (View) convertView
.findViewById(R.id.statusPlaying);
holder.statusUnread = (View) convertView
.findViewById(R.id.statusUnread);
holder.statusInProgress = (TextView) convertView
.findViewById(R.id.statusInProgress);
convertView.setTag(holder);
} else {
@ -93,26 +97,26 @@ public class FeedItemlistAdapter extends AbstractFeedItemlistAdapter {
FeedItem.State state = item.getState();
switch (state) {
case PLAYING:
holder.title.setTypeface(Typeface.DEFAULT_BOLD);
holder.statusLabel.setBackgroundColor(convertView
.getResources().getColor(R.color.status_playing));
holder.statusLabel.setVisibility(View.VISIBLE);
holder.statusPlaying.setVisibility(View.VISIBLE);
holder.statusUnread.setVisibility(View.GONE);
holder.statusInProgress.setVisibility(View.GONE);
break;
case IN_PROGRESS:
holder.title.setTypeface(Typeface.DEFAULT_BOLD);
holder.statusLabel.setBackgroundColor(convertView
.getResources().getColor(R.color.status_progress));
holder.statusLabel.setVisibility(View.VISIBLE);
holder.statusPlaying.setVisibility(View.GONE);
holder.statusUnread.setVisibility(View.GONE);
holder.statusInProgress.setVisibility(View.VISIBLE);
holder.statusInProgress.setText(Converter
.getDurationStringLong(item.getMedia().getPosition()));
break;
case NEW:
holder.title.setTypeface(Typeface.DEFAULT_BOLD);
holder.statusLabel.setBackgroundColor(convertView
.getResources().getColor(R.color.status_unread));
holder.statusLabel.setVisibility(View.VISIBLE);
holder.statusPlaying.setVisibility(View.GONE);
holder.statusUnread.setVisibility(View.VISIBLE);
holder.statusInProgress.setVisibility(View.GONE);
break;
default:
holder.title.setTypeface(Typeface.DEFAULT);
holder.statusLabel.setVisibility(View.INVISIBLE);
holder.statusPlaying.setVisibility(View.GONE);
holder.statusUnread.setVisibility(View.GONE);
holder.statusInProgress.setVisibility(View.GONE);
break;
}
@ -198,7 +202,9 @@ public class FeedItemlistAdapter extends AbstractFeedItemlistAdapter {
ImageView type;
ImageView downloading;
ImageButton butAction;
View statusLabel;
View statusUnread;
View statusPlaying;
TextView statusInProgress;
}
public int getSelectedItemIndex() {