Skip to content

Commit 3ed525b

Browse files
committed
Bump minSdk to 26
and remove now unnecessary version handling
1 parent c3938a6 commit 3ed525b

File tree

8 files changed

+26
-61
lines changed

8 files changed

+26
-61
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ android {
2525

2626
defaultConfig {
2727
applicationId "de.stephanlindauer.criticalmaps"
28-
minSdkVersion 16
28+
minSdkVersion 26
2929
targetSdkVersion 35
3030
versionCode 49
3131
versionName "2.9.1"

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
88
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
99
<uses-permission android:name="android.permission.INTERNET" />
10-
<uses-permission
11-
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
12-
android:maxSdkVersion="18" />
1310
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
1411
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
1512
<uses-permission

app/src/main/java/de/stephanlindauer/criticalmaps/fragments/SettingsFragment.java

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import android.content.SharedPreferences;
77
import android.database.Cursor;
88
import android.net.Uri;
9-
import android.os.Build;
109
import android.os.Bundle;
1110
import android.provider.OpenableColumns;
1211
import android.text.format.Formatter;
@@ -16,7 +15,6 @@
1615

1716
import androidx.annotation.NonNull;
1817
import androidx.annotation.Nullable;
19-
import androidx.annotation.RequiresApi;
2018
import androidx.appcompat.app.AlertDialog;
2119
import androidx.fragment.app.Fragment;
2220

@@ -98,14 +96,9 @@ public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
9896
binding.settingsMapRotationCheckbox.setOnCheckedChangeListener(
9997
(buttonView, isChecked) -> handleDisableMapRotationChecked(isChecked));
10098

101-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
102-
binding.settingsShowGpxCheckbox.setOnCheckedChangeListener(
103-
(buttonView, isChecked) -> handleShowTrack(isChecked));
104-
binding.settingsChooseGpxContainer.setOnClickListener(v -> handleChooseTrackClicked());
105-
} else {
106-
binding.settingsShowGpxContainer.setVisibility(View.GONE);
107-
binding.settingsChooseGpxContainer.setVisibility(View.GONE);
108-
}
99+
binding.settingsShowGpxCheckbox.setOnCheckedChangeListener(
100+
(buttonView, isChecked) -> handleShowTrack(isChecked));
101+
binding.settingsChooseGpxContainer.setOnClickListener(v -> handleChooseTrackClicked());
109102
}
110103

