diff --git a/.travis.yml b/.travis.yml
index 796a8cceb..d3ffd1f82 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
env:
global:
- ANDROID_API=29
- - ANDROID_BUILD_TOOLS=30.0.1
+ - ANDROID_BUILD_TOOLS=30.0.2
- ADB_INSTALL_TIMEOUT=5
language: android
jdk:
diff --git a/app/assets/changes.html b/app/assets/changes.html
index 60a06b3ef..d50f42a69 100644
--- a/app/assets/changes.html
+++ b/app/assets/changes.html
@@ -5,6 +5,14 @@
What's new
+v2.2.2.2
+
+
+ - #960 Check for Battery Optimization when starting GPS
+ - Avoid a few exceptions
+ - Transifex ru, pl, de
+ - Update internal libraries - AppCompatActivity update
+
v2.2.1.0
diff --git a/app/build.gradle b/app/build.gradle
index cce28dc0c..4427b5491 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -122,8 +122,10 @@ dependencies {
latestWearApp project(':wear')
}
- implementation 'androidx.annotation:annotation:1.1.0'
- latestImplementation "com.google.android.material:material:1.1.0"
+ implementation "androidx.annotation:annotation:${rootProject.ext.annotation_version}"
+ implementation "androidx.appcompat:appcompat:${rootProject.ext.appcompat_version}"
+
+ latestImplementation "com.google.android.material:material:1.2.0"
if (rootProject.ext.enableWear) {
//noinspection GradleDependency
latestImplementation "com.google.android.gms:play-services-wearable:${rootProject.ext.googlePlayServicesVersion}"
@@ -132,6 +134,7 @@ dependencies {
latestImplementation 'com.getpebble:pebblekit:4.0.1'
// MapBox uses telemetry, without Play there may be exceptions from mapbox: just ignore
//latestImplementation "com.google.android.gms:play-services-location:${rootProject.ext.googlePlayServicesVersion}"
+ //noinspection GradleDependency
latestImplementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:8.2.2'
latestImplementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v8:0.7.0'
latestImplementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-scalebar-v8:0.2.0'
diff --git a/app/res/layout/account_list.xml b/app/res/layout/account_list.xml
index 9e64b2e5f..a90b32230 100644
--- a/app/res/layout/account_list.xml
+++ b/app/res/layout/account_list.xml
@@ -21,7 +21,7 @@
android:orientation="vertical" >
Aktivität
Intervall
Runde
- Aufwärmen
- Abkühlen
+ Aufwärmphase
+ Abkühlphase
Aktuell
pro Kilometer
pro Meile
diff --git a/app/res/values-pl/cues.xml b/app/res/values-pl/cues.xml
index a58cc5820..bcc98143f 100644
--- a/app/res/values-pl/cues.xml
+++ b/app/res/values-pl/cues.xml
@@ -18,7 +18,7 @@
interwał
okrążenie
rozgrzewka
- uspokojenie
+ Uspokojenie
aktualny
na kilometr
na milę
diff --git a/app/res/values-ru/cues.xml b/app/res/values-ru/cues.xml
index ee242b1dd..e1aa46f62 100644
--- a/app/res/values-ru/cues.xml
+++ b/app/res/values-ru/cues.xml
@@ -83,6 +83,12 @@
- %d ударов в минуту
- %d ударов в минуту
+
+ - %d оборот в минуту
+ - %d оборота в минуту
+ - %d оборотов в минуту
+ - %d оборотов в минуту
+
Пауза
Продолжил движение
Остановился
diff --git a/app/res/values/pref_keys.xml b/app/res/values/pref_keys.xml
index f8efdac49..af8c30ff1 100644
--- a/app/res/values/pref_keys.xml
+++ b/app/res/values/pref_keys.xml
@@ -117,6 +117,7 @@
pref_keystartstop_active
pref_lock_run
+ pref_suppress_battery_optimization_popup
pref_bt_name
pref_bt_address
diff --git a/app/src/main/org/runnerup/db/DBHelper.java b/app/src/main/org/runnerup/db/DBHelper.java
index fb827922c..3188257d5 100644
--- a/app/src/main/org/runnerup/db/DBHelper.java
+++ b/app/src/main/org/runnerup/db/DBHelper.java
@@ -650,10 +650,10 @@ public static void importDatabase(Context ctx, String from) {
int cnt = FileUtil.copyFile(to, from);
builder.setMessage("Copied " + cnt + " bytes from " + from +
"\n\nRestart to use the database")
- .setPositiveButton(ctx.getString(R.string.OK), listener);
+ .setPositiveButton(R.string.OK, listener);
} catch (IOException e) {
builder.setMessage("Exception: " + e.toString() + " for " + from)
- .setNegativeButton(ctx.getString(R.string.Cancel), listener);
+ .setNegativeButton(R.string.Cancel, listener);
}
builder.show();
}
@@ -671,10 +671,10 @@ public static void exportDatabase(Context ctx, String to) {
int cnt = FileUtil.copyFile(to, from);
builder.setMessage("Exported " + cnt + " bytes to " + to +
"\n\nNote that the file will be deleted at uninstall")
- .setPositiveButton(ctx.getString(R.string.OK), listener);
+ .setPositiveButton(R.string.OK, listener);
} catch (IOException e) {
builder.setMessage("Exception: " + e.toString() + " for " + to)
- .setNegativeButton(ctx.getString(R.string.Cancel), listener);
+ .setNegativeButton(R.string.Cancel, listener);
}
builder.show();
}
diff --git a/app/src/main/org/runnerup/export/SyncManager.java b/app/src/main/org/runnerup/export/SyncManager.java
index 3c2157281..022ad23a7 100644
--- a/app/src/main/org/runnerup/export/SyncManager.java
+++ b/app/src/main/org/runnerup/export/SyncManager.java
@@ -390,7 +390,7 @@ private void askUsernamePassword(final Synchronizer sync, final AuthMethod authM
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
.setView(view)
- .setPositiveButton(getResources().getString(R.string.OK), (dialog, which) -> {
+ .setPositiveButton(R.string.OK, (dialog, which) -> {
try {
//noinspection ConstantConditions
authConfig.put("username", tv1.getText());
@@ -404,7 +404,7 @@ private void askUsernamePassword(final Synchronizer sync, final AuthMethod authM
testUserPass(sync, authConfig);
})
.setNeutralButton("Skip", (dialog, which) -> handleAuthComplete(sync, Status.SKIP))
- .setNegativeButton(getResources().getString(R.string.Cancel), (dialog, which) -> handleAuthComplete(sync, Status.SKIP))
+ .setNegativeButton(R.string.Cancel, (dialog, which) -> handleAuthComplete(sync, Status.SKIP))
.setOnKeyListener((dialogInterface, i, keyEvent) -> {
if (i == KeyEvent.KEYCODE_BACK && keyEvent.getAction() == KeyEvent.ACTION_UP) {
handleAuthComplete(sync, Status.CANCEL);
@@ -475,7 +475,7 @@ private void askFileUrl(final Synchronizer sync) {
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
.setView(view)
- .setPositiveButton(getResources().getString(R.string.OK), (dialog, which) -> {
+ .setPositiveButton(R.string.OK, (dialog, which) -> {
//Set default values
ContentValues tmp = new ContentValues();
String uri = tv1.getText().toString().trim();
@@ -495,7 +495,7 @@ private void askFileUrl(final Synchronizer sync) {
handleAuthComplete(sync, sync.connect());
})
- .setNegativeButton(getResources().getString(R.string.Cancel), (dialog, which) -> handleAuthComplete(sync, Status.SKIP))
+ .setNegativeButton(R.string.Cancel, (dialog, which) -> handleAuthComplete(sync, Status.SKIP))
.setOnKeyListener((dialogInterface, i, keyEvent) -> {
if (i == KeyEvent.KEYCODE_BACK && keyEvent.getAction() == KeyEvent.ACTION_UP) {
handleAuthComplete(sync, Status.CANCEL);
diff --git a/app/src/main/org/runnerup/tracker/component/TrackerCadence.java b/app/src/main/org/runnerup/tracker/component/TrackerCadence.java
index 6171433ff..a6a4d014d 100644
--- a/app/src/main/org/runnerup/tracker/component/TrackerCadence.java
+++ b/app/src/main/org/runnerup/tracker/component/TrackerCadence.java
@@ -117,7 +117,7 @@ public static boolean isAvailable(final Context context) {
private Sensor getSensor(final Context context) {
Sensor sensor = null;
- if (Build.VERSION.SDK_INT >= 20) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (mSensorManager == null) {
mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
}
diff --git a/app/src/main/org/runnerup/util/Formatter.java b/app/src/main/org/runnerup/util/Formatter.java
index bf18c6de2..3104e1e57 100644
--- a/app/src/main/org/runnerup/util/Formatter.java
+++ b/app/src/main/org/runnerup/util/Formatter.java
@@ -111,7 +111,7 @@ private class LocaleResources {
}
void setLang(Locale locale) {
- if (Build.VERSION.SDK_INT >= 17) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
configuration.setLocale(locale);
} else {
configuration.locale = locale;
diff --git a/app/src/main/org/runnerup/util/MapWrapper.java b/app/src/main/org/runnerup/util/MapWrapper.java
index 5651de7ed..3cf417ebd 100644
--- a/app/src/main/org/runnerup/util/MapWrapper.java
+++ b/app/src/main/org/runnerup/util/MapWrapper.java
@@ -36,6 +36,8 @@
import android.util.Log;
import android.view.ViewTreeObserver;
+import androidx.appcompat.content.res.AppCompatResources;
+
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
@@ -55,6 +57,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import static org.runnerup.util.Formatter.Format.TXT_SHORT;
@@ -287,19 +290,24 @@ public void onGlobalLayout() {
// Images id from text
route.map.getStyle().addImage(((Integer)DB.LOCATION.TYPE_START).toString(),
- BitmapUtils.getBitmapFromDrawable(context.getResources().getDrawable(R.drawable.ic_map_marker_start)),
+ Objects.requireNonNull(BitmapUtils.getBitmapFromDrawable(
+ AppCompatResources.getDrawable(context, R.drawable.ic_map_marker_start))),
false);
route.map.getStyle().addImage(((Integer)DB.LOCATION.TYPE_END).toString(),
- BitmapUtils.getBitmapFromDrawable(context.getResources().getDrawable(R.drawable.ic_map_marker_end)),
+ Objects.requireNonNull(BitmapUtils.getBitmapFromDrawable(
+ AppCompatResources.getDrawable(context, R.drawable.ic_map_marker_end))),
false);
route.map.getStyle().addImage(((Integer)DB.LOCATION.TYPE_PAUSE).toString(),
- BitmapUtils.getBitmapFromDrawable(context.getResources().getDrawable(R.drawable.ic_map_marker_pause)),
+ Objects.requireNonNull(BitmapUtils.getBitmapFromDrawable(
+ AppCompatResources.getDrawable(context, R.drawable.ic_map_marker_pause))),
false);
route.map.getStyle().addImage(((Integer)DB.LOCATION.TYPE_RESUME).toString(),
- BitmapUtils.getBitmapFromDrawable(context.getResources().getDrawable(R.drawable.ic_map_marker_resume)),
+ Objects.requireNonNull(BitmapUtils.getBitmapFromDrawable(
+ AppCompatResources.getDrawable(context, R.drawable.ic_map_marker_resume))),
false);
route.map.getStyle().addImage("lap",
- BitmapUtils.getBitmapFromDrawable(context.getResources().getDrawable(R.drawable.ic_map_marker_lap)),
+ Objects.requireNonNull(BitmapUtils.getBitmapFromDrawable(
+ AppCompatResources.getDrawable(context, R.drawable.ic_map_marker_lap))),
false);
symbolManager.setIconAllowOverlap(true);
diff --git a/app/src/main/org/runnerup/view/AccountActivity.java b/app/src/main/org/runnerup/view/AccountActivity.java
index 5007b8a64..c2a968017 100644
--- a/app/src/main/org/runnerup/view/AccountActivity.java
+++ b/app/src/main/org/runnerup/view/AccountActivity.java
@@ -27,7 +27,8 @@
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import androidx.core.content.ContextCompat;
+
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.text.TextUtils;
@@ -173,7 +174,7 @@ private void fillData() {
im.setVisibility(View.GONE);
tv.setVisibility(View.VISIBLE);
} else {
- im.setImageDrawable(ContextCompat.getDrawable(this, synchronizer.getIconId()));
+ im.setImageDrawable(AppCompatResources.getDrawable(this, synchronizer.getIconId()));
if (!TextUtils.isEmpty(synchronizer.getPublicUrl())) {
im.setTag(synchronizer.getPublicUrl());
im.setOnClickListener(urlButtonClick);
@@ -289,18 +290,17 @@ public boolean onOptionsItemSelected(MenuItem item) {
private final OnClickListener clearUploadsButtonClick = new OnClickListener() {
@Override
public void onClick(View v) {
- AlertDialog.Builder builder = new AlertDialog.Builder(
+ new AlertDialog.Builder(
AccountActivity.this)
- .setTitle(getString(R.string.Clear_uploads))
- .setMessage(getResources().getString(R.string.Clear_uploads_from_phone))
- .setPositiveButton(getString(R.string.OK),
+ .setTitle(R.string.Clear_uploads)
+ .setMessage(R.string.Clear_uploads_from_phone)
+ .setPositiveButton(R.string.OK,
(dialog, which) -> syncManager.clearUploadsByName(callback, mSynchronizerName))
- .setNegativeButton(getString(R.string.Cancel),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- });
- builder.show();
+ .setNegativeButton(R.string.Cancel,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss()
+ )
+ .show();
}
};
@@ -391,20 +391,18 @@ public void onClick(View v) {
final boolean[] selected = {
true
};
- AlertDialog.Builder builder = new AlertDialog.Builder(
+ new AlertDialog.Builder(
AccountActivity.this)
- .setTitle(getString(R.string.Disconnect_account))
- .setPositiveButton(getString(R.string.OK),
+ .setTitle(R.string.Disconnect_account)
+ .setPositiveButton(R.string.OK,
(dialog, which) -> syncManager.disableSynchronizer(disconnectCallback, mSynchronizerName,
selected[0]))
- .setNegativeButton(getString(R.string.Cancel),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- })
+ .setNegativeButton(R.string.Cancel,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss())
.setMultiChoiceItems(items, selected,
- (arg0, arg1, arg2) -> selected[arg1] = arg2);
- builder.show();
+ (arg0, arg1, arg2) -> selected[arg1] = arg2)
+ .show();
}
};
diff --git a/app/src/main/org/runnerup/view/AccountListActivity.java b/app/src/main/org/runnerup/view/AccountListActivity.java
index 984e46aff..d2df740dc 100644
--- a/app/src/main/org/runnerup/view/AccountListActivity.java
+++ b/app/src/main/org/runnerup/view/AccountListActivity.java
@@ -27,8 +27,9 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.annotation.NonNull;
-import androidx.loader.app.LoaderManager.LoaderCallbacks;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
+import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;
import androidx.cursoradapter.widget.CursorAdapter;
import androidx.appcompat.app.AppCompatActivity;
@@ -75,7 +76,7 @@ public void onCreate(Bundle savedInstanceState) {
mDB = DBHelper.getReadableDatabase(this);
mSyncManager = new SyncManager(this);
- ListView listView = findViewById(R.id.account_list);
+ ListView listView = findViewById(R.id.account_list_list);
// button footer
Button showDisabledBtn = new Button(this);
@@ -198,7 +199,7 @@ public void bindView(View view, Context context, Cursor cursor) {
int str = configured ?
R.string.accounts_category_connected :
R.string.accounts_category_unconnected;
- sectionTitle.setText(getString(str));
+ sectionTitle.setText(str);
sectionTitle.setVisibility(View.VISIBLE);
}
@@ -223,12 +224,12 @@ public void bindView(View view, Context context, Cursor cursor) {
// service icon
int synchronizerIcon = synchronizer.getIconId();
if (synchronizerIcon == 0) {
- Drawable circle = ContextCompat.getDrawable(context, R.drawable.circle_40dp);
- circle.setColorFilter(getResources().getColor(synchronizer.getColorId()), PorterDuff.Mode.SRC_IN);
+ Drawable circle = AppCompatResources.getDrawable(context, R.drawable.circle_40dp);
+ circle.setColorFilter(ContextCompat.getColor(context, synchronizer.getColorId()), PorterDuff.Mode.SRC_IN);
accountIcon.setImageDrawable(circle);
accountIconText.setText(name.substring(0, 1));
} else {
- accountIcon.setImageDrawable(ContextCompat.getDrawable(context, synchronizerIcon));
+ accountIcon.setImageDrawable(AppCompatResources.getDrawable(context, synchronizerIcon));
accountIconText.setText(null);
}
@@ -265,8 +266,8 @@ public View newView(Context context, Cursor cursor, ViewGroup parent) {
}
private void setCustomThumb(SwitchCompat switchCompat, int drawableId, Context context) {
- switchCompat.setThumbDrawable(ContextCompat.getDrawable(context, drawableId));
- switchCompat.setThumbTintList(ContextCompat.getColorStateList(context, R.color.switch_thumb));
+ switchCompat.setThumbDrawable(AppCompatResources.getDrawable(context, drawableId));
+ switchCompat.setThumbTintList(AppCompatResources.getColorStateList(context, R.color.switch_thumb));
switchCompat.setThumbTintMode(PorterDuff.Mode.MULTIPLY);
}
diff --git a/app/src/main/org/runnerup/view/AudioCueSettingsActivity.java b/app/src/main/org/runnerup/view/AudioCueSettingsActivity.java
index ffbbb2666..c733d7323 100644
--- a/app/src/main/org/runnerup/view/AudioCueSettingsActivity.java
+++ b/app/src/main/org/runnerup/view/AudioCueSettingsActivity.java
@@ -184,19 +184,19 @@ public boolean onOptionsItemSelected(MenuItem item) {
createNewAudioSchemeDialog();
return true;
}
- AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes),
+ new AlertDialog.Builder(this)
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
deleteAudioScheme();
})
- .setNegativeButton(getString(R.string.No),
+ .setNegativeButton(R.string.No,
(dialog, which) -> {
// Do nothing but close the dialog
dialog.dismiss();
- });
- builder.show();
+ })
+ .show();
return true;
}
@@ -297,21 +297,20 @@ private void createNewAudioSchemeDialog() {
editText.setMinimumHeight(48);
editText.setMinimumWidth(48);
- AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setTitle(getString(R.string.Create_new_audio_cue_scheme))
- // Get the layout inflater
- .setView(editText)
- .setPositiveButton(getString(R.string.OK), (dialog, which) -> {
- String scheme = editText.getText().toString();
- if (!scheme.contentEquals("")) {
- createNewAudioScheme(scheme);
- updateSortOrder(scheme);
- switchTo(scheme);
- }
- })
- .setNegativeButton(getString(R.string.Cancel), (dialog, which) -> {
- });
- builder.show();
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.Create_new_audio_cue_scheme)
+ // Get the layout inflater
+ .setView(editText)
+ .setPositiveButton(R.string.OK, (dialog, which) -> {
+ String scheme = editText.getText().toString();
+ if (!scheme.contentEquals("")) {
+ createNewAudioScheme(scheme);
+ updateSortOrder(scheme);
+ switchTo(scheme);
+ }
+ })
+ .setNegativeButton(R.string.Cancel, (dialog, which) -> {})
+ .show();
}
private final OnPreferenceClickListener onTestCueinfoClick = new OnPreferenceClickListener() {
diff --git a/app/src/main/org/runnerup/view/CreateAdvancedWorkout.java b/app/src/main/org/runnerup/view/CreateAdvancedWorkout.java
index a059a9d97..e36e7d331 100644
--- a/app/src/main/org/runnerup/view/CreateAdvancedWorkout.java
+++ b/app/src/main/org/runnerup/view/CreateAdvancedWorkout.java
@@ -179,19 +179,19 @@ public void onClick(View view) {
final StepButton stepButton = row.findViewById(R.id.workout_step_button);
if(!dontAskAgain) {
- AlertDialog.Builder builder = new AlertDialog.Builder(CreateAdvancedWorkout.this)
+ new AlertDialog.Builder(CreateAdvancedWorkout.this)
.setMultiChoiceItems(new String[]{"Don't ask again"}, new boolean[]{dontAskAgain},
(dialog, indexSelected, isChecked) -> dontAskAgain = isChecked)
- .setTitle(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes),
+ .setTitle(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
deleteStep(stepButton);
})
- .setNegativeButton(getString(R.string.No),
- (dialog, which) -> dialog.dismiss());
- builder.show();
+ .setNegativeButton(R.string.No,
+ (dialog, which) -> dialog.dismiss())
+ .show();
} else {
deleteStep(stepButton);
}
@@ -227,9 +227,9 @@ private void deleteStep(StepButton button) {
WorkoutSerializer.writeFile(ctx, advWorkoutName, advancedWorkout);
} catch (Exception ex) {
AlertDialog.Builder builder = new AlertDialog.Builder(CreateAdvancedWorkout.this)
- .setTitle(getString(R.string.Failed_to_load_workout))
+ .setTitle(R.string.Failed_to_load_workout)
.setMessage("" + ex.toString())
- .setPositiveButton(getString(R.string.OK),
+ .setPositiveButton(R.string.OK,
(dialog, which) -> dialog.dismiss());
builder.show();
}
@@ -259,19 +259,19 @@ private void deleteStep(StepButton button) {
};
private void handleWorkoutFileException(Exception e) {
- AlertDialog.Builder builder = new AlertDialog.Builder(CreateAdvancedWorkout.this)
+ new AlertDialog.Builder(CreateAdvancedWorkout.this)
.setTitle(getString(R.string.Failed_to_create_workout))
.setMessage("" + e.toString())
- .setPositiveButton(getString(R.string.OK),
- (dialog, which) -> dialog.dismiss());
- builder.show();
+ .setPositiveButton(R.string.OK,
+ (dialog, which) -> dialog.dismiss())
+ .show();
}
private final View.OnClickListener discardWorkoutButtonClick = view -> {
final AlertDialog.Builder builder = new AlertDialog.Builder(CreateAdvancedWorkout.this)
.setTitle("Delete workout?")
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes),
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
String name = advancedWorkoutSpinner.getValue().toString();
@@ -280,7 +280,7 @@ private void handleWorkoutFileException(Exception e) {
f.delete();
finish();
})
- .setNegativeButton(getString(R.string.No),
+ .setNegativeButton(R.string.No,
(dialog, which) -> dialog.dismiss());
builder.show();
};
diff --git a/app/src/main/org/runnerup/view/DetailActivity.java b/app/src/main/org/runnerup/view/DetailActivity.java
index fa5d692d5..136c3cb7d 100644
--- a/app/src/main/org/runnerup/view/DetailActivity.java
+++ b/app/src/main/org/runnerup/view/DetailActivity.java
@@ -31,6 +31,7 @@
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
@@ -284,25 +285,25 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
case R.id.menu_recompute_activity:
- final AlertDialog.Builder builderRecompute = new AlertDialog.Builder(this)
+ new AlertDialog.Builder(this)
.setTitle(R.string.Recompute_activity)
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes), (dialog, which) -> {
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes, (dialog, which) -> {
dialog.dismiss();
new ActivityCleaner().recompute(mDB, mID);
requery();
fillHeaderData();
finish();
})
- .setNegativeButton(getString(R.string.No),(dialog, which) -> dialog.dismiss());
- builderRecompute.show();
+ .setNegativeButton(R.string.No, (dialog, which) -> dialog.dismiss())
+ .show();
break;
case R.id.menu_simplify_path:
- final AlertDialog.Builder builderSimplify = new AlertDialog.Builder(this)
+ new AlertDialog.Builder(this)
.setTitle(R.string.path_simplification_menu)
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes), (dialog, which) -> {
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes, (dialog, which) -> {
dialog.dismiss();
PathSimplifier simplifier = new PathSimplifier(this);
ArrayList ids = simplifier.getNoisyLocationIDsAsStrings(mDB, mID);
@@ -312,8 +313,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
fillHeaderData();
finish();
})
- .setNegativeButton(getString(R.string.No),(dialog, which) -> dialog.dismiss());
- builderSimplify.show();
+ .setNegativeButton(R.string.No,(dialog, which) -> dialog.dismiss())
+ .show();
break;
case R.id.menu_share_activity:
@@ -650,13 +651,9 @@ private class ViewHolderDetailActivity {
public View getView(int position, View convertView, ViewGroup parent) {
if (position == reports.size()) {
Button b = new Button(DetailActivity.this);
- b.setText(getString(R.string.Configure_accounts));
+ b.setText(R.string.Configure_accounts);
b.setBackgroundResource(R.drawable.btn_blue);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- b.setTextColor(getResources().getColorStateList(R.color.btn_text_color, getTheme()));
- } else {
- b.setTextColor(getResources().getColorStateList(R.color.btn_text_color));
- }
+ b.setTextColor(AppCompatResources.getColorStateList(DetailActivity.this, R.color.btn_text_color));
b.setOnClickListener(v -> {
Intent i = new Intent(DetailActivity.this,
AccountListActivity.class);
@@ -699,7 +696,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
//Indicate Clickable label
viewHolder.tv1.setTextColor(Color.BLUE);
}
- viewHolder.cb.setText(getString(R.string.Uploaded));
+ viewHolder.cb.setText(R.string.Uploaded);
viewHolder.cb.setOnLongClickListener(clearUploadClick);
} else {
if (pendingSynchronizers.contains(name)) {
@@ -707,7 +704,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
} else {
viewHolder.cb.setChecked(false);
}
- viewHolder.cb.setText(getString(R.string.upload));
+ viewHolder.cb.setText(R.string.upload);
viewHolder.cb.setOnLongClickListener(null);
}
if (mode == MODE_DETAILS) {
@@ -748,21 +745,19 @@ private void saveActivity() {
private final OnLongClickListener clearUploadClick = arg0 -> {
final String name = (String) arg0.getTag();
- AlertDialog.Builder builder = new AlertDialog.Builder(DetailActivity.this)
+ new AlertDialog.Builder(DetailActivity.this)
.setTitle("Clear upload for " + name)
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes),
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
syncManager.clearUpload(name, mID);
requery();
})
- .setNegativeButton(getString(R.string.No),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- });
- builder.show();
+ .setNegativeButton(R.string.No,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss())
+ .show();
return false;
};
@@ -796,21 +791,20 @@ public void onClick(View v) {
};
private final OnClickListener discardButtonClick = v -> {
- AlertDialog.Builder builder = new AlertDialog.Builder(DetailActivity.this)
- .setTitle(getString(R.string.Discard_activity))
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes),
+ new AlertDialog.Builder(DetailActivity.this)
+ .setTitle(R.string.Discard_activity)
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
DetailActivity.this.setResult(RESULT_CANCELED);
DetailActivity.this.finish();
})
- .setNegativeButton(getString(R.string.No),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- });
- builder.show();
+ .setNegativeButton(R.string.No,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss()
+ )
+ .show();
};
@Override
@@ -864,22 +858,21 @@ public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
};
private final OnClickListener deleteButtonClick = v -> {
- AlertDialog.Builder builder = new AlertDialog.Builder(DetailActivity.this)
- .setTitle(getString(R.string.Delete_activity))
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes),
+ new AlertDialog.Builder(DetailActivity.this)
+ .setTitle(R.string.Delete_activity)
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
DBHelper.deleteActivity(mDB, mID);
dialog.dismiss();
DetailActivity.this.setResult(RESULT_OK);
DetailActivity.this.finish();
})
- .setNegativeButton(getString(R.string.No),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- });
- builder.show();
+ .setNegativeButton(R.string.No,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss()
+ )
+ .show();
};
@Override
@@ -900,7 +893,7 @@ private void shareActivity() {
};
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.Share_activity))
- .setPositiveButton(getString(R.string.OK),
+ .setPositiveButton(R.string.OK,
(dialog, w) -> {
if (which[0] == -1) {
dialog.dismiss();
@@ -926,7 +919,7 @@ private void shareActivity() {
intent.putExtra(Intent.EXTRA_STREAM, uri);
context.startActivity(Intent.createChooser(intent, getString(R.string.Share_activity)));
})
- .setNegativeButton(getString(R.string.Cancel),
+ .setNegativeButton(R.string.Cancel,
(dialog, which1) -> {
// Do nothing but close the dialog
dialog.dismiss();
diff --git a/app/src/main/org/runnerup/view/FeedActivity.java b/app/src/main/org/runnerup/view/FeedActivity.java
index b5c5d3ffe..a11279bef 100644
--- a/app/src/main/org/runnerup/view/FeedActivity.java
+++ b/app/src/main/org/runnerup/view/FeedActivity.java
@@ -23,10 +23,12 @@
import android.database.sqlite.SQLiteDatabase;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.Toolbar;
+import androidx.core.content.ContextCompat;
+
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -124,7 +126,7 @@ private void startSync() {
Set set = syncManager.feedSynchronizersSet(this);
if (!set.isEmpty()) {
feedProgress.setVisibility(View.VISIBLE);
- feedProgressLabel.setText(getString(R.string.synchronizing_feed));
+ feedProgressLabel.setText(R.string.synchronizing_feed);
syncManager.synchronizeFeed(syncDone, set, feed, null);
} else {
feedProgress.setVisibility(View.GONE);
@@ -233,11 +235,11 @@ public View getView(int arg0, View arg1, ViewGroup parent) {
// sport
int sportId = tmp.getAsInteger(DB.FEED.FEED_SUBTYPE);
- Drawable sportDrawable = ContextCompat.getDrawable(context, Sport.drawableColored16Of(sportId));
+ Drawable sportDrawable = AppCompatResources.getDrawable(context, Sport.drawableColored16Of(sportId));
ivSport.setImageDrawable(sportDrawable);
String sportName = Sport.textOf(getResources(), sportId);
- int sportColor = getResources().getColor(Sport.colorOf(sportId));
+ int sportColor = ContextCompat.getColor(FeedActivity.this, Sport.colorOf(sportId));
tvSport.setText(sportName);
tvSport.setTextColor(sportColor);
diff --git a/app/src/main/org/runnerup/view/HRSettingsActivity.java b/app/src/main/org/runnerup/view/HRSettingsActivity.java
index b2a32ddd4..7b1690c8a 100644
--- a/app/src/main/org/runnerup/view/HRSettingsActivity.java
+++ b/app/src/main/org/runnerup/view/HRSettingsActivity.java
@@ -232,17 +232,16 @@ private void log(String msg) {
}
private void clearHRSettings() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setTitle(getString(R.string.Clear_HR_settings))
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.OK), (dialog, which) -> doClear())
-
- .setNegativeButton(getString(R.string.Cancel),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- });
- builder.show();
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.Clear_HR_settings)
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.OK, (dialog, which) -> doClear())
+
+ .setNegativeButton(R.string.Cancel,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss()
+ )
+ .show();
}
private void load() {
@@ -288,10 +287,10 @@ private void close() {
private void notSupported() {
DialogInterface.OnClickListener listener = (dialog, which) -> dialog.dismiss();
- AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setTitle(getString(R.string.Heart_rate_monitor_is_not_supported_for_your_device))
- .setNegativeButton(getString(R.string.Cancel), listener);
- builder.show();
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.Heart_rate_monitor_is_not_supported_for_your_device)
+ .setNegativeButton(R.string.Cancel, listener)
+ .show();
}
private void clear() {
@@ -312,7 +311,7 @@ private void updateView() {
if (hrProvider == null) {
scanButton.setEnabled(true);
connectButton.setEnabled(false);
- connectButton.setText(getString(R.string.Connect));
+ connectButton.setText(R.string.Connect);
tvBTName.setText("");
tvHR.setText("");
return;
@@ -326,14 +325,14 @@ private void updateView() {
}
if (hrProvider.isConnected()) {
- connectButton.setText(getString(R.string.Disconnect));
+ connectButton.setText(R.string.Disconnect);
connectButton.setEnabled(true);
} else if (hrProvider.isConnecting()) {
connectButton.setEnabled(false);
- connectButton.setText(getString(R.string.Connecting));
+ connectButton.setText(R.string.Connecting);
} else {
connectButton.setEnabled(btName != null);
- connectButton.setText(getString(R.string.Connect));
+ connectButton.setText(R.string.Connect);
}
}
@@ -346,9 +345,9 @@ private void selectProvider() {
}
hrProvider = null;
- AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setTitle(getString(R.string.Select_type_of_Bluetooth_device))
- .setPositiveButton(getString(R.string.OK),
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.Select_type_of_Bluetooth_device)
+ .setPositiveButton(R.string.OK,
(dialog, which) -> {
if (hrProvider == null && items.length > 0) {
// Select the first in the list
@@ -358,7 +357,7 @@ private void selectProvider() {
log("hrProvider = " + (hrProvider == null ? "null" : hrProvider.getProviderName()));
open();
})
- .setNegativeButton(getString(R.string.Cancel),
+ .setNegativeButton(R.string.Cancel,
(dialog, which) -> {
mIsScanning = false;
hrProvider = null;
@@ -371,8 +370,8 @@ private void selectProvider() {
hrProvider = HRManager.getHRProvider(HRSettingsActivity.this,
items[arg1].toString());
log("hrProvider = " + (hrProvider == null ? "null" : hrProvider.getProviderName()));
- });
- builder.show();
+ })
+ .show();
}
private void startScan() {
@@ -382,8 +381,8 @@ private void startScan() {
hrProvider.startScan();
AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setTitle(getString(R.string.Scanning))
- .setPositiveButton(getString(R.string.Connect),
+ .setTitle(R.string.Scanning)
+ .setPositiveButton(R.string.Connect,
(dialog, which) -> {
log(hrProvider.getProviderName() + ".stopScan()");
hrProvider.stopScan();
@@ -391,7 +390,7 @@ private void startScan() {
updateView();
dialog.dismiss();
})
- .setNegativeButton(getString(R.string.Cancel),
+ .setNegativeButton(R.string.Cancel,
(dialog, which) -> {
log(hrProvider.getProviderName() + ".stopScan()");
hrProvider.stopScan();
@@ -619,7 +618,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
row = convertView;
}
TextView tv = row.findViewById(android.R.id.text1);
- //tv.setTextColor(resources.getColor(R.color.black));
+ //tv.setTextColor(ContextCompat.getColor(this, R.color.black));
HRDeviceRef btDevice = deviceList.get(position);
tv.setTag(btDevice);
@@ -628,5 +627,4 @@ public View getView(int position, View convertView, ViewGroup parent) {
return tv;
}
}
-
}
diff --git a/app/src/main/org/runnerup/view/HRZonesActivity.java b/app/src/main/org/runnerup/view/HRZonesActivity.java
index cce0e7ffd..8c2c24e65 100644
--- a/app/src/main/org/runnerup/view/HRZonesActivity.java
+++ b/app/src/main/org/runnerup/view/HRZonesActivity.java
@@ -199,10 +199,10 @@ private void saveHR() {
}
private void clearHRSettings() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setTitle(getString(R.string.Clear_heart_rate_zone_settings))
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.OK), (dialog, which) -> {
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.Clear_heart_rate_zone_settings)
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.OK, (dialog, which) -> {
ageSpinner.clear();
sexSpinner.clear();
maxHRSpinner.clear();
@@ -211,12 +211,11 @@ private void clearHRSettings() {
skipSave = true;
finish();
})
- .setNegativeButton(getString(R.string.Cancel),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- });
- builder.show();
+ .setNegativeButton(R.string.Cancel,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss()
+ )
+ .show();
}
@Override
diff --git a/app/src/main/org/runnerup/view/HistoryActivity.java b/app/src/main/org/runnerup/view/HistoryActivity.java
index 07bed1111..abf0cec8a 100644
--- a/app/src/main/org/runnerup/view/HistoryActivity.java
+++ b/app/src/main/org/runnerup/view/HistoryActivity.java
@@ -24,8 +24,9 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.annotation.NonNull;
-import androidx.loader.app.LoaderManager.LoaderCallbacks;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
+import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;
import androidx.cursoradapter.widget.CursorAdapter;
import androidx.appcompat.app.AppCompatActivity;
@@ -197,8 +198,8 @@ public void bindView(View view, Context context, Cursor cursor) {
ImageView emblem = view.findViewById(R.id.history_list_emblem);
TextView additionalInfo = view.findViewById(R.id.history_list_additional);
- int sportColor = getResources().getColor(Sport.colorOf(s));
- Drawable sportDrawable = ContextCompat.getDrawable(context, Sport.drawableColored16Of(s));
+ int sportColor = ContextCompat.getColor(context, Sport.colorOf(s));
+ Drawable sportDrawable = AppCompatResources.getDrawable(context, Sport.drawableColored16Of(s));
emblem.setImageDrawable(sportDrawable);
distanceText.setTextColor(sportColor);
additionalInfo.setTextColor(sportColor);
diff --git a/app/src/main/org/runnerup/view/MainLayout.java b/app/src/main/org/runnerup/view/MainLayout.java
index 3ad4ffb1f..2e553bbab 100644
--- a/app/src/main/org/runnerup/view/MainLayout.java
+++ b/app/src/main/org/runnerup/view/MainLayout.java
@@ -44,7 +44,7 @@
import android.widget.TabHost;
import androidx.appcompat.app.AlertDialog;
-import androidx.core.content.ContextCompat;
+import androidx.appcompat.content.res.AppCompatResources;
import org.runnerup.R;
import org.runnerup.common.util.Constants.DB;
@@ -62,7 +62,7 @@ public class MainLayout extends TabActivity {
private View getTabView(CharSequence label, int iconResource) {
@SuppressLint("InflateParams")View tabView = getLayoutInflater().inflate(R.layout.bottom_tab_indicator, null);
tabView.findViewById(R.id.icon).setContentDescription(label);
- Drawable icon = ContextCompat.getDrawable(this, iconResource);
+ Drawable icon = AppCompatResources.getDrawable(this, iconResource);
((ImageView)tabView.findViewById(R.id.icon)).setImageDrawable(icon);
return tabView;
}
@@ -277,10 +277,10 @@ private void whatsNew() {
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.whatsnew, null);
WebView wv = view.findViewById(R.id.web_view1);
new AlertDialog.Builder(this)
- .setTitle(getString(R.string.Whats_new))
+ .setTitle(R.string.Whats_new)
.setView(view)
- .setPositiveButton(getString(R.string.Rate_RunnerUp), (dialog, which) -> onRateClick.onClick(null))
- .setNegativeButton(getString(R.string.OK), (dialog, which) -> dialog.dismiss())
+ .setPositiveButton(R.string.Rate_RunnerUp, (dialog, which) -> onRateClick.onClick(null))
+ .setNegativeButton(R.string.OK, (dialog, which) -> dialog.dismiss())
.show();
wv.loadUrl("file:///android_asset/changes.html");
}
diff --git a/app/src/main/org/runnerup/view/ManageWorkoutsActivity.java b/app/src/main/org/runnerup/view/ManageWorkoutsActivity.java
index 850bbae73..5dce8f33e 100644
--- a/app/src/main/org/runnerup/view/ManageWorkoutsActivity.java
+++ b/app/src/main/org/runnerup/view/ManageWorkoutsActivity.java
@@ -140,15 +140,15 @@ public void onCreate(Bundle savedInstanceState) {
try {
importData(fileName, data);
} catch (Exception e) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setTitle(getString(R.string.Error))
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.Error)
.setMessage(getString(R.string.Failed_to_import) + ": " + fileName)
- .setPositiveButton(getString(R.string.OK),
+ .setPositiveButton(R.string.OK,
(dialog, which) -> {
dialog.dismiss();
ManageWorkoutsActivity.this.finish();
- });
- builder.show();
+ })
+ .show();
}
}
// launch home Activity (with FLAG_ACTIVITY_CLEAR_TOP)
@@ -193,7 +193,7 @@ private void importData(final String fileName, final Uri data) throws Exception
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.Import_workout) + ": " + fileName)
- .setPositiveButton(getString(R.string.Yes),
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
String saveName = fileName;
@@ -227,7 +227,7 @@ private void importData(final String fileName, final Uri data) throws Exception
}
launchMain(saveName);
})
- .setNegativeButton(getString(R.string.No),
+ .setNegativeButton(R.string.No,
(dialog, which) -> {
// Do nothing but close the dialog
dialog.dismiss();
@@ -396,19 +396,18 @@ private ArrayList filter(List li
// Set an EditText view to get user input
final EditText input = new EditText(ManageWorkoutsActivity.this);
- AlertDialog.Builder builder = new AlertDialog.Builder(ManageWorkoutsActivity.this)
- .setTitle(getString(R.string.Create_new_workout))
- .setMessage(getString(R.string.Set_workout_name))
+ new AlertDialog.Builder(ManageWorkoutsActivity.this)
+ .setTitle(R.string.Create_new_workout)
+ .setMessage(R.string.Set_workout_name)
.setView(input)
- .setPositiveButton(getString(R.string.OK), (dialog, whichButton) -> {
+ .setPositiveButton(R.string.OK, (dialog, whichButton) -> {
String value = input.getText().toString();
intent.putExtra(WORKOUT_NAME, value);
startActivity(intent);
})
- .setNegativeButton(getString(R.string.Cancel), (dialog, whichButton) -> dialog.dismiss());
-
- builder.show();
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> dialog.dismiss())
+ .show();
};
private final OnClickListener downloadButtonClick = new OnClickListener() {
@@ -421,20 +420,19 @@ public void onClick(View v) {
final WorkoutRef selected = (WorkoutRef) currentlySelectedWorkout.getTag();
ArrayList local = workouts.get(PHONE_STRING);
if (contains(local, selected)) {
- AlertDialog.Builder builder = new AlertDialog.Builder(ManageWorkoutsActivity.this)
+ new AlertDialog.Builder(ManageWorkoutsActivity.this)
.setTitle(getString(R.string.Downloading_1s_will_overwrite_2_workout_with_same_name, selected.workoutName, PHONE_STRING))
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes),
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
downloadWorkout(selected);
})
- .setNegativeButton(getString(R.string.No),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- });
- builder.show();
+ .setNegativeButton(R.string.No,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss()
+ )
+ .show();
return;
}
@@ -469,20 +467,18 @@ private boolean contains(ArrayList local,
return;
final WorkoutRef selected = (WorkoutRef) currentlySelectedWorkout.getTag();
- AlertDialog.Builder builder = new AlertDialog.Builder(ManageWorkoutsActivity.this)
+ new AlertDialog.Builder(ManageWorkoutsActivity.this)
.setTitle(getString(R.string.Delete_workout) + " " + selected.workoutName)
- .setMessage(getString(R.string.Are_you_sure))
- .setPositiveButton(getString(R.string.Yes),
+ .setMessage(R.string.Are_you_sure)
+ .setPositiveButton(R.string.Yes,
(dialog, which) -> {
dialog.dismiss();
deleteWorkout(selected);
})
- .setNegativeButton(getString(R.string.No),
- (dialog, which) -> {
- // Do nothing but close the dialog
- dialog.dismiss();
- });
- builder.show();
+ .setNegativeButton(R.string.No,
+ // Do nothing but close the dialog
+ (dialog, which) -> dialog.dismiss())
+ .show();
};
private void deleteWorkout(WorkoutRef selected) {
diff --git a/app/src/main/org/runnerup/view/RunActivity.java b/app/src/main/org/runnerup/view/RunActivity.java
index 2ff0f9b95..58b388394 100644
--- a/app/src/main/org/runnerup/view/RunActivity.java
+++ b/app/src/main/org/runnerup/view/RunActivity.java
@@ -34,6 +34,9 @@
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.view.ViewCompat;
+
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -55,7 +58,6 @@
import org.runnerup.tracker.component.TrackerHRM;
import org.runnerup.util.Formatter;
import org.runnerup.util.TickListener;
-import org.runnerup.widget.WidgetUtil;
import org.runnerup.workout.Intensity;
import org.runnerup.workout.Scope;
import org.runnerup.workout.Step;
@@ -224,7 +226,7 @@ private void onGpsTrackerBound() {
populateWorkoutList();
newLapButton.setOnClickListener(newLapButtonClick);
- newLapButton.setText(getString(R.string.New_lap));
+ newLapButton.setText(R.string.New_lap);
mTracker.displayNotificationState();
}
@@ -337,6 +339,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
private final OnClickListener pauseButtonClick = v -> {
+ if (workout == null) {
+ // "should not happen"
+ return;
+ }
+
if (workout.isPaused()) {
workout.onResume(workout);
} else {
@@ -347,12 +354,12 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
private void setPauseButtonEnabled(boolean enabled) {
if (enabled) {
- pauseButton.setText(getString(R.string.Pause));
- WidgetUtil.setBackground(pauseButton, getResources().getDrawable(R.drawable.btn_blue));
+ pauseButton.setText(R.string.Pause);
+ ViewCompat.setBackground(pauseButton, AppCompatResources.getDrawable(this, R.drawable.btn_blue));
pauseButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_av_pause, 0);
} else {
- pauseButton.setText(getString(R.string.Resume));
- WidgetUtil.setBackground(pauseButton, getResources().getDrawable(R.drawable.btn_green));
+ pauseButton.setText(R.string.Resume);
+ ViewCompat.setBackground(pauseButton, AppCompatResources.getDrawable(this, R.drawable.btn_green));
pauseButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_av_play_arrow, 0);
}
}
@@ -363,6 +370,11 @@ private void updateView() {
if (mTracker.getState() == TrackerState.STOPPED){
doStop();
} else {
+ if (workout == null) {
+ // "should not happen"
+ return;
+ }
+
setPauseButtonEnabled(!workout.isPaused());
double ad = workout.getDistance(Scope.ACTIVITY);
double at = workout.getTime(Scope.ACTIVITY);
@@ -557,7 +569,7 @@ private View getWorkoutRow(org.runnerup.workout.Step step, int level, View conve
}
if (step.getIntensity() == Intensity.REPEAT){
if (step.getCurrentRepeat() >= step.getRepeatCount()) {
- durationValue.setText(getString(R.string.Finished));
+ durationValue.setText(R.string.Finished);
} else {
durationValue.setText(String.format(Locale.getDefault(), "%d/%d",
(step.getCurrentRepeat() + 1), step.getRepeatCount()));
diff --git a/app/src/main/org/runnerup/view/StartActivity.java b/app/src/main/org/runnerup/view/StartActivity.java
index d265d2183..7c667f35e 100644
--- a/app/src/main/org/runnerup/view/StartActivity.java
+++ b/app/src/main/org/runnerup/view/StartActivity.java
@@ -27,11 +27,13 @@
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
+import android.content.res.Resources;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
+import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.provider.Settings;
@@ -554,10 +556,10 @@ private void notificationBatteryLevel(int batteryLevel) {
AlertDialog prompt = new AlertDialog.Builder(this)
.setView(dontShowAgain)
.setCancelable(false)
+ .setTitle(R.string.Warning)
.setMessage(getResources().getText(R.string.Low_HRM_battery_level)
- + "\n" + getResources().getText(R.string.Battery_level) + ": " + batteryLevel + "%")
- .setTitle(getResources().getText(R.string.Warning))
- .setPositiveButton(getResources().getText(R.string.OK), (dialog, which) -> {
+ + "\n" + getResources().getText(R.string.Battery_level) + ": " + batteryLevel + "%")
+ .setPositiveButton(R.string.OK, (dialog, which) -> {
if (dontShowAgain.isChecked()) {
prefs.edit().putBoolean(pref_key, true).apply();
}
@@ -669,7 +671,9 @@ private boolean checkPermissions(boolean popup) {
if (ContextCompat.checkSelfPermission(this, perm) != PackageManager.PERMISSION_GRANTED) {
missingAnyPermission = true;
// Filter non essential permissions for result
- missingEssentialPermission = missingEssentialPermission || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || !perm.equals(Manifest.permission.ACTIVITY_RECOGNITION);
+ missingEssentialPermission = missingEssentialPermission
+ || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q
+ || !perm.equals(Manifest.permission.ACTIVITY_RECOGNITION);
if (ActivityCompat.shouldShowRequestPermissionRationale(this, perm)) {
// A denied permission, show motivation in a popup
String s = "Permission " + perm + " is explicitly denied";
@@ -692,12 +696,9 @@ private boolean checkPermissions(boolean popup) {
AlertDialog.Builder builder = new AlertDialog.Builder(StartActivity.this)
.setTitle(getString(R.string.GPS_permission_required))
- .setMessage(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
- ? getString(R.string.GPS_permission_text)
- : getString(R.string.GPS_permission_text_pre_Android10))
- .setNegativeButton(getString(R.string.Cancel), (dialog, which) -> dialog.dismiss());
+ .setNegativeButton(R.string.Cancel, (dialog, which) -> dialog.dismiss());
if (requestPerms.size() > 0) {
- builder.setPositiveButton(getString(R.string.OK), (dialog, id) -> ActivityCompat.requestPermissions(this.getParent(), permissions, REQUEST_LOCATION));
+ builder.setPositiveButton(R.string.OK, (dialog, id) -> ActivityCompat.requestPermissions(this.getParent(), permissions, REQUEST_LOCATION));
builder.setMessage(baseMessage + "\n" + getString(R.string.Request_permission_text));
} else {
builder.setMessage(baseMessage);
@@ -708,6 +709,26 @@ private boolean checkPermissions(boolean popup) {
}
}
+ // https://developer.android.com/training/monitoring-device-state/doze-standby#support_for_other_use_cases
+ // Permission REQUEST_IGNORE_BATTERY_OPTIMIZATIONS requires special approval in Play
+ final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ final Resources res = this.getResources();
+ final boolean suppressOptimizeBatteryPopup = prefs.getBoolean(res.getString(R.string.pref_suppress_battery_optimization_popup), false);
+ PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
+ if ((popup || getAutoStartGps()) && !suppressOptimizeBatteryPopup
+ && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
+ && !pm.isIgnoringBatteryOptimizations(this.getPackageName())) {
+ new AlertDialog.Builder(StartActivity.this)
+ .setTitle(R.string.Battery_optimization_check)
+ .setMessage(R.string.Battery_optimization_check_text)
+ .setPositiveButton(R.string.OK, (dialog, which) ->
+ this.startActivity(new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS)))
+ .setNeutralButton(R.string.Do_not_show_again, (dialog, which) ->
+ prefs.edit().putBoolean(res.getString(R.string.pref_suppress_battery_optimization_popup), true).apply())
+ .setNegativeButton(R.string.Cancel, (dialog, which) -> dialog.dismiss())
+ .show();
+ }
+
return missingEssentialPermission;
}
@@ -786,11 +807,11 @@ private void updateGPSView() {
gpsEnable.setVisibility(View.VISIBLE);
if (statusDetailsShown) {
- gpsDetailMessage.setText(getString(R.string.GPS_indicator_off));
+ gpsDetailMessage.setText(R.string.GPS_indicator_off);
gpsDetailRow.setVisibility(View.VISIBLE);
gpsMessage.setVisibility(View.GONE);
} else {
- gpsMessage.setText(getString(R.string.GPS_indicator_off));
+ gpsMessage.setText(R.string.GPS_indicator_off);
gpsMessage.setVisibility(View.VISIBLE);
gpsDetailRow.setVisibility(View.GONE);
}
@@ -799,9 +820,9 @@ private void updateGPSView() {
gpsDetailIndicator.setVisibility(View.GONE);
if (!mGpsStatus.isLogging()) {
- gpsEnable.setText(getString(R.string.Start_GPS));
+ gpsEnable.setText(R.string.Start_GPS);
} else {
- gpsEnable.setText(getString(R.string.Enable_GPS));
+ gpsEnable.setText(R.string.Enable_GPS);
}
} else {
gpsDetailIndicator.setVisibility(View.VISIBLE);
@@ -825,7 +846,7 @@ private void updateGPSView() {
gpsIndicator.setImageResource(R.drawable.ic_gps_0);
gpsDetailIndicator.setImageResource(R.drawable.ic_gps_0);
- gpsMessage.setText(getString(R.string.Waiting_for_GPS));
+ gpsMessage.setText(R.string.Waiting_for_GPS);
notificationStateManager.displayNotificationState(gpsSearchingState);
} else {
@@ -1128,12 +1149,12 @@ private void loadAdvanced(String name) {
advancedDownloadWorkoutButton.setVisibility(View.GONE);
} catch (Exception ex) {
ex.printStackTrace();
- AlertDialog.Builder builder = new AlertDialog.Builder(StartActivity.this);
- builder.setTitle(getString(R.string.Failed_to_load_workout));
- builder.setMessage("" + ex.toString());
- builder.setPositiveButton(getString(R.string.OK),
- (dialog, which) -> dialog.dismiss());
- builder.show();
+ new AlertDialog.Builder(StartActivity.this)
+ .setTitle(getString(R.string.Failed_to_load_workout))
+ .setMessage("" + ex.toString())
+ .setPositiveButton(R.string.OK,
+ (dialog, which) -> dialog.dismiss())
+ .show();
}
}
@@ -1190,9 +1211,9 @@ public View getView(int position, View convertView, ViewGroup parent) {
WorkoutSerializer.writeFile(ctx, name, advancedWorkout);
} catch (Exception ex) {
AlertDialog.Builder builder = new AlertDialog.Builder(StartActivity.this)
- .setTitle(getString(R.string.Failed_to_load_workout))
+ .setTitle(R.string.Failed_to_load_workout)
.setMessage("" + ex.toString())
- .setPositiveButton(getString(R.string.OK),
+ .setPositiveButton(R.string.OK,
(dialog, which) -> dialog.dismiss());
builder.show();
}
diff --git a/app/src/main/org/runnerup/view/StepButton.java b/app/src/main/org/runnerup/view/StepButton.java
index 4244a6340..16c58719b 100644
--- a/app/src/main/org/runnerup/view/StepButton.java
+++ b/app/src/main/org/runnerup/view/StepButton.java
@@ -21,6 +21,8 @@
import android.content.Context;
import android.content.res.Resources;
import androidx.appcompat.app.AlertDialog;
+import androidx.core.content.ContextCompat;
+
import android.util.AttributeSet;
import android.util.Pair;
import android.view.Gravity;
@@ -93,37 +95,36 @@ public void setOnChangedListener(Runnable runnable) {
public void setStep(Step step) {
this.step = step;
- Resources res = getResources();
mDurationValue.setVisibility(VISIBLE);
switch (step.getIntensity()) {
case ACTIVE:
mIntensityIcon.setImageResource(R.drawable.step_active);
- mGoalValue.setTextColor(res.getColor(R.color.stepActive)); //todo check if it works
+ mGoalValue.setTextColor(ContextCompat.getColor(mContext, R.color.stepActive)); //todo check if it works
break;
case RESTING:
mIntensityIcon.setImageResource(R.drawable.step_resting);
- mGoalValue.setTextColor(res.getColor(R.color.stepResting));
+ mGoalValue.setTextColor(ContextCompat.getColor(mContext, R.color.stepResting));
break;
case REPEAT:
mIntensityIcon.setImageResource(R.drawable.step_repeat);
mDurationValue.setVisibility(GONE); //todo better wording in string
- mGoalValue.setText(String.format(Locale.getDefault(), res.getString(R.string.repeat_times), step.getRepeatCount()));
- mGoalValue.setTextColor(res.getColor(R.color.stepRepeat));
+ mGoalValue.setText(String.format(Locale.getDefault(), getResources().getString(R.string.repeat_times), step.getRepeatCount()));
+ mGoalValue.setTextColor(ContextCompat.getColor(mContext, R.color.stepRepeat));
if (editRepeatCount)
mLayout.setOnClickListener(onRepeatClickListener);
return;
case WARMUP:
mIntensityIcon.setImageResource(R.drawable.step_warmup);
- mGoalValue.setTextColor(res.getColor(R.color.stepWarmup));
+ mGoalValue.setTextColor(ContextCompat.getColor(mContext, R.color.stepWarmup));
break;
case COOLDOWN:
mIntensityIcon.setImageResource(R.drawable.step_cooldown);
- mGoalValue.setTextColor(res.getColor(R.color.stepCooldown));
+ mGoalValue.setTextColor(ContextCompat.getColor(mContext, R.color.stepCooldown));
break;
case RECOVERY:
mIntensityIcon.setImageResource(R.drawable.step_recovery);
- mGoalValue.setTextColor(res.getColor(R.color.stepRecovery));
+ mGoalValue.setTextColor(ContextCompat.getColor(mContext, R.color.stepRecovery));
break;
default:
mIntensityIcon.setImageResource(0);
@@ -131,7 +132,7 @@ public void setStep(Step step) {
Dimension durationType = step.getDurationType();
if (durationType == null) {
- mDurationValue.setText(res.getString(R.string.Until_press));
+ mDurationValue.setText(R.string.Until_press);
} else {
mDurationValue.setText(formatter.format(Formatter.Format.TXT_LONG, durationType,
step.getDurationValue()));
@@ -173,10 +174,10 @@ public void onClick(View v) {
layout.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
layout.addView(numberPicker);
- AlertDialog.Builder alert = new AlertDialog.Builder(mContext)
- .setTitle(getResources().getString(R.string.repeat))
+ new AlertDialog.Builder(mContext)
+ .setTitle(R.string.repeat)
.setView(layout)
- .setPositiveButton(getResources().getString(R.string.OK), (dialog, whichButton) -> {
+ .setPositiveButton(R.string.OK, (dialog, whichButton) -> {
step.setRepeatCount(numberPicker.getValue());
dialog.dismiss();
setStep(step); // redraw
@@ -184,8 +185,8 @@ public void onClick(View v) {
mOnChangedListener.run();
}
})
- .setNegativeButton(getResources().getString(R.string.Cancel), (dialog, whichButton) -> dialog.dismiss());
- alert.show();
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> dialog.dismiss())
+ .show();
}
};
@@ -199,10 +200,10 @@ public void onClick(View v) {
final Runnable save = setupEditStep(inflater, layout);
- AlertDialog.Builder alert = new AlertDialog.Builder(mContext)
- .setTitle(getResources().getString(R.string.Edit_step))
+ new AlertDialog.Builder(mContext)
+ .setTitle(R.string.Edit_step)
.setView(layout)
- .setPositiveButton(getResources().getString(R.string.OK), (dialog, whichButton) -> {
+ .setPositiveButton(R.string.OK, (dialog, whichButton) -> {
save.run();
dialog.dismiss();
setStep(step); // redraw
@@ -210,8 +211,8 @@ public void onClick(View v) {
mOnChangedListener.run();
}
})
- .setNegativeButton(getResources().getString(R.string.Cancel), (dialog, whichButton) -> dialog.dismiss());
- alert.show();
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> dialog.dismiss())
+ .show();
}
};
diff --git a/app/src/main/org/runnerup/view/UploadActivity.java b/app/src/main/org/runnerup/view/UploadActivity.java
index f44ba6863..5565e1d4b 100644
--- a/app/src/main/org/runnerup/view/UploadActivity.java
+++ b/app/src/main/org/runnerup/view/UploadActivity.java
@@ -23,8 +23,9 @@
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
-import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -132,7 +133,7 @@ public void onCreate(Bundle savedInstanceState) {
} else {
im.setVisibility(View.VISIBLE);
tv.setVisibility(View.GONE);
- im.setImageDrawable(ContextCompat.getDrawable(this, synchronizer.getIconId()));
+ im.setImageDrawable(AppCompatResources.getDrawable(this, synchronizer.getIconId()));
}
}
}
diff --git a/app/src/main/org/runnerup/widget/SpinnerPresenter.java b/app/src/main/org/runnerup/widget/SpinnerPresenter.java
index 490b0854a..2ab2b393c 100644
--- a/app/src/main/org/runnerup/widget/SpinnerPresenter.java
+++ b/app/src/main/org/runnerup/widget/SpinnerPresenter.java
@@ -155,21 +155,21 @@ private void setupEditText(final Context context, final AttributeSet attrs, Type
final LinearLayout layout = createLayout(context);
layout.addView(edit);
- AlertDialog.Builder alert = new AlertDialog.Builder(context)
+ new AlertDialog.Builder(context)
.setTitle(mLabel)
.setView(layout)
- .setPositiveButton(context.getResources().getString(R.string.OK), (dialog, whichButton) -> {
+ .setPositiveButton(R.string.OK, (dialog, whichButton) -> {
setValue(edit.getText().toString());
dialog.dismiss();
layout.removeView(edit);
onClose(true);
})
- .setNegativeButton(context.getResources().getString(R.string.Cancel), (dialog, whichButton) -> {
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> {
dialog.dismiss();
layout.removeView(edit);
onClose(false);
- });
- alert.show();
+ })
+ .show();
});
}
@@ -237,10 +237,10 @@ private void setupDatePicker(final Context context, AttributeSet attrs, CharSequ
final LinearLayout layout = createLayout(context);
layout.addView(datePicker);
- AlertDialog.Builder alert = new AlertDialog.Builder(context)
+ new AlertDialog.Builder(context)
.setTitle(mLabel)
.setView(layout)
- .setPositiveButton(context.getResources().getString(R.string.OK), new DialogInterface.OnClickListener() {
+ .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
setValue(getValue(datePicker));
dialog.dismiss();
@@ -255,12 +255,12 @@ private String getValue(DatePicker dp) {
return df.format(c.getTime());
}
})
- .setNegativeButton(context.getResources().getString(R.string.Cancel), (dialog, whichButton) -> {
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> {
dialog.dismiss();
layout.removeView(datePicker);
onClose(false);
- });
- alert.show();
+ })
+ .show();
});
}
@@ -282,10 +282,10 @@ private void setupTimePicker(final Context context, AttributeSet attrs, CharSequ
final LinearLayout layout = createLayout(context);
layout.addView(timePicker);
- AlertDialog.Builder alert = new AlertDialog.Builder(context)
+ new AlertDialog.Builder(context)
.setTitle(mLabel)
.setView(layout)
- .setPositiveButton(context.getResources().getString(R.string.OK), new DialogInterface.OnClickListener() {
+ .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
setValue(getValue(timePicker));
dialog.dismiss();
@@ -300,12 +300,12 @@ private String getValue(TimePicker dp) {
return df.format(c.getTime());
}
})
- .setNegativeButton(context.getResources().getString(R.string.Cancel), (dialog, whichButton) -> {
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> {
dialog.dismiss();
layout.removeView(timePicker);
onClose(false);
- });
- alert.show();
+ })
+ .show();
});
}
@@ -323,10 +323,10 @@ private void setupDurationPicker(final Context context, final AttributeSet attrs
final LinearLayout layout = createLayout(context);
layout.addView(picker);
- AlertDialog.Builder alert = new AlertDialog.Builder(context)
+ new AlertDialog.Builder(context)
.setTitle(mLabel)
.setView(layout)
- .setPositiveButton(context.getResources().getString(R.string.OK), new DialogInterface.OnClickListener() {
+ .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
setValue(getPickerValue());
dialog.dismiss();
@@ -338,12 +338,12 @@ private String getPickerValue() {
return DateUtils.formatElapsedTime(picker.getEpochTime());
}
})
- .setNegativeButton(context.getResources().getString(R.string.Cancel), (dialog, whichButton) -> {
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> {
dialog.dismiss();
layout.removeView(picker);
onClose(false);
- });
- alert.show();
+ })
+ .show();
});
}
@@ -362,10 +362,10 @@ private void setupDistancePicker(final Context context, AttributeSet attrs,
final LinearLayout layout = createLayout(context);
layout.addView(distancePicker);
- AlertDialog.Builder alert = new AlertDialog.Builder(context)
+ new AlertDialog.Builder(context)
.setTitle(mLabel)
.setView(layout)
- .setPositiveButton(context.getResources().getString(R.string.OK), new DialogInterface.OnClickListener() {
+ .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
setValue(getValue(distancePicker));
dialog.dismiss();
@@ -377,12 +377,12 @@ private String getValue(DistancePicker dp) {
return Long.toString(dp.getDistance());
}
})
- .setNegativeButton(context.getResources().getString(R.string.Cancel), (dialog, whichButton) -> {
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> {
dialog.dismiss();
layout.removeView(distancePicker);
onClose(false);
- });
- alert.show();
+ })
+ .show();
});
}
@@ -401,10 +401,10 @@ private void setupNumberPicker(final Context context, AttributeSet attrs, CharSe
final LinearLayout layout = createLayout(context);
layout.addView(numberPicker);
- AlertDialog.Builder alert = new AlertDialog.Builder(context)
+ new AlertDialog.Builder(context)
.setTitle(mLabel)
.setView(layout)
- .setPositiveButton(context.getResources().getString(R.string.OK), new DialogInterface.OnClickListener() {
+ .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
setValue(getValue(numberPicker));
dialog.dismiss();
@@ -416,12 +416,12 @@ private String getValue(NumberPicker dp) {
return Integer.toString(dp.getValue());
}
})
- .setNegativeButton(context.getResources().getString(R.string.Cancel), (dialog, whichButton) -> {
+ .setNegativeButton(R.string.Cancel, (dialog, whichButton) -> {
dialog.dismiss();
layout.removeView(numberPicker);
onClose(false);
- });
- alert.show();
+ })
+ .show();
});
}
diff --git a/app/src/main/org/runnerup/widget/WidgetUtil.java b/app/src/main/org/runnerup/widget/WidgetUtil.java
index 645486dc0..75b827807 100644
--- a/app/src/main/org/runnerup/widget/WidgetUtil.java
+++ b/app/src/main/org/runnerup/widget/WidgetUtil.java
@@ -20,13 +20,15 @@
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
-import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.view.ViewCompat;
+
import org.runnerup.R;
@@ -42,13 +44,12 @@ public static void setEditable(EditText editText, boolean onoff) {
}
public static View createHoloTabIndicator(Context ctx, String title) {
- Resources res = ctx.getResources(); // Resource object to get Drawables
TextView txtTab = new TextView(ctx);
txtTab.setText(title);
//txtTab.setTextColor(Color.WHITE);
//txtTab.setGravity(Gravity.CENTER_HORIZONTAL);
- Drawable drawable = res.getDrawable(R.drawable.tab_indicator_holo);
- WidgetUtil.setBackground(txtTab, drawable);
+ Drawable drawable = AppCompatResources.getDrawable(ctx, R.drawable.tab_indicator_holo);
+ ViewCompat.setBackground(txtTab, drawable);
int h = (25 * drawable.getIntrinsicHeight()) / 10;
txtTab.setPadding(0, h, 0, h);
@@ -57,14 +58,6 @@ public static View createHoloTabIndicator(Context ctx, String title) {
return txtTab;
}
- public static void setBackground(View v, Drawable d) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
- v.setBackgroundDrawable(d);
- } else {
- v.setBackground(d);
- }
- }
-
public static void addLegacyOverflowButton(Window window) {
if (window.peekDecorView() == null) {
return;
diff --git a/app/src/main/org/runnerup/workout/Workout.java b/app/src/main/org/runnerup/workout/Workout.java
index 33edfe65e..435c6f7d9 100644
--- a/app/src/main/org/runnerup/workout/Workout.java
+++ b/app/src/main/org/runnerup/workout/Workout.java
@@ -20,6 +20,7 @@
import android.content.ContentValues;
import android.content.SharedPreferences;
import android.location.Location;
+import android.util.Log;
import org.runnerup.BuildConfig;
import org.runnerup.common.util.Constants;
@@ -71,8 +72,8 @@ void add(Feedback f) {
try {
f.emit(Workout.this, tracker.getApplicationContext());
} catch (Exception ex) {
- // make sure that no small misstake crashes a workout...
- ex.printStackTrace();
+ // make sure that no small mistake crashes a workout...
+ Log.w(getClass().getName(), "PendingFeedback:add: " + ex.toString());
}
}
@@ -84,8 +85,8 @@ boolean end() {
try {
Workout.this.textToSpeech.emit();
} catch (Exception ex) {
- // make sure that no small misstake crashes a workout...
- ex.printStackTrace();
+ // make sure that no small mistake crashes a workout...
+ Log.w(getClass().getName(), "PendingFeedback:end: " + ex.toString());
}
return true;
}
@@ -96,7 +97,6 @@ boolean end() {
private final PendingFeedback pendingFeedback = new PendingFeedback();
Tracker tracker = null;
- SharedPreferences audioCuePrefs;
private HRZones hrZones = null;
private RUTextToSpeech textToSpeech = null;
diff --git a/build.gradle b/build.gradle
index aa2a251af..85f11d9f4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,11 +17,12 @@ project.ext {
//Common settings for all builds
//Note that Android Studio does not know about the 'ext' module and will warn
//minSdkVersion differs between modules
- buildToolsVersion = '30.0.1' //Update Travis manually
+ buildToolsVersion = '30.0.2' //Update Travis manually
compileSdkVersion = 29 //Update Travis manually
targetSdkVersion = 29
- appcompat_version = "1.1.0"
+ appcompat_version = "1.2.0"
+ annotation_version = "1.1.0"
//Note: Later Play Services will require a rewrite of NodeApi.NodeListener
googlePlayServicesVersion = '11.0.4'
googleWearVersion = '2.3.0'
@@ -30,8 +31,8 @@ project.ext {
mockitoVersion = '2.3.7'
//The Git tag for the release must be identical for F-Droid
- versionName = '2.2.1.0'
- versionCode = 254
+ versionName = '2.2.2.2'
+ versionCode = 262
latestBaseVersionCode = 15000000
travisBuild = System.getenv("TRAVIS") == "true"
diff --git a/common/build.gradle b/common/build.gradle
index d04d223a5..bab55da99 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -45,9 +45,9 @@ repositories {
}
dependencies {
- implementation 'androidx.annotation:annotation:1.1.0'
- testImplementation 'org.hamcrest:hamcrest-library:1.3'
+ implementation "androidx.annotation:annotation:${rootProject.ext.annotation_version}"
+ testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation "junit:junit:${rootProject.ext.junitVersion}"
testImplementation "org.mockito:mockito-core:${rootProject.ext.mockitoVersion}"
}
diff --git a/common/src/main/res/values-de/array.xml b/common/src/main/res/values-de/array.xml
index 6405c5c15..387a591e6 100644
--- a/common/src/main/res/values-de/array.xml
+++ b/common/src/main/res/values-de/array.xml
@@ -22,7 +22,7 @@
- Distanz
- - Kein Wert
+ - Freies Training
- Tempo
- Herzfrequenzbereich
diff --git a/common/src/main/res/values-de/strings.xml b/common/src/main/res/values-de/strings.xml
index 5ce3fc0d0..efb9e6ba8 100644
--- a/common/src/main/res/values-de/strings.xml
+++ b/common/src/main/res/values-de/strings.xml
@@ -32,8 +32,8 @@
ruhend
Erholen
Aufwärmphase
- Abkühlen
- wiederholen
+ Abkühlphase
+ Wiederhole
%1$dx wiederholen
Zeit
Distanz
@@ -114,14 +114,13 @@
Aktualisieren
Alter
Synchronisiere
- synchronisiere Feed…
OK
Verbindungen verwalten
Konto verbinden
Deaktivierte Konten anzeigen
Deaktivierte Konten ausblenden
Uploads löschen
- (Fehlende) Trainingseinheiten hochladen
+ Trainingseinheiten hochladen
Konto trennen
Aktivität bearbeiten
Aktivität teilen
@@ -143,25 +142,19 @@
Wählen Sie die Art des Bluetooth-Geräts aus
Suchen
Fehler beim Laden der Trainingseinheit!!
+ Fehler
Schritt bearbeiten
Neues Audiohinweisschema erstellen
Ja
Erstellen
No
- Lade…
Speichern
- Abbruch… bitte warten
Bist Du sicher?
Audiohinweise konfigurieren
Trainingseinheiten herunterladen/bearbeiten/löschen
- Sie müssen eine Verbindung zu einem RunnerUp Live-Konto herstellen
Verwende Dein Headset um RunnerUp zu starten/pausieren/fortzusetzen
- Verwenden Sie auf der Registerkarte \"Intervall\" \"Wiederherstellung\" anstelle von \"Ruhe\" (Pause)
Datenbank auf Speicher exportieren
Datenbank von Speicher importieren
- Coachen, um Ziel zu erreichen (falls Ziel gesetzt)
- Hinweise für start/pausieren/fortsetzen/stop unterdrücken
- Audiohinweis testen
Konten
Audiohinweise
Herzfrequenzmesser
@@ -169,21 +162,21 @@
Rundenautomatik
Rundenautomatik (m)
Pausenautomatik
+ Autopause bei einfachen Trainingseinheiten und während Aufwärmen/Abkühlen
RunnerUp Live aktivieren
Headset Taste start/stop
Countdown bis zum Beginn der Aktivität
- Countdown bis zum Beginn der Aktivität
Countdown-Zeit (s)
- Einheiten-Präferenzen
- Präferenz für Entfernungseinheiten
+ Einheiten
+ Entfernungseinheit
GPS automatisch starten
Erweiterte Optionen
Mapbox-Stil
RunnerUp Live-Adresse
Automatische Pause nach (s)
- Automatische Pause bei minimalem Tempo (min/km)
Intervall-Ruhe-Schritte
Rundenautomatik in Trainingseinheiten
+ Rundenautomatik für einfache Trainingseinheiten
Countdown nach Tastendruck
Schritt Countdown-Zeit (s)
Tempograph glätten
@@ -205,6 +198,7 @@
Regelmäßige Rückmeldung
Hinweisintervall (m)
Ende der Runde
+ Hinweis bei Runden-Ende / Stillstand
Musik während Audiohinweisen stummschalten
Hinweisinformation
Gesamtdistanz
@@ -231,7 +225,6 @@
Aktuelle Herzfrequenzzone
Aktuelle Trittfrequenz
Aktuell
- Diverse Hinweise
Zielcoaching
Ereignisaudiohinweise überspringen
Hier drücken
@@ -243,18 +236,15 @@
Manuellen Eintrag hinzufügen
Manuellen Eintrag hinzufügen
Notizen zur Trainingseinheit hinzufügen
- Gelöschte Aktivitäten aus der Datenbank entfernen
- Bereinigen
Herzfrequenzzonenverteilung
Batteriespannung
Aktivität fertig
Bereit zu laufen!
Suche GPS
- RunnerUp Aktivität gestartet
+ RunnerUp Aktivität gestartet
Niedrige Akkukapazität
Hohe Akkukapazität
Warnung
- Nicht mehr anzeigen
Warte auf Telefon
Speichere auf Telefon
Speichern
@@ -278,27 +268,21 @@
Der Download von %1$s wird das Training %2$s mit demselben Namen überschreiben
Trainingseinheit löschen
RunnerUp-Trainingseinheit
- Hallo\nHier ist ein Training, dass dir vielleicht gefallen könnte.
Trainingseinheit teilen…
Neues Audioschema
- GPS-Berechtigung ist erforderlich
Standard
- Notizen über Ihre Trainingseinheit
Von %1$s wird heruntergeladen
Auf %1$s wird hochgeladen
Aktivitäten werden geladen
Aktivitäten werden von %1$s abgerufen
Kein Feed zum Anzeigen
- Momentan unbenutzt.
Unbekannt
- Aufnahmevorgang
+ Aufzeichnung
Sensoren
Wartung
Verbindung zum Pulsmessgerät wiederhergestellt
Verbindung zum Pulsmessgerät verloren
- Herzfrequenz-gesteuerter Audiohinweis
Einheit in Audio-Hinweis einfügen
- Neuester Feed (klicken um zu aktualisieren)
Nur in GPX exportieren
Erweiterte GPS-Genauigkeitsdaten protokollieren
Aktuelle Geschwindigkeit aus GPS-Punkten
@@ -306,21 +290,19 @@
Für Trittfrequenz verwenden
Temperatursensor
Drucksensor
- Das Barometer zur Berechnung der Höhe verwenden
Barometerhöhe an die GPS-Höhe anpassen
Anfängliche GPS-Höhe zum Ausmitteln der barometrischen Höhe verwenden
RunnerUp GPS- und Aktivitätsbenachrichtigungen
Rundenstart
+ Hinweis bei Rundenstart und Aktivität, Aufwärmen, Abkühlen
Aktivitätsschaltflächen sperren
Aktivitätsschaltflächen durch schnelles Klicken auf die Kopfzeile sperren
Geschwindigkeit
Geschwindigkeitseinheit
Weg-Vereinfachung
- Reduziere die Auflösung des GPS-Weges (protokollierte Standorte im Laufe der Zeit). Glättet den Weg und verringert die Größe einer Aktivität in der Datenbank oder einer exportierten Datei.
+ Vereinfachen beim Speichern der Aktivität
+ Vereinfachen beim Hochladen
Toleranz (m)
Algorithmus
- Wähle schnelle oder qualitativ hochwertige Wegvereinfachung
Weg vereinfachen
- Datei(en) hochladen als:
- Mindestens ein Format erforderlich!
diff --git a/common/src/main/res/values-pl/array.xml b/common/src/main/res/values-pl/array.xml
index 323b00501..46a96a6e1 100644
--- a/common/src/main/res/values-pl/array.xml
+++ b/common/src/main/res/values-pl/array.xml
@@ -4,6 +4,10 @@
- Mile
- Kilometry
+
+ - Tempo
+ - Prędkość
+
- Rozgrzewka
@@ -20,7 +24,7 @@
- Brak
- Tempo
- - Strefa tentna
+ - Strefa tętna
@@ -39,4 +43,8 @@
- Kobieta
+
+ - Radial-Distance (szybki)
+ - Ramer-Douglas-Peucker (wysoka jakość)
+
diff --git a/common/src/main/res/values-pl/strings.xml b/common/src/main/res/values-pl/strings.xml
index a98c79250..435aaf1d3 100644
--- a/common/src/main/res/values-pl/strings.xml
+++ b/common/src/main/res/values-pl/strings.xml
@@ -33,8 +33,8 @@
regeneracja
rozgrzewka
uspokojenie
- powtórzenia
- Powtórz %1$d
+ Powtórz
+ Powtórz %1$d razy
czas
dystans
Dystans
@@ -113,15 +113,15 @@
Konfiguruj konta
Odśwież
Wiek
- aktualizuję kanał...
Synchronizowanie
+ Synchronizowanie kanałów
OK
Zarządzaj połączeniami
Podłącz konto
Pokaż wyłączone konta
Ukryj wyłączone konta
Usuń aktywności
- Synchronizuje brakujące aktywności
+ Przesyłanie brakujących aktywności
Odłącz konto
Edytuj aktywność
Udostępnij aktywność
@@ -135,32 +135,32 @@
Co nowego
Oceń RunnerUp
Włącz GPS
- Oczekuje na GPS
+ Oczekuję na GPS
Rozpocznij
Urządzenie Wear OS
Wyczyść ustawienia HRM
HRM nie jest obsługiwany przez twoje urządzenie
Wybierz rodzaj urządzenia Bluetooth
- Skanuje
+ Skanuję
Błąd przy ładowaniu treningu
+ Błąd
Edycja etapu
Utwórz schemat wskazówek audio
Tak
Utwórz
Nie
- Ładuje…
- Zapisuje
- Anuluje…
+ Ładuję
+ Zapisuję
+ Anuluję, proszę czekać...
Jesteś pewien?
Konfiguruj wskazówki audio
Pobierz/edytuj/usuń treningi
- Aby aktywować musisz połączyć się z kontem
+ Musisz połączyć się z kontem RunnerUp Live
Użyj słuchawek do rozpoczynania/wstrzymania treningu
- Konwertuj interwał \"odpoczynek (dystans)\" na interwał \"regeneracja\" na zakładce \"Interwałowy\"
- Konwertuj interwał \"odpoczynek (dystans)\" na interwał \"regeneracja\" na zakładce \"Rozszerzony\"
+ W zakładce interwału użyj regeneracji zamiast odpoczynku (pauza)
Eksportuj bazę danych na kartę SD (np. przed aktualizacjią)
Importuj bazę danych z karty SD (np. po aktualizacji)
- Trener wspomoże Cię w osiągnięciu założonego celu
+ Trener wspomoże Cię w osiągnięciu założonego celu (jeśli jest)
Wyłącz powiadomienia przy rozpoczynaniu/wznawianiu/etc. treningu.
Test wskazówek audio
Konta
@@ -170,23 +170,20 @@
Auto-okrążenie
Auto-okrążenie (m)
Autopauza
+ Autopauza przy prostych treningach, rozgrzewce i uspokojeniu
Włącz Live
Sterowanie słuchawkami (start/stop/pauza)
- Odliczanie
+ Odliczanie do startu aktywności
Czas odliczania (s)
- Jednostki
+ Jednostki
+ Jednostka dystansu
Automatycznie uruchom GPS
Ustawienia zaawansowane
styl Mapboxa
Adres RunnerUpLive
Autopauza po (s)
Autopauza przy tempie (min/km)
- Konwertuj odpoczynek na zakładce \"Interwałowy\"
- Konwertuj odpoczynek na zakładce \"Rozszerzony\"
- Target pace moving average seconds
- Target pace grace seconds
- Auto-okrążenie przy interwałach
- Dodaj odliczanie po interwale zakończonym przez kliknięcie
+ Interwał odpoczynku
Odliczanie przed kolejnym interwałem (s)
Wygładzaj wykres tempa
Filtr wygładzający
@@ -200,11 +197,9 @@
Imituj urządzenie HRM
O RunnerUp
Wyzwalacze
- Wskazówki wyzwalane czasowo
Interwał wskazówek (s)
- Wskazówki wyzwalane dystansem
Interwał wskazówek (m)
- Wskazówki na koniec okrążenia
+ Koniec okrążenia
Wycisz muzykę podczas wskazówek
Informacje wskazówek
Dystans całkowity
@@ -231,7 +226,7 @@
Aktualna strefa tętna
Bieżąca kadencja
Bieżący
- Różne wskazówki
+ Inne wskazówki
Wskazówki trenera
Pomiń wskazówki przy zdarzeniach
Naciśnij
@@ -243,14 +238,14 @@
Dodaj pozycję ręcznie
Dodaj pozycję ręcznie
Dodaj notatki
- Usuwa zapisane aktywności z bazy danych
- Wyczyść
+ Wyczyść usunięte aktywności
+ Trwałe usunięcie
Rozkład stref tętna
Poziom baterii
Gotowy
Czas rozpocząć trening!
Szukam GPS
- RunnerUp trening rozpoczęty
+ RunnerUp trening rozpoczęty
Niski poziom baterii HRM
Wysoki poziom baterii HRM
Uwaga
@@ -270,33 +265,36 @@
Usuń treningi (z telefonu)
mój telefon
Błąd przy imporcie
- Importuj trening:
- Zapisuje jako
+ Importuj aktywność
+ Zapisywanie jako
Nadpisz istniejący
Utwórz nowy trening
Nazwa treningu
Pobranie %1$s nadpisze trening %2$s z tą samą nazwą
- Usuń trening
- Trening RunnerUp:
- To jest trening, który możesz polubić.
+ Usuń aktywność
+ Trening RunnerUp
Podziel się treningiem…
Nowy schemat wskazówek
Wymagane uprawnienie do GPS
+ Wymagane uprawnienie do lokalizacji w ustawieniach systemowych
+ Uprawnienie do lokalizacji \"Zezwól zawsze\" wymagane w ustawieniach systemowych.\nDla kadencji biegu wymagane jest także uprawnienie \"Aktywność fizyczna\".
+ Zezwól na uprawnienie wciskając \"OK\".
Domyślne
- Notatki
+ Notatki treningu
Pobieram z %1$s
Wysyłam do %1$s
Ładuje treningi
Pobieram treningi z %1$s
Brak wątku do wyświetlenia
- Obecnie nieużywany.
+ Obecnie nieużywane
Nieznane
Nagrywanie
Czujniki
Utrzymanie
Odzyskano połączenie z pulsometrem
Utracono połączenie z pulsometrem
- Wskazówki audio przy podłączaniu HRM
+ Wskazówki audio pulsometru
+ Uwzględnij jednostki we wskazówkach
Najnowsze wiadomości (kliknij aby odświeżyć)
Eksportuj tylko GPX
Zaloguj dane GPS z większą dokładnością
diff --git a/common/src/main/res/values-ru/array.xml b/common/src/main/res/values-ru/array.xml
index 52fd352ed..02b4a4b9b 100644
--- a/common/src/main/res/values-ru/array.xml
+++ b/common/src/main/res/values-ru/array.xml
@@ -4,6 +4,10 @@
- Мили
- Километры
+
+ - Темп
+ - Скорость
+
- Разминка
@@ -17,11 +21,6 @@
- Время
- Дистанция
-
- - Нет
- - Темп
- - Зона ЧСС
-
- Бег
@@ -39,4 +38,8 @@
- Женский
+
+ - Радиальное расстояние (быстрое)
+ - Алгоритм Рамера — Дугласа — Пекера (качественное)
+
diff --git a/common/src/main/res/values-ru/strings.xml b/common/src/main/res/values-ru/strings.xml
index 1f692376d..45fa2861d 100644
--- a/common/src/main/res/values-ru/strings.xml
+++ b/common/src/main/res/values-ru/strings.xml
@@ -31,9 +31,9 @@
Движение
отдых
восстановление
- разминка
- заминка
- повторять
+ Разминка
+ Заминка
+ Повторить %1$d раз
Время
Дистанция
Дистанция
@@ -70,7 +70,15 @@
Тип отдыха
Повторения
Дата
+ Нет подключенных устройств
Спутники GPS, ГЛОНАСС
+ GPS выключен
+ GPS: %1$d/%2$d спут. (%3$s)
+ GPS: %1$d/%2$d спутников
+ Точность %s
+ Плохой сигнал GPS
+ Допустимый сигнал GPS
+ Хороший сигнал GPS
Старт GPS
Подолжительность
Отмена
@@ -103,11 +111,12 @@
Настройка фитнес аккаунтов
Обновить
Возраст
- Синхронизация:
- синхронизируем фитнес аккаунты…
ОК
+ Менеджер соединений
+ Подключить аккаунт
+ Показать отключенные аккаунты
+ Спрятать отключенные аккаунты
Очистить загруженные
- Выгрузить недостающие тренировки
Отключить аккаунт
Редактировать
Опубликовать
@@ -128,6 +137,7 @@
Выбор типа устройства Bluetooth
Поиск
Не удалось загрузить тренировку!!!
+ Ошибка
Редактирование интервала
Создать голосовую схему
Да
@@ -135,19 +145,12 @@
Нет
Загрузка…
Сохранение
- Отмена… подождите
Уверен?
Настройка голосового сопровождения
Загрузка/редактирование/удаление тренировки
- Внимание, так же требуется подключиться к фитнес аккаунту
Пользуйся кнопкой гарнитуры для пуска/остановки RunnerUp
- Для интервальной тренировки по дистанции переводить остановки в интервалы восстановления
- Для продвинутой тренировки по дистанции переводить
Экспорт базы данных на карту памяти (перед обновлением)
Импорт базы данных с карты памяти (после обновления)
- Помощь голосового тренера в достижении целевых показателей тренировки (если выбран пульс/темп)
- Не озвучивать старт/паузу/возобновление/стоп
- Проверить голосовые настройки
Фитнес аккаунты
Голосовые схемы
Выбор датчика ЧСС, HRM
@@ -155,23 +158,20 @@
Авто круг
Авто круг (м)
Авто пауза
+ Автопауза в основных тренировках и на этапах разминки и заминки
Включить Live
Кнопка гарнитуры старт/стоп
- Отсчёт до начала тренировки
+ Добавить обратный отсчет до начала тренировки
Отсчитывать время ©
- Единицы измерений
+ Единицы
+ Измерение растояний
Автоматически включать GPS
Продвинутые настройки
Стиль карты (Mapbox)
RunnerUp live адрес сервера
Автопауза - после N секунд (с)
- Автопауза - минимальный темп (минут/км)
- Изменить время отдыха на
- Изменить время отдыха на
- Целевой темп скользящих средних секунд
- Держать показатели темпа
- Завершать круг в промежутках интервалов
- Добавить обратный отсчёт перед стартом
+ Функция автоматического отсчета участков дистанции на последнем этапе и до текущего действия
+ Добавить обратный отсчет времени восстановления или отдыха после шага завершенного нажатием клавиши
Время обратного отсчёта (с)
Сгладить график темпа
Настройки сглаживания (с)
@@ -185,11 +185,11 @@
Имитировать датчик HRM
О RunnerUp
Получать информацию через интервалы:
- По времени
+ Периодический отчет
Каждые N секунд (с)
- По пройденной дистанции
+ Периодический отчет
Каждые N метров (м)
- По завершению круга
+ Конец автоматического отсчета участков дистанции и текущего действия
Приглушать музыку во время сообщений
Озвучивать следующие параметры:
Общая дистанция
@@ -214,7 +214,7 @@
Текущая скорость
Текущий пульс
Текущая зона ЧСС
- Прочие голосовые команды
+ Текущий
Тренировка по показателям
Не озвучивать паузу
Воспроизвести голос тренера
@@ -224,18 +224,15 @@
Базовая
Продвинутая
Добавить примечание
- Очистить базу данных от ранее выгруженных записей
- Очистка базы
Распределение тренировки по зонам ЧСС
Уровень заряда
Готово
Готов к старту!
Поиск спутников GPS
- Начал движение
+ Начал движение
Низкий уровень заряда датчика HRM
Высокий уровень заряда датчика HRM
Предупреждение
- Не показывать снова
Ожидание телефона
Сохранить в память телефона
Сохранить
@@ -250,38 +247,47 @@
Добавить карту в запись
Очистить от выгруженных (с телефона)
Мой телефон
- Ошибка импорта:
- Импорт занятия:
- Сохранить как
+ Сохранить как...
Перезаписывать существующие
Создать новую тренировку
Называние тренировки
Загружаемая тренировка %1$s будет перезаписана %2$s
- Удалить тренировку
- Тренировка RunnerUp:
- Привет!\nВот тренировки. Я думаю ты можешь так же .
Опубликовать
Новая голосовая схема
+ Нужно разрешение на определение местоположения
+ Требуется разрешение на определение местоположения через настройки системы
+ Нажмите \"ОК\", что бы разрешить.
Стандартная
- Примечания о этом занятии
+ Заметка к тренировке
Загрузка из %1$s
Выгрузка в %1$s
Загрузка данных
Извлечение данных из %1$s
Нет данных для отображения
- Устаревшие
Неизвестно
Настройка записи движения
Настройка датчиков
Управление базой данных
- Подключение к HRM восстановлено.
- Соединение с HRM потеряно.
- HRM подключение вызывало голосовую схему
- Крайняя выгрузка (нажмите для обновления)
+ Включить озвучивание единиц измерения
Выгрузка в GPX формате
Лог данных GPS улучшенной точности
+ Текущая скорость по GPS
Датчик шага
Частота шагов в минуту (каденс)
Датчик температуры
Датчик давления
+ RunnerUp: уведомления об активности
+ Новый круг
+ Сигнал для начала кругов и этапов Движения, Разминки и Заминки
+ Блокировка кнопок
+ скорость
+ Упрощение пути
+ Уменьшить \"разрешение пути GPS\" (местоположения, регистрируемые с течением времени). Это сглаживает путь и уменьшает размер данных в базе данных или экспортированном файле.
+ Упрощение при сохранении активности
+ Упростить, при выгрузке в аккуанты
+ Алгоритм
+ Выберите быстрое или качественное упрощение пути
+ Упростить
+ Загрузить файлы:
+ Вы должны выбрать хотя бы один из форматов
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index 7ccd424a3..5200a5cab 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -297,6 +297,8 @@
Location permission required in system settings
Location permission \"Allow all the time\" required in system settings.\nFor running cadence \"Physical activity\" permission is required too.
Allow permission by clicking \"OK\".
+ Battery optimization enabled
+ Battery optimization will decrease the accuracy.\nPress OK to go system settings and select \"All apps\", search for \"RunnerUp\", select \"Don\'t optimize\".
Default
Workout notes
Downloading from %1$s
diff --git a/hrdevice/build.gradle b/hrdevice/build.gradle
index 2ca6ab752..21b0fff54 100644
--- a/hrdevice/build.gradle
+++ b/hrdevice/build.gradle
@@ -50,6 +50,7 @@ repositories {
dependencies {
implementation "androidx.appcompat:appcompat:${rootProject.ext.appcompat_version}"
+
if (rootProject.ext.antPlusLib) {
implementation files("../" + antPlusLib)
}
diff --git a/hrdevice/src/org/runnerup/hr/AndroidBLEHRProvider.java b/hrdevice/src/org/runnerup/hr/AndroidBLEHRProvider.java
index 446c8235c..27668f8b9 100644
--- a/hrdevice/src/org/runnerup/hr/AndroidBLEHRProvider.java
+++ b/hrdevice/src/org/runnerup/hr/AndroidBLEHRProvider.java
@@ -505,7 +505,7 @@ public void onLeScan(final BluetoothDevice device, int rssi,
@Override
public void startScan() {
- if (mIsScanning)
+ if (mIsScanning || btAdapter == null)
return;
mIsScanning = true;
@@ -539,7 +539,7 @@ public boolean isConnecting() {
public void connect(HRDeviceRef ref) {
stopScan();
- if (!Bt20Base.isEnabledImpl()) {
+ if (!Bt20Base.isEnabledImpl() || btAdapter == null) {
reportConnectFailed("BT is not enabled");
return;
}
diff --git a/wear/build.gradle b/wear/build.gradle
index a620c3474..6e4254a7e 100644
--- a/wear/build.gradle
+++ b/wear/build.gradle
@@ -53,12 +53,13 @@ repositories {
dependencies {
implementation project(':common')
+ implementation "androidx.annotation:annotation:${rootProject.ext.annotation_version}"
+
implementation "com.google.android.support:wearable:${rootProject.ext.googleWearVersion}"
compileOnly "com.google.android.wearable:wearable:${rootProject.ext.googleWearVersion}"
// Wear requires rewrite to update Play services
//noinspection GradleDependency
implementation "com.google.android.gms:play-services-wearable:${rootProject.ext.googlePlayServicesVersion}"
- implementation 'androidx.annotation:annotation:1.1.0'
}
def props = new Properties()
diff --git a/wear/src/main/java/org/runnerup/view/SearchingFragment.java b/wear/src/main/java/org/runnerup/view/SearchingFragment.java
index 849026418..2e6c3d2ad 100644
--- a/wear/src/main/java/org/runnerup/view/SearchingFragment.java
+++ b/wear/src/main/java/org/runnerup/view/SearchingFragment.java
@@ -38,7 +38,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
View view = inflater.inflate(R.layout.searching, container, false);
super.onViewCreated(view, savedInstanceState);
- if (Build.VERSION.SDK_INT >= 23) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
CircledImageView button = view.findViewById(R.id.icon_searching);
AnimationDrawable frameAnimation = (AnimationDrawable) button.getForeground();
frameAnimation.start();
diff --git a/wear/src/main/java/org/runnerup/view/StartFragment.java b/wear/src/main/java/org/runnerup/view/StartFragment.java
index 5c3829a5c..f631a8c9c 100644
--- a/wear/src/main/java/org/runnerup/view/StartFragment.java
+++ b/wear/src/main/java/org/runnerup/view/StartFragment.java
@@ -57,12 +57,12 @@ private void updateView(TrackerState state) {
case INIT:
case INITIALIZING:
case INITIALIZED:
- mTxt.setText(getString(R.string.Start_GPS));
+ mTxt.setText(R.string.Start_GPS);
break;
case CONNECTING:
break;
case CONNECTED:
- mTxt.setText(getString(R.string.Start_activity));
+ mTxt.setText(R.string.Start_activity);
break;
case STARTED:
break;