add generic feed icons to feedlist

This commit is contained in:
Andrew Dolgov 2011-11-28 14:25:55 +03:00
parent e6bbb7ae3a
commit 1cd840077e
3 changed files with 30 additions and 5 deletions

View File

@ -4,13 +4,21 @@
android:orientation="horizontal"
android:gravity="center_vertical"
android:id="@+id/feeds_row" android:layout_width="match_parent" android:paddingBottom="4dip" android:paddingLeft="8dip" android:paddingRight="8dip" android:paddingTop="4dip">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:src="@drawable/ic_rss_bw" />
<TextView
android:id="@+id/title"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:paddingLeft="6dip"
android:text="{FEED}" android:layout_width="wrap_content" android:textSize="18dip"/>
android:text="{FEED}" android:layout_width="0dp" android:textSize="18dip"/>
<TextView
android:id="@+id/unread_counter"
android:gravity="right"
@ -19,7 +27,8 @@
android:textColor="?unreadCounterColor"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_weight="0"
android:layout_height="wrap_content"
android:text="{123}" android:textSize="13dip"/>
android:text="{123}" android:textSize="13sp"/>
</LinearLayout>

View File

@ -5,13 +5,21 @@
android:background="?feedsSelectedBackground"
android:gravity="center_vertical"
android:id="@+id/feeds_row" android:layout_width="match_parent" android:paddingBottom="4dip" android:paddingLeft="8dip" android:paddingRight="8dip" android:paddingTop="4dip">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:src="@drawable/ic_rss_bw" />
<TextView
android:id="@+id/title"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:paddingLeft="6dip"
android:text="{FEED}" android:layout_width="wrap_content" android:textSize="18dip"/>
android:text="{FEED}" android:layout_width="0dp" android:textSize="18dip"/>
<TextView
android:id="@+id/unread_counter"
android:gravity="right"
@ -20,7 +28,8 @@
android:textColor="?unreadCounterColor"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_weight="0"
android:layout_height="wrap_content"
android:text="{123}" android:textSize="13dip"/>
android:text="{123}" android:textSize="13sp"/>
</LinearLayout>

View File

@ -19,6 +19,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -285,7 +286,13 @@ public class FeedsFragment extends Fragment implements OnItemClickListener {
if (tu != null) {
tu.setText(String.valueOf(feed.unread));
tu.setVisibility((feed.unread > 0) ? View.VISIBLE : View.INVISIBLE);
}
}
ImageView icon = (ImageView)v.findViewById(R.id.icon);
if (icon != null) {
icon.setImageResource(feed.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
return v;
}