111104
@Override
@@ -167,14 +160,14 @@ private void updateGpxFileName() {
167160
String gpxFile = new StringPreference(
168161
sharedPreferences, SharedPrefsKeys.GPX_FILE).get();
169162
String filename = gpxFile;
170-
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
171-
Cursor fileCursor = getContext().getContentResolver().query(Uri.parse(gpxFile), null, null, null);
172-
if (fileCursor != null) {
173-
fileCursor.moveToFirst();
174-
filename = fileCursor.getString(fileCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
175-
fileCursor.close();
176-
}
163+
164+
Cursor fileCursor = getContext().getContentResolver().query(Uri.parse(gpxFile), null, null, null);
165+
if (fileCursor != null) {
166+
fileCursor.moveToFirst();
167+
filename = fileCursor.getString(fileCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
168+
fileCursor.close();
177169
}
170+
178171
binding.settingsChooseGpxSummaryText.setText(filename);
179172
}
180173

@@ -261,7 +254,6 @@ void handleShowTrack(boolean isChecked) {
261254
sharedPreferences, SharedPrefsKeys.SHOW_GPX).set(isChecked);
262255
}
263256

264-
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
265257
void handleChooseTrackClicked() {
266258
new ChooseGpxFileHandler(this).openChooser();
267259
}

app/src/main/java/de/stephanlindauer/criticalmaps/utils/TrackingInfoNotificationBuilder.java

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ public class TrackingInfoNotificationBuilder {
1919
private static final String NOTIFICATION_CHANNEL_ID = "cm_notification_channel_id";
2020

2121
public static Notification getNotification(Application application) {
22-
int pendingIntentFlags = PendingIntent.FLAG_UPDATE_CURRENT;
23-
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
24-
pendingIntentFlags += PendingIntent.FLAG_IMMUTABLE;
25-
}
22+
int pendingIntentFlags = PendingIntent.FLAG_UPDATE_CURRENT + PendingIntent.FLAG_IMMUTABLE;
2623

2724
Intent openIntent = new Intent(application, Main.class);
2825
openIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -36,25 +33,23 @@ public static Notification getNotification(Application application) {
3633
PendingIntent closePendingIntent = PendingIntent.getActivity(application, INTENT_CLOSE_ID,
3734
closeIntent, pendingIntentFlags);
3835

39-
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
40-
NotificationManager mNotificationManager =
41-
(NotificationManager) application.getSystemService(Application.NOTIFICATION_SERVICE);
36+
NotificationManager mNotificationManager =
37+
(NotificationManager) application.getSystemService(Application.NOTIFICATION_SERVICE);
4238

43-
NotificationChannel notificationChannel =
44-
new NotificationChannel(NOTIFICATION_CHANNEL_ID,
45-
application.getString(R.string.notification_channel_name),
46-
NotificationManager.IMPORTANCE_LOW); // no sound, status bar visibility
39+
NotificationChannel notificationChannel =
40+
new NotificationChannel(NOTIFICATION_CHANNEL_ID,
41+
application.getString(R.string.notification_channel_name),
42+
NotificationManager.IMPORTANCE_LOW); // no sound, status bar visibility
4743

48-
notificationChannel.setDescription(
49-
application.getString(R.string.notification_channel_description_max300chars));
50-
notificationChannel.setBypassDnd(true);
51-
notificationChannel.setShowBadge(false);
52-
notificationChannel.enableLights(false);
53-
notificationChannel.enableVibration(false);
54-
notificationChannel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC);
44+
notificationChannel.setDescription(
45+
application.getString(R.string.notification_channel_description_max300chars));
46+
notificationChannel.setBypassDnd(true);
47+
notificationChannel.setShowBadge(false);
48+
notificationChannel.enableLights(false);
49+
notificationChannel.enableVibration(false);
50+
notificationChannel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC);
5551

56-
mNotificationManager.createNotificationChannel(notificationChannel);
57-
}
52+
mNotificationManager.createNotificationChannel(notificationChannel);
5853

5954
NotificationCompat.Builder builder =
6055
new NotificationCompat.Builder(application, NOTIFICATION_CHANNEL_ID)

app/src/main/res/layout/activity_main.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@
6161
android:layout_width="match_parent"
6262
android:layout_height="match_parent"
6363
android:layout_marginStart="60dp"
64-
android:layout_marginLeft="60dp"
6564
android:layout_marginTop="-8dp"
6665
android:layout_marginEnd="22dp"
67-
android:layout_marginRight="22dp"
6866
android:layout_marginBottom="8dp"
6967
android:text="@string/nav_observer_mode_text"
7068
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption" />

app/src/main/res/layout/fragment_chat.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
android:background="@drawable/border_bottom"
2525
android:gravity="start"
2626
android:paddingStart="16dp"
27-
android:paddingLeft="16dp"
2827
android:paddingTop="8dp"
2928
android:paddingEnd="0dp"
30-
android:paddingRight="0dp"
3129
android:paddingBottom="8dp"
3230
android:text="@string/chat_heading"
3331
android:textAlignment="viewStart"
@@ -39,9 +37,7 @@
3937
android:layout_height="0dp"
4038
android:layout_weight="1"
4139
android:paddingStart="16dp"
42-
android:paddingLeft="16dp"
4340
android:paddingEnd="0dp"
44-
android:paddingRight="0dp"
4541
tools:listitem="@layout/view_chatmessage" />
4642

4743
<LinearLayout
@@ -79,7 +75,6 @@
7975
android:layout_height="wrap_content"
8076
android:layout_gravity="center_vertical"
8177
android:layout_marginStart="8dp"
82-
android:layout_marginLeft="8dp"
8378
android:layout_marginTop="2dp"
8479
android:contentDescription="@string/chat_send"
8580
app:backgroundTint="@color/chat_fab_background_states"

