mirror of
https://github.com/MatomoCamp/matomocamp-companion-android.git
synced 2024-09-19 16:13:46 +02:00
Improved bookmark add/remove vector animation and make it compatible with any background color
This commit is contained in:
parent
01e1c25f36
commit
bedab2071c
18 changed files with 99 additions and 103 deletions
|
@ -266,10 +266,10 @@ public class EventDetailsFragment extends Fragment {
|
||||||
|
|
||||||
if (isBookmarked) {
|
if (isBookmarked) {
|
||||||
actionButton.setContentDescription(getString(R.string.remove_bookmark));
|
actionButton.setContentDescription(getString(R.string.remove_bookmark));
|
||||||
actionButton.setImageResource(animate ? R.drawable.avd_fab_bookmark_add_24dp : R.drawable.ic_bookmark_white_24dp);
|
actionButton.setImageResource(animate ? R.drawable.avd_bookmark_add_24dp : R.drawable.ic_bookmark_white_24dp);
|
||||||
} else {
|
} else {
|
||||||
actionButton.setContentDescription(getString(R.string.add_bookmark));
|
actionButton.setContentDescription(getString(R.string.add_bookmark));
|
||||||
actionButton.setImageResource(animate ? R.drawable.avd_fab_bookmark_remove_24dp : R.drawable.ic_bookmark_outline_white_24dp);
|
actionButton.setImageResource(animate ? R.drawable.avd_bookmark_remove_24dp : R.drawable.ic_bookmark_outline_white_24dp);
|
||||||
}
|
}
|
||||||
if (animate) {
|
if (animate) {
|
||||||
((Animatable) actionButton.getDrawable()).start();
|
((Animatable) actionButton.getDrawable()).start();
|
||||||
|
@ -289,10 +289,10 @@ public class EventDetailsFragment extends Fragment {
|
||||||
|
|
||||||
if (isBookmarked) {
|
if (isBookmarked) {
|
||||||
bookmarkMenuItem.setTitle(R.string.remove_bookmark);
|
bookmarkMenuItem.setTitle(R.string.remove_bookmark);
|
||||||
bookmarkMenuItem.setIcon(animate ? R.drawable.avd_appbar_bookmark_add_24dp : R.drawable.ic_bookmark_white_24dp);
|
bookmarkMenuItem.setIcon(animate ? R.drawable.avd_bookmark_add_24dp : R.drawable.ic_bookmark_white_24dp);
|
||||||
} else {
|
} else {
|
||||||
bookmarkMenuItem.setTitle(R.string.add_bookmark);
|
bookmarkMenuItem.setTitle(R.string.add_bookmark);
|
||||||
bookmarkMenuItem.setIcon(animate ? R.drawable.avd_appbar_bookmark_remove_24dp : R.drawable.ic_bookmark_outline_white_24dp);
|
bookmarkMenuItem.setIcon(animate ? R.drawable.avd_bookmark_remove_24dp : R.drawable.ic_bookmark_outline_white_24dp);
|
||||||
}
|
}
|
||||||
if (animate) {
|
if (animate) {
|
||||||
((Animatable) bookmarkMenuItem.getIcon()).stop();
|
((Animatable) bookmarkMenuItem.getIcon()).stop();
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:ordering="sequentially">
|
android:ordering="sequentially">
|
||||||
<objectAnimator
|
<objectAnimator
|
||||||
android:name="check"
|
android:duration="200"
|
||||||
android:duration="250"
|
android:propertyName="scaleX"
|
||||||
android:propertyName="trimPathEnd"
|
android:valueFrom="1"
|
||||||
android:valueFrom="0"
|
|
||||||
android:valueTo="0"/>
|
|
||||||
<objectAnimator
|
|
||||||
android:name="check"
|
|
||||||
android:duration="250"
|
|
||||||
android:interpolator="@android:anim/accelerate_interpolator"
|
|
||||||
android:propertyName="trimPathEnd"
|
|
||||||
android:valueFrom="0"
|
|
||||||
android:valueTo="1"/>
|
android:valueTo="1"/>
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="300"
|
||||||
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
android:propertyName="scaleX"
|
||||||
|
android:valueFrom="1"
|
||||||
|
android:valueTo="0"/>
|
||||||
</set>
|
</set>
|
|
@ -1,8 +1,7 @@
|
||||||
<objectAnimator
|
<objectAnimator
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:name="check"
|
android:duration="300"
|
||||||
android:duration="250"
|
|
||||||
android:interpolator="@android:anim/decelerate_interpolator"
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
android:propertyName="trimPathEnd"
|
android:propertyName="scaleX"
|
||||||
android:valueFrom="1"
|
android:valueFrom="0"
|
||||||
android:valueTo="0"/>
|
android:valueTo="1"/>
|
|
@ -1,14 +1,12 @@
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:ordering="sequentially">
|
android:ordering="sequentially">
|
||||||
<objectAnimator
|
<objectAnimator
|
||||||
android:name="filler"
|
|
||||||
android:duration="250"
|
android:duration="250"
|
||||||
android:propertyName="fillAlpha"
|
android:propertyName="fillAlpha"
|
||||||
android:valueFrom="1"
|
android:valueFrom="1"
|
||||||
android:valueTo="1"/>
|
android:valueTo="1"/>
|
||||||
<objectAnimator
|
<objectAnimator
|
||||||
android:name="filler"
|
android:duration="0"
|
||||||
android:duration="250"
|
|
||||||
android:propertyName="fillAlpha"
|
android:propertyName="fillAlpha"
|
||||||
android:valueFrom="1"
|
android:valueFrom="1"
|
||||||
android:valueTo="0"/>
|
android:valueTo="0"/>
|
13
app/src/main/res/animator-v11/bookmark_toggle_out.xml
Normal file
13
app/src/main/res/animator-v11/bookmark_toggle_out.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:ordering="sequentially">
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="250"
|
||||||
|
android:propertyName="fillAlpha"
|
||||||
|
android:valueFrom="0"
|
||||||
|
android:valueTo="0"/>
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="0"
|
||||||
|
android:propertyName="fillAlpha"
|
||||||
|
android:valueFrom="0"
|
||||||
|
android:valueTo="1"/>
|
||||||
|
</set>
|
|
@ -1,7 +1,7 @@
|
||||||
<objectAnimator
|
<objectAnimator
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:name="filler"
|
|
||||||
android:duration="250"
|
android:duration="250"
|
||||||
android:propertyName="fillAlpha"
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
android:propertyName="scaleY"
|
||||||
android:valueFrom="0"
|
android:valueFrom="0"
|
||||||
android:valueTo="1"/>
|
android:valueTo="1"/>
|
14
app/src/main/res/animator-v11/bookmark_zoom_out.xml
Normal file
14
app/src/main/res/animator-v11/bookmark_zoom_out.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:ordering="sequentially">
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="250"
|
||||||
|
android:propertyName="scaleY"
|
||||||
|
android:valueFrom="1"
|
||||||
|
android:valueTo="1"/>
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="250"
|
||||||
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
|
android:propertyName="scaleY"
|
||||||
|
android:valueFrom="1"
|
||||||
|
android:valueTo="0"/>
|
||||||
|
</set>
|
|
@ -1,9 +0,0 @@
|
||||||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:drawable="@drawable/ic_avd_appbar_bookmark_24dp">
|
|
||||||
<target
|
|
||||||
android:name="filler"
|
|
||||||
android:animation="@animator/bookmark_fade_in"/>
|
|
||||||
<target
|
|
||||||
android:name="check"
|
|
||||||
android:animation="@animator/bookmark_check_in"/>
|
|
||||||
</animated-vector>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:drawable="@drawable/ic_avd_appbar_bookmark_24dp">
|
|
||||||
<target
|
|
||||||
android:name="filler"
|
|
||||||
android:animation="@animator/bookmark_fade_out"/>
|
|
||||||
<target
|
|
||||||
android:name="check"
|
|
||||||
android:animation="@animator/bookmark_check_out"/>
|
|
||||||
</animated-vector>
|
|
12
app/src/main/res/drawable/avd_bookmark_add_24dp.xml
Normal file
12
app/src/main/res/drawable/avd_bookmark_add_24dp.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:drawable="@drawable/ic_avd_bookmark_24dp">
|
||||||
|
<target
|
||||||
|
android:name="outline_extension"
|
||||||
|
android:animation="@animator/bookmark_toggle_in"/>
|
||||||
|
<target
|
||||||
|
android:name="zoom_group"
|
||||||
|
android:animation="@animator/bookmark_zoom_in"/>
|
||||||
|
<target
|
||||||
|
android:name="filler_group"
|
||||||
|
android:animation="@animator/bookmark_check_in"/>
|
||||||
|
</animated-vector>
|
12
app/src/main/res/drawable/avd_bookmark_remove_24dp.xml
Normal file
12
app/src/main/res/drawable/avd_bookmark_remove_24dp.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:drawable="@drawable/ic_avd_bookmark_24dp">
|
||||||
|
<target
|
||||||
|
android:name="outline_extension"
|
||||||
|
android:animation="@animator/bookmark_toggle_out"/>
|
||||||
|
<target
|
||||||
|
android:name="zoom_group"
|
||||||
|
android:animation="@animator/bookmark_zoom_out"/>
|
||||||
|
<target
|
||||||
|
android:name="filler_group"
|
||||||
|
android:animation="@animator/bookmark_check_out"/>
|
||||||
|
</animated-vector>
|
|
@ -1,9 +0,0 @@
|
||||||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:drawable="@drawable/ic_avd_fab_bookmark_24dp">
|
|
||||||
<target
|
|
||||||
android:name="filler"
|
|
||||||
android:animation="@animator/bookmark_fade_in"/>
|
|
||||||
<target
|
|
||||||
android:name="check"
|
|
||||||
android:animation="@animator/bookmark_check_in"/>
|
|
||||||
</animated-vector>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:drawable="@drawable/ic_avd_fab_bookmark_24dp">
|
|
||||||
<target
|
|
||||||
android:name="filler"
|
|
||||||
android:animation="@animator/bookmark_fade_out"/>
|
|
||||||
<target
|
|
||||||
android:name="check"
|
|
||||||
android:animation="@animator/bookmark_check_out"/>
|
|
||||||
</animated-vector>
|
|
|
@ -1,19 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:name="bookmark_outline"
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="@string/path_ic_bookmark_outline"/>
|
|
||||||
<path
|
|
||||||
android:name="filler"
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="@string/path_ic_bookmark_filler"/>
|
|
||||||
<path
|
|
||||||
android:name="check"
|
|
||||||
android:pathData="@string/path_ic_bookmark_check"
|
|
||||||
android:strokeColor="?attr/colorPrimary"
|
|
||||||
android:strokeWidth="2"/>
|
|
||||||
</vector>
|
|
27
app/src/main/res/drawable/ic_avd_bookmark_24dp.xml
Normal file
27
app/src/main/res/drawable/ic_avd_bookmark_24dp.xml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M18,18V5H7V18L12,15.82L17,18H18M17,3A2,2 0 0,1 19,5V21L12,18L5,21V5C5,3.89 5.9,3 7,3H17"/>
|
||||||
|
<path
|
||||||
|
android:name="outline_extension"
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M11,7H13V9H15V11H13V13H11V11H9V9H11V7ZM17,4.5H18.5V18.5H17Z"/>
|
||||||
|
<group
|
||||||
|
android:name="zoom_group"
|
||||||
|
android:pivotY="18">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M5.5,4.5H18.5V18H5.5ZM11,14L17.25,7.76L15.84,6.34L11,11.18L8.41,8.59L7,10L11,14Z"/>
|
||||||
|
<group
|
||||||
|
android:name="filler_group"
|
||||||
|
android:pivotX="17.5">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M6.75,5H17.5V15H6.75Z"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</vector>
|
|
@ -1,19 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:name="bookmark_outline"
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="@string/path_ic_bookmark_outline"/>
|
|
||||||
<path
|
|
||||||
android:name="filler"
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="@string/path_ic_bookmark_filler"/>
|
|
||||||
<path
|
|
||||||
android:name="check"
|
|
||||||
android:pathData="@string/path_ic_bookmark_check"
|
|
||||||
android:strokeColor="?attr/colorAccent"
|
|
||||||
android:strokeWidth="2"/>
|
|
||||||
</vector>
|
|
|
@ -5,5 +5,5 @@
|
||||||
android:viewportHeight="24.0">
|
android:viewportHeight="24.0">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="@string/path_ic_bookmark_outline"/>
|
android:pathData="M17,18V5H7V18L12,15.82L17,18M17,3A2,2 0 0,1 19,5V21L12,18L5,21V5C5,3.89 5.9,3 7,3H17M11,7H13V9H15V11H13V13H11V11H9V9H11V7Z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="path_ic_bookmark" translatable="false">M17,3A2,2 0 0,1 19,5V21L12,18L5,21V5C5,3.89 5.9,3 7,3H17M11,14L17.25,7.76L15.84,6.34L11,11.18L8.41,8.59L7,10L11,14Z</string>
|
<string name="path_ic_bookmark" translatable="false">M17,3A2,2 0 0,1 19,5V21L12,18L5,21V5C5,3.89 5.9,3 7,3H17M11,14L17.25,7.76L15.84,6.34L11,11.18L8.41,8.59L7,10L11,14Z</string>
|
||||||
<string name="path_ic_bookmark_filler" translatable="false">M6,4h12v14h-12z</string>
|
|
||||||
<string name="path_ic_bookmark_check" translatable="false">M7.71,9.3L11,12.59L16.55,7.05</string>
|
|
||||||
<string name="path_ic_bookmark_outline" translatable="false">M17,18V5H7V18L12,15.82L17,18M17,3A2,2 0 0,1 19,5V21L12,18L5,21V5C5,3.89 5.9,3 7,3H17M11,7H13V9H15V11H13V13H11V11H9V9H11V7Z</string>
|
|
||||||
<string name="path_ic_play_circle_outline" translatable="false">M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z</string>
|
<string name="path_ic_play_circle_outline" translatable="false">M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z</string>
|
||||||
<string name="path_shortcut_background" translatable="false">M24,24m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0</string>
|
<string name="path_shortcut_background" translatable="false">M24,24m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue