Android Open Source - unbounce-android Expanding Layout






From Project

Back to project page unbounce-android.

License

The source code is released under:

MIT License

If you think the Android project unbounce-android 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.ryansteckler.nlpunbounce;
/*from   w ww.j  a  v  a  2  s . c o  m*/
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;

/**
 * Created by rsteckler on 9/9/14.
 */
public class ExpandingLayout extends FrameLayout {

    private int mStartTop;
    private int mFinalTop;
    private int mStartBottom;
    private int mFinalBottom;

    public ExpandingLayout(Context context) {
        super(context);
    }

    public ExpandingLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setAnimationBounds(int startTop, int finalTop, int startBottom, int finalBottom)
    {
        mStartBottom =  startBottom;
        mStartTop = startTop;
        mFinalBottom = finalBottom;
        mFinalTop = finalTop;
    }

    public float getYFraction() {
        if (getHeight() == 0)
            return 0;
        return getY() / getHeight();
    }

    public void setYFraction(float yFraction) {

        if (yFraction <= 0) {
            setY(mStartTop);
            setBottom(mStartBottom - mStartTop);
            setAlpha((float) ((-0.2 - yFraction) * -5));
        }
        else if (yFraction > 0)
        {
            setAlpha(1);

            int newY = (int)(mStartTop - ((mStartTop - mFinalTop) * yFraction));
            setY(newY);
            int newBottom = (int)(mStartBottom + ((mFinalBottom - mStartBottom) * yFraction));
            this.setBottom(newBottom - newY);
        }

        if (yFraction > -0.2 && getVisibility() == INVISIBLE)
        {
            setVisibility(View.VISIBLE);
        }
        else if (yFraction <= -0.2)
            setVisibility(View.INVISIBLE);
    }
}




Java Source Code List

com.example.rsteckler.myapplication.ApplicationTest.java
com.ryansteckler.inappbilling.Base64DecoderException.java
com.ryansteckler.inappbilling.Base64.java
com.ryansteckler.inappbilling.IabException.java
com.ryansteckler.inappbilling.IabHelper.java
com.ryansteckler.inappbilling.IabResult.java
com.ryansteckler.inappbilling.Inventory.java
com.ryansteckler.inappbilling.Purchase.java
com.ryansteckler.inappbilling.Security.java
com.ryansteckler.inappbilling.SkuDetails.java
com.ryansteckler.nlpunbounce.ActivityReceiver.java
com.ryansteckler.nlpunbounce.AlarmDetailFragment.java
com.ryansteckler.nlpunbounce.AlarmsFragment.java
com.ryansteckler.nlpunbounce.BaseDetailFragment.java
com.ryansteckler.nlpunbounce.ExpandingLayout.java
com.ryansteckler.nlpunbounce.HomeFragment.java
com.ryansteckler.nlpunbounce.MaterialSettingsActivity.java
com.ryansteckler.nlpunbounce.NavigationDrawerFragment.java
com.ryansteckler.nlpunbounce.ServiceDetailFragment.java
com.ryansteckler.nlpunbounce.ServicesFragment.java
com.ryansteckler.nlpunbounce.SettingsActivity.java
com.ryansteckler.nlpunbounce.WakelockDetailFragment.java
com.ryansteckler.nlpunbounce.WakelocksFragment.java
com.ryansteckler.nlpunbounce.XposedReceiver.java
com.ryansteckler.nlpunbounce.adapters.AlarmsAdapter.java
com.ryansteckler.nlpunbounce.adapters.BaseAdapter.java
com.ryansteckler.nlpunbounce.adapters.ServicesAdapter.java
com.ryansteckler.nlpunbounce.adapters.WakelocksAdapter.java
com.ryansteckler.nlpunbounce.helpers.DownloadHelper.java
com.ryansteckler.nlpunbounce.helpers.LocaleHelper.java
com.ryansteckler.nlpunbounce.helpers.LogHelper.java
com.ryansteckler.nlpunbounce.helpers.NetworkHelper.java
com.ryansteckler.nlpunbounce.helpers.RootHelper.java
com.ryansteckler.nlpunbounce.helpers.SettingsHelper.java
com.ryansteckler.nlpunbounce.helpers.SortWakeLocks.java
com.ryansteckler.nlpunbounce.helpers.ThemeHelper.java
com.ryansteckler.nlpunbounce.helpers.UidNameResolver.java
com.ryansteckler.nlpunbounce.hooks.Wakelocks.java
com.ryansteckler.nlpunbounce.models.AlarmStats.java
com.ryansteckler.nlpunbounce.models.BaseStatsWrapper.java
com.ryansteckler.nlpunbounce.models.BaseStats.java
com.ryansteckler.nlpunbounce.models.EventLookup.java
com.ryansteckler.nlpunbounce.models.InterimEvent.java
com.ryansteckler.nlpunbounce.models.ServiceStats.java
com.ryansteckler.nlpunbounce.models.UnbounceStatsCollection.java
com.ryansteckler.nlpunbounce.models.WakelockStats.java
com.ryansteckler.nlpunbounce.tasker.TaskerActivity.java
com.ryansteckler.nlpunbounce.tasker.TaskerReceiver.java
com.ryansteckler.nlpunbounce.tasker.TaskerWhichFragment.java