Skip to content

Commit

Permalink
Merge pull request willowtreeapps#98 from willowtreeapps/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Theodore Wilson authored Jul 10, 2017
2 parents 2744d69 + 73618de commit 7f93649
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, @Nullable
listView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// Animate in the visible children
spruceAnimator = new Spruce.SpruceBuilder(listView)
.sortWith(new DefaultSort(100))
.animateWith(DefaultAnimations.shrinkAnimator(listView, 800),
ObjectAnimator.ofFloat(listView, "translationX", -listView.getWidth(), 0f).setDuration(800))
.start();
initSpruce();
}
});

Expand All @@ -93,6 +88,14 @@ public void onResume() {
}
}

private void initSpruce() {
spruceAnimator = new Spruce.SpruceBuilder(listView)
.sortWith(new DefaultSort(100))
.animateWith(DefaultAnimations.shrinkAnimator(listView, 800),
ObjectAnimator.ofFloat(listView, "translationX", -listView.getWidth(), 0f).setDuration(800))
.start();
}

private class ListViewAdapter extends BaseAdapter {

private List<ExampleData> placeholderList;
Expand All @@ -114,9 +117,7 @@ class ViewHolder implements View.OnClickListener{

@Override
public void onClick(View v) {
if (spruceAnimator != null) {
spruceAnimator.start();
}
initSpruce();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, @Nullable
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
super.onLayoutChildren(recycler, state);
// Animate in the visible children
spruceAnimator = new Spruce.SpruceBuilder(recyclerView)
.sortWith(new DefaultSort(100))
.animateWith(DefaultAnimations.shrinkAnimator(recyclerView, 800),
ObjectAnimator.ofFloat(recyclerView, "translationX", -recyclerView.getWidth(), 0f).setDuration(800))
.start();

initSpruce();
}
};

Expand All @@ -93,6 +87,14 @@ public void onResume() {
}
}

private void initSpruce() {
spruceAnimator = new Spruce.SpruceBuilder(recyclerView)
.sortWith(new DefaultSort(100))
.animateWith(DefaultAnimations.shrinkAnimator(recyclerView, 800),
ObjectAnimator.ofFloat(recyclerView, "translationX", -recyclerView.getWidth(), 0f).setDuration(800))
.start();
}

private class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ViewHolder> {

List<ExampleData> placeholderList;
Expand All @@ -109,9 +111,7 @@ class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener

@Override
public void onClick(View v) {
if (spruceAnimator != null) {
spruceAnimator.start();
}
initSpruce();
}
}

Expand Down

0 comments on commit 7f93649

Please sign in to comment.