From 8f6d2875921f8a9c7b95cc690675dbe0d2ab4676 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Thu, 12 Apr 2018 22:11:58 +0200 Subject: [PATCH] Amazfit Bip: add option to reset the last fetched activity (timestamp) Show a datepicker to reset the date after which the next activity will be fetched. Also add .gpx extension to fetched activity track (if present) and make the menu entries translatable. Close #1057 --- .../activities/ActivitySummariesActivity.java | 44 ++++++++++++++++++- .../FetchSportsDetailsOperation.java | 2 +- app/src/main/res/drawable/ic_reset.xml | 5 +++ .../res/menu/activity_list_context_menu.xml | 24 ++++++++++ app/src/main/res/menu/activity_list_menu.xml | 22 ++-------- app/src/main/res/values/strings.xml | 3 ++ 6 files changed, 80 insertions(+), 20 deletions(-) create mode 100644 app/src/main/res/drawable/ic_reset.xml create mode 100644 app/src/main/res/menu/activity_list_context_menu.xml diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummariesActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummariesActivity.java index 4fa97af97..6a33e27d2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummariesActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummariesActivity.java @@ -1,9 +1,11 @@ package nodomain.freeyourgadget.gadgetbridge.activities; +import android.app.DatePickerDialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; @@ -17,12 +19,14 @@ import android.view.MenuItem; import android.view.View; import android.widget.AbsListView; import android.widget.AdapterView; +import android.widget.DatePicker; import android.widget.ListView; import android.widget.Toast; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; import java.util.Objects; @@ -63,6 +67,27 @@ public class ActivitySummariesActivity extends AbstractListActivity + + diff --git a/app/src/main/res/menu/activity_list_context_menu.xml b/app/src/main/res/menu/activity_list_context_menu.xml new file mode 100644 index 000000000..17b30864a --- /dev/null +++ b/app/src/main/res/menu/activity_list_context_menu.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/activity_list_menu.xml b/app/src/main/res/menu/activity_list_menu.xml index d5049da44..c60b7695c 100644 --- a/app/src/main/res/menu/activity_list_menu.xml +++ b/app/src/main/res/menu/activity_list_menu.xml @@ -2,23 +2,9 @@ - - - - - - + android:id="@+id/activity_action_manage_timestamp" + android:icon="@drawable/ic_reset" + android:title="@string/reset_index" + app:showAsAction="never" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 016e3a9aa..6f9afd11a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -521,6 +521,9 @@ Activities Biking Treadmill + Select all + Share + Reset fetch date Firmware Invalid data