forked from upstream-mirrors/OpenTracks
Improve list view layout.
This commit is contained in:
@@ -14,81 +14,73 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:gravity="top"
|
||||
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="8dp" >
|
||||
<ImageView
|
||||
android:contentDescription="@string/icon_track"
|
||||
android:id="@+id/list_item_icon"
|
||||
android:paddingTop="8dp"
|
||||
android:shrinkColumns="1"
|
||||
android:stretchColumns="1" >
|
||||
<TableRow
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:paddingTop="4dp" />
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical" >
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent" >
|
||||
<ImageView
|
||||
android:contentDescription="@string/icon_track"
|
||||
android:id="@+id/list_item_icon"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_width="wrap_content" />
|
||||
<TableLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal" >
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:orientation="vertical" >
|
||||
android:shrinkColumns="0"
|
||||
android:stretchColumns="0" >
|
||||
<TableRow>
|
||||
<TextView
|
||||
android:id="@+id/list_item_name"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_width="fill_parent"
|
||||
android:singleLine="true"
|
||||
style="@style/TextLarge" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/list_item_date"
|
||||
android:layout_gravity="bottom"
|
||||
android:paddingLeft="8dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@android:color/secondary_text_dark"
|
||||
style="@style/TextSmall" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal" >
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:id="@+id/list_item_date"
|
||||
style="@style/ListItemDate" />
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TextView
|
||||
android:id="@+id/list_item_time_distance"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_width="fill_parent"
|
||||
android:singleLine="true"
|
||||
android:textColor="@android:color/primary_text_dark"
|
||||
style="@style/TextSmall" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/list_item_time"
|
||||
android:layout_gravity="bottom"
|
||||
android:paddingLeft="8dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@android:color/secondary_text_dark"
|
||||
style="@style/TextSmall" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/list_item_time"
|
||||
style="@style/ListItemDate" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</TableRow>
|
||||
<TableRow
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" >
|
||||
<TextView
|
||||
android:id="@+id/list_item_recording"
|
||||
android:layout_column="1"
|
||||
android:singleLine="true"
|
||||
style="@style/TextSmall" />
|
||||
</TableRow>
|
||||
<TableRow
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" >
|
||||
<TextView
|
||||
android:id="@+id/list_item_description"
|
||||
android:layout_column="1"
|
||||
android:singleLine="false"
|
||||
android:textColor="@android:color/secondary_text_dark"
|
||||
style="@style/TextSmall" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
@@ -106,6 +106,14 @@ limitations under the License.
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:padding">8dp</item>
|
||||
</style>
|
||||
<!-- list item date -->
|
||||
<style name="ListItemDate" parent="@style/TextSmall">
|
||||
<item name="android:gravity">right</item>
|
||||
<item name="android:layout_gravity">bottom</item>
|
||||
<item name="android:paddingLeft">8dp</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:textColor">@android:color/secondary_text_dark</item>
|
||||
</style>
|
||||
<!-- scroll view -->
|
||||
<style name="ScrollView">
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
|
||||
@@ -138,10 +138,14 @@ public class ListItemUtils {
|
||||
if (category == null || category.length() == 0) {
|
||||
return description;
|
||||
}
|
||||
if (description == null || description.length() == 0) {
|
||||
return category;
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
buffer.append("[" + category + "]");
|
||||
if (description != null && description.length() != 0) {
|
||||
buffer.append(" " + description);
|
||||
}
|
||||
return "[" + category + "] " + description;
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user