forked from upstream-mirrors/OpenTracks
@@ -379,8 +379,8 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
|
|||||||
startGpsMenuItem.setVisibility(!isRecording ? View.VISIBLE : View.INVISIBLE);
|
startGpsMenuItem.setVisibility(!isRecording ? View.VISIBLE : View.INVISIBLE);
|
||||||
if (!isRecording) {
|
if (!isRecording) {
|
||||||
startGpsMenuItem.setIcon(AppCompatResources.getDrawable(this, isGpsStarted ? gpsStatusValue.icon : R.drawable.ic_gps_off_24dp));
|
startGpsMenuItem.setIcon(AppCompatResources.getDrawable(this, isGpsStarted ? gpsStatusValue.icon : R.drawable.ic_gps_off_24dp));
|
||||||
if (startGpsMenuItem.getIcon() instanceof AnimatedVectorDrawable) {
|
if (startGpsMenuItem.getIcon() instanceof AnimatedVectorDrawable animatedVectorDrawable) {
|
||||||
((AnimatedVectorDrawable) startGpsMenuItem.getIcon()).start();
|
animatedVectorDrawable.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ public class ResetDialogPreference extends DialogPreference {
|
|||||||
Toast.makeText(activity, R.string.settings_layout_reset_done, Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity, R.string.settings_layout_reset_done, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activity instanceof ResetCallback) {
|
if (activity instanceof ResetCallback resetCallback) {
|
||||||
((ResetCallback) activity).onReset();
|
resetCallback.onReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ public class SensorsSettingsFragment extends PreferenceFragmentCompat {
|
|||||||
private void setWheelCircumferenceInputFilter() {
|
private void setWheelCircumferenceInputFilter() {
|
||||||
EditTextPreference wheelPreference = findPreference(getString(R.string.settings_sensor_bluetooth_cycling_speed_wheel_circumference_key));
|
EditTextPreference wheelPreference = findPreference(getString(R.string.settings_sensor_bluetooth_cycling_speed_wheel_circumference_key));
|
||||||
wheelPreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
wheelPreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
if (newValue instanceof String) {
|
if (newValue instanceof String newValueString) {
|
||||||
try {
|
try {
|
||||||
int newValueInt = Integer.parseInt((String) newValue);
|
int newValueInt = Integer.parseInt(newValueString);
|
||||||
return newValueInt >= 100 && newValueInt < 4000;
|
return newValueInt >= 100 && newValueInt < 4000;
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.w(TAG, "Entered string is no number.");
|
Log.w(TAG, "Entered string is no number.");
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ public class MarkerDetailActivity extends AbstractActivity implements DeleteMark
|
|||||||
|
|
||||||
Object bundleMarkerId = getIntent().getExtras().get(EXTRA_MARKER_ID);
|
Object bundleMarkerId = getIntent().getExtras().get(EXTRA_MARKER_ID);
|
||||||
Marker.Id markerId = null;
|
Marker.Id markerId = null;
|
||||||
if (bundleMarkerId instanceof Marker.Id) {
|
if (bundleMarkerId instanceof Marker.Id cast) {
|
||||||
markerId = (Marker.Id) bundleMarkerId;
|
markerId = cast;
|
||||||
}
|
}
|
||||||
if (bundleMarkerId instanceof Long) {
|
if (bundleMarkerId instanceof Long cast) {
|
||||||
//Incoming Intent via Dashboard API.
|
//Incoming Intent via Dashboard API.
|
||||||
markerId = new Marker.Id((Long) bundleMarkerId);
|
markerId = new Marker.Id(cast);
|
||||||
}
|
}
|
||||||
if (markerId == null) {
|
if (markerId == null) {
|
||||||
Log.d(TAG, "invalid marker id");
|
Log.d(TAG, "invalid marker id");
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ public class ViewUtils {
|
|||||||
|
|
||||||
for (int i = 0; i < view.getChildCount(); i++) {
|
for (int i = 0; i < view.getChildCount(); i++) {
|
||||||
final View child = view.getChildAt(i);
|
final View child = view.getChildAt(i);
|
||||||
if (child instanceof ViewGroup) {
|
if (child instanceof ViewGroup childVg) {
|
||||||
makeClickableLinks((ViewGroup) child);
|
makeClickableLinks(childVg);
|
||||||
} else if (child instanceof TextView) {
|
} else if (child instanceof TextView childTv) {
|
||||||
((TextView) child).setMovementMethod(LinkMovementMethod.getInstance());
|
childTv.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,9 +240,9 @@ public class StringUtils {
|
|||||||
public static OffsetDateTime parseTime(String xmlDateTime) {
|
public static OffsetDateTime parseTime(String xmlDateTime) {
|
||||||
try {
|
try {
|
||||||
TemporalAccessor t = DateTimeFormatter.ISO_DATE_TIME.parseBest(xmlDateTime, ZonedDateTime::from, LocalDateTime::from);
|
TemporalAccessor t = DateTimeFormatter.ISO_DATE_TIME.parseBest(xmlDateTime, ZonedDateTime::from, LocalDateTime::from);
|
||||||
if (t instanceof LocalDateTime) {
|
if (t instanceof LocalDateTime localDateTime) {
|
||||||
Log.w(TAG, "Date does not contain timezone information: using UTC.");
|
Log.w(TAG, "Date does not contain timezone information: using UTC.");
|
||||||
t = ((LocalDateTime) t).atZone(ZoneOffset.UTC);
|
t = localDateTime.atZone(ZoneOffset.UTC);
|
||||||
}
|
}
|
||||||
return OffsetDateTime.from(t);
|
return OffsetDateTime.from(t);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user