Skip to content

Commit 8fdec83

Browse files
authored
Merge pull request #848 from Iterable/MOB-10410-TargetSDK31
[MOB-10410] - Making SDK Target SDK 31 compliant
2 parents c80a471 + 3aa3e19 commit 8fdec83

File tree

11 files changed

+65
-6
lines changed

11 files changed

+65
-6
lines changed

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ android {
1717
defaultConfig {
1818
applicationId "com.iterable.iterableapi.testapp"
1919
minSdkVersion 16
20-
targetSdkVersion 27
20+
targetSdkVersion 31
2121
versionCode 1
2222
versionName "1.0"
2323
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

app/src/main/AndroidManifest.xml

+11
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,23 @@
1010
android:theme="@style/AppTheme">
1111
<activity
1212
android:name="com.iterable.androidsdk.MainActivity"
13+
android:exported="true"
1314
android:label="@string/app_name"
1415
android:theme="@style/AppTheme.NoActionBar">
1516
<intent-filter>
1617
<action android:name="android.intent.action.MAIN" />
18+
1719
<category android:name="android.intent.category.LAUNCHER" />
1820
</intent-filter>
1921
</activity>
22+
<activity
23+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
24+
android:exported="true" />
25+
<activity
26+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
27+
android:exported="true" />
28+
<activity
29+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
30+
android:exported="true" />
2031
</application>
2132
</manifest>

iterableapi-ui/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88

99
defaultConfig {
1010
minSdkVersion 16
11-
targetSdkVersion 28
11+
targetSdkVersion 31
1212
vectorDrawables.useSupportLibrary = true
1313
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1414
}

iterableapi-ui/src/main/res/layout-v21/banner_view.xml

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
android:layout_gravity="center_vertical"
88
android:layout_marginTop="8dp"
99
android:layout_marginStart="16dp"
10+
android:layout_marginLeft="16dp"
1011
android:layout_marginBottom="12dp"
1112
app:cardCornerRadius="8dp"
1213
app:cardElevation="0dp"
@@ -18,6 +19,7 @@
1819
android:layout_width="240dp"
1920
android:layout_height="wrap_content"
2021
android:layout_marginStart="16dp"
22+
android:layout_marginLeft="16dp"
2123
android:layout_marginTop="16dp"
2224
android:ellipsize="end"
2325
android:maxLines="2"
@@ -34,6 +36,7 @@
3436
android:layout_width="240dp"
3537
android:layout_height="wrap_content"
3638
android:layout_marginStart="16dp"
39+
android:layout_marginLeft="16dp"
3740
android:layout_marginTop="8dp"
3841
android:ellipsize="end"
3942
android:maxLines="2"
@@ -74,6 +77,8 @@
7477
android:ellipsize="end"
7578
android:layout_marginStart="16dp"
7679
android:layout_marginEnd="8dp"
80+
android:layout_marginLeft="16dp"
81+
android:layout_marginRight="8dp"
7782
android:paddingTop="0dp"
7883
android:paddingBottom="0dp"
7984
android:paddingStart="12dp"

iterableapi-ui/src/main/res/layout-v21/card_view.xml

+6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
android:layout_height="wrap_content"
4141
android:layout_marginStart="16dp"
4242
android:layout_marginEnd="16dp"
43+
android:layout_marginLeft="16dp"
44+
android:layout_marginRight="16dp"
4345
android:layout_marginTop="16dp"
4446
android:ellipsize="end"
4547
android:maxLines="2"
@@ -56,6 +58,8 @@
5658
android:layout_height="wrap_content"
5759
android:layout_marginStart="16dp"
5860
android:layout_marginEnd="16dp"
61+
android:layout_marginLeft="16dp"
62+
android:layout_marginRight="16dp"
5963
android:layout_marginTop="8dp"
6064
android:ellipsize="end"
6165
android:maxLines="2"
@@ -85,6 +89,8 @@
8589
android:ellipsize="end"
8690
android:layout_marginStart="16dp"
8791
android:layout_marginEnd="8dp"
92+
android:layout_marginLeft="16dp"
93+
android:layout_marginRight="8dp"
8894
android:paddingTop="0dp"
8995
android:paddingBottom="0dp"
9096
android:paddingStart="12dp"

iterableapi-ui/src/main/res/layout/banner_view.xml

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
android:layout_gravity="center_vertical"
88
android:layout_marginTop="8dp"
99
android:layout_marginStart="16dp"
10+
android:layout_marginLeft="16dp"
1011
android:layout_marginBottom="12dp"
1112
app:cardCornerRadius="8dp"
1213
app:cardElevation="0dp"
@@ -18,6 +19,7 @@
1819
android:layout_width="240dp"
1920
android:layout_height="wrap_content"
2021
android:layout_marginStart="16dp"
22+
android:layout_marginLeft="16dp"
2123
android:layout_marginTop="16dp"
2224
android:ellipsize="end"
2325
android:maxLines="2"
@@ -34,6 +36,7 @@
3436
android:layout_width="240dp"
3537
android:layout_height="wrap_content"
3638
android:layout_marginStart="16dp"
39+
android:layout_marginLeft="16dp"
3740
android:layout_marginTop="8dp"
3841
android:ellipsize="end"
3942
android:maxLines="2"
@@ -51,6 +54,7 @@
5154
android:layout_height="80dp"
5255
android:layout_marginTop="16dp"
5356
android:layout_marginEnd="16dp"
57+
android:layout_marginRight="16dp"
5458
android:contentDescription=""
5559
app:layout_constraintEnd_toEndOf="parent"
5660
app:layout_constraintTop_toTopOf="parent" />
@@ -72,6 +76,7 @@
7276
android:background="@drawable/primary_banner_button_background"
7377
android:ellipsize="end"
7478
android:layout_marginStart="16dp"
79+
android:layout_marginLeft="16dp"
7580
android:paddingTop="0dp"
7681
android:paddingBottom="0dp"
7782
android:paddingStart="12dp"
@@ -88,6 +93,7 @@
8893
android:layout_width="wrap_content"
8994
android:layout_height="36dp"
9095
android:layout_marginEnd="16dp"
96+
android:layout_marginRight="16dp"
9197
android:background="@drawable/secondary_banner_button_background"
9298
android:ellipsize="end"
9399
android:paddingTop="0dp"

iterableapi-ui/src/main/res/layout/card_view.xml

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<androidx.constraintlayout.widget.ConstraintLayout
3-
xmlns:android="http://schemas.android.com/apk/res/android"
2+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
43
xmlns:app="http://schemas.android.com/apk/res-auto"
54
android:layout_width="match_parent"
65
android:layout_height="match_parent"
6+
xmlns:tools="http://schemas.android.com/tools"
77
android:layout_gravity="center_vertical"
8+
android:layout_marginStart="16dp"
89
android:layout_marginTop="8dp"
910
android:layout_marginLeft="16dp"
1011
android:layout_marginBottom="12dp"
@@ -40,6 +41,8 @@
4041
android:layout_height="wrap_content"
4142
android:layout_marginStart="16dp"
4243
android:layout_marginEnd="16dp"
44+
android:layout_marginLeft="16dp"
45+
android:layout_marginRight="16dp"
4346
android:layout_marginTop="16dp"
4447
android:ellipsize="end"
4548
android:maxLines="2"
@@ -56,6 +59,8 @@
5659
android:layout_height="wrap_content"
5760
android:layout_marginStart="16dp"
5861
android:layout_marginEnd="16dp"
62+
android:layout_marginLeft="16dp"
63+
android:layout_marginRight="16dp"
5964
android:layout_marginTop="8dp"
6065
android:ellipsize="end"
6166
android:maxLines="2"
@@ -82,6 +87,8 @@
8287
android:layout_height="36dp"
8388
android:layout_marginStart="16dp"
8489
android:layout_marginEnd="8dp"
90+
android:layout_marginLeft="16dp"
91+
android:layout_marginRight="8dp"
8592
android:background="@drawable/primary_card_button_background"
8693
android:ellipsize="end"
8794
android:paddingStart="8dp"
@@ -92,13 +99,16 @@
9299
android:stateListAnimator="@null"
93100
android:textAllCaps="false"
94101
android:textColor="@color/white"
95-
app:cornerRadius="32dp" />
102+
app:cornerRadius="32dp"
103+
tools:ignore="Suspicious0dp"/>
96104

97105
<Button
98106
android:id="@+id/embedded_message_second_button"
99107
android:layout_width="0dp"
100108
android:layout_height="36dp"
101109
android:layout_marginEnd="16dp"
110+
android:layout_marginLeft="16dp"
111+
android:layout_marginRight="16dp"
102112
android:paddingTop="0dp"
103113
android:paddingBottom="0dp"
104114
android:layout_weight="1"

iterableapi-ui/src/main/res/layout/notification_view.xml

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
android:layout_marginTop="8dp"
99
android:layout_marginBottom="12dp"
1010
android:layout_marginStart="16dp"
11+
android:layout_marginLeft="16dp"
1112
app:cardCornerRadius="8dp"
1213
app:cardElevation="0dp"
1314
android:background="@drawable/notification_view_border"
@@ -18,6 +19,8 @@
1819
android:layout_width="match_parent"
1920
android:layout_height="wrap_content"
2021
android:layout_marginStart="16dp"
22+
android:layout_marginLeft="16dp"
23+
android:layout_marginRight="16dp"
2124
android:layout_marginTop="16dp"
2225
android:layout_marginEnd="16dp"
2326
android:ellipsize="end"
@@ -36,6 +39,8 @@
3639
android:layout_marginStart="16dp"
3740
android:layout_marginTop="8dp"
3841
android:layout_marginEnd="16dp"
42+
android:layout_marginLeft="16dp"
43+
android:layout_marginRight="16dp"
3944
android:ellipsize="end"
4045
android:maxLines="2"
4146
android:text=""
@@ -62,6 +67,7 @@
6267
android:layout_width="wrap_content"
6368
android:layout_height="36dp"
6469
android:layout_marginStart="16dp"
70+
android:layout_marginLeft="16dp"
6571
android:textColor="@color/notification_text_color"
6672
android:background="@drawable/primary_notification_button_background"
6773
android:ellipsize="end"
@@ -80,6 +86,7 @@
8086
android:layout_width="wrap_content"
8187
android:layout_height="36dp"
8288
android:layout_marginEnd="16dp"
89+
android:layout_marginRight="16dp"
8390
android:textColor="@color/notification_text_color"
8491
android:background="@drawable/secondary_notification_button_background"
8592
android:ellipsize="end"

iterableapi/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ android {
1717

1818
defaultConfig {
1919
minSdkVersion 16
20-
targetSdkVersion 27
20+
targetSdkVersion 31
2121

2222
buildConfigField "String", "ITERABLE_SDK_VERSION", "\"3.5.4\""
2323

iterableapi/src/main/AndroidManifest.xml

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
xmlns:tools="http://schemas.android.com/tools">
33

44
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
<uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS"
6+
tools:ignore="ProtectedPermissions" />
57

68
<application>
79
<!--FCM-->
@@ -29,6 +31,16 @@
2931
android:excludeFromRecents="true"
3032
android:theme="@style/TrampolineActivity.Transparent"/>
3133

34+
<activity
35+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
36+
android:exported="true" />
37+
<activity
38+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
39+
android:exported="true" />
40+
<activity
41+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
42+
android:exported="true" />
43+
3244
<uses-library android:name="androidx.security" android:required="false" />
3345
</application>
3446

iterableapi/src/main/java/com/iterable/iterableapi/IterableTaskStorage.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.iterable.iterableapi;
22

3+
import android.annotation.SuppressLint;
34
import android.content.ContentValues;
45
import android.content.Context;
56
import android.database.Cursor;
@@ -184,6 +185,7 @@ IterableTask getTask(String id) {
184185
return task;
185186
}
186187

188+
@SuppressLint("Range")
187189
private IterableTask createTaskFromCursor(Cursor cursor) {
188190
String id, name;
189191
IterableTaskType type = null;

0 commit comments

Comments
 (0)