Created list layout for OrganizeActivity

This commit is contained in:
daniel oeh 2013-02-18 13:37:53 +01:00
parent d2649ce4b8
commit 89d4bdc9c6
7 changed files with 241 additions and 6 deletions

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#D2D2D2" />
</shape>
</item>
<item android:top="10dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#ECECEC" />
</shape>
</item>
<item android:top="20dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#D2D2D2" />
</shape>
</item>
<item android:top="30dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#ECECEC" />
</shape>
</item>
<item android:top="40dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#D2D2D2" />
</shape>
</item>
<item android:top="50dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#ECECEC" />
</shape>
</item>
<item android:top="60dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#D2D2D2" />
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#BEBEBE" />
</shape>
</item>
<item android:top="10dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#242A30" />
</shape>
</item>
<item android:top="20dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#BEBEBE" />
</shape>
</item>
<item android:top="30dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#242A30" />
</shape>
</item>
<item android:top="40dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#BEBEBE" />
</shape>
</item>
<item android:top="50dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#242A30" />
</shape>
</item>
<item android:top="60dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#BEBEBE" />
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imgvFeedimage"
android:layout_width="@dimen/thumbnail_length"
android:layout_height="@dimen/thumbnail_length"
android:layout_alignParentLeft="true"
android:scaleType="centerCrop" />
<View
android:id="@+id/dragHandle"
android:layout_width="@dimen/dragview_length"
android:layout_height="@dimen/dragview_length"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:background="?attr/dragview_background"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_toLeftOf="@id/dragHandle"
android:layout_toRightOf="@id/imgvFeedimage"
android:ellipsize="end"
android:lines="2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_small" />
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/txtvTitle"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@id/dragHandle"
android:layout_toRightOf="@id/imgvFeedimage"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
</RelativeLayout>

View File

@ -30,6 +30,7 @@
<attr name="borderless_button" format="reference" /> <attr name="borderless_button" format="reference" />
<attr name="spinner_button" format="reference" /> <attr name="spinner_button" format="reference" />
<attr name="overlay_drawable" format="reference" /> <attr name="overlay_drawable" format="reference" />
<attr name="dragview_background" format="reference" />
<!-- Used in itemdescription --> <!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference" /> <attr name="non_transparent_background" format="reference" />
<attr name="overlay_background" format="color" /> <attr name="overlay_background" format="color" />

View File

@ -3,6 +3,7 @@
<dimen name="widget_margin">8dp</dimen> <dimen name="widget_margin">8dp</dimen>
<dimen name="thumbnail_length">70dp</dimen> <dimen name="thumbnail_length">70dp</dimen>
<dimen name="dragview_length">54dp</dimen>
<dimen name="external_player_height">55dp</dimen> <dimen name="external_player_height">55dp</dimen>
<dimen name="enc_icons_size">20dp</dimen> <dimen name="enc_icons_size">20dp</dimen>
<dimen name="text_size_micro">12sp</dimen> <dimen name="text_size_micro">12sp</dimen>

View File

@ -34,11 +34,10 @@
<item name="attr/overlay_background">@color/overlay_light</item> <item name="attr/overlay_background">@color/overlay_light</item>
<item name="attr/spinner_button">@drawable/spinner_button</item> <item name="attr/spinner_button">@drawable/spinner_button</item>
<item name="attr/overlay_drawable">@drawable/overlay_drawable</item> <item name="attr/overlay_drawable">@drawable/overlay_drawable</item>
<item name="attr/dragview_background">@drawable/dragview_background</item>
</style> </style>
<style name="AntennaPod.TabPageIndicator" parent="Widget.TabPageIndicator"> <style name="AntennaPod.TabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:dividerPadding">10dp</item>
<item name="android:showDividers">middle</item>
<item name="android:paddingTop">16dp</item> <item name="android:paddingTop">16dp</item>
<item name="android:paddingLeft">8dp</item> <item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item> <item name="android:paddingRight">8dp</item>
@ -84,6 +83,7 @@
<item name="attr/overlay_background">@color/overlay_dark</item> <item name="attr/overlay_background">@color/overlay_dark</item>
<item name="attr/spinner_button">@drawable/spinner_button_dark</item> <item name="attr/spinner_button">@drawable/spinner_button_dark</item>
<item name="attr/overlay_drawable">@drawable/overlay_drawable_dark</item> <item name="attr/overlay_drawable">@drawable/overlay_drawable_dark</item>
<item name="attr/dragview_background">@drawable/dragview_background_dark</item>
</style> </style>
<style name="AntennaPod.DarkTabPageIndicator" parent="AntennaPod.TabPageIndicator"> <style name="AntennaPod.DarkTabPageIndicator" parent="AntennaPod.TabPageIndicator">

View File

@ -1,7 +1,16 @@
package de.danoeh.antennapod.activity; package de.danoeh.antennapod.activity;
import java.util.List;
import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockListActivity; import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
@ -9,17 +18,25 @@ import com.actionbarsherlock.view.MenuItem;
import de.danoeh.antennapod.PodcastApp; import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.FeedImageLoader;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedManager;
public class OrganizeQueueActivity extends SherlockListActivity { public class OrganizeQueueActivity extends SherlockListActivity {
private static final String TAG = "OrganizeQueueActivity"; private static final String TAG = "OrganizeQueueActivity";
private static final int MENU_ID_ACCEPT = 2; private static final int MENU_ID_ACCEPT = 2;
private OrganizeAdapter adapter;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setTheme(PodcastApp.getThemeResourceId()); setTheme(PodcastApp.getThemeResourceId());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
adapter = new OrganizeAdapter(this, 0, FeedManager.getInstance()
.getQueue());
setListAdapter(adapter);
} }
@Override @Override
@ -37,9 +54,6 @@ public class OrganizeQueueActivity extends SherlockListActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
case MENU_ID_ACCEPT: case MENU_ID_ACCEPT:
finish(); finish();
return true; return true;
@ -48,4 +62,59 @@ public class OrganizeQueueActivity extends SherlockListActivity {
} }
} }
private static class OrganizeAdapter extends ArrayAdapter<FeedItem> {
private Context context;
public OrganizeAdapter(Context context, int textViewResourceId,
List<FeedItem> objects) {
super(context, textViewResourceId, objects);
this.context = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
final FeedItem item = getItem(position);
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(
R.layout.organize_queue_listitem, null);
holder.title = (TextView) convertView
.findViewById(R.id.txtvTitle);
holder.feedTitle = (TextView) convertView
.findViewById(R.id.txtvFeedname);
holder.feedImage = (ImageView) convertView
.findViewById(R.id.imgvFeedimage);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.title.setText(item.getTitle());
holder.feedTitle.setText(item.getFeed().getTitle());
holder.feedImage.setTag(item.getFeed().getImage());
FeedImageLoader.getInstance().loadThumbnailBitmap(
item.getFeed().getImage(),
holder.feedImage,
(int) convertView.getResources().getDimension(
R.dimen.thumbnail_length));
return convertView;
}
static class Holder {
TextView title;
TextView feedTitle;
ImageView feedImage;
View dragHandle;
}
}
} }