app/src/main/res/layout/fragment_map.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
android:id="@+id/map_osm_notice_text"
6565
style="@style/map_osm_notice"
6666
android:layout_alignParentStart="true"
67-
android:layout_alignParentLeft="true"
6867
android:layout_alignParentBottom="true"
6968
android:text="@string/osm_credits" />
7069

app/src/main/res/layout/fragment_settings.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
android:layout_height="10dp"
114114
android:layout_gravity="center"
115115
android:layout_marginEnd="4dp"
116-
android:layout_marginRight="4dp"
117116
android:background="@color/settings_used_space" />
118117

119118
<TextView
@@ -122,15 +121,13 @@
122121
android:layout_height="wrap_content"
123122
android:layout_gravity="center"
124123
android:layout_marginEnd="12dp"
125-
android:layout_marginRight="12dp"
126124
tools:text="Used: 16050 MB" />
127125

128126
<ImageView
129127
android:layout_width="10dp"
130128
android:layout_height="10dp"
131129
android:layout_gravity="center"
132130
android:layout_marginEnd="4dp"
133-
android:layout_marginRight="4dp"
134131
android:background="@color/settings_cache_space" />
135132

136133
<TextView
@@ -139,15 +136,13 @@
139136
android:layout_height="wrap_content"
140137
android:layout_gravity="center"
141138
android:layout_marginEnd="12dp"
142-
android:layout_marginRight="12dp"
143139
tools:text="Cache: 48 MB" />
144140

145141
<ImageView
146142
android:layout_width="10dp"
147143
android:layout_height="10dp"
148144
android:layout_gravity="center"
149145
android:layout_marginEnd="4dp"
150-
android:layout_marginRight="4dp"
151146
android:background="@color/settings_free_space" />
152147

153148
<TextView
@@ -195,7 +190,6 @@
195190
android:layout_height="wrap_content"
196191
android:layout_below="@id/title3"
197192
android:layout_alignStart="@id/title3"
198-
android:layout_alignLeft="@id/title3"
199193
android:maxLines="4"
200194
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
201195
android:textColor="?android:attr/textColorSecondary"
@@ -245,7 +239,6 @@
245239
android:layout_height="wrap_content"
246240
android:layout_below="@id/settings_show_on_lockscreen_title"
247241
android:layout_alignStart="@id/settings_show_on_lockscreen_title"
248-
android:layout_alignLeft="@id/settings_show_on_lockscreen_title"
249242
android:maxLines="4"
250243
android:text="@string/settings_show_on_lockscreen_summary"
251244
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
@@ -302,7 +295,6 @@
302295
android:layout_height="wrap_content"
303296
android:layout_below="@id/settings_keep_screen_on_title"
304297
android:layout_alignStart="@id/settings_keep_screen_on_title"
305-
android:layout_alignLeft="@id/settings_keep_screen_on_title"
306298
android:maxLines="4"
307299
android:text="@string/settings_keep_screen_on_summary"
308300
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
@@ -366,7 +358,6 @@
366358
android:layout_height="wrap_content"
367359
android:layout_below="@id/settings_map_rotation_title"
368360
android:layout_alignStart="@id/settings_map_rotation_title"
369-
android:layout_alignLeft="@id/settings_map_rotation_title"
370361
android:maxLines="4"
371362
android:text="@string/settings_map_rotation_summary"
372363
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
@@ -419,7 +410,6 @@
419410
android:layout_height="wrap_content"
420411
android:layout_below="@id/settings_show_gpx_title"
421412
android:layout_alignStart="@id/settings_show_gpx_title"
422-
android:layout_alignLeft="@id/settings_show_gpx_title"
423413
android:maxLines="4"
424414
android:text="@string/settings_show_gpx_summary"
425415
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
@@ -472,7 +462,6 @@
472462
android:layout_height="wrap_content"
473463
android:layout_below="@id/title_choose_gpx"
474464
android:layout_alignStart="@id/title_choose_gpx"
475-
android:layout_alignLeft="@id/title_choose_gpx"
476465
android:maxLines="4"
477466
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
478467
android:textColor="?android:attr/textColorSecondary"

0 commit comments

Comments
 (0)