From d5e395ecdfb5300983728c4b30c9e6c0b476b328 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Wed, 6 Jun 2018 13:56:44 +0100 Subject: [PATCH] Better user feedback on location button presses; more reliable map point retrieval --- .../uk/ac/masts/sifids/activities/Fish1FormsActivity.java | 6 ++++++ .../java/uk/ac/masts/sifids/activities/MapActivity.java | 5 +---- catch/src/main/res/values/strings.xml | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/catch/src/main/java/uk/ac/masts/sifids/activities/Fish1FormsActivity.java b/catch/src/main/java/uk/ac/masts/sifids/activities/Fish1FormsActivity.java index 36ce974..ff56b23 100644 --- a/catch/src/main/java/uk/ac/masts/sifids/activities/Fish1FormsActivity.java +++ b/catch/src/main/java/uk/ac/masts/sifids/activities/Fish1FormsActivity.java @@ -164,15 +164,21 @@ public void startTrackingLocation(View v) { public void stopTrackingLocation(View v) { stopService(new Intent(this, CatchLocationService.class)); + Toast.makeText(getBaseContext(), getString(R.string.stopped_tracking_location), + Toast.LENGTH_LONG).show(); } public void startFishing(View v) { ((CatchApplication) this.getApplication()).setFishing(true); this.startTrackingLocation(v); + Toast.makeText(getBaseContext(), getString(R.string.started_fishing), + Toast.LENGTH_LONG).show(); } public void stopFishing(View v) { ((CatchApplication) this.getApplication()).setFishing(false); + Toast.makeText(getBaseContext(), getString(R.string.stopped_fishing), + Toast.LENGTH_LONG).show(); } private void startLocationService() { diff --git a/catch/src/main/java/uk/ac/masts/sifids/activities/MapActivity.java b/catch/src/main/java/uk/ac/masts/sifids/activities/MapActivity.java index bedb229..9dfce30 100644 --- a/catch/src/main/java/uk/ac/masts/sifids/activities/MapActivity.java +++ b/catch/src/main/java/uk/ac/masts/sifids/activities/MapActivity.java @@ -107,10 +107,7 @@ private void getPoints() { @Override public void run() { Calendar cal = Calendar.getInstance(); - cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); - if (cal.after(new Date())) { - cal.add(Calendar.DATE, -7); - } + cal.add(Calendar.DATE, -1 * (cal.get(Calendar.DAY_OF_WEEK) - 1)); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); diff --git a/catch/src/main/res/values/strings.xml b/catch/src/main/res/values/strings.xml index cb18592..dcda7a6 100644 --- a/catch/src/main/res/values/strings.xml +++ b/catch/src/main/res/values/strings.xml @@ -41,6 +41,9 @@ Stop Fishing Submit last 1000 location points %s\n%s -\n%s + Stopped tracking location + Recorded location information will now indicate that you are fishing + Recorded location information will no longer indicate that you are fishing