Skip to content

Commit

Permalink
fixed a crash if arrow element not present
Browse files Browse the repository at this point in the history
  • Loading branch information
desnyki committed Oct 13, 2016
1 parent e5f990f commit 551335a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ RelativeLayout bar1 = (RelativeLayout) findViewById(R.id.bar1);
});
```

.openWithAnim(param 1: title bar object, param 2: is child full screen, param 3: do you want to animate the arrow) is the call that opens your accordion.
.openWithAnim(param 1: title bar object, param 2: is child full screen, param 3: do you want to show the title bar if full screen) is the call that opens your accordion.

[1]: ./art/demo.gif
10 changes: 0 additions & 10 deletions app/src/main/res/layout/activity_main_relative.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,7 @@
android:layout_toEndOf="@+id/imgLeft1"
android:paddingStart="24dp"
/>
<ImageView
android:scaleType="fitCenter"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_centerVertical="true"
android:src="@drawable/arrow_right"
android:layout_alignParentEnd="true"
android:tag="arrow"
android:layout_marginRight="@dimen/activity_horizontal_margin"

/>
</RelativeLayout>
<RelativeLayout android:id="@+id/bar2" android:background="@drawable/bar"
android:layout_width="match_parent" android:layout_height="64dp" android:orientation="horizontal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public void run() {
mHeightAnimator.setIntValues(heightRange, beginBottomMargin);
mScrollYAnimator.setIntValues(mScrollView.getScrollY(), beginScrollY);
ImageView arrow = (ImageView) topView.findViewWithTag("arrow");
arrow.animate().rotation(0f);
if(arrow!=null)
arrow.animate().rotation(0f);
animatorSet.start();
postDelayed(new Runnable() {
@Override
Expand Down Expand Up @@ -398,7 +399,7 @@ public void setCloseDistance(int dp){
closeDistance = dp2px(dp);
}

public void openWithAnim(final View topView,final boolean fullScreen, final boolean showTitle) {
public void openWithAnim(final View topView, final boolean fullScreen, final boolean showTitle) {
if(isOpen()) {
closeWithAnim();
}
Expand Down

0 comments on commit 551335a

Please sign in to comment.