From 443230268fa6eb9da81cf43b20a8e7b93a0f39a3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 3 Sep 2022 10:47:05 +0200 Subject: [PATCH] updating kotlin, gradle and target SDK to 33 --- app/build.gradle | 6 +++--- app/src/main/AndroidManifest.xml | 1 + .../gallery/pro/activities/PhotoVideoActivity.kt | 4 ++-- .../pro/activities/VideoPlayerActivity.kt | 11 ++++------- .../gallery/pro/activities/ViewPagerActivity.kt | 14 ++++++-------- .../gallery/pro/fragments/VideoFragment.kt | 11 ++++------- .../gallery/pro/views/MediaSideScroll.kt | 16 ++++++++-------- app/src/main/res/layout/activity_settings.xml | 1 + build.gradle | 8 ++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- 10 files changed, 34 insertions(+), 40 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9a26f3e8c..2360cd343 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,12 +10,12 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdk 31 + compileSdk 33 defaultConfig { applicationId "com.simplemobiletools.gallery.pro" minSdk 21 - targetSdk 31 + targetSdk 33 versionCode 374 versionName "6.24.1" setProperty("archivesBaseName", "gallery-$versionCode") @@ -78,7 +78,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:0c82e5f216' + implementation 'com.github.SimpleMobileTools:Simple-Commons:28e3b108e7' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9c0c20529..cae2d3dd4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,6 +13,7 @@ + diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt index 7792cf62b..7fc0595b1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt @@ -188,7 +188,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList } top_shadow.layoutParams.height = statusBarHeight + actionBarHeight - if (!portrait && navigationBarRight && navigationBarWidth > 0) { + if (!portrait && navigationBarOnSide && navigationBarWidth > 0) { fragment_viewer_toolbar.setPadding(0, 0, navigationBarWidth, 0) } else { fragment_viewer_toolbar.setPadding(0, 0, 0, 0) @@ -285,7 +285,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList top_shadow.layoutParams.height = statusBarHeight + actionBarHeight (fragment_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight - if (!portrait && navigationBarRight && navigationBarWidth > 0) { + if (!portrait && navigationBarOnSide && navigationBarWidth > 0) { fragment_viewer_toolbar.setPadding(0, 0, navigationBarWidth, 0) } else { fragment_viewer_toolbar.setPadding(0, 0, 0, 0) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index 62e218dee..f019fef43 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -87,7 +87,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen updateTextColors(video_player_holder) - if (!portrait && navigationBarRight && navigationBarWidth > 0) { + if (!portrait && navigationBarOnSide && navigationBarWidth > 0) { video_toolbar.setPadding(0, 0, navigationBarWidth, 0) } else { video_toolbar.setPadding(0, 0, 0, 0) @@ -149,7 +149,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen top_shadow.layoutParams.height = statusBarHeight + actionBarHeight (video_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight - if (!portrait && navigationBarRight && navigationBarWidth > 0) { + if (!portrait && navigationBarOnSide && navigationBarWidth > 0) { video_toolbar.setPadding(0, 0, navigationBarWidth, 0) } else { video_toolbar.setPadding(0, 0, 0, 0) @@ -191,11 +191,8 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen val gestureDetector = GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() { - override fun onDoubleTap(e: MotionEvent?): Boolean { - if (e != null) { - handleDoubleTap(e.rawX) - } - + override fun onDoubleTap(e: MotionEvent): Boolean { + handleDoubleTap(e.rawX) return true } }) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index baa597763..a9d2000b9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -529,10 +529,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val oldPosition = view_pager.currentItem val animator = ValueAnimator.ofInt(0, view_pager.width) animator.addListener(object : Animator.AnimatorListener { - override fun onAnimationRepeat(animation: Animator?) { - } - - override fun onAnimationEnd(animation: Animator?) { + override fun onAnimationEnd(animation: Animator) { if (view_pager.isFakeDragging) { try { view_pager.endFakeDrag() @@ -546,12 +543,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - override fun onAnimationCancel(animation: Animator?) { + override fun onAnimationCancel(animation: Animator) { view_pager.endFakeDrag() } - override fun onAnimationStart(animation: Animator?) { - } + override fun onAnimationStart(animation: Animator) {} + + override fun onAnimationRepeat(animation: Animator) {} }) if (config.slideshowAnimation == SLIDESHOW_ANIMATION_SLIDE) { @@ -831,7 +829,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View bottom_actions.beGone() } - if (!portrait && navigationBarRight && navigationBarWidth > 0) { + if (!portrait && navigationBarOnSide && navigationBarWidth > 0) { medium_viewer_toolbar.setPadding(0, 0, navigationBarWidth, 0) } else { medium_viewer_toolbar.setPadding(0, 0, 0, 0) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index bf68ff8cf..9abe82a76 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -116,7 +116,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mTextureView.surfaceTextureListener = this@VideoFragment val gestureDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() { - override fun onSingleTapConfirmed(e: MotionEvent?): Boolean { + override fun onSingleTapConfirmed(e: MotionEvent): Boolean { if (!mConfig.allowInstantChange) { toggleFullscreen() return true @@ -124,7 +124,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S val viewWidth = width val instantWidth = viewWidth / 7 - val clickedX = e?.rawX ?: 0f + val clickedX = e.rawX when { clickedX <= instantWidth -> listener?.goToPrevItem() clickedX >= viewWidth - instantWidth -> listener?.goToNextItem() @@ -133,11 +133,8 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S return true } - override fun onDoubleTap(e: MotionEvent?): Boolean { - if (e != null) { - handleDoubleTap(e.rawX) - } - + override fun onDoubleTap(e: MotionEvent): Boolean { + handleDoubleTap(e.rawX) return true } }) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt index dcb8793bd..7224cf990 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt @@ -39,8 +39,10 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co private lateinit var slideInfoView: TextView private lateinit var singleTap: (Float, Float) -> Unit - fun initialize(activity: Activity, slideInfoView: TextView, isBrightness: Boolean, parentView: ViewGroup?, singleTap: (x: Float, y: Float) -> Unit, - doubleTap: ((x: Float, y: Float) -> Unit)? = null) { + fun initialize( + activity: Activity, slideInfoView: TextView, isBrightness: Boolean, parentView: ViewGroup?, singleTap: (x: Float, y: Float) -> Unit, + doubleTap: ((x: Float, y: Float) -> Unit)? = null + ) { this.activity = activity this.slideInfoView = slideInfoView this.singleTap = singleTap @@ -54,15 +56,13 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co } private val gestureDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() { - override fun onSingleTapConfirmed(e: MotionEvent?): Boolean { - if (e != null) { - singleTap(e.rawX, e.rawY) - } + override fun onSingleTapConfirmed(e: MotionEvent): Boolean { + singleTap(e.rawX, e.rawY) return true } - override fun onDoubleTap(e: MotionEvent?): Boolean { - if (e != null && doubleTap != null) { + override fun onDoubleTap(e: MotionEvent): Boolean { + if (doubleTap != null) { doubleTap!!.invoke(e.rawX, e.rawY) } return true diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 3757d1b62..98537ee8f 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -16,6 +16,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/color_primary" + app:layout_scrollFlags="scroll|enterAlways" app:title="@string/settings" app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> diff --git a/build.gradle b/build.gradle index a25d3b974..b8447146e 100644 --- a/build.gradle +++ b/build.gradle @@ -3,14 +3,14 @@ buildscript { // needed only if we are including commons locally from our pc, not via Jitpack /*ext { - propCompileSdkVersion = 31 + propCompileSdkVersion = 33 propMinSdkVersion = 21 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 propVersionName = '5.34.26' }*/ - ext.kotlin_version = '1.6.21' + ext.kotlin_version = '1.7.10' ext.is_proprietary = gradle.startParameter.taskNames.any { task -> task.contains("Proprietary") } repositories { @@ -22,10 +22,10 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' + classpath 'com.android.tools.build:gradle:7.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" if (is_proprietary) { - classpath 'ly.img.android.pesdk:plugin:10.2.1' + classpath 'ly.img.android.pesdk:plugin:10.3.0' } // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d96f5290b..476a0f060 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip