Improve marker count layout in list view

This commit is contained in:
Jimmy Shih
2013-10-30 10:53:37 -07:00
parent 64c03a40a7
commit 961d8be8b9
7 changed files with 31 additions and 16 deletions
+1 -1
View File
@@ -7,6 +7,6 @@
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.google.gdt.eclipse.managedapis.MANAGED_API_CONTAINER/fusiontables-v1r16lv1.12.0-beta"/>
<classpathentry kind="con" path="com.google.gdt.eclipse.managedapis.MANAGED_API_CONTAINER/gdata-spreadsheet-2.1"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
+13 -2
View File
@@ -69,19 +69,30 @@ limitations under the License.
<!-- Need to match the style set in ListItemUtils.setListItem -->
<!-- Table 2: Row 2: Column 1: (shared owner, total time, total distance, and marker count) -->
<LinearLayout
android:layout_gravity="bottom"
android:layout_height="wrap_content"
android:layout_width="match_parent" >
<TextView
android:ellipsize="end"
android:id="@+id/list_item_owner_time_distance"
android:layout_gravity="bottom"
android:layout_width="wrap_content"
android:singleLine="true"
style="@style/TextSmall" />
<ImageView
android:contentDescription="@string/icon_marker"
android:id="@+id/list_item_marker_count_icon"
android:layout_gravity="bottom"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="2dp"
android:layout_width="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/ic_menu_insert_marker" />
<TextView
android:drawablePadding="4dp"
android:ellipsize="end"
android:id="@+id/list_item_marker_count"
android:layout_gravity="bottom"
android:singleLine="true"
style="@style/TextSmall" />
</LinearLayout>
<!-- Table 2: Row 2: Column 2: (time) -->
@@ -21,11 +21,11 @@ import com.google.android.maps.mytracks.R;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.format.DateUtils;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
@@ -95,25 +95,29 @@ public class ListItemUtils {
ownerTimeDistanceTextView.setTextAppearance(activity, R.style.TextSmall);
ownerTimeDistance = getOwnerTimeDistance(sharedOwner, totalTime, totalDistance);
if (markerCount > 0) {
ownerTimeDistance += " \u2027 ";
ownerTimeDistance += " \u2027";
}
}
setTextView(ownerTimeDistanceTextView, ownerTimeDistance);
// Set markerCount
ImageView markerCountIcon = (ImageView) view.findViewById(R.id.list_item_marker_count_icon);
TextView markerCountTextView = (TextView) view.findViewById(R.id.list_item_marker_count);
if (markerCount > 0) {
markerCountIcon.setVisibility(View.VISIBLE);
markerCountTextView.setVisibility(View.VISIBLE);
Drawable markerDrawable = activity.getResources()
.getDrawable(R.drawable.ic_menu_insert_marker);
int size = markerCountTextView.getLineHeight();
markerDrawable.setBounds(0, 0, size, size);
markerCountTextView.setCompoundDrawables(markerDrawable, null, null, null);
markerCountTextView.setText(markerCount + "");
int lineHeight = markerCountTextView.getLineHeight();
LayoutParams layoutParams = markerCountIcon.getLayoutParams();
layoutParams.width = lineHeight;
layoutParams.height = lineHeight;
markerCountTextView.setText(String.valueOf(markerCount));
} else {
markerCountIcon.setVisibility(View.GONE);
markerCountTextView.setVisibility(View.GONE);
}
// Set date/time
String[] dateTime = getDateTime(isRecording, activity, startTime);
TextView dateTextView = (TextView) view.findViewById(R.id.list_item_date);
+1 -1
View File
@@ -4,6 +4,6 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
+1 -1
View File
@@ -10,6 +10,6 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
+1 -1
View File
@@ -10,6 +10,6 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
+1 -1
View File
@@ -4,6 +4,6 @@
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>