AggregatedStatisticsActivity: added filter option (by category, start and/or end date).

Fixes #1039.
This commit is contained in:
Román Ginés
2021-12-15 23:22:13 +01:00
committed by Román Martínez
parent 4d333bbafa
commit b4ce99440a
20 changed files with 940 additions and 18 deletions
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M9,11L7,11v2h2v-2zM13,11h-2v2h2v-2zM17,11h-2v2h2v-2zM19,4h-1L18,2h-2v2L8,4L8,2L6,2v2L5,4c-1.11,0 -1.99,0.9 -1.99,2L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.9,-2 -2,-2zM19,20L5,20L5,9h14v11z"/>
</vector>
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M4.25,5.61C6.27,8.2 10,13 10,13v6c0,0.55 0.45,1 1,1h2c0.55,0 1,-0.45 1,-1v-6c0,0 3.72,-4.8 5.74,-7.39C20.25,4.95 19.78,4 18.95,4H5.04C4.21,4 3.74,4.95 4.25,5.61z"/>
</vector>
@@ -0,0 +1,14 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:name="path"
android:pathData="M 5.039 4 C 4.209 4 3.74 4.949 4.25 5.609 C 6.086 7.964 8.901 11.587 9.477 12.328 L 17.805 4 L 5.039 4 Z M 14 13.959 L 10 17.959 L 10 19 C 10 19.55 10.45 20 11 20 L 13 20 C 13.55 20 14 19.55 14 19 L 14 13.959 Z M 5.415 18.466 L 19.284 4.597 C 19.449 4.432 19.673 4.339 19.906 4.339 C 20.14 4.339 20.364 4.432 20.529 4.597 L 20.529 4.597 C 20.694 4.762 20.787 4.986 20.787 5.219 C 20.787 5.453 20.694 5.677 20.529 5.842 L 6.66 19.711 C 6.495 19.876 6.271 19.968 6.037 19.968 C 5.804 19.968 5.58 19.876 5.415 19.711 C 5.306 19.601 5.227 19.465 5.187 19.316 C 5.147 19.167 5.147 19.009 5.187 18.86 C 5.227 18.711 5.306 18.575 5.415 18.466"
android:fillColor="@android:color/white"
android:strokeWidth="1"/>
</vector>
+1
View File
@@ -16,6 +16,7 @@
style="@style/TextLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:gravity="center_horizontal|center_vertical"
android:text="@string/aggregated_stats_empty_message" />
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<ScrollView style="@style/ScrollView.WithBottomButtons">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">
<GridLayout
android:id="@+id/filter_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2"
android:orientation="horizontal"
android:padding="8dp"
android:alignmentMode="alignBounds"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/filter_date_from" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/filter_date_from"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generic_from"
android:imeOptions="actionNext"
android:importantForAutofill="no"
android:padding="8dp"
app:layout_constraintTop_toBottomOf="@id/filter_items"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/filter_date_picker_from">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/filter_date_edit_text_from"
android:drawableStart="@drawable/ic_baseline_date_range_24"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="date"
android:selectAllOnFocus="true" />
</com.google.android.material.textfield.TextInputLayout>
<DatePicker
android:id="@+id/filter_date_picker_from"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible"
android:paddingLeft="8dp"
android:paddingRight="8dp"
app:layout_constraintTop_toBottomOf="@id/filter_date_from"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/filter_date_to" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/filter_date_to"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/generic_to"
android:imeOptions="actionNext"
android:importantForAutofill="no"
android:padding="8dp"
app:layout_constraintTop_toBottomOf="@id/filter_date_picker_from"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/filter_date_picker_to">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/filter_date_edit_text_to"
android:drawableStart="@drawable/ic_baseline_date_range_24"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="date"
android:selectAllOnFocus="true" />
</com.google.android.material.textfield.TextInputLayout>
<DatePicker
android:id="@+id/filter_date_picker_to"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible"
android:paddingLeft="8dp"
android:paddingRight="8dp"
app:layout_constraintTop_toBottomOf="@id/filter_date_to"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</LinearLayout>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/filter_dialog_check_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
tools:text="Check Button" />
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/aggregated_statistics_clear_filter"
android:icon="@drawable/ic_clear_filter_24dp"
app:showAsAction="always"
android:title="@string/menu_filter" />
<item
android:id="@+id/aggregated_statistics_filter"
android:icon="@drawable/ic_baseline_filter_alt_24"
app:showAsAction="always"
android:title="@string/menu_filter" />
</menu>
+5
View File
@@ -239,6 +239,9 @@ limitations under the License.
<string name="generic_click_twice_cancel">Click back again to cancel</string>
<string name="generic_choose_an_option">Choose an option</string>
<string name="generic_undo">Undo</string>
<string name="generic_filter">Filter</string>
<string name="generic_from">From</string>
<string name="generic_to">To</string>
<!-- Gps -->
<string name="gps_starting">Starting GPS</string>
<string name="gps_wait_for_better_signal">Waiting for a better GPS signal</string>
@@ -306,6 +309,7 @@ limitations under the License.
<string name="menu_voice_rate">Voice speed</string>
<string name="menu_resume_track">Resume track</string>
<string name="menu_add_custom_layout">New Layout</string>
<string name="menu_filter">Filter</string>
<!-- OpenTracks -->
<string name="recording_service">Recording service</string>
<string name="delete_service">Deletion service</string>
@@ -491,6 +495,7 @@ limitations under the License.
<string name="track_list_empty_message">Start recording your next adventure here</string>
<!-- Aggregated Statistics -->
<string name="aggregated_stats_empty_message">Record your first track to see aggregated statistics</string>
<string name="aggregated_stats_filter_no_results">There are not activities for the specified filter</string>
<!-- Interval List -->
<string name="interval_list_empty_message">There are not any interval yet</string>
<!-- Unit -->