Skip to content

Commit

Permalink
Merge pull request nickbutcher#239 from alexjlockwood/animated-state-…
Browse files Browse the repository at this point in the history
…list-drawable

use asl for close to down avd
  • Loading branch information
nickbutcher authored Dec 21, 2017
2 parents 3a2878e + f05531f commit ae2ba87
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
10 changes: 2 additions & 8 deletions app/src/main/java/io/plaidapp/ui/PlayerSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,13 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
private void showClose() {
if (dismissState == DISMISS_CLOSE) return;
dismissState = DISMISS_CLOSE;
final AnimatedVectorDrawable downToClose = (AnimatedVectorDrawable)
ContextCompat.getDrawable(this, R.drawable.avd_down_to_close);
close.setImageDrawable(downToClose);
downToClose.start();
close.setImageState(new int[] {android.R.attr.state_expanded}, true);
}

private void showDown() {
if (dismissState == DISMISS_DOWN) return;
dismissState = DISMISS_DOWN;
final AnimatedVectorDrawable closeToDown = (AnimatedVectorDrawable)
ContextCompat.getDrawable(this, R.drawable.avd_close_to_down);
close.setImageDrawable(closeToDown);
closeToDown.start();
close.setImageState(new int[] {-android.R.attr.state_expanded}, true);
}

@OnClick({ R.id.bottom_sheet, R.id.close })
Expand Down
39 changes: 39 additions & 0 deletions app/src/main/res/drawable/asl_close_down.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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-selector xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/close"
android:state_expanded="true"
android:drawable="@drawable/ic_close_down" />

<item
android:id="@+id/down"
android:drawable="@drawable/ic_down" />

<transition
android:fromId="@id/down"
android:toId="@id/close"
android:drawable="@drawable/avd_down_to_close" />

<transition
android:fromId="@id/close"
android:toId="@id/down"
android:drawable="@drawable/avd_close_to_down" />

</animated-selector>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/player_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
android:layout_gravity="center"
android:padding="@dimen/avatar_margin"
android:background="?android:selectableItemBackgroundBorderless"
android:src="@drawable/ic_down"
android:src="@drawable/asl_close_down"
android:visibility="invisible" />

<TextView
Expand Down

0 comments on commit ae2ba87

Please sign in to comment.