fix: Upgrade to SDK 33

This commit is contained in:
J-Jamet 2023-06-17 19:01:35 +02:00
parent 7cd456ecbc
commit f02b7c16d2
10 changed files with 96 additions and 99 deletions

View file

@ -5,13 +5,13 @@ apply plugin: 'kotlin-kapt'
android { android {
namespace 'com.kunzisoft.keepass' namespace 'com.kunzisoft.keepass'
compileSdkVersion 32 compileSdkVersion 33
buildToolsVersion "32.0.0" buildToolsVersion "33.0.2"
defaultConfig { defaultConfig {
applicationId "com.kunzisoft.keepass" applicationId "com.kunzisoft.keepass"
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 32 targetSdkVersion 33
versionCode = 120 versionCode = 120
versionName = "3.5.2" versionName = "3.5.2"
multiDexEnabled true multiDexEnabled true
@ -93,7 +93,7 @@ android {
} }
} }
def room_version = "2.4.3" def room_version = "2.5.1"
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
@ -102,13 +102,13 @@ dependencies {
implementation 'androidx.preference:preference-ktx:1.2.0' implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01' implementation 'androidx.viewpager2:viewpager2:1.1.0-beta02'
implementation 'androidx.documentfile:documentfile:1.0.1' implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.biometric:biometric:1.1.0' implementation 'androidx.biometric:biometric:1.1.0'
implementation 'androidx.media:media:1.6.0' implementation 'androidx.media:media:1.6.0'
// Lifecycle - LiveData - ViewModel - Coroutines // Lifecycle - LiveData - ViewModel - Coroutines
implementation "androidx.core:core-ktx:$android_core_version" implementation "androidx.core:core-ktx:$android_core_version"
implementation 'androidx.fragment:fragment-ktx:1.5.2' implementation 'androidx.fragment:fragment-ktx:1.6.0'
implementation "com.google.android.material:material:$android_material_version" implementation "com.google.android.material:material:$android_material_version"
// Token auto complete // Token auto complete
// From sources until https://github.com/splitwise/TokenAutoComplete/pull/422 fixed // From sources until https://github.com/splitwise/TokenAutoComplete/pull/422 fixed

View file

@ -172,16 +172,16 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
private val onScaleGestureListener: ScaleGestureDetector.OnScaleGestureListener = private val onScaleGestureListener: ScaleGestureDetector.OnScaleGestureListener =
object : ScaleGestureDetector.OnScaleGestureListener { object : ScaleGestureDetector.OnScaleGestureListener {
override fun onScale(detector: ScaleGestureDetector?): Boolean { override fun onScale(detector: ScaleGestureDetector): Boolean {
if (isDragging() || isBitmapTranslateAnimationRunning || isBitmapScaleAnimationRunninng) { if (isDragging() || isBitmapTranslateAnimationRunning || isBitmapScaleAnimationRunninng) {
return false return false
} }
val scaleFactor = detector?.scaleFactor ?: 1.0f val scaleFactor = detector.scaleFactor
val focalX = detector?.focusX ?: bitmapBounds.centerX() val focalX = detector.focusX
val focalY = detector?.focusY ?: bitmapBounds.centerY() val focalY = detector.focusY
if (detector?.scaleFactor == 1.0f) { if (detector.scaleFactor == 1.0f) {
// scale is not changing // scale is not changing
return true return true
} }
@ -191,22 +191,23 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
return true return true
} }
override fun onScaleBegin(p0: ScaleGestureDetector?): Boolean = true override fun onScaleBegin(p0: ScaleGestureDetector): Boolean = true
override fun onScaleEnd(p0: ScaleGestureDetector) {}
override fun onScaleEnd(p0: ScaleGestureDetector?) {}
} }
private val onGestureListener: GestureDetector.OnGestureListener = private val onGestureListener: GestureDetector.OnGestureListener =
object : GestureDetector.SimpleOnGestureListener() { object : GestureDetector.SimpleOnGestureListener() {
override fun onDown(e: MotionEvent?): Boolean = true override fun onDown(e: MotionEvent): Boolean = true
override fun onScroll( override fun onScroll(
e1: MotionEvent?, e1: MotionEvent,
e2: MotionEvent?, e2: MotionEvent,
distanceX: Float, distanceX: Float,
distanceY: Float distanceY: Float
): Boolean { ): Boolean {
if (e2?.pointerCount != 1) { if (e2.pointerCount != 1) {
return true return true
} }
@ -219,13 +220,11 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
} }
override fun onFling( override fun onFling(
e1: MotionEvent?, e1: MotionEvent,
e2: MotionEvent?, e2: MotionEvent,
velocityX: Float, velocityX: Float,
velocityY: Float velocityY: Float
): Boolean { ): Boolean {
e1 ?: return true
if (scale > minScale) { if (scale > minScale) {
processFlingBitmap(velocityX, velocityY) processFlingBitmap(velocityX, velocityY)
} else { } else {
@ -234,9 +233,7 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
return true return true
} }
override fun onDoubleTap(e: MotionEvent?): Boolean { override fun onDoubleTap(e: MotionEvent): Boolean {
e ?: return false
if (isBitmapScaleAnimationRunninng) { if (isBitmapScaleAnimationRunninng) {
return true return true
} }
@ -376,21 +373,21 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
onViewTranslateListener?.onViewTranslate(imageView, amount) onViewTranslateListener?.onViewTranslate(imageView, amount)
} }
.setListener(object : Animator.AnimatorListener { .setListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
isViewTranslateAnimationRunning = false isViewTranslateAnimationRunning = false
onViewTranslateListener?.onDismiss(imageView) onViewTranslateListener?.onDismiss(imageView)
cleanup() cleanup()
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
isViewTranslateAnimationRunning = false isViewTranslateAnimationRunning = false
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })
@ -409,21 +406,21 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
onViewTranslateListener?.onViewTranslate(imageView, amount) onViewTranslateListener?.onViewTranslate(imageView, amount)
} }
addListener(object : Animator.AnimatorListener { addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
// no op // no op
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
isViewTranslateAnimationRunning = false isViewTranslateAnimationRunning = false
onViewTranslateListener?.onDismiss(imageView) onViewTranslateListener?.onDismiss(imageView)
cleanup() cleanup()
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
isViewTranslateAnimationRunning = false isViewTranslateAnimationRunning = false
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })
@ -480,20 +477,20 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
setTransform() setTransform()
} }
addListener(object : Animator.AnimatorListener { addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
isBitmapTranslateAnimationRunning = true isBitmapTranslateAnimationRunning = true
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
isBitmapTranslateAnimationRunning = false isBitmapTranslateAnimationRunning = false
constrainBitmapBounds() constrainBitmapBounds()
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
isBitmapTranslateAnimationRunning = false isBitmapTranslateAnimationRunning = false
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })
@ -531,11 +528,11 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
setTransform() setTransform()
} }
addListener(object : Animator.AnimatorListener { addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
isBitmapScaleAnimationRunninng = true isBitmapScaleAnimationRunninng = true
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
isBitmapScaleAnimationRunninng = false isBitmapScaleAnimationRunninng = false
if (endScale == minScale) { if (endScale == minScale) {
zoomToTargetScale(minScale, focalX, focalY) zoomToTargetScale(minScale, focalX, focalY)
@ -543,11 +540,11 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
} }
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
isBitmapScaleAnimationRunninng = false isBitmapScaleAnimationRunninng = false
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })
@ -585,11 +582,11 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
setTransform() setTransform()
} }
addListener(object : Animator.AnimatorListener { addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
isBitmapScaleAnimationRunninng = true isBitmapScaleAnimationRunninng = true
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
isBitmapScaleAnimationRunninng = false isBitmapScaleAnimationRunninng = false
if (endScale == minScale) { if (endScale == minScale) {
scale = minScale scale = minScale
@ -599,11 +596,11 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
} }
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
isBitmapScaleAnimationRunninng = false isBitmapScaleAnimationRunninng = false
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })
@ -669,19 +666,19 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
onViewTranslateListener?.onViewTranslate(this, amount) onViewTranslateListener?.onViewTranslate(this, amount)
} }
.setListener(object : Animator.AnimatorListener { .setListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
// no op // no op
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
onViewTranslateListener?.onRestore(imageView) onViewTranslateListener?.onRestore(imageView)
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
// no op // no op
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })
@ -696,19 +693,19 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
onViewTranslateListener?.onViewTranslate(imageView, amount) onViewTranslateListener?.onViewTranslate(imageView, amount)
} }
addListener(object : Animator.AnimatorListener { addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
// no op // no op
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
onViewTranslateListener?.onRestore(imageView) onViewTranslateListener?.onRestore(imageView)
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
// no op // no op
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })
@ -737,27 +734,27 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
onViewTranslateListener?.onViewTranslate(this, amount) onViewTranslateListener?.onViewTranslate(this, amount)
} }
.setListener(object : Animator.AnimatorListener { .setListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
isViewTranslateAnimationRunning = true isViewTranslateAnimationRunning = true
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
isViewTranslateAnimationRunning = false isViewTranslateAnimationRunning = false
onViewTranslateListener?.onDismiss(imageView) onViewTranslateListener?.onDismiss(imageView)
cleanup() cleanup()
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
isViewTranslateAnimationRunning = false isViewTranslateAnimationRunning = false
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })
} }
} else { } else {
ObjectAnimator.ofFloat(imageView, View.TRANSLATION_Y, imageView.translationY.toFloat()).apply { ObjectAnimator.ofFloat(imageView, View.TRANSLATION_Y, imageView.translationY).apply {
duration = dismissAnimationDuration duration = dismissAnimationDuration
interpolator = AccelerateDecelerateInterpolator() interpolator = AccelerateDecelerateInterpolator()
addUpdateListener { addUpdateListener {
@ -766,21 +763,21 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
onViewTranslateListener?.onViewTranslate(imageView, amount) onViewTranslateListener?.onViewTranslate(imageView, amount)
} }
addListener(object : Animator.AnimatorListener { addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) { override fun onAnimationStart(p0: Animator) {
isViewTranslateAnimationRunning = true isViewTranslateAnimationRunning = true
} }
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
isViewTranslateAnimationRunning = false isViewTranslateAnimationRunning = false
onViewTranslateListener?.onDismiss(imageView) onViewTranslateListener?.onDismiss(imageView)
cleanup() cleanup()
} }
override fun onAnimationCancel(p0: Animator?) { override fun onAnimationCancel(p0: Animator) {
isViewTranslateAnimationRunning = false isViewTranslateAnimationRunning = false
} }
override fun onAnimationRepeat(p0: Animator?) { override fun onAnimationRepeat(p0: Animator) {
// no op // no op
} }
}) })

