use rounded buttons at photo/video toggler

This commit is contained in:
tibbi 2022-11-27 20:14:33 +01:00
parent cc3c064edd
commit e5c35ff9ee
4 changed files with 41 additions and 38 deletions

View File

@ -211,7 +211,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
} }
private fun hideIntentButtons() { private fun hideIntentButtons() {
camera_mode_tab.beGone() camera_mode_holder.beGone()
settings.beGone() settings.beGone()
last_photo_video_preview.beInvisible() last_photo_video_preview.beInvisible()
} }
@ -452,13 +452,13 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
} }
private fun onSwipeLeft() { private fun onSwipeLeft() {
if (!isThirdPartyIntent() && camera_mode_tab.isVisible()) { if (!isThirdPartyIntent() && camera_mode_holder.isVisible()) {
selectPhotoTab(triggerListener = true) selectPhotoTab(triggerListener = true)
} }
} }
private fun onSwipeRight() { private fun onSwipeRight() {
if (!isThirdPartyIntent() && camera_mode_tab.isVisible()) { if (!isThirdPartyIntent() && camera_mode_holder.isVisible()) {
selectVideoTab(triggerListener = true) selectVideoTab(triggerListener = true)
} }
} }
@ -687,7 +687,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
} }
override fun onVideoRecordingStarted() { override fun onVideoRecordingStarted() {
camera_mode_tab.beInvisible() camera_mode_holder.beInvisible()
video_rec_curr_timer.beVisible() video_rec_curr_timer.beVisible()
toggle_camera.fadeOut() toggle_camera.fadeOut()
@ -703,7 +703,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
} }
override fun onVideoRecordingStopped() { override fun onVideoRecordingStopped() {
camera_mode_tab.beVisible() camera_mode_holder.beVisible()
toggle_camera.fadeIn() toggle_camera.fadeIn()
last_photo_video_preview.fadeIn() last_photo_video_preview.fadeIn()
@ -833,7 +833,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
constraintSet.clone(view_holder) constraintSet.clone(view_holder)
if (requiresCentering) { if (requiresCentering) {
constraintSet.connect(preview_view.id, ConstraintSet.TOP, top_options.id, ConstraintSet.BOTTOM) 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 { } else {
constraintSet.connect(preview_view.id, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP) constraintSet.connect(preview_view.id, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)
constraintSet.connect(preview_view.id, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM) 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() { 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.fadeOut()
it.beInvisible() it.beInvisible()
} }
} }
private fun resetViewsOnTimerFinish() { 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.fadeIn()
it.beVisible() it.beVisible()
} }

View File

@ -1,14 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:bottom="@dimen/tab_indicator_margin" android:bottom="@dimen/small_margin"
android:end="@dimen/tab_indicator_margin" android:top="@dimen/small_margin">
android:start="@dimen/tab_indicator_margin"
android:top="@dimen/tab_indicator_margin">
<shape> <shape>
<corners android:radius="@dimen/tab_indicator_margin" /> <corners android:radius="@dimen/material_button_corner_radius" />
<solid android:color="@color/tab_color" /> <solid android:color="@color/tab_color" />
</shape> </shape>
</item> </item>
</layer-list> </layer-list>

View File

@ -55,7 +55,16 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/camera_mode_tab" /> app:layout_constraintTop_toTopOf="@id/camera_mode_holder" />
<RelativeLayout
android:id="@+id/camera_mode_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/medium_margin"
app:layout_constraintBottom_toTopOf="@id/shutter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/camera_mode_tab" android:id="@+id/camera_mode_tab"
@ -63,9 +72,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/big_margin" android:layout_marginBottom="@dimen/big_margin"
android:background="@android:color/transparent" android:background="@android:color/transparent"
app:layout_constraintBottom_toTopOf="@id/shutter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:tabBackground="@drawable/tab_indicator" app:tabBackground="@drawable/tab_indicator"
app:tabIndicator="@null" app:tabIndicator="@null"
app:tabMode="auto" app:tabMode="auto"
@ -86,6 +92,7 @@
android:text="@string/photo" /> android:text="@string/photo" />
</com.google.android.material.tabs.TabLayout> </com.google.android.material.tabs.TabLayout>
</RelativeLayout>
<TextView <TextView
android:id="@+id/video_rec_curr_timer" android:id="@+id/video_rec_curr_timer"

View File

@ -4,6 +4,5 @@
<dimen name="large_icon_size">72dp</dimen> <dimen name="large_icon_size">72dp</dimen>
<dimen name="top_icon_size">48dp</dimen> <dimen name="top_icon_size">48dp</dimen>
<dimen name="toggle_icon_size">24dp</dimen> <dimen name="toggle_icon_size">24dp</dimen>
<dimen name="tab_indicator_margin">10dp</dimen>
<dimen name="timer_text_size">180sp</dimen> <dimen name="timer_text_size">180sp</dimen>
</resources> </resources>