Improvements to layouts
This commit is contained in:
parent
119f718bcf
commit
5c308c7f1e
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -1,36 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
<TextView
|
||||
android:id="@+id/txtvItemname"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/txtvItemsize"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/txtvItemname"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/butAction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/navigation_expand"
|
||||
android:background="@drawable/borderless_button"
|
||||
android:layout_alignParentRight="true"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:clickable="false"
|
||||
/>
|
||||
<ImageView
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/vertical_divider"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@id/butAction"
|
||||
android:focusable="false"/>
|
||||
|
||||
</RelativeLayout>
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:layout_marginTop="4dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butAction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/borderless_button"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/navigation_expand" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@id/butAction"
|
||||
android:focusable="false"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/vertical_divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@id/divider"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvItemname"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvPublished"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/gray" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/enc_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvLenSize"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/txtvLenSize"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignTop="@id/txtvLenSize"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgvType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgvDownloaded"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/av_download"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -2,7 +2,6 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
|
@ -44,13 +43,14 @@
|
|||
<SeekBar
|
||||
android:id="@+id/sbPosition"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:max="500" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:padding="5dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/horizontal_divider" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -96,4 +96,11 @@
|
|||
android:src="@android:drawable/ic_media_ff" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/horizontal_divider" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,5 +1,6 @@
|
|||
package de.podfetcher.adapter;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import de.podfetcher.feed.FeedItem;
|
||||
|
@ -8,7 +9,10 @@ import de.podfetcher.R;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -19,8 +23,8 @@ import android.graphics.Typeface;
|
|||
public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
|
||||
private OnClickListener onButActionClicked;
|
||||
|
||||
public FeedItemlistAdapter(Context context,
|
||||
int textViewResourceId, List<FeedItem> objects, OnClickListener onButActionClicked) {
|
||||
public FeedItemlistAdapter(Context context, int textViewResourceId,
|
||||
List<FeedItem> objects, OnClickListener onButActionClicked) {
|
||||
super(context, textViewResourceId, objects);
|
||||
this.onButActionClicked = onButActionClicked;
|
||||
}
|
||||
|
@ -30,17 +34,28 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
|
|||
Holder holder;
|
||||
FeedItem item = getItem(position);
|
||||
|
||||
if(convertView == null) {
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
LayoutInflater inflater = (LayoutInflater) getContext()
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = inflater.inflate(R.layout.feeditemlist_item, null);
|
||||
holder.title = (TextView) convertView.findViewById(R.id.txtvItemname);
|
||||
holder.size = (TextView) convertView.findViewById(R.id.txtvItemsize);
|
||||
holder.butAction = (ImageButton) convertView.findViewById(R.id.butAction);
|
||||
|
||||
holder.title = (TextView) convertView
|
||||
.findViewById(R.id.txtvItemname);
|
||||
holder.lenSize = (TextView) convertView
|
||||
.findViewById(R.id.txtvLenSize);
|
||||
holder.butAction = (ImageButton) convertView
|
||||
.findViewById(R.id.butAction);
|
||||
holder.published = (TextView) convertView
|
||||
.findViewById(R.id.txtvPublished);
|
||||
holder.downloaded = (ImageView) convertView
|
||||
.findViewById(R.id.imgvDownloaded);
|
||||
holder.type = (ImageView) convertView.findViewById(R.id.imgvType);
|
||||
holder.encInfo = (RelativeLayout) convertView
|
||||
.findViewById(R.id.enc_info);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.title.setText(item.getTitle());
|
||||
|
@ -49,16 +64,45 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
|
|||
} else {
|
||||
holder.title.setTypeface(Typeface.DEFAULT);
|
||||
}
|
||||
holder.size.setText(Converter.byteToString(item.getMedia().getSize()));
|
||||
|
||||
holder.published.setText("Published: "
|
||||
+ DateUtils.formatSameDayTime(item.getPubDate().getTime(),
|
||||
System.currentTimeMillis(), DateFormat.SHORT,
|
||||
DateFormat.SHORT));
|
||||
|
||||
if (item.getMedia() == null) {
|
||||
holder.encInfo.setVisibility(View.GONE);
|
||||
} else {
|
||||
if (item.getMedia().isDownloaded()) {
|
||||
holder.lenSize.setText(Converter.getDurationStringShort(item
|
||||
.getMedia().getDuration()));
|
||||
holder.downloaded.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.lenSize.setText(Converter.byteToString(item.getMedia()
|
||||
.getSize()));
|
||||
}
|
||||
String type = item.getMedia().getMime_type()
|
||||
.substring(0, item.getMedia().getMime_type().indexOf('/'));
|
||||
if (type.equals("audio")) {
|
||||
holder.type.setImageResource(R.drawable.type_audio);
|
||||
} else if (type.equals("video")) {
|
||||
holder.type.setImageResource(R.drawable.type_video);
|
||||
}
|
||||
}
|
||||
|
||||
holder.butAction.setFocusable(false);
|
||||
holder.butAction.setOnClickListener(onButActionClicked);
|
||||
return convertView;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static class Holder {
|
||||
TextView title;
|
||||
TextView size;
|
||||
TextView published;
|
||||
TextView lenSize;
|
||||
ImageView downloaded;
|
||||
ImageView type;
|
||||
ImageButton butAction;
|
||||
RelativeLayout encInfo;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue