From e5c35ff9eee4a4b7690b7adc9110c01246ff0b47 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 27 Nov 2022 20:14:33 +0100 Subject: [PATCH] use rounded buttons at photo/video toggler --- .../camera/activities/MainActivity.kt | 16 +++--- app/src/main/res/drawable/tab_indicator.xml | 9 ++-- app/src/main/res/layout/activity_main.xml | 53 +++++++++++-------- app/src/main/res/values/dimens.xml | 1 - 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt index 43868954..2c3e6db9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt @@ -211,7 +211,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera } private fun hideIntentButtons() { - camera_mode_tab.beGone() + camera_mode_holder.beGone() settings.beGone() last_photo_video_preview.beInvisible() } @@ -452,13 +452,13 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera } private fun onSwipeLeft() { - if (!isThirdPartyIntent() && camera_mode_tab.isVisible()) { + if (!isThirdPartyIntent() && camera_mode_holder.isVisible()) { selectPhotoTab(triggerListener = true) } } private fun onSwipeRight() { - if (!isThirdPartyIntent() && camera_mode_tab.isVisible()) { + if (!isThirdPartyIntent() && camera_mode_holder.isVisible()) { selectVideoTab(triggerListener = true) } } @@ -687,7 +687,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera } override fun onVideoRecordingStarted() { - camera_mode_tab.beInvisible() + camera_mode_holder.beInvisible() video_rec_curr_timer.beVisible() toggle_camera.fadeOut() @@ -703,7 +703,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera } override fun onVideoRecordingStopped() { - camera_mode_tab.beVisible() + camera_mode_holder.beVisible() toggle_camera.fadeIn() last_photo_video_preview.fadeIn() @@ -833,7 +833,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera constraintSet.clone(view_holder) if (requiresCentering) { constraintSet.connect(preview_view.id, ConstraintSet.TOP, top_options.id, ConstraintSet.BOTTOM) - constraintSet.connect(preview_view.id, ConstraintSet.BOTTOM, camera_mode_tab.id, ConstraintSet.TOP) + constraintSet.connect(preview_view.id, ConstraintSet.BOTTOM, camera_mode_holder.id, ConstraintSet.TOP) } else { constraintSet.connect(preview_view.id, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP) constraintSet.connect(preview_view.id, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM) @@ -884,14 +884,14 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera } private fun hideViewsOnTimerStart() { - arrayOf(top_options, toggle_camera, last_photo_video_preview, camera_mode_tab).forEach { + arrayOf(top_options, toggle_camera, last_photo_video_preview, camera_mode_holder).forEach { it.fadeOut() it.beInvisible() } } private fun resetViewsOnTimerFinish() { - arrayOf(top_options, toggle_camera, last_photo_video_preview, camera_mode_tab).forEach { + arrayOf(top_options, toggle_camera, last_photo_video_preview, camera_mode_holder).forEach { it.fadeIn() it.beVisible() } diff --git a/app/src/main/res/drawable/tab_indicator.xml b/app/src/main/res/drawable/tab_indicator.xml index afaa1853..32f614df 100644 --- a/app/src/main/res/drawable/tab_indicator.xml +++ b/app/src/main/res/drawable/tab_indicator.xml @@ -1,14 +1,11 @@ + android:bottom="@dimen/small_margin" + android:top="@dimen/small_margin"> - + - diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c0275935..49bffbc4 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -55,37 +55,44 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@id/camera_mode_tab" /> + app:layout_constraintTop_toTopOf="@id/camera_mode_holder" /> - + app:layout_constraintStart_toStartOf="parent"> - + android:layout_marginBottom="@dimen/big_margin" + android:background="@android:color/transparent" + app:tabBackground="@drawable/tab_indicator" + app:tabIndicator="@null" + app:tabMode="auto" + app:tabRippleColor="@null" + app:tabSelectedTextColor="@color/md_grey_600_dark" + app:tabTextColor="@color/md_grey_white"> - + - + + + + 72dp 48dp 24dp - 10dp 180sp