forked from upstream-mirrors/OpenTracks
Cleanup using AndroidStudio analyze.
This commit is contained in:
@@ -7,7 +7,6 @@ import android.view.Menu;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@@ -40,17 +39,12 @@ public class ShowErrorActivity extends AbstractActivity {
|
|||||||
|
|
||||||
private void reportBug() {
|
private void reportBug() {
|
||||||
Uri uriUrl;
|
Uri uriUrl;
|
||||||
try {
|
uriUrl = Uri.parse(
|
||||||
uriUrl = Uri.parse(
|
String.format(
|
||||||
String.format(
|
getString(R.string.report_issue_link),
|
||||||
getString(R.string.report_issue_link),
|
URLEncoder.encode(viewBinding.textViewError.getText().toString(), StandardCharsets.UTF_8)
|
||||||
URLEncoder.encode(viewBinding.textViewError.getText().toString(), StandardCharsets.UTF_8.toString())
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
} catch (final UnsupportedEncodingException ignored) {
|
|
||||||
// can't happen as UTF-8 is always available
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
|
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ import androidx.core.view.GestureDetectorCompat;
|
|||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import de.dennisguse.opentracks.R;
|
import de.dennisguse.opentracks.R;
|
||||||
import de.dennisguse.opentracks.data.models.Marker;
|
import de.dennisguse.opentracks.data.models.Marker;
|
||||||
@@ -679,12 +679,13 @@ public class ChartView extends View {
|
|||||||
private record TitlePosition(
|
private record TitlePosition(
|
||||||
int line, // line number (starts at 1, top to bottom numbering)
|
int line, // line number (starts at 1, top to bottom numbering)
|
||||||
int xPos // x position in points (starts at 0, left to right indexing)
|
int xPos // x position in points (starts at 0, left to right indexing)
|
||||||
) {};
|
) {}
|
||||||
|
|
||||||
private record TitleDimensions(
|
private record TitleDimensions(
|
||||||
int lineCount, // number of lines the titles will take
|
int lineCount, // number of lines the titles will take
|
||||||
int lineHeight, // height of a line (all lines have the same height)
|
int lineHeight, // height of a line (all lines have the same height)
|
||||||
List<TitlePosition> titlePositions // positions of visible titles (the order corresponds to seriesList)
|
List<TitlePosition> titlePositions // positions of visible titles (the order corresponds to seriesList)
|
||||||
) {};
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws series titles.
|
* Draws series titles.
|
||||||
@@ -711,7 +712,7 @@ public class ChartView extends View {
|
|||||||
private TitleDimensions getTitleDimensions() {
|
private TitleDimensions getTitleDimensions() {
|
||||||
int lineCnt = 1;
|
int lineCnt = 1;
|
||||||
int lineHeight = 0;
|
int lineHeight = 0;
|
||||||
List<TitlePosition> tps = new ArrayList<TitlePosition>();
|
List<TitlePosition> tps = new ArrayList<>();
|
||||||
int xPosInLine = spacer;
|
int xPosInLine = spacer;
|
||||||
for (ChartValueSeries chartValueSeries : seriesList) {
|
for (ChartValueSeries chartValueSeries : seriesList) {
|
||||||
if (chartValueSeries.isEnabled() && chartValueSeries.hasData() || allowIfEmpty(chartValueSeries)) {
|
if (chartValueSeries.isEnabled() && chartValueSeries.hasData() || allowIfEmpty(chartValueSeries)) {
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ public final class Marker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPhoto() {
|
public boolean hasPhoto() {
|
||||||
return photoUrl != null && !"".equals(photoUrl);
|
return photoUrl != null && !photoUrl.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public record Id(long id) implements Parcelable {
|
public record Id(long id) implements Parcelable {
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ public class GPXTrackExporter implements TrackExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Distance writeTrackPoint(ZoneOffset zoneOffset, TrackPoint trackPoint, List<TrackPoint> sensorPoints, Distance trackDistance) {
|
public Distance writeTrackPoint(ZoneOffset zoneOffset, TrackPoint trackPoint, List<TrackPoint> sensorPoints, Distance trackDistance) {
|
||||||
Distance cumulativeDistance = null;
|
Distance cumulativeDistance;
|
||||||
|
|
||||||
printWriter.println("<trkpt " + formatLocation(trackPoint.getLatitude(), trackPoint.getLongitude()) + ">");
|
printWriter.println("<trkpt " + formatLocation(trackPoint.getLatitude(), trackPoint.getLongitude()) + ">");
|
||||||
|
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ public class KMLTrackExporter implements TrackExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeTypeLocalized(String localizedValue) {
|
private void writeTypeLocalized(String localizedValue) {
|
||||||
if (localizedValue == null || localizedValue.equals("")) {
|
if (localizedValue == null || localizedValue.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printWriter.println("<ExtendedData>");
|
printWriter.println("<ExtendedData>");
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ public class KmlTrackImporter extends DefaultHandler implements XMLImporter.Trac
|
|||||||
Float value = null;
|
Float value = null;
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
content = content.trim();
|
content = content.trim();
|
||||||
if (!"".equals(content)) {
|
if (!content.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
value = Float.parseFloat(content);
|
value = Float.parseFloat(content);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ public class GainManager implements SensorConnector {
|
|||||||
|
|
||||||
private final SensorManager.SensorDataChangedObserver listener;
|
private final SensorManager.SensorDataChangedObserver listener;
|
||||||
|
|
||||||
private final SharedPreferences.OnSharedPreferenceChangeListener sharedPreferenceChangeListener = (sharedPreferences, key) -> {
|
private final SharedPreferences.OnSharedPreferenceChangeListener sharedPreferenceChangeListener = (sharedPreferences, key) -> connect();
|
||||||
connect();
|
|
||||||
};
|
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private Handler handler;
|
private Handler handler;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public abstract class Aggregator<Input, Output> {
|
|||||||
/**
|
/**
|
||||||
* Reset long term aggregated values (more than derived from previous SensorData). e.g. overall distance.
|
* Reset long term aggregated values (more than derived from previous SensorData). e.g. overall distance.
|
||||||
*/
|
*/
|
||||||
public void reset() {};
|
public void reset() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the data recent considering the current time.
|
* Is the data recent considering the current time.
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ public class PreferencesUtils {
|
|||||||
|
|
||||||
//TODO Check if actually needed or can be superseeded by a flexible default in getUnit()
|
//TODO Check if actually needed or can be superseeded by a flexible default in getUnit()
|
||||||
public static void applyDefaultUnit() {
|
public static void applyDefaultUnit() {
|
||||||
if (getString(R.string.stats_units_key, "").equals("")) {
|
if (getString(R.string.stats_units_key, "").isEmpty()) {
|
||||||
if (!Locale.US.equals(Locale.getDefault())) {
|
if (!Locale.US.equals(Locale.getDefault())) {
|
||||||
setUnit(UnitSystem.METRIC);
|
setUnit(UnitSystem.METRIC);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -114,9 +114,7 @@ public class MarkerListActivity extends AbstractActivity implements DeleteMarker
|
|||||||
|
|
||||||
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
|
setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar);
|
||||||
setSupportActionBar(viewBinding.markerListToolbar);
|
setSupportActionBar(viewBinding.markerListToolbar);
|
||||||
viewBinding.bottomAppBarLayout.bottomAppBar.setNavigationOnClickListener(item -> {
|
viewBinding.bottomAppBarLayout.bottomAppBar.setNavigationOnClickListener(item -> finish());
|
||||||
finish();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -201,7 +201,6 @@ limitations under the License.
|
|||||||
<string name="generic_separator_done_total">/</string>
|
<string name="generic_separator_done_total">/</string>
|
||||||
<string name="generic_show_errors">顯示錯誤</string>
|
<string name="generic_show_errors">顯示錯誤</string>
|
||||||
<plurals name="generic_completed_with_errors">
|
<plurals name="generic_completed_with_errors">
|
||||||
<item quantity="one">已完成,但有一個錯誤</item>
|
|
||||||
<item quantity="other">已完成,但有 %1$d 個錯誤</item>
|
<item quantity="other">已完成,但有 %1$d 個錯誤</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="generic_completed">完成</string>
|
<string name="generic_completed">完成</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user