View file

@ -200,7 +200,7 @@ class GroupActivity : DatabaseLockActivity(),
} }
} }
private val mOnSearchActionExpandListener = object : MenuItem.OnActionExpandListener { private val mOnSearchActionExpandListener = object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(p0: MenuItem?): Boolean { override fun onMenuItemActionExpand(p0: MenuItem): Boolean {
searchFiltersView?.visibility = View.VISIBLE searchFiltersView?.visibility = View.VISIBLE
searchView?.setOnQueryTextListener(mOnSearchQueryTextListener) searchView?.setOnQueryTextListener(mOnSearchQueryTextListener)
searchFiltersView?.onParametersChangeListener = mOnSearchFiltersChangeListener searchFiltersView?.onParametersChangeListener = mOnSearchFiltersChangeListener
@ -215,7 +215,7 @@ class GroupActivity : DatabaseLockActivity(),
return true return true
} }
override fun onMenuItemActionCollapse(p0: MenuItem?): Boolean { override fun onMenuItemActionCollapse(p0: MenuItem): Boolean {
searchFiltersView?.onParametersChangeListener = null searchFiltersView?.onParametersChangeListener = null
searchView?.setOnQueryTextListener(null) searchView?.setOnQueryTextListener(null)
searchFiltersView?.visibility = View.GONE searchFiltersView?.visibility = View.GONE

View file

@ -122,15 +122,15 @@ fun View.collapse(animate: Boolean = true,
play(slideAnimator) play(slideAnimator)
interpolator = AccelerateDecelerateInterpolator() interpolator = AccelerateDecelerateInterpolator()
addListener(object: Animator.AnimatorListener { addListener(object: Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator?) { override fun onAnimationStart(animation: Animator) {
} }
override fun onAnimationRepeat(animation: Animator?) {} override fun onAnimationRepeat(animation: Animator) {}
override fun onAnimationEnd(animation: Animator?) { override fun onAnimationEnd(animation: Animator) {
visibility = View.GONE visibility = View.GONE
layoutParams.height = recordViewHeight layoutParams.height = recordViewHeight
onCollapseFinished?.invoke() onCollapseFinished?.invoke()
} }
override fun onAnimationCancel(animation: Animator?) {} override fun onAnimationCancel(animation: Animator) {}
}) })
}.start() }.start()
} }
@ -156,12 +156,12 @@ fun View.expand(animate: Boolean = true,
play(slideAnimator) play(slideAnimator)
interpolator = AccelerateDecelerateInterpolator() interpolator = AccelerateDecelerateInterpolator()
addListener(object: Animator.AnimatorListener { addListener(object: Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator?) {} override fun onAnimationStart(animation: Animator) {}
override fun onAnimationRepeat(animation: Animator?) {} override fun onAnimationRepeat(animation: Animator) {}
override fun onAnimationEnd(animation: Animator?) { override fun onAnimationEnd(animation: Animator) {
onExpandFinished?.invoke() onExpandFinished?.invoke()
} }
override fun onAnimationCancel(animation: Animator?) {} override fun onAnimationCancel(animation: Animator) {}
}) })
}.start() }.start()
} }
@ -191,12 +191,12 @@ fun View.hideByFading() {
.alpha(0f) .alpha(0f)
.setDuration(140) .setDuration(140)
.setListener(object: Animator.AnimatorListener { .setListener(object: Animator.AnimatorListener {
override fun onAnimationStart(p0: Animator?) {} override fun onAnimationStart(p0: Animator) {}
override fun onAnimationEnd(p0: Animator?) { override fun onAnimationEnd(p0: Animator) {
isVisible = false isVisible = false
} }
override fun onAnimationCancel(p0: Animator?) {} override fun onAnimationCancel(p0: Animator) {}
override fun onAnimationRepeat(p0: Animator?) {} override fun onAnimationRepeat(p0: Animator) {}
}) })
} }

