forked from upstream-mirrors/OpenTracks
Automated code cleanup using AndroidStudio.
This commit is contained in:
@@ -42,7 +42,7 @@ public class DescriptionGeneratorTest {
|
|||||||
private static final long START_TIME = 1288721514000L;
|
private static final long START_TIME = 1288721514000L;
|
||||||
private DescriptionGenerator descriptionGenerator;
|
private DescriptionGenerator descriptionGenerator;
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class SearchEngineTest {
|
|||||||
private ContentProviderUtils providerUtils;
|
private ContentProviderUtils providerUtils;
|
||||||
private SearchEngine engine;
|
private SearchEngine engine;
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -66,7 +66,7 @@ public class SearchEngineTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() {
|
||||||
providerUtils.deleteAllTracks(context);
|
providerUtils.deleteAllTracks(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ import de.dennisguse.opentracks.content.data.WaypointsColumns;
|
|||||||
public class CustomContentProviderTest {
|
public class CustomContentProviderTest {
|
||||||
|
|
||||||
private CustomContentProvider customContentProvider;
|
private CustomContentProvider customContentProvider;
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|||||||
+2
-3
@@ -58,7 +58,7 @@ public class CustomContentProviderUtilsTest {
|
|||||||
private static final String TEST_DESC = "Test Desc!";
|
private static final String TEST_DESC = "Test Desc!";
|
||||||
private static final String TEST_DESC_NEW = "Test Desc new!";
|
private static final String TEST_DESC_NEW = "Test Desc new!";
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
private ContentProviderUtils contentProviderUtils;
|
private ContentProviderUtils contentProviderUtils;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@@ -107,7 +107,7 @@ public class CustomContentProviderUtilsTest {
|
|||||||
testIterator(1, 20000, 2000, false);
|
testIterator(1, 20000, 2000, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TrackPoint> testIterator(long trackId, int numPoints, int batchSize, boolean descending) {
|
private void testIterator(long trackId, int numPoints, int batchSize, boolean descending) {
|
||||||
long lastPointId = initializeTrack(trackId, numPoints);
|
long lastPointId = initializeTrack(trackId, numPoints);
|
||||||
contentProviderUtils.setDefaultCursorBatchSize(batchSize);
|
contentProviderUtils.setDefaultCursorBatchSize(batchSize);
|
||||||
List<TrackPoint> locations = new ArrayList<>(numPoints);
|
List<TrackPoint> locations = new ArrayList<>(numPoints);
|
||||||
@@ -122,7 +122,6 @@ public class CustomContentProviderUtilsTest {
|
|||||||
}
|
}
|
||||||
Assert.assertEquals(numPoints, locations.size());
|
Assert.assertEquals(numPoints, locations.size());
|
||||||
}
|
}
|
||||||
return locations;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private long initializeTrack(long id, int numPoints) {
|
private long initializeTrack(long id, int numPoints) {
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ public class CustomSQLiteOpenHelperTest {
|
|||||||
|
|
||||||
private static final String DATABASE_NAME = "test.db";
|
private static final String DATABASE_NAME = "test.db";
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the SQL create statements for all tables (ordered by name).
|
* Get the SQL create statements for all tables (ordered by name).
|
||||||
|
|||||||
+3
-3
@@ -40,16 +40,16 @@ public class ExportImportTest {
|
|||||||
|
|
||||||
private static final String TAG = ExportImportTest.class.getSimpleName();
|
private static final String TAG = ExportImportTest.class.getSimpleName();
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
private ContentProviderUtils contentProviderUtils = new ContentProviderUtils(context);
|
private final ContentProviderUtils contentProviderUtils = new ContentProviderUtils(context);
|
||||||
|
|
||||||
private static final String TRACK_ICON = "the track icon";
|
private static final String TRACK_ICON = "the track icon";
|
||||||
private static final String TRACK_CATEGORY = "the category";
|
private static final String TRACK_CATEGORY = "the category";
|
||||||
private static final String TRACK_DESCRIPTION = "the description";
|
private static final String TRACK_DESCRIPTION = "the description";
|
||||||
private final List<Waypoint> waypoints = new ArrayList<>();
|
private final List<Waypoint> waypoints = new ArrayList<>();
|
||||||
private long importTrackId;
|
private long importTrackId;
|
||||||
private long trackId = System.currentTimeMillis();
|
private final long trackId = System.currentTimeMillis();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|||||||
+2
-2
@@ -73,9 +73,9 @@ public class GpxFileTrackImporterTest extends AbstractTestFileTrackImporter {
|
|||||||
String longitude = Double.toString(TRACK_LONGITUDE + index);
|
String longitude = Double.toString(TRACK_LONGITUDE + index);
|
||||||
String elevation = Double.toString(TRACK_ELEVATION + index);
|
String elevation = Double.toString(TRACK_ELEVATION + index);
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
buffer.append("<trkpt lat=\"" + latitude + "\" lon=\"" + longitude + "\"><ele>" + elevation + "</ele>");
|
buffer.append("<trkpt lat=\"").append(latitude).append("\" lon=\"").append(longitude).append("\"><ele>").append(elevation).append("</ele>");
|
||||||
if (time != null) {
|
if (time != null) {
|
||||||
buffer.append("<time>" + time + "</time>");
|
buffer.append("<time>").append(time).append("</time>");
|
||||||
}
|
}
|
||||||
buffer.append("</trkpt>");
|
buffer.append("</trkpt>");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ import static org.mockito.Mockito.when;
|
|||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class TrackRecordingServiceNotificationManagerTest {
|
public class TrackRecordingServiceNotificationManagerTest {
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private TrackPoint locationMock;
|
private TrackPoint locationMock;
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ public class TrackRecordingServiceTest {
|
|||||||
@Rule
|
@Rule
|
||||||
public GrantPermissionRule mRuntimePermissionRule = GrantPermissionRule.grant(android.Manifest.permission.ACCESS_FINE_LOCATION);
|
public GrantPermissionRule mRuntimePermissionRule = GrantPermissionRule.grant(android.Manifest.permission.ACCESS_FINE_LOCATION);
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
private ContentProviderUtils contentProviderUtils;
|
private ContentProviderUtils contentProviderUtils;
|
||||||
|
|
||||||
private final long trackId = Math.abs(new Random().nextLong());
|
private final long trackId = Math.abs(new Random().nextLong());
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ public class TrackRecordingServiceTestLooper {
|
|||||||
@Rule
|
@Rule
|
||||||
public final ServiceTestRule mServiceRule = ServiceTestRule.withTimeout(5, TimeUnit.SECONDS);
|
public final ServiceTestRule mServiceRule = ServiceTestRule.withTimeout(5, TimeUnit.SECONDS);
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
private ContentProviderUtils contentProviderUtils;
|
private ContentProviderUtils contentProviderUtils;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ import org.junit.runner.RunWith;
|
|||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class AnnouncementPeriodicTaskFactoryTest {
|
public class AnnouncementPeriodicTaskFactoryTest {
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void preSetUp() {
|
public static void preSetUp() {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import de.dennisguse.opentracks.stats.TrackStatistics;
|
|||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class AnnouncementUtilsTest {
|
public class AnnouncementUtilsTest {
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAnnouncement() {
|
public void getAnnouncement() {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.junit.runner.RunWith;
|
|||||||
import org.junit.runners.JUnit4;
|
import org.junit.runners.JUnit4;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link FileUtils}.
|
* Tests for {@link FileUtils}.
|
||||||
@@ -108,9 +109,7 @@ public class FileUtilsTest {
|
|||||||
File directory = new File("/dir1/dir2/");
|
File directory = new File("/dir1/dir2/");
|
||||||
String suffix = ".gpx";
|
String suffix = ".gpx";
|
||||||
char[] name = new char[FileUtils.MAX_FAT32_PATH_LENGTH];
|
char[] name = new char[FileUtils.MAX_FAT32_PATH_LENGTH];
|
||||||
for (int i = 0; i < name.length; i++) {
|
Arrays.fill(name, 'a');
|
||||||
name[i] = 'a';
|
|
||||||
}
|
|
||||||
String nameString = new String(name);
|
String nameString = new String(name);
|
||||||
String truncated = FileUtils.truncateFileName(directory, nameString, suffix);
|
String truncated = FileUtils.truncateFileName(directory, nameString, suffix);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import java.util.TimeZone;
|
|||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class StringUtilsTest {
|
public class StringUtilsTest {
|
||||||
|
|
||||||
private Context context = ApplicationProvider.getApplicationContext();
|
private final Context context = ApplicationProvider.getApplicationContext();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class MarkerEditActivity extends AbstractActivity {
|
|||||||
|
|
||||||
trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
|
trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
|
||||||
markerId = getIntent().getLongExtra(EXTRA_MARKER_ID, -1L);
|
markerId = getIntent().getLongExtra(EXTRA_MARKER_ID, -1L);
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
||||||
|
|
||||||
hasCamera = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
|
hasCamera = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
|
||||||
|
|
||||||
@@ -254,8 +254,8 @@ public class MarkerEditActivity extends AbstractActivity {
|
|||||||
private void hideAndShowOptions() {
|
private void hideAndShowOptions() {
|
||||||
boolean isPhotoSet = (waypoint != null && waypoint.hasPhoto()) || photoUri != null;
|
boolean isPhotoSet = (waypoint != null && waypoint.hasPhoto()) || photoUri != null;
|
||||||
if (insertPhotoMenuItem != null && insertGalleryImgMenuItem != null) {
|
if (insertPhotoMenuItem != null && insertGalleryImgMenuItem != null) {
|
||||||
insertPhotoMenuItem.setVisible(isPhotoSet ? false : true);
|
insertPhotoMenuItem.setVisible(!isPhotoSet);
|
||||||
insertGalleryImgMenuItem.setVisible(isPhotoSet ? false : true);
|
insertGalleryImgMenuItem.setVisible(!isPhotoSet);
|
||||||
}
|
}
|
||||||
waypointDeletePhotoBtn.setVisibility(isPhotoSet ? View.VISIBLE : View.GONE);
|
waypointDeletePhotoBtn.setVisibility(isPhotoSet ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ public class SearchListActivity extends AbstractListActivity implements DeleteMa
|
|||||||
|
|
||||||
contentProviderUtils = new ContentProviderUtils(this);
|
contentProviderUtils = new ContentProviderUtils(this);
|
||||||
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
|
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
||||||
searchEngine = new SearchEngine(contentProviderUtils);
|
searchEngine = new SearchEngine(contentProviderUtils);
|
||||||
|
|
||||||
arrayAdapter = new ArrayAdapter<Map<String, Object>>(this, R.layout.list_item, R.id.list_item_name) {
|
arrayAdapter = new ArrayAdapter<Map<String, Object>>(this, R.layout.list_item, R.id.list_item_name) {
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ public class TrackDetailActivity extends AbstractListActivity implements ChooseA
|
|||||||
|
|
||||||
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
|
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
|
||||||
|
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, bindChangedCallback);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(bindChangedCallback);
|
||||||
trackDataHub = new TrackDataHub(this);
|
trackDataHub = new TrackDataHub(this);
|
||||||
|
|
||||||
FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager(), 1) {
|
FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager(), 1) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
|
|||||||
protected void onCreate(Bundle bundle) {
|
protected void onCreate(Bundle bundle) {
|
||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
|
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
||||||
long trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
|
long trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
|
||||||
if (trackId == -1L) {
|
if (trackId == -1L) {
|
||||||
Log.e(TAG, "invalid trackId");
|
Log.e(TAG, "invalid trackId");
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ public class TrackListActivity extends AbstractListActivity implements ConfirmDe
|
|||||||
contentProviderUtils = new ContentProviderUtils(this);
|
contentProviderUtils = new ContentProviderUtils(this);
|
||||||
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
|
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
|
||||||
|
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, bindChangedCallback);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(bindChangedCallback);
|
||||||
trackController = new TrackController(this, trackRecordingServiceConnection, true, recordListener, stopListener);
|
trackController = new TrackController(this, trackRecordingServiceConnection, true, recordListener, stopListener);
|
||||||
|
|
||||||
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
|
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ public class TrackDataHub implements DataSourceManager.DataSourceListener, Share
|
|||||||
|
|
||||||
// Track points sampling state
|
// Track points sampling state
|
||||||
private int numLoadedPoints;
|
private int numLoadedPoints;
|
||||||
private long firstSeenLocationId;
|
private long firstSeenTrackPointId;
|
||||||
private long lastSeenLocationId;
|
private long lastSeenTrackPointId;
|
||||||
|
|
||||||
public TrackDataHub(Context context) {
|
public TrackDataHub(Context context) {
|
||||||
this(context, new TrackDataManager(), new ContentProviderUtils(context), TARGET_DISPLAYED_TRACK_POINTS);
|
this(context, new TrackDataManager(), new ContentProviderUtils(context), TARGET_DISPLAYED_TRACK_POINTS);
|
||||||
@@ -380,9 +380,9 @@ public class TrackDataHub implements DataSourceManager.DataSourceListener, Share
|
|||||||
}
|
}
|
||||||
|
|
||||||
int localNumLoadedPoints = updateSamplingState ? numLoadedPoints : 0;
|
int localNumLoadedPoints = updateSamplingState ? numLoadedPoints : 0;
|
||||||
long localFirstSeenLocationId = updateSamplingState ? firstSeenLocationId : -1L;
|
long localFirstSeenLocationId = updateSamplingState ? firstSeenTrackPointId : -1L;
|
||||||
long localLastSeenLocationId = updateSamplingState ? lastSeenLocationId : -1L;
|
long localLastSeenLocationId = updateSamplingState ? lastSeenTrackPointId : -1L;
|
||||||
long maxPointId = updateSamplingState ? -1L : lastSeenLocationId;
|
long maxPointId = updateSamplingState ? -1L : lastSeenTrackPointId;
|
||||||
|
|
||||||
long lastTrackPointId = contentProviderUtils.getLastTrackPointId(selectedTrackId);
|
long lastTrackPointId = contentProviderUtils.getLastTrackPointId(selectedTrackId);
|
||||||
int samplingFrequency = -1;
|
int samplingFrequency = -1;
|
||||||
@@ -431,8 +431,8 @@ public class TrackDataHub implements DataSourceManager.DataSourceListener, Share
|
|||||||
|
|
||||||
if (updateSamplingState) {
|
if (updateSamplingState) {
|
||||||
numLoadedPoints = localNumLoadedPoints;
|
numLoadedPoints = localNumLoadedPoints;
|
||||||
firstSeenLocationId = localFirstSeenLocationId;
|
firstSeenTrackPointId = localFirstSeenLocationId;
|
||||||
lastSeenLocationId = localLastSeenLocationId;
|
lastSeenTrackPointId = localLastSeenLocationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TrackDataListener listener : sampledInListeners) {
|
for (TrackDataListener listener : sampledInListeners) {
|
||||||
@@ -445,8 +445,8 @@ public class TrackDataHub implements DataSourceManager.DataSourceListener, Share
|
|||||||
*/
|
*/
|
||||||
private void resetSamplingState() {
|
private void resetSamplingState() {
|
||||||
numLoadedPoints = 0;
|
numLoadedPoints = 0;
|
||||||
firstSeenLocationId = -1L;
|
firstSeenTrackPointId = -1L;
|
||||||
lastSeenLocationId = -1L;
|
lastSeenTrackPointId = -1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -463,13 +463,4 @@ public class TrackDataHub implements DataSourceManager.DataSourceListener, Share
|
|||||||
}
|
}
|
||||||
handler.post(runnable);
|
handler.post(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value selectedTrackId.
|
|
||||||
*
|
|
||||||
* @return the selectedTrackId
|
|
||||||
*/
|
|
||||||
public long getSelectedTrackId() {
|
|
||||||
return selectedTrackId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ import de.dennisguse.opentracks.content.sensor.SensorDataSet;
|
|||||||
*/
|
*/
|
||||||
public class TrackPoint {
|
public class TrackPoint {
|
||||||
|
|
||||||
private Location location;
|
private final Location location;
|
||||||
|
|
||||||
public TrackPoint() {
|
public TrackPoint() {
|
||||||
this.location = new Location("");
|
this.location = new Location("");
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
// A recording track id has been set -> Resumes track and starts timer.
|
// A recording track id has been set -> Resumes track and starts timer.
|
||||||
resumeTrackDataHub();
|
resumeTrackDataHub();
|
||||||
if (trackRecordingServiceConnection == null) {
|
if (trackRecordingServiceConnection == null) {
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(getContext(), null);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
||||||
}
|
}
|
||||||
trackRecordingServiceConnection.startConnection(getContext());
|
trackRecordingServiceConnection.startConnection(getContext());
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ public class StatsFragment extends Fragment implements TrackDataListener {
|
|||||||
resumeTrackDataHub();
|
resumeTrackDataHub();
|
||||||
PreferencesUtils.register(getContext(), sharedPreferenceChangeListener);
|
PreferencesUtils.register(getContext(), sharedPreferenceChangeListener);
|
||||||
|
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(getContext(), null);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
||||||
trackRecordingServiceConnection.startConnection(getContext());
|
trackRecordingServiceConnection.startConnection(getContext());
|
||||||
|
|
||||||
handlerUpdateUI.post(updateUIeachSecond);
|
handlerUpdateUI.post(updateUIeachSecond);
|
||||||
|
|||||||
+1
-2
@@ -54,10 +54,9 @@ public class TrackRecordingServiceConnection implements ServiceConnection, Death
|
|||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param context the context
|
|
||||||
* @param callback the callback to invoke when the service binding changes
|
* @param callback the callback to invoke when the service binding changes
|
||||||
*/
|
*/
|
||||||
public TrackRecordingServiceConnection(Context context, Runnable callback) {
|
public TrackRecordingServiceConnection(Runnable callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class AnnouncementUtils {
|
|||||||
} else {
|
} else {
|
||||||
//TODO This seems weird; why not use Math.round(d) or Math.ceil()?
|
//TODO This seems weird; why not use Math.round(d) or Math.ceil()?
|
||||||
int count = (int) d;
|
int count = (int) d;
|
||||||
return count < 3 ? 3 : count;
|
return Math.max(count, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import java.io.File;
|
|||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -231,9 +230,8 @@ public class FileUtils {
|
|||||||
*
|
*
|
||||||
* @param src source file.
|
* @param src source file.
|
||||||
* @param dst destination file.
|
* @param dst destination file.
|
||||||
* @throws IOException
|
*/
|
||||||
*/
|
public static void copy(FileDescriptor src, File dst) {
|
||||||
public static void copy(FileDescriptor src, File dst) throws IOException {
|
|
||||||
try (FileChannel in = new FileInputStream(src).getChannel();
|
try (FileChannel in = new FileInputStream(src).getChannel();
|
||||||
FileChannel out = new FileOutputStream(dst).getChannel()) {
|
FileChannel out = new FileOutputStream(dst).getChannel()) {
|
||||||
in.transferTo(0, in.size(), out);
|
in.transferTo(0, in.size(), out);
|
||||||
|
|||||||
Reference in New Issue
Block a user