Improved status indicators of feeditemlist items
This commit is contained in:
parent
5e001760d6
commit
235c073938
|
@ -1,114 +1,151 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dip"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
android:paddingLeft="4dp" >
|
android:paddingLeft="4dp" >
|
||||||
|
|
||||||
<View
|
<TextView
|
||||||
android:id="@+id/vStatusLabel"
|
android:id="@+id/txtvItemname"
|
||||||
android:layout_width="5dip"
|
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_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: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
|
<ImageView
|
||||||
android:layout_width="0dip"
|
android:id="@+id/statusPlaying"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="@dimen/status_indicator_width"
|
||||||
android:layout_weight="1"
|
android:layout_height="18dp"
|
||||||
android:paddingLeft="4dp" >
|
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
|
<TextView
|
||||||
android:id="@+id/txtvItemname"
|
android:id="@+id/statusInProgress"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="18dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_alignParentTop="true"
|
||||||
android:maxLines="2"
|
android:layout_margin="8dp"
|
||||||
android:ellipsize="end"
|
android:background="@color/status_progress"
|
||||||
android:layout_toLeftOf="@+id/butAction"
|
android:gravity="center"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:minWidth="@dimen/status_indicator_width"
|
||||||
android:textSize="@dimen/text_size_medium" />
|
android:paddingLeft="2dp"
|
||||||
|
android:paddingRight="2dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/text_size_micro"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
</RelativeLayout>
|
||||||
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>
|
|
|
@ -25,7 +25,7 @@
|
||||||
<color name="download_failed_red">#CC0000</color>
|
<color name="download_failed_red">#CC0000</color>
|
||||||
<color name="status_unread">#E099CC00</color>
|
<color name="status_unread">#E099CC00</color>
|
||||||
<color name="status_progress">#E033B5E5</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_dark">#262C31</color>
|
||||||
<color name="overlay_light">#DDDDDD</color>
|
<color name="overlay_light">#DDDDDD</color>
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,12 @@ public class FeedItemlistAdapter extends AbstractFeedItemlistAdapter {
|
||||||
holder.feedtitle = (TextView) convertView
|
holder.feedtitle = (TextView) convertView
|
||||||
.findViewById(R.id.txtvFeedname);
|
.findViewById(R.id.txtvFeedname);
|
||||||
}
|
}
|
||||||
holder.statusLabel = (View) convertView
|
holder.statusPlaying = (View) convertView
|
||||||
.findViewById(R.id.vStatusLabel);
|
.findViewById(R.id.statusPlaying);
|
||||||
|
holder.statusUnread = (View) convertView
|
||||||
|
.findViewById(R.id.statusUnread);
|
||||||
|
holder.statusInProgress = (TextView) convertView
|
||||||
|
.findViewById(R.id.statusInProgress);
|
||||||
|
|
||||||
convertView.setTag(holder);
|
convertView.setTag(holder);
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,26 +97,26 @@ public class FeedItemlistAdapter extends AbstractFeedItemlistAdapter {
|
||||||
FeedItem.State state = item.getState();
|
FeedItem.State state = item.getState();
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case PLAYING:
|
case PLAYING:
|
||||||
holder.title.setTypeface(Typeface.DEFAULT_BOLD);
|
holder.statusPlaying.setVisibility(View.VISIBLE);
|
||||||
holder.statusLabel.setBackgroundColor(convertView
|
holder.statusUnread.setVisibility(View.GONE);
|
||||||
.getResources().getColor(R.color.status_playing));
|
holder.statusInProgress.setVisibility(View.GONE);
|
||||||
holder.statusLabel.setVisibility(View.VISIBLE);
|
|
||||||
break;
|
break;
|
||||||
case IN_PROGRESS:
|
case IN_PROGRESS:
|
||||||
holder.title.setTypeface(Typeface.DEFAULT_BOLD);
|
holder.statusPlaying.setVisibility(View.GONE);
|
||||||
holder.statusLabel.setBackgroundColor(convertView
|
holder.statusUnread.setVisibility(View.GONE);
|
||||||
.getResources().getColor(R.color.status_progress));
|
holder.statusInProgress.setVisibility(View.VISIBLE);
|
||||||
holder.statusLabel.setVisibility(View.VISIBLE);
|
holder.statusInProgress.setText(Converter
|
||||||
|
.getDurationStringLong(item.getMedia().getPosition()));
|
||||||
break;
|
break;
|
||||||
case NEW:
|
case NEW:
|
||||||
holder.title.setTypeface(Typeface.DEFAULT_BOLD);
|
holder.statusPlaying.setVisibility(View.GONE);
|
||||||
holder.statusLabel.setBackgroundColor(convertView
|
holder.statusUnread.setVisibility(View.VISIBLE);
|
||||||
.getResources().getColor(R.color.status_unread));
|
holder.statusInProgress.setVisibility(View.GONE);
|
||||||
holder.statusLabel.setVisibility(View.VISIBLE);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
holder.title.setTypeface(Typeface.DEFAULT);
|
holder.statusPlaying.setVisibility(View.GONE);
|
||||||
holder.statusLabel.setVisibility(View.INVISIBLE);
|
holder.statusUnread.setVisibility(View.GONE);
|
||||||
|
holder.statusInProgress.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +202,9 @@ public class FeedItemlistAdapter extends AbstractFeedItemlistAdapter {
|
||||||
ImageView type;
|
ImageView type;
|
||||||
ImageView downloading;
|
ImageView downloading;
|
||||||
ImageButton butAction;
|
ImageButton butAction;
|
||||||
View statusLabel;
|
View statusUnread;
|
||||||
|
View statusPlaying;
|
||||||
|
TextView statusInProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSelectedItemIndex() {
|
public int getSelectedItemIndex() {
|
||||||
|
|
Loading…
Reference in New Issue