Android Open Source - android-collapse-calendar-view Size View Holder






From Project

Back to project page android-collapse-calendar-view.

License

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.

Java Source Code

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();
    }
}




Java Source Code List

com.wefika.calendar.CollapseCalendarView.java
com.wefika.calendar.example.MainActivity.java
com.wefika.calendar.manager.CalendarManager.java
com.wefika.calendar.manager.CalendarUnit.java
com.wefika.calendar.manager.Day.java
com.wefika.calendar.manager.Month.java
com.wefika.calendar.manager.ProgressManagerImpl.java
com.wefika.calendar.manager.ProgressManager.java
com.wefika.calendar.manager.RangeUnit.java
com.wefika.calendar.manager.ResizeManager.java
com.wefika.calendar.manager.Week.java
com.wefika.calendar.models.AbstractViewHolder.java
com.wefika.calendar.models.SizeViewHolder.java
com.wefika.calendar.models.StubViewHolder.java
com.wefika.calendar.widget.DayView.java
com.wefika.calendar.widget.WeekView.java