From 2467352bf1d274b63be6a91bad29acf5033bae44 Mon Sep 17 00:00:00 2001 From: punchdrunker Date: Thu, 20 Jun 2024 09:23:43 +0900 Subject: [PATCH 1/2] bump version --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e9d20ff..6340c1f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,9 +11,9 @@ android { minSdkVersion 24 // <- サポートする最小のandroidバージョン targetSdkVersion 34 // <- buildに利用するツール郡の設定(Android plugin for Gradle 3.0.0以降なら設定しない場合プラグインに合わせたバージョンが自動で選択される) - versionCode 9 + versionCode 10 // <- アプリのバージョンコード 内部的に使われるもので基本的にユーザーの目にするものではない アプリのインストール時やGoogle Play Consoleでのリリースで使われる - versionName "1.4.0" // <- ユーザーが目にするバージョン名 + versionName "1.4.1" // <- ユーザーが目にするバージョン名 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // <- androidTestに使われるRunner } From a99546aba3feb3c9b0497f5950d466c796a824ed Mon Sep 17 00:00:00 2001 From: punchdrunker Date: Thu, 20 Jun 2024 09:38:07 +0900 Subject: [PATCH 2/2] update libs --- app/build.gradle | 18 +++--- .../hocho/transition/PagerActivity.kt | 64 +++++++++++-------- build.gradle | 10 +-- gallery/build.gradle | 2 +- 4 files changed, 53 insertions(+), 41 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6340c1f..4d24915 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,7 +39,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion "1.5.3" + kotlinCompilerExtensionVersion "1.5.14" } // app bundleを有効にする @@ -66,12 +66,12 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // <- app/libs の下にある*.jar ファイルを利用する設定(デフォルトで記述されるが大抵の場合不要) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$versions.kotlin" - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.9.0' + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'com.google.android.material:material:1.12.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.cardview:cardview:1.0.0' - implementation "androidx.activity:activity-ktx:1.7.2" - implementation 'androidx.browser:browser:1.6.0' + implementation "androidx.activity:activity-ktx:1.9.0" + implementation 'androidx.browser:browser:1.8.0' // <- Kotlinでプラグインによる自動生成処理を行うための設定(kotlinを使わない場合はannotationProcessor) implementation 'com.google.android.play:core:1.10.3' // <- Dynamic Featureのロードに必要 @@ -94,15 +94,15 @@ dependencies { implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' // <- 利用するライブラリを設定する // coroutine - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0' implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2' // compose - implementation 'androidx.activity:activity-compose:1.7.2' - implementation "androidx.compose.material3:material3:1.1.1" + implementation 'androidx.activity:activity-compose:1.9.0' + implementation "androidx.compose.material3:material3:1.2.1" implementation "androidx.compose.animation:animation:$versions.compose" implementation "androidx.compose.ui:ui-tooling:$versions.compose" - implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1' + implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.8.2' implementation "com.google.android.material:compose-theme-adapter:1.2.1" // utils diff --git a/app/src/main/java/tokyo/punchdrunker/hocho/transition/PagerActivity.kt b/app/src/main/java/tokyo/punchdrunker/hocho/transition/PagerActivity.kt index 35cffbe..ddf7970 100644 --- a/app/src/main/java/tokyo/punchdrunker/hocho/transition/PagerActivity.kt +++ b/app/src/main/java/tokyo/punchdrunker/hocho/transition/PagerActivity.kt @@ -3,9 +3,9 @@ package tokyo.punchdrunker.hocho.transition import android.content.Context import android.content.Intent import android.os.Bundle -import android.view.KeyEvent import android.view.View import android.widget.ImageView +import androidx.activity.OnBackPressedCallback import androidx.appcompat.app.AppCompatActivity import androidx.core.app.SharedElementCallback import androidx.databinding.DataBindingUtil @@ -13,7 +13,6 @@ import androidx.viewpager.widget.ViewPager import tokyo.punchdrunker.hocho.R import tokyo.punchdrunker.hocho.databinding.ActivityPagerBinding - class PagerActivity : AppCompatActivity() { private var initialPosition = 0 private var useTransition = true @@ -31,33 +30,43 @@ class PagerActivity : AppCompatActivity() { binding.viewPager.also { it.adapter = adapter it.currentItem = initialPosition - it.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() { - override fun onPageSelected(position: Int) { - PhotoStore.setCurrentPosition(this@PagerActivity, position) - } - }) + it.addOnPageChangeListener( + object : ViewPager.SimpleOnPageChangeListener() { + override fun onPageSelected(position: Int) { + PhotoStore.setCurrentPosition(this@PagerActivity, position) + } + }, + ) } - prepareEnterTransition() - } - override fun dispatchKeyEvent(event: KeyEvent?): Boolean { - // Backボタン検知する - if (!useTransition && event?.keyCode == KeyEvent.KEYCODE_BACK) { - finishViewer() - return false - } - return super.dispatchKeyEvent(event) + val callback: OnBackPressedCallback = + object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + // Backボタン検知する + if (!useTransition) { + finishViewer() + } + } + } + onBackPressedDispatcher.addCallback(callback) + prepareEnterTransition() } private fun prepareEnterTransition() { - setEnterSharedElementCallback(object : SharedElementCallback() { - override fun onMapSharedElements(names: List, sharedElements: MutableMap) { - val detailImageView = adapter.getCurrentFragment().view?.findViewById(R.id.photo) - if (detailImageView != null) { - sharedElements[names[0]] = detailImageView + setEnterSharedElementCallback( + object : SharedElementCallback() { + override fun onMapSharedElements( + names: List, + sharedElements: MutableMap, + ) { + val detailImageView = + adapter.getCurrentFragment().view?.findViewById(R.id.photo) + if (detailImageView != null) { + sharedElements[names[0]] = detailImageView + } } - } - }) + }, + ) } private fun finishViewer() { @@ -69,12 +78,15 @@ class PagerActivity : AppCompatActivity() { } companion object { - fun createIntent(context: Context, position: Int, useTransition: Boolean = true): Intent { - return Intent(context, PagerActivity::class.java).also { + fun createIntent( + context: Context, + position: Int, + useTransition: Boolean = true, + ): Intent = + Intent(context, PagerActivity::class.java).also { it.putExtra(KEY_POSITION, position) it.putExtra(KEY_USE_TRANSITION, useTransition) } - } private const val KEY_POSITION = "KEY_POSITION" private const val KEY_USE_TRANSITION = "KEY_USE_TRANSITION" diff --git a/build.gradle b/build.gradle index 63f6a84..16dc7df 100644 --- a/build.gradle +++ b/build.gradle @@ -4,10 +4,10 @@ apply plugin: 'com.github.ben-manes.versions' buildscript { ext.versions = [ 'glide': '4.14.0', - 'kotlin': '1.9.10', - 'retrofit': '2.9.0', - 'okhttp': '4.11.0', - 'leakcanary': '2.12', + 'kotlin': '1.9.24', + 'retrofit': '2.11.0', + 'okhttp': '4.12.0', + 'leakcanary': '2.14', 'compose': '1.6.0-alpha04', ] repositories { @@ -16,7 +16,7 @@ buildscript { gradlePluginPortal() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.1' + classpath 'com.android.tools.build:gradle:8.1.4' // <- buildに使うandroid用のpluginの設定 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin" // <- kotlin用のpluginの設定 diff --git a/gallery/build.gradle b/gallery/build.gradle index 27a1e93..093e7d1 100644 --- a/gallery/build.gradle +++ b/gallery/build.gradle @@ -26,7 +26,7 @@ dependencies { implementation project(':app') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$versions.kotlin" // 暫定的な対応... - implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'