Skip to content

Commit

Permalink
AndroidStudio: code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisguse committed Aug 8, 2023
1 parent 3910837 commit 7530e1d
Show file tree
Hide file tree
Showing 12 changed files with 226 additions and 833 deletions.
581 changes: 0 additions & 581 deletions .editorconfig

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//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() {
Expand All @@ -26,7 +26,7 @@ public static Collection<String> data() {

private final TrackFilenameGenerator subject;

public TrackFilenameGeneratorTest2(String template) {
public TrackFilenameGenerator2Test(String template) {
this.subject = new TrackFilenameGenerator(template);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static void preSetUp() {
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());
Expand All @@ -124,7 +124,7 @@ public void fileSetup() throws IOException, TimeoutException {
}

@After
public void tearDown() throws TimeoutException {
public void tearDown() {
tmpFile.deleteOnExit();
tmpFileUri = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
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);
Expand Down Expand Up @@ -86,7 +86,7 @@ public void setUp() throws TimeoutException {
}

@After
public void tearDown() throws TimeoutException {
public void tearDown() {
TrackRecordingServiceTestUtils.resetService(mServiceRule, context);

// Ensure that the database is empty after every test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* 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);
Expand Down Expand Up @@ -96,7 +96,7 @@ public void setUp() throws TimeoutException {
}

@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* 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);
Expand Down Expand Up @@ -93,7 +93,7 @@ public void setUp() throws TimeoutException {
}

@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ Notification setGPSonlyStarted(Context context) {
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static void setListItem(Context context, View view, boolean isRecording,
// Match list_item_time_distance in list_item.xml
timeDistanceText = getTimeDistance(totalTime, totalDistance);
if (markerCount > 0) {
timeDistanceText += " \u2027";
timeDistanceText += " ";
}
}
setTextView(context, timeDistanceTextView, timeDistanceText, hasPhoto);
Expand Down Expand Up @@ -145,7 +145,7 @@ private static String getTimeDistance(String totalTime, String totalDistance) {
StringBuilder builder = new StringBuilder();
if (totalTime != null && totalTime.length() != 0) {
if (builder.length() != 0) {
builder.append(" \u2027 ");
builder.append(" ");
}
builder.append(totalTime);
}
Expand Down
179 changes: 86 additions & 93 deletions src/main/res/layout/about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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:layout_height="match_parent"
android:gravity="center"
android:padding="6dp" />
android:padding="12dp"
android:textAppearance="?attr/textAppearanceSubtitle1" />
</LinearLayout>

<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" />
<View style="@style/HorizontalLine" />

<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: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: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" />
<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" />

<View style="@style/HorizontalLine" />
<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:textAppearance="?attr/textAppearanceBody1"
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:gravity="center"
android:linksClickable="true"
android:padding="6dp"
android:text="@string/about_history"
android:textAppearance="?attr/textAppearanceBody1" />

<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" />

<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: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:gravity="center"
android:padding="12dp"
android:text="@string/third_party_data"
android:textAppearance="?attr/textAppearanceBody1" />

<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" />
<View style="@style/HorizontalLine" />

</LinearLayout>
</ScrollView>
<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>
</LinearLayout>
</ScrollView>

<include
android:id="@+id/bottom_app_bar_layout"
Expand Down
1 change: 0 additions & 1 deletion src/main/res/layout/activity_settings_custom_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

Expand Down
Loading

0 comments on commit 7530e1d

Please sign in to comment.