Android Open Source - Mini-Password-Manager Show Hide On Scroll






From Project

Back to project page Mini-Password-Manager.

License

The source code is released under:

MIT License

If you think the Android project Mini-Password-Manager 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.shamanland.fab;
/* ww w .j  av  a  2s.  c  o  m*/
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

/**
 * Implementation of {@link View.OnTouchListener} which shows/hides specified view
 * when {@link #onScrollUp()} and {@link #onScrollDown()} events recognized.
 */
public class ShowHideOnScroll extends ScrollDetector implements Animation.AnimationListener {
    private final View mView;
    private final int mShow;
    private final int mHide;

    /**
     * Construct object with defaults animations {@link R.anim#floating_action_button_show} and {@link R.anim#floating_action_button_hide}.
     *
     * @param view null not allowed
     */
    public ShowHideOnScroll(View view) {
        this(view, R.anim.floating_action_button_show, R.anim.floating_action_button_hide);
    }

    /**
     * Construct object with custom animations.
     *
     * @param view     null not allowed
     * @param animShow anim resource id
     * @param animHide anim resource id
     */
    public ShowHideOnScroll(View view, int animShow, int animHide) {
        super(view.getContext());
        mView = view;
        mShow = animShow;
        mHide = animHide;
    }

    @Override
    public void onScrollDown() {
        if (mView.getVisibility() != View.VISIBLE) {
            mView.setVisibility(View.VISIBLE);
            animate(mShow);
        }
    }

    @Override
    public void onScrollUp() {
        if (mView.getVisibility() == View.VISIBLE) {
            mView.setVisibility(View.GONE);
            animate(mHide);
        }
    }

    private void animate(int anim) {
        if (anim != 0) {
            Animation a = AnimationUtils.loadAnimation(mView.getContext(), anim);
            a.setAnimationListener(this);

            mView.startAnimation(a);
            setIgnore(true);
        }
    }

    @Override
    public void onAnimationStart(Animation animation) {
        // empty
    }

    @Override
    public void onAnimationEnd(Animation animation) {
        setIgnore(false);
    }

    @Override
    public void onAnimationRepeat(Animation animation) {
        // empty
    }
}




Java Source Code List

com.buildacode.tpmfree.ApplicationTest.java
com.haibison.android.lockpattern.ApplicationTest.java
com.haibison.android.lockpattern.LockPatternActivity.java
com.haibison.android.lockpattern.collect.Lists.java
com.haibison.android.lockpattern.util.IEncrypter.java
com.haibison.android.lockpattern.util.InvalidEncrypterException.java
com.haibison.android.lockpattern.util.LoadingDialog.java
com.haibison.android.lockpattern.util.Randoms.java
com.haibison.android.lockpattern.util.Settings.java
com.haibison.android.lockpattern.util.SimpleWeakEncryption.java
com.haibison.android.lockpattern.util.Sys.java
com.haibison.android.lockpattern.util.UI.java
com.haibison.android.lockpattern.widget.LockPatternUtils.java
com.haibison.android.lockpattern.widget.LockPatternView.java
com.haibison.android.lockpattern.widget.LockPatternView_v14.java
com.haibison.android.lockpattern.widget.ViewCompat_v16.java
com.karthikmlore.floatingbutton.ApplicationTest.java
com.karthikmlore.minipasswordmanager.Crypter.java
com.karthikmlore.minipasswordmanager.DBHelper.java
com.karthikmlore.minipasswordmanager.Login.java
com.karthikmlore.minipasswordmanager.NewPattern.java
com.karthikmlore.minipasswordmanager.RecordData.java
com.karthikmlore.minipasswordmanager.Records.java
com.karthikmlore.minipasswordmanager.ServiceListAdapter.java
com.karthikmlore.minipasswordmanager.ServiceList.java
com.karthikmlore.minipasswordmanager.SetService.java
com.shamanland.fab.FloatingActionButton.java
com.shamanland.fab.ScrollDetector.java
com.shamanland.fab.ShowHideOnScroll.java