Added icons to nav-items in navigation drawer
After Width: | Height: | Size: 891 B |
After Width: | Height: | Size: 716 B |
After Width: | Height: | Size: 593 B |
After Width: | Height: | Size: 484 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 989 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
|
@ -5,6 +5,21 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgvCover"
|
||||
android:contentDescription="@string/cover_label"
|
||||
android:layout_width="@dimen/thumbnail_length_navlist"
|
||||
android:layout_height="@dimen/thumbnail_length_navlist"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:cropToPadding="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvTitle"
|
||||
android:lines="1"
|
||||
|
@ -13,8 +28,11 @@
|
|||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/text_size_navdrawer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginBottom="28dp"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginRight="48dp"
|
||||
android:layout_toRightOf="@id/imgvCover"
|
||||
/>
|
||||
</RelativeLayout>
|
|
@ -33,6 +33,7 @@
|
|||
<attr name="dragview_background" format="reference"/>
|
||||
<attr name="dragview_float_background" format="reference"/>
|
||||
<attr name="ic_action_overflow" format="reference"/>
|
||||
<attr name="ic_new" format="reference"/>
|
||||
<!-- Used in itemdescription -->
|
||||
<attr name="non_transparent_background" format="reference"/>
|
||||
<attr name="overlay_background" format="color"/>
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
<item name="attr/nav_drawer_background">@color/white</item>
|
||||
<item name="attr/nav_drawer_toggle">@drawable/ic_drawer</item>
|
||||
<item name="attr/ic_action_overflow">@drawable/ic_action_overflow</item>
|
||||
<item name="attr/ic_new">@drawable/ic_new</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.AntennaPod.Dark" parent="@style/Theme.AppCompat">
|
||||
|
@ -77,6 +78,7 @@
|
|||
<item name="attr/nav_drawer_background">#3B3B3B</item>
|
||||
<item name="attr/nav_drawer_toggle">@drawable/ic_drawer_dark</item>
|
||||
<item name="attr/ic_action_overflow">@drawable/ic_action_overflow_dark</item>
|
||||
<item name="attr/ic_new">@drawable/ic_new_dark</item>
|
||||
|
||||
</style>
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -23,6 +25,7 @@ public class NavListAdapter extends BaseAdapter {
|
|||
|
||||
public static final int[] NAV_TITLES = {R.string.new_episodes_label, R.string.queue_label, R.string.downloads_label, R.string.playback_history_label, R.string.add_feed_label};
|
||||
|
||||
private final Drawable[] drawables;
|
||||
|
||||
public static final int SUBSCRIPTION_OFFSET = 1 + NAV_TITLES.length;
|
||||
|
||||
|
@ -32,6 +35,12 @@ public class NavListAdapter extends BaseAdapter {
|
|||
public NavListAdapter(ItemAccess itemAccess, Context context) {
|
||||
this.itemAccess = itemAccess;
|
||||
this.context = context;
|
||||
|
||||
TypedArray ta = context.obtainStyledAttributes(new int[] {R.attr.ic_new, R.attr.stat_playlist,
|
||||
R.attr.av_download, R.attr.device_access_time, R.attr.content_new});
|
||||
drawables = new Drawable[] {ta.getDrawable(0), ta.getDrawable(1), ta.getDrawable(2),
|
||||
ta.getDrawable(3), ta.getDrawable(4)};
|
||||
ta.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,12 +113,14 @@ public class NavListAdapter extends BaseAdapter {
|
|||
convertView = inflater.inflate(R.layout.nav_listitem, null);
|
||||
|
||||
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
|
||||
holder.image = (ImageView) convertView.findViewById(R.id.imgvCover);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (NavHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.title.setText(title);
|
||||
holder.image.setImageDrawable(drawables[position]);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -163,6 +174,7 @@ public class NavListAdapter extends BaseAdapter {
|
|||
|
||||
static class NavHolder {
|
||||
TextView title;
|
||||
ImageView image;
|
||||
}
|
||||
|
||||
static class SectionHolder {
|
||||
|
|