Basic Android 12 compatibility + file names now include milliseconds (see #110)

This commit is contained in:
y20k 2021-10-27 21:01:24 +02:00
parent 43067329e3
commit 0ef9ea8dbc
No known key found for this signature in database
GPG key ID: 824D4259F41FAFF6
6 changed files with 16 additions and 14 deletions

View file

@ -4,14 +4,14 @@ apply plugin: 'kotlin-parcelize'
apply plugin: 'androidx.navigation.safeargs.kotlin' apply plugin: 'androidx.navigation.safeargs.kotlin'
android { android {
compileSdkVersion 30 compileSdkVersion 31
defaultConfig { defaultConfig {
applicationId 'org.y20k.trackbook' applicationId 'org.y20k.trackbook'
minSdkVersion 25 minSdkVersion 25
targetSdkVersion 30 targetSdkVersion 31
versionCode 48 versionCode 49
versionName '2.1.0' versionName '2.1.1'
resConfigs "en", "da", "de", "fr", "hr", "id", "it", "ja", "nb-rNO", "nl", "pl", "pt-rBR", "ru", "sv", "tr", "zh-rCN" resConfigs "en", "da", "de", "fr", "hr", "id", "it", "ja", "nb-rNO", "nl", "pl", "pt-rBR", "ru", "sv", "tr", "zh-rCN"
} }
@ -51,7 +51,7 @@ android {
dependencies { dependencies {
// Kotlin // Kotlin
def coroutinesVersion = "1.5.0" def coroutinesVersion = "1.5.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"

View file

@ -27,7 +27,9 @@
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<!-- MAIN ACTIVITY --> <!-- MAIN ACTIVITY -->
<activity android:name=".MainActivity"> <activity
android:name=".MainActivity"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
@ -51,8 +53,9 @@
android:name=".TrackingToggleTileService" android:name=".TrackingToggleTileService"
android:label="@string/quick_settings_tile_title_default" android:label="@string/quick_settings_tile_title_default"
android:icon="@drawable/ic_notification_icon_small_24dp" android:icon="@drawable/ic_notification_icon_small_24dp"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"> android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
<intent-filter> android:exported="true">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" /> <action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter> </intent-filter>
</service> </service>

View file

@ -210,7 +210,6 @@ class MapFragment : Fragment(), YesNoDialog.YesNoDialogListener, MapOverlayHelpe
private fun startTracking() { private fun startTracking() {
// request activity recognition permission on Android Q+ if denied // request activity recognition permission on Android Q+ if denied
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && ContextCompat.checkSelfPermission(activity as Context, Manifest.permission.ACTIVITY_RECOGNITION) == PackageManager.PERMISSION_DENIED) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && ContextCompat.checkSelfPermission(activity as Context, Manifest.permission.ACTIVITY_RECOGNITION) == PackageManager.PERMISSION_DENIED) {
LogHelper.e(TAG, "permissions resume DING") // todo remove
startTrackingPermissionLauncher.launch(Manifest.permission.ACTIVITY_RECOGNITION) startTrackingPermissionLauncher.launch(Manifest.permission.ACTIVITY_RECOGNITION)
} else { } else {
// start service via intent so that it keeps running after unbind // start service via intent so that it keeps running after unbind

View file

@ -58,7 +58,7 @@ object DateTimeHelper {
/* Create sortable string for date - used for filenames */ /* Create sortable string for date - used for filenames */
fun convertToSortableDateString(date: Date): String { fun convertToSortableDateString(date: Date): String {
val dateFormat: SimpleDateFormat = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US) val dateFormat: SimpleDateFormat = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS", Locale.US)
return dateFormat.format(date) return dateFormat.format(date)
} }

View file

@ -107,13 +107,13 @@ class NotificationHelper(private val trackerService: TrackerService) {
/* Notification pending intents */ /* Notification pending intents */
private val stopActionPendingIntent = PendingIntent.getService( private val stopActionPendingIntent = PendingIntent.getService(
trackerService,14, trackerService,14,
Intent(trackerService, TrackerService::class.java).setAction(Keys.ACTION_STOP),0) Intent(trackerService, TrackerService::class.java).setAction(Keys.ACTION_STOP),PendingIntent.FLAG_IMMUTABLE)
private val resumeActionPendingIntent = PendingIntent.getService( private val resumeActionPendingIntent = PendingIntent.getService(
trackerService, 16, trackerService, 16,
Intent(trackerService, TrackerService::class.java).setAction(Keys.ACTION_RESUME),0) Intent(trackerService, TrackerService::class.java).setAction(Keys.ACTION_RESUME),PendingIntent.FLAG_IMMUTABLE)
private val showActionPendingIntent: PendingIntent? = TaskStackBuilder.create(trackerService).run { private val showActionPendingIntent: PendingIntent? = TaskStackBuilder.create(trackerService).run {
addNextIntentWithParentStack(Intent(trackerService, MainActivity::class.java)) addNextIntentWithParentStack(Intent(trackerService, MainActivity::class.java))
getPendingIntent(10, PendingIntent.FLAG_UPDATE_CURRENT) getPendingIntent(10, PendingIntent.FLAG_IMMUTABLE)
} }

View file

@ -10,7 +10,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { 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 "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"