View file

@ -1,10 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.7.10' ext.kotlin_version = '1.8.20'
ext.android_core_version = '1.8.0' ext.android_core_version = '1.10.1'
ext.android_appcompat_version = '1.5.0' ext.android_appcompat_version = '1.6.1'
ext.android_material_version = '1.6.1' ext.android_material_version = '1.9.0'
ext.android_test_version = '1.4.0' ext.android_test_version = '1.5.2'
repositories { repositories {
mavenCentral() mavenCentral()
google() google()

View file

@ -5,13 +5,13 @@ plugins {
android { android {
namespace 'com.kunzisoft.encrypt' namespace 'com.kunzisoft.encrypt'
compileSdkVersion 32 compileSdkVersion 33
buildToolsVersion "32.0.0" buildToolsVersion "33.0.2"
ndkVersion "21.4.7075529" ndkVersion "21.4.7075529"
defaultConfig { defaultConfig {
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 32 targetSdkVersion 33
multiDexEnabled true multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
android { android {
namespace 'com.kunzisoft.keepass.database' namespace 'com.kunzisoft.keepass.database'
compileSdkVersion 32 compileSdkVersion 33
buildToolsVersion "32.0.0" buildToolsVersion "33.0.2"
defaultConfig { defaultConfig {
minSdkVersion 15 minSdkVersion 15
targetSdk 32 targetSdk 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro" consumerProguardFiles "consumer-rules.pro"

View file

@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
android { android {
namespace 'com.kunzisoft.keepass.icon' namespace 'com.kunzisoft.keepass.icon'
compileSdkVersion 32 compileSdkVersion 33
buildToolsVersion '32.0.0' buildToolsVersion '33.0.2'
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 32 targetSdkVersion 33
} }
} }

View file

@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
android { android {
namespace 'com.kunzisoft.keepass.icon.classic' namespace 'com.kunzisoft.keepass.icon.classic'
compileSdkVersion 32 compileSdkVersion 33
buildToolsVersion '32.0.0' buildToolsVersion '33.0.2'
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 32 targetSdkVersion 33
} }
resourcePrefix 'classic_' resourcePrefix 'classic_'

View file

@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
android { android {
namespace 'com.kunzisoft.keepass.icon.material' namespace 'com.kunzisoft.keepass.icon.material'
compileSdkVersion 32 compileSdkVersion 33
buildToolsVersion '32.0.0' buildToolsVersion '33.0.2'
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 32 targetSdkVersion 33
} }
resourcePrefix 'material_' resourcePrefix 'material_'