aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-05-01 09:57:05 +0200
committerBananeweizen <bananeweizen@gmx.de>2012-05-01 09:57:05 +0200
commit43dea34aab288874d103672ad2e124c66d52b468 (patch)
tree1c419f6821e7cc92d7e02b0df6c9f2025b5a31c9
parente3f07c229b048d39bcb61db16545648aa697e0d6 (diff)
downloadcgeo-43dea34aab288874d103672ad2e124c66d52b468.zip
cgeo-43dea34aab288874d103672ad2e124c66d52b468.tar.gz
cgeo-43dea34aab288874d103672ad2e124c66d52b468.tar.bz2
pimp listview layout
* remove margins outside for better use of screen space * avoid dynamic creation of inventory icons * center inventory icon * remove unneeded layout around inventory
-rw-r--r--main/res/layout/caches_item.xml (renamed from main/res/layout/cache.xml)53
-rw-r--r--main/res/layout/trackable_icon.xml8
-rw-r--r--main/src/cgeo/geocaching/ui/CacheListAdapter.java12
-rw-r--r--main/src/cgeo/geocaching/ui/CacheListView.java2
4 files changed, 39 insertions, 36 deletions
diff --git a/main/res/layout/cache.xml b/main/res/layout/caches_item.xml
index 3f13fbe..2385e08 100644
--- a/main/res/layout/cache.xml
+++ b/main/res/layout/caches_item.xml
@@ -3,30 +3,40 @@
android:id="@+id/one_cache"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:paddingBottom="7dip"
- android:paddingTop="7dip"
+ android:paddingBottom="6dip"
+ android:paddingTop="6dip"
android:background="?background_color" >
+
+ <!-- selection mode checkbox -->
+
<CheckBox android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_gravity="left"
- android:padding="5dip"
+ android:paddingRight="5dip"
android:gravity="left|center_horizontal"
- android:visibility="visible" />
- <ImageView android:id="@+id/log_status_mark"
+ android:visibility="gone" />
+
+ <!-- "found" marker, vertical green/red line -->
+
+ <ImageView android:id="@+id/log_status_mark"
android:layout_width="2dip"
android:layout_height="30dip"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/checkbox"
+ android:layout_marginRight="4dip"
android:scaleType="fitXY"
+ android:visibility="gone"
android:src="@drawable/mark_green" />
+
+ <!-- cache name and icon -->
+
<TextView android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="110dip"
- android:layout_marginLeft="10dip"
android:layout_toRightOf="@+id/log_status_mark"
android:layout_gravity="left"
android:paddingRight="3dip"
@@ -36,12 +46,14 @@
android:ellipsize="marquee"
android:textSize="18dip"
android:textColor="?text_color" />
+
+ <!-- cache attributes and other info -->
+
<TextView android:id="@+id/info"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="28dip"
android:layout_marginRight="110dip"
- android:layout_marginLeft="10dip"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/log_status_mark"
android:layout_gravity="left"
@@ -52,6 +64,9 @@
android:ellipsize="marquee"
android:textSize="12dip"
android:textColor="?text_color_grey" />
+
+ <!-- real text based direction and distance -->
+
<RelativeLayout android:id="@+id/direction_layout"
android:visibility="gone"
android:layout_width="78dip"
@@ -86,6 +101,9 @@
android:gravity="center"
cc:skin="?compass" />
</RelativeLayout>
+
+ <!-- image based direction and distance -->
+
<RelativeLayout android:id="@+id/dirimg_layout"
android:visibility="gone"
android:layout_width="78dip"
@@ -104,28 +122,29 @@
android:scaleType="fitXY"
android:src="@null" />
</RelativeLayout>
+
+ <!-- inventory and favorites -->
+
<RelativeLayout
android:layout_width="28dip"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginTop="1dip"
- android:layout_marginBottom="1dip"
- android:layout_marginRight="2dip" >
- <RelativeLayout android:id="@+id/inventory"
- android:visibility="gone"
+ android:layout_marginBottom="1dip">
+
+ <ImageView android:id="@+id/inventory"
android:layout_width="28dip"
android:layout_height="22dip"
- android:layout_marginTop="2dip"
- android:layout_centerHorizontal="true"
+ android:layout_gravity="center_vertical|center_horizontal"
android:layout_alignParentTop="true"
- android:layout_gravity="center"
- android:background="?inventory" >
- </RelativeLayout>
+ android:scaleType="center"
+ android:src="@drawable/trackable_all"
+ android:background="?inventory"/>
<TextView android:id="@+id/favourite"
android:layout_width="28dip"
android:layout_height="wrap_content"
- android:layout_marginTop="24dip"
+ android:layout_marginTop="22dip"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
diff --git a/main/res/layout/trackable_icon.xml b/main/res/layout/trackable_icon.xml
deleted file mode 100644
index 019918b..0000000
--- a/main/res/layout/trackable_icon.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="22dip"
- android:layout_height="22dip"
- android:layout_gravity="center_vertical|center_horizontal"
- android:layout_centerInParent="true"
- android:scaleType="fitXY"
- android:src="@drawable/trackable_all" />
diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
index b98aea1..99263e7 100644
--- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java
+++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
@@ -297,7 +297,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> {
View v = rowView;
if (v == null) {
- v = inflater.inflate(R.layout.cache, null);
+ v = inflater.inflate(R.layout.caches_item, null);
holder = new CacheListView();
holder.checkbox = (CheckBox) v.findViewById(R.id.checkbox);
@@ -308,7 +308,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> {
holder.direction = (CompassMiniView) v.findViewById(R.id.direction);
holder.dirImgLayout = (RelativeLayout) v.findViewById(R.id.dirimg_layout);
holder.dirImg = (ImageView) v.findViewById(R.id.dirimg);
- holder.inventory = (RelativeLayout) v.findViewById(R.id.inventory);
+ holder.inventory = (ImageView) v.findViewById(R.id.inventory);
holder.favourite = (TextView) v.findViewById(R.id.favourite);
holder.info = (TextView) v.findViewById(R.id.info);
@@ -363,15 +363,7 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> {
holder.text.setText(cache.getNameSp(), TextView.BufferType.SPANNABLE);
holder.text.setCompoundDrawablesWithIntrinsicBounds(getCacheIcon(cache), null, null, null);
- if (holder.inventory.getChildCount() > 0) {
- holder.inventory.removeAllViews();
- }
-
if (cache.getInventoryItems() > 0) {
- final ImageView tbIcon = (ImageView) inflater.inflate(R.layout.trackable_icon, null);
- tbIcon.setImageResource(R.drawable.trackable_all);
-
- holder.inventory.addView(tbIcon);
holder.inventory.setVisibility(View.VISIBLE);
} else {
holder.inventory.setVisibility(View.GONE);
diff --git a/main/src/cgeo/geocaching/ui/CacheListView.java b/main/src/cgeo/geocaching/ui/CacheListView.java
index 00d3ad7..0b89c9c 100644
--- a/main/src/cgeo/geocaching/ui/CacheListView.java
+++ b/main/src/cgeo/geocaching/ui/CacheListView.java
@@ -13,7 +13,7 @@ public class CacheListView {
public TextView text;
public TextView favourite;
public TextView info;
- public RelativeLayout inventory;
+ public ImageView inventory;
public RelativeLayout directionLayout;
public DistanceView distance;
public CompassMiniView direction;