1
0
Fork 0
mirror of https://github.com/MatomoCamp/matomocamp-companion-android.git synced 2024-09-19 16:13:46 +02:00

Update target SDK to 31 (Android 12) (#72)

- update target SDK to 31 and libraries to their latest version
- enable back PhotoViewDrawerLayout
- add PendingIntent flags and manifest entries required by target SDK 31
- update Travis config to API 31 build tools
- add missing experimental Kotlin API annotation.
This commit is contained in:
Christophe Beyls 2021-11-06 17:04:36 +01:00 committed by GitHub
parent a5b9aca2e7
commit 58550b8f92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 12 deletions

View file

@ -11,7 +11,7 @@ install:
# Download latest Android command line tools if not already in cache and replace the previous ones, if any
- if test ! -e $ANDROID_SDK_ROOT/$COMMAND_LINE_TOOLS_ARCHIVE ; then rm -rf $ANDROID_SDK_ROOT && mkdir -p $ANDROID_SDK_ROOT && curl https://dl.google.com/android/repository/$COMMAND_LINE_TOOLS_ARCHIVE -o $ANDROID_SDK_ROOT/$COMMAND_LINE_TOOLS_ARCHIVE && unzip -qq -n $ANDROID_SDK_ROOT/$COMMAND_LINE_TOOLS_ARCHIVE -d $ANDROID_SDK_ROOT ; fi
# Install or update Android SDK components (no-op if already up-to-date and cached)
- echo y | $ANDROID_SDK_ROOT/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT 'platforms;android-30' 'build-tools;30.0.3' > /dev/null
- echo y | $ANDROID_SDK_ROOT/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT 'platforms;android-31' 'build-tools;31.0.0' > /dev/null
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

View file

@ -7,13 +7,13 @@ plugins {
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
compileSdkVersion 31
buildToolsVersion "31.0.0"
defaultConfig {
applicationId "be.digitalia.fosdem"
minSdkVersion 17
targetSdkVersion 30
targetSdkVersion 31
versionCode 1700205
versionName "2.0.5"
// Supported languages
@ -73,14 +73,14 @@ android {
}
dependencies {
def lifecycle_version = "2.3.1"
def lifecycle_version = "2.4.0"
def room_version = "2.3.0"
def okhttp_version = "3.12.13"
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-compiler:$hilt_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.fragment:fragment-ktx:1.3.6'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
@ -89,7 +89,7 @@ dependencies {
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.browser:browser:1.4.0'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"

View file

@ -31,6 +31,7 @@
android:theme="@style/AppTheme">
<activity
android:name=".activities.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/AppTheme.TranslucentStatusBar">
<intent-filter>
@ -48,12 +49,15 @@
</activity>
<activity
android:name=".activities.TrackScheduleActivity"
android:exported="false"
android:parentActivityName=".activities.MainActivity" />
<activity
android:name=".activities.TrackScheduleEventActivity"
android:exported="false"
android:label="@string/event_details" />
<activity
android:name=".activities.EventDetailsActivity"
android:exported="true"
android:label="@string/event_details"
android:parentActivityName=".activities.TrackScheduleActivity">
<intent-filter>
@ -66,9 +70,11 @@
</activity>
<activity
android:name=".activities.PersonInfoActivity"
android:exported="false"
android:theme="@style/AppTheme.TranslucentStatusBar" />
<activity
android:name=".activities.SearchResultActivity"
android:exported="true"
android:label="@string/search_events"
android:launchMode="singleTop">
<intent-filter>
@ -81,6 +87,7 @@
</activity>
<activity
android:name=".activities.ExternalBookmarksActivity"
android:exported="true"
android:label="@string/external_bookmarks_title"
android:parentActivityName=".activities.MainActivity">
<intent-filter>
@ -95,10 +102,12 @@
<activity
android:name=".activities.RoomImageDialogActivity"
android:excludeFromRecents="true"
android:exported="false"
android:taskAffinity=""
android:theme="@style/AlertDialogTheme" />
<activity
android:name=".activities.SettingsActivity"
android:exported="true"
android:label="@string/settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View file

@ -40,6 +40,7 @@ class SearchResultActivity : AppCompatActivity(R.layout.search_result) {
searchEditText = findViewById(R.id.search_edittext)
val searchClearButton: View = findViewById(R.id.search_clear)
@OptIn(kotlinx.coroutines.FlowPreview::class)
searchEditText.textChangeEvents
.onEach {
// immediately update the button state

View file

@ -65,7 +65,7 @@ class AlarmIntentService : JobIntentService() {
val intent = Intent(this, AlarmReceiver::class.java)
.setAction(AlarmReceiver.ACTION_NOTIFY_EVENT)
.setData(eventId.toString().toUri())
return PendingIntent.getBroadcast(this, 0, intent, 0)
return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)
}
override fun onHandleWork(intent: Intent) {
@ -219,7 +219,10 @@ class AlarmIntentService : JobIntentService() {
.setData(roomName.toUri())
.putExtra(RoomImageDialogActivity.EXTRA_ROOM_NAME, roomName)
.putExtra(RoomImageDialogActivity.EXTRA_ROOM_IMAGE_RESOURCE_ID, roomImageResId)
val mapPendingIntent = PendingIntent.getActivity(this, 0, mapIntent, PendingIntent.FLAG_UPDATE_CURRENT)
val mapPendingIntent = PendingIntent.getActivity(
this, 0, mapIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val mapTitle = getString(R.string.room_map)
notificationBuilder.addAction(NotificationCompat.Action(R.drawable.ic_place_white_24dp, mapTitle, mapPendingIntent))
// Use bigger action icon for wearable notification

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
<be.digitalia.fosdem.widgets.PhotoViewDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
@ -73,4 +73,4 @@
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>
</be.digitalia.fosdem.widgets.PhotoViewDrawerLayout>

View file

@ -9,7 +9,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
}