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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:gravity="top"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingBottom="12dp"
|
android:paddingBottom="12dp"
|
||||||
android:paddingLeft="12dp"
|
|
||||||
android:paddingRight="12dp"
|
android:paddingRight="12dp"
|
||||||
android:paddingTop="8dp" >
|
android:paddingTop="8dp"
|
||||||
<ImageView
|
android:shrinkColumns="1"
|
||||||
android:contentDescription="@string/icon_track"
|
android:stretchColumns="1" >
|
||||||
android:id="@+id/list_item_icon"
|
<TableRow
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent" >
|
||||||
android:paddingTop="4dp" />
|
<ImageView
|
||||||
<LinearLayout
|
android:contentDescription="@string/icon_track"
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/list_item_icon"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical" >
|
android:layout_marginLeft="8dp"
|
||||||
<LinearLayout
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_width="wrap_content" />
|
||||||
|
<TableLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:orientation="horizontal" >
|
android:shrinkColumns="0"
|
||||||
<LinearLayout
|
android:stretchColumns="0" >
|
||||||
android:layout_height="wrap_content"
|
<TableRow>
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/list_item_name"
|
android:id="@+id/list_item_name"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
style="@style/TextLarge" />
|
style="@style/TextLarge" />
|
||||||
</LinearLayout>
|
<TextView
|
||||||
<TextView
|
android:id="@+id/list_item_date"
|
||||||
android:id="@+id/list_item_date"
|
style="@style/ListItemDate" />
|
||||||
android:layout_gravity="bottom"
|
</TableRow>
|
||||||
android:paddingLeft="8dp"
|
<TableRow>
|
||||||
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
|
<TextView
|
||||||
android:id="@+id/list_item_time_distance"
|
android:id="@+id/list_item_time_distance"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="@android:color/primary_text_dark"
|
android:textColor="@android:color/primary_text_dark"
|
||||||
style="@style/TextSmall" />
|
style="@style/TextSmall" />
|
||||||
</LinearLayout>
|
<TextView
|
||||||
<TextView
|
android:id="@+id/list_item_time"
|
||||||
android:id="@+id/list_item_time"
|
style="@style/ListItemDate" />
|
||||||
android:layout_gravity="bottom"
|
</TableRow>
|
||||||
android:paddingLeft="8dp"
|
</TableLayout>
|
||||||
android:singleLine="true"
|
</TableRow>
|
||||||
android:textColor="@android:color/secondary_text_dark"
|
<TableRow
|
||||||
style="@style/TextSmall" />
|
android:layout_height="wrap_content"
|
||||||
</LinearLayout>
|
android:layout_width="match_parent" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/list_item_recording"
|
android:id="@+id/list_item_recording"
|
||||||
|
android:layout_column="1"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
style="@style/TextSmall" />
|
style="@style/TextSmall" />
|
||||||
|
</TableRow>
|
||||||
|
<TableRow
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/list_item_description"
|
android:id="@+id/list_item_description"
|
||||||
|
android:layout_column="1"
|
||||||
android:singleLine="false"
|
android:singleLine="false"
|
||||||
android:textColor="@android:color/secondary_text_dark"
|
android:textColor="@android:color/secondary_text_dark"
|
||||||
style="@style/TextSmall" />
|
style="@style/TextSmall" />
|
||||||
</LinearLayout>
|
</TableRow>
|
||||||
</LinearLayout>
|
</TableLayout>
|
||||||
@@ -106,6 +106,14 @@ limitations under the License.
|
|||||||
<item name="android:layout_gravity">center</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
<item name="android:padding">8dp</item>
|
<item name="android:padding">8dp</item>
|
||||||
</style>
|
</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 -->
|
<!-- scroll view -->
|
||||||
<style name="ScrollView">
|
<style name="ScrollView">
|
||||||
<item name="android:layout_height">match_parent</item>
|
<item name="android:layout_height">match_parent</item>
|
||||||
|
|||||||
@@ -138,10 +138,14 @@ public class ListItemUtils {
|
|||||||
if (category == null || category.length() == 0) {
|
if (category == null || category.length() == 0) {
|
||||||
return description;
|
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