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,17 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="4dp" >
<View
android:id="@+id/vStatusLabel"
android:layout_width="5dip"
android:layout_height="match_parent"
android:background="@color/status_unread"
android:visibility="invisible" />
<RelativeLayout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
@ -22,10 +10,11 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:maxLines="2"
android:ellipsize="end"
android:layout_toLeftOf="@+id/butAction"
android:ellipsize="end"
android:maxLines="2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium" />
@ -55,7 +44,8 @@
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:layout_toLeftOf="@+id/imgvInPlaylist"
android:padding="2dp" />
<ImageView
android:id="@id/imgvInPlaylist"
@ -63,6 +53,7 @@
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" />
@ -72,6 +63,7 @@
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" />
@ -81,6 +73,7 @@
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" />
@ -109,6 +102,50 @@
android:paddingTop="16dp"
android:scaleType="fitEnd"
android:src="?attr/spinner_button" />
</RelativeLayout>
</LinearLayout>
<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: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" />
<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/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" />
</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() {