Skip to content

Commit

Permalink
New un-liking anim for dribbble shots.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbutcher committed Nov 25, 2015
1 parent 0d735bb commit 9aeb6c8
Show file tree
Hide file tree
Showing 13 changed files with 273 additions and 107 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/io/plaidapp/ui/widget/FABToggle.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public class FABToggle extends ImageButton implements Checkable {

private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};
private static final int[] CHECKED_STATE_SET = { android.R.attr.state_checked };

private boolean isChecked = false;
private int minOffset;
Expand Down Expand Up @@ -71,4 +71,5 @@ public int[] onCreateDrawableState(int extraSpace) {
}
return drawableState;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
public class PinnedOffsetView extends View {

private static final int[] STATE_PINNED = {R.attr.state_pinned};
private static final int[] STATE_PINNED = { R.attr.state_pinned };

private int minOffset;
private boolean isPinned = false;
Expand Down
37 changes: 37 additions & 0 deletions app/src/main/res/animator/heart_break_draw_stroke.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="sequentially">

<!-- first reset state -->
<objectAnimator
android:propertyName="trimPathEnd"
android:valueFrom="0"
android:valueTo="0"
android:duration="0" />

<objectAnimator
android:propertyName="trimPathEnd"
android:valueFrom="0"
android:valueTo="1"
android:startOffset="400"
android:duration="300"
android:interpolator="@android:interpolator/fast_out_slow_in" />

</set>
37 changes: 37 additions & 0 deletions app/src/main/res/animator/heart_break_fade_out.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="sequentially">

<!-- first reset state -->
<objectAnimator
android:propertyName="fillAlpha"
android:valueFrom="1"
android:valueTo="1"
android:duration="0" />

<objectAnimator
android:propertyName="fillAlpha"
android:valueFrom="1"
android:valueTo="0"
android:startOffset="100"
android:duration="300"
android:interpolator="@android:interpolator/linear_out_slow_in" />

</set>
24 changes: 24 additions & 0 deletions app/src/main/res/animator/heart_break_left_rotate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="rotation"
android:valueFrom="0"
android:valueTo="-20"
android:duration="400"
android:interpolator="@android:interpolator/linear_out_slow_in" />
24 changes: 24 additions & 0 deletions app/src/main/res/animator/heart_break_right_rotate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="rotation"
android:valueFrom="0"
android:valueTo="20"
android:duration="400"
android:interpolator="@android:interpolator/linear_out_slow_in" />
35 changes: 0 additions & 35 deletions app/src/main/res/animator/heart_fill.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,4 @@
android:valueTo="@string/heart_clip_shown"
android:valueType="pathType"
android:duration="@integer/heart_fill_time"

android:interpolator="@android:interpolator/fast_out_slow_in" />

<!--<set-->
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:ordering="sequentially">-->

<!--<objectAnimator-->
<!--android:propertyName="pathData"-->
<!--android:valueFrom="@string/heart_clip_hidden"-->
<!--android:valueTo="@string/heart_clip_hidden"-->
<!--android:valueType="pathType"-->
<!--android:duration="@integer/heart_fill_delay" />-->

<!--<objectAnimator-->
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:propertyName="pathData"-->
<!--android:valueFrom="@string/heart_clip_hidden"-->
<!--android:valueTo="@string/heart_clip_shown"-->
<!--android:valueType="pathType"-->
<!--android:duration="@integer/heart_fill_time"-->
<!--android:interpolator="@android:interpolator/decelerate_quad" />-->

<!--</set>-->

<!-- TODO: startDelay seems to be ignored so using a set with a bs first anim. work out why this is happening! -->

<!--<objectAnimator-->
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:propertyName="pathData"-->
<!--android:valueFrom="@string/heart_clip_hidden"-->
<!--android:valueTo="@string/heart_clip_shown"-->
<!--android:valueType="pathType"-->
<!--android:startDelay="2400"-->
<!--android:duration="@android:integer/config_mediumAnimTime"-->
<!--android:interpolator="@android:interpolator/decelerate_quad" />-->
48 changes: 48 additions & 0 deletions app/src/main/res/drawable/avd_heart_empty.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_heart_break">

<!-- rotate and fade out the two broken-halves -->
<target
android:name="broken_heart_left_group"
android:animation="@animator/heart_break_left_rotate" />

<target
android:name="broken_heart_left"
android:animation="@animator/heart_break_fade_out" />

<target
android:name="broken_heart_right_group"
android:animation="@animator/heart_break_right_rotate" />

<target
android:name="broken_heart_right"
android:animation="@animator/heart_break_fade_out" />

<!-- re-draw the stroke -->
<target
android:name="heart_stroke_left_atrium"
android:animation="@animator/heart_break_draw_stroke"/>

<target
android:name="heart_stroke_right_atrium"
android:animation="@animator/heart_break_draw_stroke"/>

</animated-vector>
26 changes: 26 additions & 0 deletions app/src/main/res/drawable/avd_heart_fill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/heart_anim">

<target
android:name="clip"
android:animation="@animator/heart_fill" />

</animated-vector>
74 changes: 6 additions & 68 deletions app/src/main/res/drawable/fab_heart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,78 +26,16 @@

<item
android:id="@+id/not_liked"
android:drawable="@drawable/ic_heart_empty_56dp"/>
android:drawable="@drawable/ic_heart_empty_56dp" />

<transition
android:fromId="@id/not_liked"
android:toId="@id/liked">

<animated-vector android:drawable="@drawable/heart_anim">

<target
android:name="clip"
android:animation="@animator/heart_fill" />

</animated-vector>
</transition>

<!--<transition
android:fromId="@id/not_liked"
android:toId="@id/liked"
android:reversible="false">
<animated-vector android:drawable="@drawable/heart_anim">
<target
android:name="activity_circle"
android:animation="@anim/fab_show_activity_circle" />
<target
android:name="activity_circle_progress_bar"
android:animation="@anim/fab_load_progress" />
<target
android:name="activity_circle_progress"
android:animation="@anim/fab_load_progress_rotate" />
<target
android:name="activity_circle"
android:animation="@anim/fab_hide_activity_circle" />
<target
android:name="progress_bar_empty_right"
android:animation="@anim/fab_show_progress_bar_emptying" />
android:drawable="@drawable/avd_heart_fill" />

<target
android:name="activity_circle_progress_bar"
android:animation="@anim/fab_empty_progress_left" />
<target
android:name="progress_bar_empty_right"
android:animation="@anim/fab_empty_progress_right" />
<target
android:name="clip"
android:animation="@anim/heart_fill" />
</animated-vector>
</transition>-->

<!-- the following transition does seem to be played (and including it breaks the above)
TODO: work out why?! -->

<!-- <transition
<transition
android:fromId="@id/liked"
android:toId="@id/not_liked">
<animated-vector android:drawable="@drawable/heart_anim">
<target
android:name="clip"
android:animation="@animator/heart_empty" />
</animated-vector>
</transition>-->
android:toId="@id/not_liked"
android:drawable="@drawable/avd_heart_empty" />

</animated-selector>
</animated-selector>
Loading

0 comments on commit 9aeb6c8

Please sign in to comment.