animate video shutter icon

This commit is contained in:
darthpaul 2022-09-20 17:50:12 +01:00
parent d9fbc17bff
commit 0cc5210bd2
15 changed files with 188 additions and 5 deletions

View File

@ -478,7 +478,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
}
private fun initVideoButtons() {
shutter.setImageResource(R.drawable.ic_video_rec)
shutter.setImageResource(R.drawable.ic_video_rec_animated)
setupPreviewImage(false)
mPreview?.checkFlashlight()
selectVideoTab()
@ -659,7 +659,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
override fun onVideoRecordingStarted() {
camera_mode_tab.beInvisible()
shutter.setImageResource(R.drawable.ic_video_stop)
shutter.isSelected = true
toggle_camera.beInvisible()
change_resolution.isEnabled = false
video_rec_curr_timer.beVisible()
@ -667,7 +667,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
override fun onVideoRecordingStopped() {
camera_mode_tab.beVisible()
shutter.setImageResource(R.drawable.ic_video_rec)
shutter.isSelected = false
video_rec_curr_timer.text = 0.getFormattedDuration()
video_rec_curr_timer.beGone()
change_resolution.isEnabled = true
@ -797,11 +797,11 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
fun setRecordingState(isRecording: Boolean) {
runOnUiThread {
if (isRecording) {
shutter.setImageResource(R.drawable.ic_video_stop)
shutter.isSelected = true
toggle_camera.beInvisible()
showTimer()
} else {
shutter.setImageResource(R.drawable.ic_video_rec)
shutter.isSelected = false
hideTimer()
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1,26 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="@dimen/large_icon_size"
android:height="@dimen/large_icon_size"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:fillColor="@android:color/white"
android:fillType="evenOdd"
android:pathData="M256,485C382.47,485 485,382.47 485,256C485,129.53 382.47,27 256,27C129.53,27 27,129.53 27,256C27,382.47 129.53,485 256,485ZM256,465C370.32,465 463,371.43 463,256C463,140.57 370.32,47 256,47C141.68,47 49,140.57 49,256C49,371.43 141.68,465 256,465Z" />
<path
android:name="inner_big"
android:fillColor="@color/md_red"
android:fillType="evenOdd"
android:pathData="M255.5,426C349.67,426 426,349.67 426,255.5C426,161.34 349.67,85 255.5,85C161.34,85 85,161.34 85,255.5C85,349.67 161.34,426 255.5,426ZM255.5,402C336.41,402 402,336.41 402,255.5C402,174.59 336.41,109 255.5,109C174.59,109 109,174.59 109,255.5C109,336.41 174.59,402 255.5,402Z" />
<path
android:name="inner_medium"
android:fillColor="@color/md_red"
android:pathData="M105,255.5a150.5,147.5 0,1 0,301 0a150.5,147.5 0,1 0,-301 0z" />
<path
android:name="inner_small"
android:fillColor="@color/md_red"
android:pathData="M221,138L292,138A82,82 0,0 1,374 220L374,291A82,82 0,0 1,292 373L221,373A82,82 0,0 1,139 291L139,220A82,82 0,0 1,221 138z" />
</vector>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="@dimen/large_icon_size"
android:height="@dimen/large_icon_size"
android:viewportWidth="168"
android:viewportHeight="168">
<item
android:id="@+id/selected"
android:drawable="@drawable/ic_video_rec"
android:state_selected="true" />
<item
android:id="@+id/pressed"
android:drawable="@drawable/ic_video_rec"
android:state_pressed="true" />
<item
android:id="@+id/default_state"
android:drawable="@drawable/ic_video_rec" />
<transition
android:drawable="@drawable/video_rec_start_to_stop"
android:fromId="@id/selected"
android:toId="@id/default_state" />
<transition
android:drawable="@drawable/video_rec_stop_to_start"
android:fromId="@id/default_state"
android:toId="@id/selected" />
<transition
android:drawable="@drawable/video_rec_pressed_to_unpressed"
android:fromId="@id/pressed"
android:toId="@id/default_state" />
<transition
android:drawable="@drawable/video_rec_unpressed_to_pressed"
android:fromId="@id/default_state"
android:toId="@id/pressed" />
</animated-selector>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:drawable="@drawable/ic_video_rec">
<target android:name="inner_big">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="3"
android:interpolator="@android:interpolator/decelerate_cubic"
android:propertyName="fillColor"
android:valueFrom="@android:color/transparent"
android:valueTo="@color/md_red"
android:valueType="colorType" />
</aapt:attr>
</target>
</animated-vector>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:drawable="@drawable/ic_video_rec">
<target android:name="inner_big">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="3"
android:interpolator="@android:interpolator/decelerate_cubic"
android:propertyName="fillColor"
android:valueFrom="@android:color/transparent"
android:valueTo="@color/md_red"
android:valueType="colorType" />
</aapt:attr>
</target>
<target android:name="inner_medium">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="3"
android:interpolator="@android:interpolator/decelerate_cubic"
android:propertyName="fillColor"
android:valueFrom="@android:color/transparent"
android:valueTo="@color/md_red"
android:valueType="colorType" />
</aapt:attr>
</target>
<target android:name="inner_small">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="3"
android:interpolator="@android:interpolator/decelerate_cubic"
android:propertyName="fillColor"
android:valueFrom="@color/md_red"
android:valueTo="@android:color/transparent"
android:valueType="colorType" />
</aapt:attr>
</target>
</animated-vector>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:drawable="@drawable/ic_video_rec">
<target android:name="inner_big">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="3"
android:interpolator="@android:interpolator/decelerate_cubic"
android:propertyName="fillColor"
android:valueTo="@android:color/transparent"
android:valueFrom="@color/md_red"
android:valueType="colorType" />
</aapt:attr>
</target>
<target android:name="inner_medium">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="3"
android:interpolator="@android:interpolator/decelerate_cubic"
android:propertyName="fillColor"
android:valueTo="@android:color/transparent"
android:valueFrom="@color/md_red"
android:valueType="colorType" />
</aapt:attr>
</target>
<target android:name="inner_small">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="3"
android:interpolator="@android:interpolator/decelerate_cubic"
android:propertyName="fillColor"
android:valueTo="@color/md_red"
android:valueFrom="@android:color/transparent"
android:valueType="colorType" />
</aapt:attr>
</target>
</animated-vector>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:drawable="@drawable/ic_video_rec">
<target android:name="inner_big">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="3"
android:interpolator="@android:interpolator/decelerate_cubic"
android:propertyName="fillColor"
android:valueFrom="@color/md_red"
android:valueTo="@android:color/transparent"
android:valueType="colorType" />
</aapt:attr>
</target>
</animated-vector>