Improve animations on audio controls, enable push to talk

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2016-11-21 18:58:10 -08:00
parent 3e008f6752
commit 8af9b7fd15
26 changed files with 259 additions and 23 deletions

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/play_button_animation_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:propertyName="pathData"
android:valueFrom="@string/pause_icon_bottom_path_data"
android:valueTo="@string/play_icon_bottom_path_data"
android:valueType="pathType"/>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/play_button_animation_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:propertyName="pathData"
android:valueFrom="@string/play_icon_bottom_path_data"
android:valueTo="@string/pause_icon_bottom_path_data"
android:valueType="pathType"/>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/play_button_animation_duration"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="rotation"
android:valueFrom="0"
android:valueTo="90"
android:valueType="floatType"/>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/play_button_animation_duration"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:propertyName="rotation"
android:valueFrom="90"
android:valueTo="0"
android:valueType="floatType"/>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/play_button_animation_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:propertyName="pathData"
android:valueFrom="@string/pause_icon_upper_path_data"
android:valueTo="@string/play_icon_upper_path_data"
android:valueType="pathType"/>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/play_button_animation_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:propertyName="pathData"
android:valueFrom="@string/play_icon_upper_path_data"
android:valueTo="@string/pause_icon_upper_path_data"
android:valueType="pathType"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,35 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="128"
android:viewportHeight="128">
<group
android:name="@string/play_icon_group_parts"
android:rotation="90"
android:pivotX="64"
android:pivotY="64"
android:scaleX="1.5"
android:scaleY="1.5">
<group android:name="@string/play_icon_group_top">
<path
android:name="@string/play_icon_top_path_name"
android:pathData="@string/pause_icon_upper_path_data"
android:fillColor="@android:color/white"
android:strokeLineCap="butt"
android:strokeLineJoin="miter"
android:strokeMiterLimit="10"/>
</group>
<group android:name="@string/play_icon_group_bottom">
<path
android:name="@string/play_icon_bottom_path_name"
android:pathData="@string/pause_icon_bottom_path_data"
android:fillColor="@android:color/white"
android:strokeLineCap="butt"
android:strokeLineJoin="miter"
android:strokeMiterLimit="10"/>
</group>
</group>
</vector>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:drawable="@drawable/pause_icon"
tools:targetApi="lollipop">
<target
android:name="@string/play_icon_group_parts"
android:animation="@animator/rotate_minus_90_animation"/>
<target
android:name="@string/play_icon_top_path_name"
android:animation="@animator/upper_pause_to_play_animation"/>
<target
android:name="@string/play_icon_bottom_path_name"
android:animation="@animator/bottom_pause_to_play_animation"/>
</animated-vector>

View File

@@ -0,0 +1,34 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="128"
android:viewportHeight="128">
<group
android:name="@string/play_icon_group_parts"
android:pivotX="64"
android:pivotY="64"
android:scaleX="1.5"
android:scaleY="1.5">
<group android:name="@string/play_icon_group_top">
<path
android:name="@string/play_icon_top_path_name"
android:pathData="@string/play_icon_upper_path_data"
android:fillColor="@android:color/white"
android:strokeLineCap="butt"
android:strokeLineJoin="miter"
android:strokeMiterLimit="10"/>
</group>
<group android:name="@string/play_icon_group_bottom">
<path
android:name="@string/play_icon_bottom_path_name"
android:pathData="@string/play_icon_bottom_path_data"
android:fillColor="@android:color/white"
android:strokeLineCap="butt"
android:strokeLineJoin="miter"
android:strokeMiterLimit="10"/>
</group>
</group>
</vector>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:drawable="@drawable/play_icon"
tools:targetApi="lollipop">
<target
android:name="@string/play_icon_group_parts"
android:animation="@animator/rotate_90_animation"/>
<target
android:name="@string/play_icon_top_path_name"
android:animation="@animator/upper_play_to_pause_animation"/>
<target
android:name="@string/play_icon_bottom_path_name"
android:animation="@animator/bottom_play_to_pause_animation"/>
</animated-vector>

View File

@@ -28,7 +28,7 @@
app:matProg_barColor="@color/white"
app:matProg_linearProgress="true"
app:matProg_spinSpeed="0.333"
tools:visibility="visible"/>
tools:visibility="gone"/>
<ImageView android:id="@+id/play"
android:layout_width="wrap_content"
@@ -39,6 +39,8 @@
android:visibility="gone"
android:background="@drawable/circle_touch_highlight_background"
android:src="@drawable/ic_play_circle_fill_white_48dp"
android:scaleType="centerInside"
tools:visibility="gone"
android:contentDescription="Play"/>
<ImageView android:id="@+id/pause"
@@ -50,6 +52,7 @@
android:visibility="gone"
android:background="@drawable/circle_touch_highlight_background"
android:src="@drawable/ic_pause_circle_fill_white_48dp"
android:scaleType="centerInside"
android:contentDescription="Pause"/>
<ImageView android:id="@+id/download"

View File

@@ -70,7 +70,8 @@
android:background="@color/white"
android:paddingTop="15dp"
android:paddingBottom="15dp"
app:tintColor="@color/grey_500"/>
app:foregroundTintColor="@color/grey_500"
app:backgroundTintColor="@color/white"/>
</org.thoughtcrime.securesms.components.RemovableMediaView>

View File

@@ -65,7 +65,8 @@
android:layout_width="210dp"
android:layout_height="wrap_content"
android:visibility="gone"
app:tintColor="@color/white"
app:foregroundTintColor="@color/white"
app:backgroundTintColor="@color/blue_500"
tools:visibility="visible"/>
<org.thoughtcrime.securesms.components.emoji.EmojiTextView

View File

@@ -55,7 +55,8 @@
android:id="@+id/audio_view"
android:layout_width="210dp"
android:layout_height="wrap_content"
app:tintColor="@color/grey_500"
app:foregroundTintColor="@color/grey_500"
app:backgroundTintColor="@color/white"
android:visibility="gone"/>
<org.thoughtcrime.securesms.components.emoji.EmojiTextView

View File

@@ -154,7 +154,8 @@
</declare-styleable>
<declare-styleable name="AudioView">
<attr name="tintColor" format="color" />
<attr name="foregroundTintColor" format="color" />
<attr name="backgroundTintColor" format="color" />
</declare-styleable>
<declare-styleable name="CircleColorImageView">

4
res/values/integers.xml Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="play_button_animation_duration">300</integer>
</resources>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Play Icon -->
<string name="play_icon_upper_path_data">M 44 32 L 44 64 L 100 64 L 100 64 Z</string>
<string name="play_icon_bottom_path_data">M 44 96 L 44 64 L 100 64 L 100 64 Z</string>
<!-- Pause Icon -->
<string name="pause_icon_upper_path_data">M 32 40 L 32 56 L 96 56 L 96 40 Z</string>
<string name="pause_icon_bottom_path_data">M 32 88 L 32 72 L 96 72 L 96 88 Z</string>
<!-- Groups -->
<string name="play_icon_group_top">upperpart</string>
<string name="play_icon_group_bottom">bottompart</string>
<string name="play_icon_group_parts">parts</string>
<!-- Path Name -->
<string name="play_icon_top_path_name">upper</string>
<string name="play_icon_bottom_path_name">bottom</string>
</resources>