AndroidStudio: code cleanup.

This commit is contained in:
Dennis Guse
2023-08-08 17:57:36 +02:00
parent 3910837d1a
commit 7530e1d120
12 changed files with 214 additions and 821 deletions
@@ -14,7 +14,7 @@ import de.dennisguse.opentracks.data.models.Track;
//TODO Merge with TrackFilenameGeneratorTest whenever Junit5 gets available.
//https://github.com/android/android-test/issues/224
@RunWith(Parameterized.class)
public class TrackFilenameGeneratorTest2 {
public class TrackFilenameGenerator2Test {
@Parameterized.Parameters
public static Collection<String> data() {
@@ -26,7 +26,7 @@ public class TrackFilenameGeneratorTest2 {
private final TrackFilenameGenerator subject;
public TrackFilenameGeneratorTest2(String template) {
public TrackFilenameGenerator2Test(String template) {
this.subject = new TrackFilenameGenerator(template);
}
@@ -112,7 +112,7 @@ public class ExportImportTest {
private TrackImporter trackImporter;
@Before
public void fileSetup() throws IOException, TimeoutException {
public void fileSetup() throws IOException {
TrackRecordingServiceTestUtils.resetService(mServiceRule, context);
tmpFile = File.createTempFile("test", "test", context.getFilesDir());
@@ -124,7 +124,7 @@ public class ExportImportTest {
}
@After
public void tearDown() throws TimeoutException {
public void tearDown() {
tmpFile.deleteOnExit();
tmpFileUri = null;
@@ -51,7 +51,7 @@ import de.dennisguse.opentracks.data.models.TrackPoint;
import de.dennisguse.opentracks.services.handlers.TrackPointCreator;
@RunWith(AndroidJUnit4.class)
public class TrackRecordingServiceTestMarker {
public class TrackRecordingServiceMarkerTest {
@Rule
public final ServiceTestRule mServiceRule = ServiceTestRule.withTimeout(5, TimeUnit.SECONDS);
@@ -86,7 +86,7 @@ public class TrackRecordingServiceTestMarker {
}
@After
public void tearDown() throws TimeoutException {
public void tearDown() {
TrackRecordingServiceTestUtils.resetService(mServiceRule, context);
// Ensure that the database is empty after every test
@@ -49,7 +49,7 @@ import de.dennisguse.opentracks.stats.TrackStatistics;
* So, if something fails, subsequent tests may be affected.
*/
@RunWith(AndroidJUnit4.class)
public class TrackRecordingServiceTestRecording {
public class TrackRecordingServiceRecordingTest {
@Rule
public final ServiceTestRule mServiceRule = ServiceTestRule.withTimeout(5, TimeUnit.SECONDS);
@@ -96,7 +96,7 @@ public class TrackRecordingServiceTestRecording {
}
@After
public void tearDown() throws TimeoutException {
public void tearDown() {
TrackRecordingServiceTestUtils.resetService(mServiceRule, context);
// Ensure that the database is empty after every test
contentProviderUtils.deleteAllTracks(context);
@@ -54,7 +54,7 @@ import de.dennisguse.opentracks.services.handlers.GpsStatusValue;
* As states are checked against MutableLiveData that are updated via `postValue()` (is asynchronous to be inform other Threads), Thread.sleep() is required.
*/
@RunWith(AndroidJUnit4.class)
public class TrackRecordingServiceTestStateMachine {
public class TrackRecordingServiceStateMachineTest {
@Rule
public final ServiceTestRule mServiceRule = ServiceTestRule.withTimeout(5, TimeUnit.SECONDS);
@@ -93,7 +93,7 @@ public class TrackRecordingServiceTestStateMachine {
}
@After
public void tearDown() throws TimeoutException {
public void tearDown() {
TrackRecordingServiceTestUtils.resetService(mServiceRule, context);
// Ensure that the database is empty after every test
contentProviderUtils.deleteAllTracks(context);
@@ -108,9 +108,7 @@ class TrackRecordingServiceNotificationManager implements SharedPreferences.OnSh
Intent intent = IntentUtils.newIntent(context, TrackListActivity.class);
int pendingIntentFlags = 0;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
pendingIntentFlags = PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT;
}
pendingIntentFlags = PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT;
PendingIntent pendingIntent = TaskStackBuilder.create(context)
.addParentStack(TrackListActivity.class)
.addNextIntent(intent)
@@ -81,7 +81,7 @@ public class ListItemUtils {
// Match list_item_time_distance in list_item.xml
timeDistanceText = getTimeDistance(totalTime, totalDistance);
if (markerCount > 0) {
timeDistanceText += " \u2027";
timeDistanceText += " ‧";
}
}
setTextView(context, timeDistanceTextView, timeDistanceText, hasPhoto);
@@ -145,7 +145,7 @@ public class ListItemUtils {
StringBuilder builder = new StringBuilder();
if (totalTime != null && totalTime.length() != 0) {
if (builder.length() != 0) {
builder.append(" \u2027 ");
builder.append(" ‧ ");
}
builder.append(totalTime);
}
+94 -101
View File
@@ -13,126 +13,119 @@
android:id="@+id/track_list_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:title="@string/about_preference_title"
app:navigationIcon="@drawable/ic_baseline_info_24" />
app:navigationIcon="@drawable/ic_baseline_info_24"
app:title="@string/about_preference_title" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ScrollView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp">
android:layout_margin="8dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="8dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="30dp"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:scaleType="fitCenter"
android:src="@drawable/ic_logo_color_24dp" />
<TextView
android:id="@+id/about_text_description"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?attr/textAppearanceSubtitle1"
android:gravity="center"
android:padding="12dp" />
</LinearLayout>
<View style="@style/HorizontalLine" />
<ImageView
android:id="@+id/imageView"
android:layout_width="30dp"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:scaleType="fitCenter"
android:src="@drawable/ic_logo_color_24dp" />
<TextView
android:id="@+id/about_text_version_name"
android:id="@+id/about_text_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceSubtitle1"
android:gravity="center"
android:padding="6dp" />
<TextView
android:id="@+id/about_text_version_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceBody1"
android:gravity="center"
android:padding="6dp" />
<TextView
android:id="@+id/about_app_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceBody1"
android:autoLink="web"
android:gravity="center"
android:padding="6dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceBody1"
android:gravity="center"
android:linksClickable="true"
android:padding="6dp"
android:text="@string/about_history" />
<View style="@style/HorizontalLine" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceBody1"
android:layout_height="match_parent"
android:gravity="center"
android:padding="12dp"
android:text="@string/about_third_party_data" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceBody1"
android:gravity="center"
android:padding="12dp"
android:text="@string/third_party_data" />
<View style="@style/HorizontalLine" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceSubtitle1"
android:gravity="center"
android:padding="12dp"
android:text="@string/about_libraries" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceBody1"
android:gravity="center"
android:linksClickable="true"
android:text="@string/third_party_libraries" />
android:textAppearance="?attr/textAppearanceSubtitle1" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<View style="@style/HorizontalLine" />
<TextView
android:id="@+id/about_text_version_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="6dp"
android:textAppearance="?attr/textAppearanceSubtitle1" />
<TextView
android:id="@+id/about_text_version_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="6dp"
android:textAppearance="?attr/textAppearanceBody1" />
<TextView
android:id="@+id/about_app_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:gravity="center"
android:padding="6dp"
android:textAppearance="?attr/textAppearanceBody1" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:linksClickable="true"
android:padding="6dp"
android:text="@string/about_history"
android:textAppearance="?attr/textAppearanceBody1" />
<View style="@style/HorizontalLine" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="12dp"
android:text="@string/about_third_party_data"
android:textAppearance="?attr/textAppearanceBody1" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="12dp"
android:text="@string/third_party_data"
android:textAppearance="?attr/textAppearanceBody1" />
<View style="@style/HorizontalLine" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="12dp"
android:text="@string/about_libraries"
android:textAppearance="?attr/textAppearanceSubtitle1" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:linksClickable="true"
android:text="@string/third_party_libraries"
android:textAppearance="?attr/textAppearanceBody1" />
</LinearLayout>
</ScrollView>
<include
android:id="@+id/bottom_app_bar_layout"
@@ -18,7 +18,6 @@
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:paddingBottom="60dp">
+107 -114
View File
@@ -16,145 +16,138 @@
app:title="@string/menu_help" />
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
android:paddingBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ScrollView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp">
<LinearLayout
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp">
android:text="@string/help_feature_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:text="@string/help_feature_title" />
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/help_feature_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:text="@string/help_feature_content" />
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/help_track_map_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:layout_marginTop="20dp"
android:text="@string/help_track_map_title" />
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:linksClickable="true"
android:text="@string/help_track_map_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:linksClickable="true"
android:text="@string/help_track_map_content" />
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/help_recording_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:layout_marginTop="20dp"
android:text="@string/help_recording_title" />
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/help_recording_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:text="@string/help_recording_content" />
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/help_storage_pictures_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:layout_marginTop="20dp"
android:text="@string/help_storage_pictures_title" />
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/help_storage_pictures_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:text="@string/help_storage_pictures_content" />
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/help_track_export_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:layout_marginTop="20dp"
android:text="@string/help_track_export_title" />
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/help_track_export_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:text="@string/help_track_export_content" />
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/help_data_google_play_services_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:layout_marginTop="20dp"
android:text="@string/help_data_google_play_services_title" />
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/help_data_google_play_services_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:text="@string/help_data_google_play_services_content" />
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/help_data_storage_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:layout_marginTop="20dp"
android:text="@string/help_data_storage_title" />
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/help_data_storage_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:text="@string/help_data_storage_content" />
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/help_gps_troubleshooting_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:layout_marginTop="20dp"
android:text="@string/help_gps_troubleshooting_title" />
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:linksClickable="true"
android:text="@string/help_gps_troubleshooting_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:linksClickable="true"
android:text="@string/help_gps_troubleshooting_content" />
<TextView
style="?attr/textAppearanceHeadline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/help_support_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceHeadline6"
android:layout_marginTop="20dp"
android:text="@string/help_support_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/textAppearanceBody1"
android:linksClickable="true"
android:text="@string/help_support_content" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<TextView
style="?attr/textAppearanceBody1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:linksClickable="true"
android:text="@string/help_support_content" />
</LinearLayout>
</ScrollView>
<include
android:id="@+id/bottom_app_bar_layout"