Cleanup using Android Studio code analyzer.

This commit is contained in:
Dennis Guse
2020-04-28 07:11:17 +02:00
parent 9a7d4fdb36
commit a50b1ac78e
36 changed files with 41 additions and 116 deletions
@@ -35,8 +35,6 @@ public class TrackStubUtils {
private static final float INITIAL_ACCURACY = 5;
private static final float INITIAL_SPEED = 10;
private static final float INITIAL_BEARING = 3.0f;
// Used to change the value of latitude, longitude, and altitude.
private static final double DIFFERENCE = 0.01;
/**
* Create a MyTracks location with default values.
@@ -70,7 +70,7 @@ public class SearchEngineTest {
providerUtils.deleteAllTracks(context);
}
private long insertTrack(String title, String description, String category, double distance, long hoursAgo) {
private long insertTrack(String title, String description, String category, long hoursAgo) {
Track track = new Track();
track.setName(title);
track.setDescription(description);
@@ -88,15 +88,11 @@ public class SearchEngineTest {
}
private long insertTrack(String title, String description, String category) {
return insertTrack(title, description, category, 0, -1);
}
private long insertTrack(String title, double distance) {
return insertTrack(title, "", "", distance, -1);
return insertTrack(title, description, category, -1);
}
private long insertTrack(String title, long hoursAgo) {
return insertTrack(title, "", "", 0.0, hoursAgo);
return insertTrack(title, "", "", hoursAgo);
}
private long insertWaypoint(String title, String description, String category, double distance, long hoursAgo, long trackId) {
@@ -90,14 +90,10 @@ public class TestDataUtil {
*/
public static Waypoint createWaypointWithPhoto(Context context, long trackId, Location location) throws IOException {
String photoUrl = "";
try {
File dstFile = new File(FileUtils.getImageUrl(context, trackId));
dstFile.createNewFile();
Uri photoUri = FileUtils.getUriForFile(context, dstFile);
photoUrl = photoUri.toString();
} catch (IOException ioe) {
throw ioe;
}
File dstFile = new File(FileUtils.getImageUrl(context, trackId));
dstFile.createNewFile();
Uri photoUri = FileUtils.getUriForFile(context, dstFile);
photoUrl = photoUri.toString();
return new Waypoint("Waypoint name", "Waypoint description", "Waypoint category", "", trackId, 0.0, 0, location, photoUrl);
}
@@ -77,7 +77,7 @@ public class TrackRecordingServiceTestLocation {
}
@After
public void tearDown() throws TimeoutException {
public void tearDown() {
// Reset service (if some previous test failed)
service.enableLocationExecutor(true);
if (service.isRecording() || service.isPaused()) {
@@ -603,7 +603,6 @@ public class StatsFragment extends Fragment implements TrackDataListener {
private void setLocationValues() {
boolean metricUnits = PreferencesUtils.isMetricUnits(getContext());
boolean reportSpeed = PreferencesUtils.isReportSpeed(getContext(), category);
boolean isRecording = isSelectedTrackRecording();
// Set speed/pace
@@ -74,7 +74,7 @@ public class KmlTrackWriter implements TrackWriter {
* @param context the context
* @param hasMultipleTracks should encode multiple tracks into one file?
* @param exportTrackDetail should detailed information about the track be exported (e.g., title, description, waypoints, timing)?
* @param exportSensorData should {@link TrackPointSensorDataSet} be exported?
* @param exportSensorData should {@link TrackPoint}'s sensor data be exported?
* @param exportPhotos should pictures be exported (if true: exports to KMZ)?
*/
public KmlTrackWriter(Context context, boolean hasMultipleTracks, boolean exportTrackDetail, boolean exportSensorData, boolean exportPhotos) {
@@ -42,7 +42,7 @@ import de.dennisguse.opentracks.util.FileUtils;
* @author Jimmy Shih
*/
public class KmzTrackExporter implements TrackExporter {
public static final String KMZ_IMAGES_DIR = "images";
private static final String KMZ_IMAGES_DIR = "images";
public static final String KMZ_KML_FILE = "doc.kml";
private static final String TAG = KmzTrackExporter.class.getSimpleName();
@@ -47,7 +47,7 @@ public class KmzTrackImporter implements TrackImporter {
private static final String TAG = KmzTrackImporter.class.getSimpleName();
public static final List<String> KMZ_IMAGES_EXT = Arrays.asList("jpeg", "jpg", "png");
private static final List<String> KMZ_IMAGES_EXT = Arrays.asList("jpeg", "jpg", "png");
private static final int BUFFER_SIZE = 4096;
@@ -154,11 +154,7 @@ public class KmzTrackImporter implements TrackImporter {
return false;
}
if (KMZ_IMAGES_EXT.contains(fileExt)) {
return true;
}
return false;
return KMZ_IMAGES_EXT.contains(fileExt);
}
/**
@@ -717,7 +717,7 @@ public class TrackRecordingService extends Service {
return remoteSensorManager.getSensorData();
}
void fillWithSensorDataSet(TrackPoint trackPoint) {
private void fillWithSensorDataSet(TrackPoint trackPoint) {
SensorDataSet sensorData = getSensorDataSet();
if (sensorData != null) {
sensorData.fillTrackPoint(trackPoint);
@@ -47,8 +47,6 @@ public interface TrackRecordingServiceInterface {
/**
* Resumes the track identified by trackId.
*
* @param trackId
*/
void resumeTrack(long trackId);
@@ -25,7 +25,6 @@ import android.util.Log;
import java.util.Locale;
import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.content.data.Track;
import de.dennisguse.opentracks.content.provider.ContentProviderUtils;
import de.dennisguse.opentracks.services.TrackRecordingService;
@@ -94,8 +94,6 @@ public abstract class BluetoothLeSensorPreference extends DialogPreference {
private int selectedEntryIndex;
private final BluetoothLeAdapter listAdapter = new BluetoothLeAdapter();
private UUID sensorUUID;
private BluetoothLeScanner scanner = null;
private final ScanCallback scanCallback = new ScanCallback() {
@Override
@@ -135,7 +133,7 @@ public abstract class BluetoothLeSensorPreference extends DialogPreference {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sensorUUID = (UUID) getArguments().getSerializable(ARG_BLUETOOTH_UUID);
UUID sensorUUID = (UUID) getArguments().getSerializable(ARG_BLUETOOTH_UUID);
Log.i(TAG, "UUID: " + sensorUUID);
BluetoothAdapter bluetoothAdapter = BluetoothUtils.getDefaultBluetoothAdapter(TAG);
@@ -147,7 +145,7 @@ public abstract class BluetoothLeSensorPreference extends DialogPreference {
}
if (bluetoothAdapter.isDiscovering()) {
Log.i(TAG, "Cancelling ongoing bluetooth discovery.");
Log.i(TAG, "Cancelling ongoing B<aluetooth discovery.");
bluetoothAdapter.cancelDiscovery();
}
@@ -17,9 +17,9 @@ import de.dennisguse.opentracks.content.provider.ContentProviderUtils;
*/
public class IntentDashboardUtils {
public static final String ACTION_DASHBOARD = "Intent.OpenTracks-Dashboard";
private static final String ACTION_DASHBOARD = "Intent.OpenTracks-Dashboard";
public static final String ACTION_DASHBOARD_PAYLOAD = ACTION_DASHBOARD + ".Payload";
private static final String ACTION_DASHBOARD_PAYLOAD = ACTION_DASHBOARD + ".Payload";
private IntentDashboardUtils() {
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

-6
View File
@@ -1,6 +0,0 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
<path android:fillColor="#FF000000" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
</vector>
-30
View File
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2013 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item android:drawable="@drawable/tab_unselected" android:state_focused="false" android:state_pressed="false" android:state_selected="false" />
<item android:drawable="@drawable/tab_selected" android:state_focused="false" android:state_pressed="false" android:state_selected="true" />
<!-- Focused states -->
<item android:drawable="@drawable/tab_unselected_focused" android:state_focused="true" android:state_pressed="false" android:state_selected="false" />
<item android:drawable="@drawable/tab_selected_focused" android:state_focused="true" android:state_pressed="false" android:state_selected="true" />
<!-- Pressed -->
<!-- Non focused states -->
<item android:drawable="@drawable/tab_unselected_pressed" android:state_focused="false" android:state_pressed="true" android:state_selected="false" />
<item android:drawable="@drawable/tab_selected_pressed" android:state_focused="false" android:state_pressed="true" android:state_selected="true" />
<!-- Focused states -->
<item android:drawable="@drawable/tab_unselected_pressed" android:state_focused="true" android:state_pressed="true" android:state_selected="false" />
<item android:drawable="@drawable/tab_selected_pressed" android:state_focused="true" android:state_pressed="true" android:state_selected="true" />
</selector>
+4 -4
View File
@@ -29,10 +29,10 @@
<item>2150</item>
</string-array>
<string-array name="wheel_circumference_options">
<item>20-622</item>
<item>23-622</item>
<item>25-622</item>
<item>28-622</item>
<item>20–622</item>
<item>23–622</item>
<item>25–622</item>
<item>28–622</item>
</string-array>
<string name="default_activity_key" translatable="false">defaultActivity</string>
+20 -10
View File
@@ -38,20 +38,30 @@
<item>-100</item>
</string-array>
<string name="chart_show_cadence_key" translatable="false">chartShowCadence</string>
<bool name="chart_show_cadence_default" translatable="false">true</bool>
<string name="chart_show_cadence_key" translatable="false" tools:keep="@string/chart_show_cadence_key">chartShowCadence</string>
<bool name="chart_show_cadence_default" translatable="false" tools:keep="@bool/chart_show_cadence_default">
true
</bool>
<string name="chart_show_elevation_key" translatable="false">chartShowElevation</string>
<bool name="chart_show_elevation_default" translatable="false">true</bool>
<string name="chart_show_elevation_key" translatable="false" tools:keep="@string/chart_show_elevation_key">chartShowElevation</string>
<bool name="chart_show_elevation_default" translatable="false" tools:keep="@bool/chart_show_elevation_default">
true
</bool>
<string name="chart_show_heart_rate_key" translatable="false">chartShowHeartRate</string>
<bool name="chart_show_heart_rate_default" translatable="false">true</bool>
<string name="chart_show_heart_rate_key" translatable="false" tools:keep="@string/chart_show_heart_rate_key">chartShowHeartRate</string>
<bool name="chart_show_heart_rate_default" translatable="false" tools:keep="@bool/chart_show_heart_rate_default">
true
</bool>
<string name="chart_show_power_key" translatable="false">chartShowPower</string>
<bool name="chart_show_power_default" translatable="false">true</bool>
<string name="chart_show_power_key" translatable="false" tools:keep="@string/chart_show_power_key">chartShowPower</string>
<bool name="chart_show_power_default" translatable="false" tools:keep="@bool/chart_show_power_default">
true
</bool>
<string name="chart_show_speed_key" translatable="false">chartShowSpeed</string>
<bool name="chart_show_speed_default" translatable="false">true</bool>
<string name="chart_show_speed_key" translatable="false" tools:keep="@string/chart_show_speed_key">chartShowSpeed</string>
<bool name="chart_show_speed_default" translatable="false" tools:keep="@bool/chart_show_speed_default">
true
</bool>
<!-- <string name="auto_resume_track_timeout_key" translatable="false">autoResumeTrackTimeout</string>-->
<!-- <string name="auto_resume_track_timeout_default" translatable="false">10</string>-->
-29
View File
@@ -62,9 +62,6 @@ limitations under the License.
<item name="android:layout_width">match_parent</item>
</style>
<!-- edit label with icon -->
<style name="EditLabel.WithIcon" parent="@style/TextMedium.WithIcon">
<item name="android:layout_width">match_parent</item>
</style>
<!-- edit label with padding top -->
<style name="EditLabel.WithPaddingTop">
<item name="android:paddingTop">16dp</item>
@@ -84,22 +81,8 @@ limitations under the License.
<item name="android:singleLine">true</item>
</style>
<!-- export radio group -->
<style name="ExportRadioGroup">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">8dp</item>
<item name="android:layout_marginLeft">20dp</item>
<item name="android:layout_width">match_parent</item>
</style>
<!-- help answer -->
<style name="HelpAnswer" parent="@style/TextSmall">
<item name="android:autoLink">web</item>
<item name="android:paddingBottom">8dp</item>
</style>
<!-- help question -->
<style name="HelpQuestion" parent="@style/TextMedium">
<item name="android:paddingTop">8dp</item>
<item name="android:textStyle">bold</item>
</style>
<!-- list empty text view -->
<style name="ListEmptyTextView" parent="@style/TextLarge">
<item name="android:gravity">center</item>
@@ -130,13 +113,6 @@ limitations under the License.
<item name="android:layout_weight">1</item>
</style>
<!-- sensor state value -->
<style name="SensorStateValue" parent="@style/TextLarge">
<item name="android:background">@android:color/background_light</item>
<item name="android:gravity">right</item>
<item name="android:layout_width">match_parent</item>
<item name="android:paddingRight">8dp</item>
<item name="android:textColor">@android:color/primary_text_light</item>
</style>
<!-- stats horizontal line -->
<style name="StatsHorizontalLine">
<item name="android:background">@color/stats_separator</item>
@@ -233,11 +209,6 @@ limitations under the License.
<item name="android:textColor">@android:color/white</item>
</style>
<style name="TextChooseActivity">
<!-- Same as TextChooseActivity in values/styles.xml except removing textSize and using textAppearance -->
<item name="android:textAppearance">?android:attr/textAppearanceListItemSmall</item>
</style>
<style name="TextLarge" parent="@android:style/TextAppearance.Holo.Large">
<!-- same as TextLarge in values/styles.xml except inheriting from a parent instead of specifying textSize -->
<item name="android:layout_height">wrap_content</item>