forked from upstream-mirrors/OpenTracks
Cleanup: automatic code inspection via Android Studio.
This commit is contained in:
+2
-2
@@ -27,7 +27,7 @@ def getVersionCode = { ->
|
|||||||
return Integer.parseInt(stdout.toString().trim())
|
return Integer.parseInt(stdout.toString().trim())
|
||||||
}
|
}
|
||||||
catch (ignored) {
|
catch (ignored) {
|
||||||
return -1;
|
return -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ def getVersionName = { ->
|
|||||||
return stdout.toString().trim()
|
return stdout.toString().trim()
|
||||||
}
|
}
|
||||||
catch (ignored) {
|
catch (ignored) {
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package de.dennisguse.opentracks;
|
package de.dennisguse.opentracks;
|
||||||
|
|
||||||
import android.app.SearchManager;
|
import android.app.SearchManager;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||||
@@ -38,6 +37,13 @@ import android.widget.ListView;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.content.ContentProviderUtils;
|
import de.dennisguse.opentracks.content.ContentProviderUtils;
|
||||||
import de.dennisguse.opentracks.content.SearchEngine;
|
import de.dennisguse.opentracks.content.SearchEngine;
|
||||||
import de.dennisguse.opentracks.content.SearchEngine.ScoredResult;
|
import de.dennisguse.opentracks.content.SearchEngine.ScoredResult;
|
||||||
@@ -57,14 +63,6 @@ import de.dennisguse.opentracks.util.PreferencesUtils;
|
|||||||
import de.dennisguse.opentracks.util.StringUtils;
|
import de.dennisguse.opentracks.util.StringUtils;
|
||||||
import de.dennisguse.opentracks.util.TrackIconUtils;
|
import de.dennisguse.opentracks.util.TrackIconUtils;
|
||||||
import de.dennisguse.opentracks.util.TrackRecordingServiceConnectionUtils;
|
import de.dennisguse.opentracks.util.TrackRecordingServiceConnectionUtils;
|
||||||
import de.dennisguse.opentracks.R;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An activity to display a list of search results.
|
* An activity to display a list of search results.
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package de.dennisguse.opentracks;
|
package de.dennisguse.opentracks;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||||
@@ -37,7 +36,6 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.app.TaskStackBuilder;
|
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.dennisguse.opentracks.content;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utilities for serializing primitive types.
|
|
||||||
*
|
|
||||||
* @author Rodrigo Damazio
|
|
||||||
*/
|
|
||||||
public class ContentTypeIds {
|
|
||||||
|
|
||||||
public static final byte BOOLEAN_TYPE_ID = 0;
|
|
||||||
public static final byte LONG_TYPE_ID = 1;
|
|
||||||
public static final byte INT_TYPE_ID = 2;
|
|
||||||
public static final byte FLOAT_TYPE_ID = 3;
|
|
||||||
public static final byte DOUBLE_TYPE_ID = 4;
|
|
||||||
public static final byte STRING_TYPE_ID = 5;
|
|
||||||
public static final byte BLOB_TYPE_ID = 6;
|
|
||||||
private ContentTypeIds() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,6 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
|||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.Constants;
|
|
||||||
import de.dennisguse.opentracks.util.PreferencesUtils;
|
import de.dennisguse.opentracks.util.PreferencesUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+4
-9
@@ -32,13 +32,13 @@ import android.widget.GridView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.util.DialogUtils;
|
|
||||||
import de.dennisguse.opentracks.util.TrackIconUtils;
|
|
||||||
import de.dennisguse.opentracks.R;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.dennisguse.opentracks.R;
|
||||||
|
import de.dennisguse.opentracks.util.DialogUtils;
|
||||||
|
import de.dennisguse.opentracks.util.TrackIconUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DialogFragment to choose an activity type.
|
* A DialogFragment to choose an activity type.
|
||||||
*
|
*
|
||||||
@@ -119,11 +119,6 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateWeightContainer(View weightContainer, int position) {
|
|
||||||
boolean showWeight = position == 0 || position == 1 || position == 2;
|
|
||||||
weightContainer.setVisibility(showWeight ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
|||||||
+3
-4
@@ -23,10 +23,10 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.R;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.dennisguse.opentracks.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image adapter for choosing an activity type.
|
* Image adapter for choosing an activity type.
|
||||||
*
|
*
|
||||||
@@ -41,8 +41,7 @@ public class ChooseActivityTypeImageAdapter extends BaseAdapter {
|
|||||||
private final int padding;
|
private final int padding;
|
||||||
private int selected = -1;
|
private int selected = -1;
|
||||||
|
|
||||||
public ChooseActivityTypeImageAdapter(
|
public ChooseActivityTypeImageAdapter(Context context, List<Integer> imageIds, int width, int height, int padding) {
|
||||||
Context context, List<Integer> imageIds, int width, int height, int padding) {
|
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.imageIds = imageIds;
|
this.imageIds = imageIds;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package de.dennisguse.opentracks.io.file.exporter;
|
package de.dennisguse.opentracks.io.file.exporter;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.preference.DialogPreference;
|
import android.preference.DialogPreference;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.R;
|
import de.dennisguse.opentracks.R;
|
||||||
@@ -16,11 +15,6 @@ public class ResetDialogPreference extends DialogPreference {
|
|||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected View onCreateDialogView() {
|
|
||||||
return super.onCreateDialogView();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
super.onClick(dialog, which);
|
super.onClick(dialog, which);
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ import android.preference.Preference;
|
|||||||
import android.preference.Preference.OnPreferenceChangeListener;
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.util.PreferencesUtils;
|
|
||||||
import de.dennisguse.opentracks.R;
|
import de.dennisguse.opentracks.R;
|
||||||
import de.dennisguse.opentracks.util.StringUtils;
|
import de.dennisguse.opentracks.util.PreferencesUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An activity for accessing stats settings.
|
* An activity for accessing stats settings.
|
||||||
|
|||||||
@@ -77,30 +77,6 @@ public class DoubleBuffer {
|
|||||||
return sum / numberOfEntries;
|
return sum / numberOfEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the average and the variance of the buffer.
|
|
||||||
*
|
|
||||||
* @return an array of two elements - the first is the average, the second is
|
|
||||||
* the variance
|
|
||||||
*/
|
|
||||||
public double[] getAverageAndVariance() {
|
|
||||||
int numberOfEntries = isFull ? buffer.length : index;
|
|
||||||
if (numberOfEntries == 0) {
|
|
||||||
return new double[]{0, 0};
|
|
||||||
}
|
|
||||||
|
|
||||||
double sum = 0;
|
|
||||||
double sumSquares = 0;
|
|
||||||
for (int i = 0; i < numberOfEntries; i++) {
|
|
||||||
sum += buffer[i];
|
|
||||||
sumSquares += Math.pow(buffer[i], 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
double average = sum / numberOfEntries;
|
|
||||||
double variance = sumSquares / numberOfEntries - Math.pow(average, 2);
|
|
||||||
return new double[]{average, variance};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a double to the buffer. If the buffer is full the oldest element is
|
* Adds a double to the buffer. If the buffer is full the oldest element is
|
||||||
* overwritten.
|
* overwritten.
|
||||||
|
|||||||
@@ -17,19 +17,14 @@
|
|||||||
package de.dennisguse.opentracks.util;
|
package de.dennisguse.opentracks.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.location.Address;
|
|
||||||
import android.location.Geocoder;
|
|
||||||
import android.location.Location;
|
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.R;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import de.dennisguse.opentracks.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for track name.
|
* Utilities for track name.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ limitations under the License.
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/marker_list_empty"
|
android:id="@+id/marker_list_empty"
|
||||||
style="@style/ListEmptyTextView"
|
style="@style/ListEmptyTextView"
|
||||||
android:text="@string/marker_list_empty_message"></TextView>
|
android:text="@string/marker_list_empty_message" />
|
||||||
</merge>
|
</merge>
|
||||||
@@ -25,5 +25,5 @@ limitations under the License.
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/search_list_empty"
|
android:id="@+id/search_list_empty"
|
||||||
style="@style/ListEmptyTextView"
|
style="@style/ListEmptyTextView"
|
||||||
android:text="@string/search_list_empty_message"></TextView>
|
android:text="@string/search_list_empty_message" />
|
||||||
</merge>
|
</merge>
|
||||||
@@ -73,7 +73,7 @@ limitations under the License.
|
|||||||
android:layout_weight="22"
|
android:layout_weight="22"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:text="@string/track_list_empty_message"
|
android:text="@string/track_list_empty_message"
|
||||||
android:textColor="@color/list_empty_text"></TextView>
|
android:textColor="@color/list_empty_text" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
Reference in New Issue
Block a user