diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index c8303bd..eaa0cd5 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -115,7 +115,6 @@ dependencies { implementation(project(":shared")) implementation("com.google.android.material:material:1.5.0") implementation("androidx.appcompat:appcompat:1.4.1") - implementation("androidx.constraintlayout:constraintlayout:2.1.3") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0") implementation("androidx.preference:preference-ktx:1.1.1") @@ -131,7 +130,7 @@ dependencies { implementation("androidx.cardview:cardview:1.0.0") implementation("androidx.annotation:annotation:1.3.0") implementation("androidx.work:work-runtime-ktx:2.7.1") - implementation("androidx.constraintlayout:constraintlayout:2.1.3") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("org.jsoup:jsoup:1.14.3") //multidex diff --git a/androidApp/src/main/AndroidManifest.xml b/androidApp/src/main/AndroidManifest.xml index 0a84aea..f8552d4 100644 --- a/androidApp/src/main/AndroidManifest.xml +++ b/androidApp/src/main/AndroidManifest.xml @@ -70,7 +70,8 @@ android:name=".ReaderActivity"> + android:name=".ImageActivity" + android:theme="@style/Theme.AppCompat.ImageActivity"> @@ -31,12 +31,35 @@ class ImageActivity : AppCompatActivity() { binding.pager.adapter = ScreenSlidePagerAdapter(this) binding.pager.setCurrentItem(position, false) + + val transitionListener = object : MotionLayout.TransitionListener { + override fun onTransitionStarted(motionLayout: MotionLayout?, startId: Int, endId: Int) { + // Nothing + } + + override fun onTransitionChange(motionLayout: MotionLayout?, startId: Int, endId: Int, progress: Float + ) { + // Nothing + } + + override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) { + if (motionLayout?.currentState == binding.root.endState) { + onBackPressedDispatcher.onBackPressed() + overridePendingTransition(0, 0) + } + } + + override fun onTransitionTrigger(motionLayout: MotionLayout?, triggerId: Int, positive: Boolean, progress: Float) { + // Nothing + } + } + binding.root.setTransitionListener(transitionListener) } override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { android.R.id.home -> { - onBackPressed() + onBackPressedDispatcher.onBackPressed() return true } } diff --git a/androidApp/src/main/res/layout/activity_image.xml b/androidApp/src/main/res/layout/activity_image.xml index 66f62c8..632163a 100644 --- a/androidApp/src/main/res/layout/activity_image.xml +++ b/androidApp/src/main/res/layout/activity_image.xml @@ -1,33 +1,40 @@ - + android:layout_height="match_parent" + app:layoutDescription="@xml/image_close_scene"> + android:layout_height="wrap_content"> - + /> - + android:layout_height="match_parent" + android:fillViewport="true" + app:layout_constraintTop_toBottomOf="@+id/appBarLayout"> - + + + + + diff --git a/androidApp/src/main/res/layout/fragment_image.xml b/androidApp/src/main/res/layout/fragment_image.xml index 3bd2094..223c47e 100644 --- a/androidApp/src/main/res/layout/fragment_image.xml +++ b/androidApp/src/main/res/layout/fragment_image.xml @@ -1,16 +1,16 @@ - - + - \ No newline at end of file + \ No newline at end of file diff --git a/androidApp/src/main/res/values/colors.xml b/androidApp/src/main/res/values/colors.xml index 1e45a00..2505bff 100644 --- a/androidApp/src/main/res/values/colors.xml +++ b/androidApp/src/main/res/values/colors.xml @@ -12,4 +12,5 @@ @color/colorAccent @color/pink #FF282828 + #33000000 diff --git a/androidApp/src/main/res/values/styles.xml b/androidApp/src/main/res/values/styles.xml index 22e1a4b..9ba9049 100644 --- a/androidApp/src/main/res/values/styles.xml +++ b/androidApp/src/main/res/values/styles.xml @@ -26,4 +26,10 @@ @color/white @color/white + + diff --git a/androidApp/src/main/res/xml/image_close_scene.xml b/androidApp/src/main/res/xml/image_close_scene.xml new file mode 100644 index 0000000..2e3f356 --- /dev/null +++ b/androidApp/src/main/res/xml/image_close_scene.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file