mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-15 23:33:07 +02:00
Migration to Material Components theme and style.
New night theme mainly white on black. Fixes #1122. Fixes #957.
This commit is contained in:
committed by
Román Martínez
parent
72f7b12da6
commit
79e45f7aea
+132
-138
@@ -1,152 +1,146 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2012 Google Inc.
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
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.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/activated_background"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<!-- Photo -->
|
||||
<ImageView
|
||||
android:id="@+id/list_item_photo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:contentDescription="@string/image_photo_marker"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<!-- A gradient on top of the text -->
|
||||
<ImageView
|
||||
android:id="@+id/list_item_text_gradient"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha=".6"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:contentDescription="@string/image_photo_marker"
|
||||
android:src="@drawable/text_gradient" />
|
||||
<!-- Table 1 -->
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:shrinkColumns="1"
|
||||
android:stretchColumns="1">
|
||||
<!-- Table 1: Row 1 -->
|
||||
<TableRow>
|
||||
<!-- Table 1: Row 1: Column 1: (icon) -->
|
||||
<ImageView
|
||||
android:id="@+id/list_item_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:contentDescription="@string/image_track"
|
||||
app:tint="?android:textColorPrimary" />
|
||||
<!-- Table 1: Row 1: Column 2: (Table 2) -->
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:shrinkColumns="0"
|
||||
android:stretchColumns="0">
|
||||
|
||||
<TableRow>
|
||||
<!-- Table 2: Row 1: Column 1: (name) -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_name"
|
||||
style="@style/TextMediumPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
tools:text="Main text" />
|
||||
<!-- Table 2: Row 1: Column 2: (date) -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_date"
|
||||
style="@style/ListItemDate"
|
||||
tools:text="2020-09-09" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
<!-- 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_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list_item_time_distance"
|
||||
style="@style/TextSmall"
|
||||
android:layout_gravity="bottom"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
tools:text="50:43 (50.00km)" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/list_item_marker_count_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:contentDescription="@string/image_marker_count"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_marker_show_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list_item_marker_count"
|
||||
style="@style/TextSmall"
|
||||
android:layout_gravity="bottom"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
tools:text="2" />
|
||||
</LinearLayout>
|
||||
<!-- Table 2: Row 2: Column 2: (time) -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_time"
|
||||
style="@style/ListItemDate" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
<!-- Table 1: Row 2: (category and description) -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_category_description"
|
||||
style="@style/TextSmall"
|
||||
android:layout_column="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:singleLine="false"
|
||||
tools:text="description" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
<!-- A gradient on top of the text -->
|
||||
<ImageView
|
||||
android:id="@+id/list_item_text_gradient"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/activatedBackgroundIndicator" />
|
||||
</FrameLayout>
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:alpha=".6"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:contentDescription="@string/image_photo_marker"
|
||||
android:src="@drawable/text_gradient" />
|
||||
|
||||
<!-- Icon -->
|
||||
<ImageView
|
||||
android:id="@+id/list_item_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:contentDescription="@string/image_track"
|
||||
tools:src="@drawable/ic_activity_bike_24dp"/>
|
||||
|
||||
<!-- Name -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/textAppearanceBody1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/list_item_icon"
|
||||
app:layout_constraintEnd_toStartOf="@id/list_item_date"
|
||||
tools:text="Main text" />
|
||||
|
||||
<!-- Date -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/textAppearanceBodySmall"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/list_item_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:gravity="end"
|
||||
android:layout_marginStart="8dp"
|
||||
tools:text="2022-02-17" />
|
||||
|
||||
<!-- Total time and distance -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_time_distance"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/textAppearanceBodySmall"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_item_name"
|
||||
app:layout_constraintStart_toStartOf="@id/list_item_name"
|
||||
tools:text="50:43 (50.00km)" />
|
||||
|
||||
<!-- Marker count icon -->
|
||||
<ImageView
|
||||
android:id="@+id/list_item_marker_count_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_item_name"
|
||||
app:layout_constraintStart_toEndOf="@id/list_item_time_distance"
|
||||
app:layout_constraintBottom_toBottomOf="@id/list_item_time_distance"
|
||||
android:contentDescription="@string/image_marker_count"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_marker_show_24dp" />
|
||||
|
||||
<!-- Marker count text -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_marker_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/textAppearanceBodySmall"
|
||||
app:layout_constraintStart_toEndOf="@id/list_item_marker_count_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@id/list_item_marker_count_icon"
|
||||
android:singleLine="true"
|
||||
tools:text="2" />
|
||||
|
||||
<!-- Time -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/textAppearanceBodySmall"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_item_name"
|
||||
app:layout_constraintStart_toEndOf="@id/list_item_marker_count"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:gravity="end"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="8dp"
|
||||
tools:text="10:10:10"/>
|
||||
|
||||
<!-- Second row barrier -->
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/list_item_second_row_barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="list_item_time_distance,list_item_marker_count_icon,list_item_marker_count,list_item_time" />
|
||||
|
||||
<!-- Category and description -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_category_description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/textAppearanceBodySmall"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_item_second_row_barrier"
|
||||
app:layout_constraintStart_toStartOf="@id/list_item_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
tools:text="Description" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user