Back to project page android-collapse-calendar-view.
The source code is released under:
MIT License
If you think the Android project android-collapse-calendar-view listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.wefika.calendar.models; /*from ww w . j a va 2 s .c o m*/ import android.view.View; import android.view.ViewGroup; /** * Created by Blaz Solar on 17/04/14. */ public class SizeViewHolder extends AbstractViewHolder { private int mMinHeight; private int mMaxHeight; public SizeViewHolder(int minHeight, int maxHeight) { mMinHeight = minHeight; mMaxHeight = maxHeight; } public int getHeight() { return mMaxHeight - mMinHeight; } public void setMinHeight(int minHeight) { mMinHeight = minHeight; } public int getMaxHeight() { return mMaxHeight; } public int getMinHeight() { return mMinHeight; } public void setMaxHeight(int maxHeight) { mMaxHeight = maxHeight; } @Override public void onFinish(boolean done) { if (done) { onShown(); } else { onHidden(); } } public void onShown() { getView().getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT; getView().setVisibility(View.VISIBLE); } public void onHidden() { getView().getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT; getView().setVisibility(View.GONE); } @Override protected void onAnimate(float time) { View view = getView(); view.setVisibility(View.VISIBLE); view.getLayoutParams().height = (int) (getMinHeight() + getHeight() * time); view.requestLayout(); } }