Example usage for android.animation AnimatorListenerAdapter AnimatorListenerAdapter

List of usage examples for android.animation AnimatorListenerAdapter AnimatorListenerAdapter

Introduction

In this page you can find the example usage for android.animation AnimatorListenerAdapter AnimatorListenerAdapter.

Prototype

AnimatorListenerAdapter

Source Link

Usage

From source file:com.android.calculator2.Calculator.java

private void onClear() {
    if (mEvaluator.getExpr().isEmpty()) {
        return;//  w w w  .ja v a  2  s  .c o  m
    }
    cancelIfEvaluating(true);
    announceClearedForAccessibility();
    reveal(mCurrentButton, R.color.calculator_accent_color, new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mUnprocessedChars = null;
            mResultText.clear();
            mEvaluator.clear();
            setState(CalculatorState.INPUT);
            redisplayFormula();
        }
    });
}

From source file:android.support.transition.Transition.java

private void runAnimator(Animator animator, final ArrayMap<Animator, AnimationInfo> runningAnimators) {
    if (animator != null) {
        // TODO: could be a single listener instance for all of them since it uses the param
        animator.addListener(new AnimatorListenerAdapter() {
            @Override/* w w  w. jav  a  2s  .  com*/
            public void onAnimationStart(Animator animation) {
                mCurrentAnimators.add(animation);
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                runningAnimators.remove(animation);
                mCurrentAnimators.remove(animation);
            }
        });
        animate(animator);
    }
}

From source file:com.commonsware.cwac.crossport.design.widget.TextInputLayout.java

private void setError(@Nullable final CharSequence error, final boolean animate) {
    mError = error;/*from w w  w.jav a  2  s  .  c om*/

    if (!mErrorEnabled) {
        if (TextUtils.isEmpty(error)) {
            // If error isn't enabled, and the error is empty, just return
            return;
        }
        // Else, we'll assume that they want to enable the error functionality
        setErrorEnabled(true);
    }

    mErrorShown = !TextUtils.isEmpty(error);

    // Cancel any on-going animation
    mErrorView.animate().cancel();

    if (mErrorShown) {
        mErrorView.setText(error);
        mErrorView.setVisibility(VISIBLE);

        if (animate) {
            if (mErrorView.getAlpha() == 1f) {
                // If it's currently 100% show, we'll animate it from 0
                mErrorView.setAlpha(0f);
            }
            mErrorView.animate().alpha(1f).setDuration(ANIMATION_DURATION)
                    .setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR)
                    .setListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationStart(Animator animator) {
                            mErrorView.setVisibility(VISIBLE);
                        }
                    }).start();
        } else {
            // Set alpha to 1f, just in case
            mErrorView.setAlpha(1f);
        }
    } else {
        if (mErrorView.getVisibility() == VISIBLE) {
            if (animate) {
                mErrorView.animate().alpha(0f).setDuration(ANIMATION_DURATION)
                        .setInterpolator(AnimationUtils.FAST_OUT_LINEAR_IN_INTERPOLATOR)
                        .setListener(new AnimatorListenerAdapter() {
                            @Override
                            public void onAnimationEnd(Animator animator) {
                                mErrorView.setText(error);
                                mErrorView.setVisibility(INVISIBLE);
                            }
                        }).start();
            } else {
                mErrorView.setText(error);
                mErrorView.setVisibility(INVISIBLE);
            }
        }
    }

    updateEditTextBackground();
    updateLabelState(animate);
}

From source file:com.android.launcher3.folder.Folder.java

public void animateClosed() {
    if (!(getParent() instanceof DragLayer))
        return;/*from  w  w w  . j a v a  2 s.  c o m*/
    final ObjectAnimator oa = LauncherAnimUtils.ofViewAlphaAndScale(this, 0, 0.9f, 0.9f);
    oa.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            setLayerType(LAYER_TYPE_NONE, null);
            close(true);
        }

        @Override
        public void onAnimationStart(Animator animation) {
            Utilities.sendCustomAccessibilityEvent(Folder.this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
                    getContext().getString(R.string.folder_closed));
            mState = STATE_ANIMATING;
        }
    });
    oa.setDuration(mExpandDuration);
    setLayerType(LAYER_TYPE_HARDWARE, null);
    oa.start();
}

From source file:com.lovejjfg.powerrefresh.PowerRefreshLayout.java

private void performAnim(int start, int end, final AnimListener listener) {
    ValueAnimator animator = ValueAnimator.ofInt(start, end);
    animator.setDuration(ANIMATION_DURATION).start();
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override//from w ww  .jav  a 2 s .c  o  m
        public void onAnimationUpdate(ValueAnimator animation) {
            int value = (int) animation.getAnimatedValue();
            scrollTo(0, value);
            postInvalidate();
            listener.onGoing();
        }
    });
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            listener.onEnd();
        }
    });
}

From source file:com.google.samples.apps.iosched.ui.BaseActivity.java

private void setupAccountBoxToggle() {
    int selfItem = getSelfNavDrawerItem();
    if (mDrawerLayout == null || selfItem == NAVDRAWER_ITEM_INVALID) {
        // this Activity does not have a nav drawer
        return;/*from  w  ww . j  ava  2s  . c  o m*/
    }
    mExpandAccountBoxIndicator.setImageResource(mAccountBoxExpanded ? R.drawable.ic_navview_accounts_collapse
            : R.drawable.ic_navview_accounts_expand);
    int hideTranslateY = -mAccountListContainer.getHeight() / 4; // last 25% of animation
    if (mAccountBoxExpanded && mAccountListContainer.getTranslationY() == 0) {
        // initial setup
        mAccountListContainer.setAlpha(0);
        mAccountListContainer.setTranslationY(hideTranslateY);
    }

    AnimatorSet set = new AnimatorSet();
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mDrawerItemsListContainer.setVisibility(mAccountBoxExpanded ? View.INVISIBLE : View.VISIBLE);
            mAccountListContainer.setVisibility(mAccountBoxExpanded ? View.VISIBLE : View.INVISIBLE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            onAnimationEnd(animation);
        }
    });

    if (mAccountBoxExpanded) {
        mAccountListContainer.setVisibility(View.VISIBLE);
        AnimatorSet subSet = new AnimatorSet();
        subSet.playTogether(
                ObjectAnimator.ofFloat(mAccountListContainer, View.ALPHA, 1)
                        .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION),
                ObjectAnimator.ofFloat(mAccountListContainer, View.TRANSLATION_Y, 0)
                        .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION));
        set.playSequentially(ObjectAnimator.ofFloat(mDrawerItemsListContainer, View.ALPHA, 0)
                .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION), subSet);
        set.start();
    } else {
        mDrawerItemsListContainer.setVisibility(View.VISIBLE);
        AnimatorSet subSet = new AnimatorSet();
        subSet.playTogether(
                ObjectAnimator.ofFloat(mAccountListContainer, View.ALPHA, 0)
                        .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION),
                ObjectAnimator.ofFloat(mAccountListContainer, View.TRANSLATION_Y, hideTranslateY)
                        .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION));
        set.playSequentially(subSet, ObjectAnimator.ofFloat(mDrawerItemsListContainer, View.ALPHA, 1)
                .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION));
        set.start();
    }

    set.start();
}

From source file:com.android.calculator2.Calculator.java

void onError(final int errorResourceId) {
    if (mCurrentState == CalculatorState.EVALUATE) {
        setState(CalculatorState.ANIMATE);
        mResultText.announceForAccessibility(getResources().getString(errorResourceId));
        reveal(mCurrentButton, R.color.calculator_error_color, new AnimatorListenerAdapter() {
            @Override//from w  w  w .  jav a2s.c o  m
            public void onAnimationEnd(Animator animation) {
                setState(CalculatorState.ERROR);
                mResultText.displayError(errorResourceId);
            }
        });
    } else if (mCurrentState == CalculatorState.INIT) {
        setState(CalculatorState.ERROR);
        mResultText.displayError(errorResourceId);
    } else {
        mResultText.clear();
    }
}

From source file:com.saarang.samples.apps.iosched.ui.BaseActivity.java

private void setupAccountBoxToggle() {
    int selfItem = getSelfNavDrawerItem();
    if (mDrawerLayout == null || selfItem == NAVDRAWER_ITEM_INVALID) {
        // this Activity does not have a nav drawer
        return;/* w w  w .  j  a  v  a 2  s  . com*/
    }
    mExpandAccountBoxIndicator.setImageResource(
            mAccountBoxExpanded ? com.saarang.samples.apps.iosched.R.drawable.ic_drawer_accounts_collapse
                    : com.saarang.samples.apps.iosched.R.drawable.ic_drawer_accounts_expand);
    int hideTranslateY = -mAccountListContainer.getHeight() / 4; // last 25% of animation
    if (mAccountBoxExpanded && mAccountListContainer.getTranslationY() == 0) {
        // initial setup
        mAccountListContainer.setAlpha(0);
        mAccountListContainer.setTranslationY(hideTranslateY);
    }

    AnimatorSet set = new AnimatorSet();
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mDrawerItemsListContainer.setVisibility(mAccountBoxExpanded ? View.INVISIBLE : View.VISIBLE);
            mAccountListContainer.setVisibility(mAccountBoxExpanded ? View.VISIBLE : View.INVISIBLE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            onAnimationEnd(animation);
        }
    });

    if (mAccountBoxExpanded) {
        mAccountListContainer.setVisibility(View.VISIBLE);
        AnimatorSet subSet = new AnimatorSet();
        subSet.playTogether(
                ObjectAnimator.ofFloat(mAccountListContainer, View.ALPHA, 1)
                        .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION),
                ObjectAnimator.ofFloat(mAccountListContainer, View.TRANSLATION_Y, 0)
                        .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION));
        set.playSequentially(ObjectAnimator.ofFloat(mDrawerItemsListContainer, View.ALPHA, 0)
                .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION), subSet);
        set.start();
    } else {
        mDrawerItemsListContainer.setVisibility(View.VISIBLE);
        AnimatorSet subSet = new AnimatorSet();
        subSet.playTogether(
                ObjectAnimator.ofFloat(mAccountListContainer, View.ALPHA, 0)
                        .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION),
                ObjectAnimator.ofFloat(mAccountListContainer, View.TRANSLATION_Y, hideTranslateY)
                        .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION));
        set.playSequentially(subSet, ObjectAnimator.ofFloat(mDrawerItemsListContainer, View.ALPHA, 1)
                .setDuration(ACCOUNT_BOX_EXPAND_ANIM_DURATION));
        set.start();
    }

    set.start();
}

From source file:com.quanliren.quan_one.pull.swipe.SwipeRefreshLayout.java

@Override
public boolean onTouchEvent(MotionEvent ev) {
    final int action = MotionEventCompat.getActionMasked(ev);

    if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
        mReturningToStart = false;/* w w w.  ja v a2s. c  om*/
    }

    if (!isEnabled() || mReturningToStart || canChildScrollUp()) {
        // Fail fast if we're not in a state where a swipe is possible
        return false;
    }

    switch (action) {
    case MotionEvent.ACTION_DOWN:
        mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
        mIsBeingDragged = false;
        break;

    case MotionEvent.ACTION_MOVE: {
        final int pointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
        if (pointerIndex < 0) {
            Log.e(LOG_TAG, "Got ACTION_MOVE event but have an invalid active pointer id.");
            return false;
        }

        final float y = MotionEventCompat.getY(ev, pointerIndex);
        final float overscrollTop = (y - mInitialMotionY) * DRAG_RATE;
        if (mIsBeingDragged) {
            mProgress.showArrow(true);
            float originalDragPercent = overscrollTop / mTotalDragDistance;
            if (originalDragPercent < 0) {
                return false;
            }
            float dragPercent = Math.min(1f, Math.abs(originalDragPercent));
            float adjustedPercent = (float) Math.max(dragPercent - .4, 0) * 5 / 3;
            float extraOS = Math.abs(overscrollTop) - mTotalDragDistance;
            float slingshotDist = mUsingCustomStart ? mSpinnerFinalOffset - mOriginalOffsetTop
                    : mSpinnerFinalOffset;
            float tensionSlingshotPercent = Math.max(0, Math.min(extraOS, slingshotDist * 2) / slingshotDist);
            float tensionPercent = (float) ((tensionSlingshotPercent / 4)
                    - Math.pow((tensionSlingshotPercent / 4), 2)) * 2f;
            float extraMove = (slingshotDist) * tensionPercent * 2;

            int targetY = mOriginalOffsetTop + (int) ((slingshotDist * dragPercent) + extraMove);
            // where 1.0f is a full circle
            if (mCircleView.getVisibility() != View.VISIBLE) {
                mCircleView.setVisibility(View.VISIBLE);
            }
            if (!mScale) {
                ViewCompat.setScaleX(mCircleView, 1f);
                ViewCompat.setScaleY(mCircleView, 1f);
            }
            if (overscrollTop < mTotalDragDistance) {
                if (mScale) {
                    setAnimationProgress(overscrollTop / mTotalDragDistance);
                }
                if (mProgress.getAlpha() > STARTING_PROGRESS_ALPHA
                        && !isAnimationRunning(mAlphaStartAnimation)) {
                    // Animate the alpha
                    startProgressAlphaStartAnimation();
                }
                float strokeStart = adjustedPercent * .8f;
                mProgress.setStartEndTrim(0f, Math.min(MAX_PROGRESS_ANGLE, strokeStart));
                mProgress.setArrowScale(Math.min(1f, adjustedPercent));
            } else {
                if (mProgress.getAlpha() < MAX_ALPHA && !isAnimationRunning(mAlphaMaxAnimation)) {
                    // Animate the alpha
                    startProgressAlphaMaxAnimation();
                }
            }
            float rotation = (-0.25f + .4f * adjustedPercent + tensionPercent * 2) * .5f;
            mProgress.setProgressRotation(rotation);
            setTargetOffsetTopAndBottom(targetY - mCurrentTargetOffsetTop, true /* requires update */);
        }
        break;
    }
    case MotionEventCompat.ACTION_POINTER_DOWN: {
        final int index = MotionEventCompat.getActionIndex(ev);
        mActivePointerId = MotionEventCompat.getPointerId(ev, index);
        break;
    }

    case MotionEventCompat.ACTION_POINTER_UP:
        onSecondaryPointerUp(ev);
        break;

    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL: {
        if (mActivePointerId == INVALID_POINTER) {
            if (action == MotionEvent.ACTION_UP) {
                Log.e(LOG_TAG, "Got ACTION_UP event but don't have an active pointer id.");
            }
            return false;
        }
        final int pointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
        final float y = MotionEventCompat.getY(ev, pointerIndex);
        final float overscrollTop = (y - mInitialMotionY) * DRAG_RATE;
        mIsBeingDragged = false;
        if (overscrollTop > mTotalDragDistance) {
            setRefreshing(true, true /* notify */);
        } else {
            // cancel refresh
            mRefreshing = false;
            mProgress.setStartEndTrim(0f, 0f);
            AnimatorListenerAdapter listener = null;
            if (!mScale) {
                listener = new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        animation.removeListener(this);
                        if (!mScale) {
                            startScaleDownAnimation(null);
                        }
                    }
                };
            }
            animateOffsetToStartPosition(mCurrentTargetOffsetTop, listener);
            mProgress.showArrow(false);
        }
        mActivePointerId = INVALID_POINTER;
        return false;
    }
    }

    return true;
}

From source file:com.bt.heliniumstudentapp.MainActivity.java

@SuppressWarnings("deprecation")
protected static void setUI(final int view, final int action) {
    if (action == HeliniumStudentApp.ACTION_SHORT_IN
            || (action == HeliniumStudentApp.ACTION_INIT_IN && view == HeliniumStudentApp.VIEW_GRADES)) {
        containerFL.setVisibility(View.GONE);
        drawerDL.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
        drawerDLtoggle.setToolbarNavigationClickListener(null);
        drawerDLtoggle.syncState();/*  w w  w  .j  a  v a 2  s.co m*/

        weekTV.setText("");
        yearTV.setText("");

        prevIV.setAlpha(130);
        historyIV.setAlpha(130);
        nextIV.setAlpha(130);
        containerFL.setAlpha(0);
        statusLL.setAlpha(1);
    } else if (action == HeliniumStudentApp.ACTION_SHORT_OUT
            || (action == HeliniumStudentApp.ACTION_INIT_OUT && view == HeliniumStudentApp.VIEW_GRADES)) {
        containerFL.setVisibility(View.VISIBLE);
        drawerDL.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
        drawerDLtoggle.setToolbarNavigationClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                drawerDL.openDrawer(drawerNV);
            }
        });
        drawerDLtoggle.syncState();

        historyIV.setAlpha(255);

        switch (GradesFragment.termFocus) {
        case 1:
            prevIV.setAlpha(130);
            nextIV.setAlpha(255);
            break;
        case 4:
            prevIV.setAlpha(255);
            nextIV.setAlpha(130);
            break;
        default:
            prevIV.setAlpha(255);
            nextIV.setAlpha(255);
            break;
        }

        final int shortAnimationDuration = mainContext.getResources()
                .getInteger(android.R.integer.config_shortAnimTime);

        statusLL.animate().alpha(0).setDuration(shortAnimationDuration).setListener(null);
        containerFL.animate().alpha(1).setDuration(shortAnimationDuration).setListener(null);
    } else if (action == HeliniumStudentApp.ACTION_INIT_IN) {
        toolbarTB.setVisibility(View.GONE);
        containerFL.setVisibility(View.GONE);
        containerLL.setVisibility(View.GONE);
        drawerDL.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

        toolbarTB.setAlpha(0);
        containerFL.setAlpha(0);
        containerLL.setAlpha(0);
        statusLL.setAlpha(1);
    } else if (action == HeliniumStudentApp.ACTION_INIT_OUT) {
        toolbarTB.setVisibility(View.VISIBLE);
        containerFL.setVisibility(View.VISIBLE);
        containerLL.setVisibility(View.VISIBLE);
        drawerDL.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);

        setStatusBar(mainContext);

        final int shortAnimationDuration = mainContext.getResources()
                .getInteger(android.R.integer.config_shortAnimTime);
        final int longAnimationDuration = mainContext.getResources()
                .getInteger(android.R.integer.config_longAnimTime);

        toolbarTB.animate().alpha(1).setDuration(longAnimationDuration).setListener(null);
        containerLL.animate().alpha(1).setDuration(longAnimationDuration)
                .setListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);

                        statusLL.animate().alpha(0).setDuration(shortAnimationDuration).setListener(null);
                        containerFL.animate().alpha(1).setDuration(shortAnimationDuration).setListener(null);
                    }
                });
    } else {
        switch (view) {
        case HeliniumStudentApp.VIEW_SCHEDULE:
            switch (action) {
            case HeliniumStudentApp.ACTION_ONLINE:
            case HeliniumStudentApp.ACTION_ONLINE_1:
                prevIV.setAlpha(255);
                historyIV.setAlpha(255);
                nextIV.setAlpha(255);
                break;
            case HeliniumStudentApp.ACTION_OFFLINE:
            case HeliniumStudentApp.ACTION_OFFLINE_1:
                if (PreferenceManager.getDefaultSharedPreferences(mainContext).getString("schedule_1",
                        null) == null) {
                    prevIV.setAlpha(130);
                    historyIV.setAlpha(130);
                    nextIV.setAlpha(130);
                } else {
                    if (ScheduleFragment.scheduleFocus == new GregorianCalendar(HeliniumStudentApp.LOCALE)
                            .get(Calendar.WEEK_OF_YEAR) + 1) {
                        prevIV.setAlpha(255);
                        historyIV.setAlpha(255);
                        nextIV.setAlpha(130);
                    } else {
                        prevIV.setAlpha(130);
                        historyIV.setAlpha(130);
                        nextIV.setAlpha(255);
                    }
                }
                break;
            case HeliniumStudentApp.ACTION_REFRESH_IN:
                drawerDL.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
                drawerDLtoggle.setToolbarNavigationClickListener(null);
                drawerDLtoggle.syncState();

                prevIV.setAlpha(130);
                historyIV.setAlpha(130);
                nextIV.setAlpha(130);

                ((SwipeRefreshLayout) ScheduleFragment.scheduleLayout).setRefreshing(true);
                break;
            case HeliniumStudentApp.ACTION_REFRESH_OUT:
                drawerDL.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
                drawerDLtoggle.setToolbarNavigationClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        drawerDL.openDrawer(drawerNV);
                    }
                });
                drawerDLtoggle.syncState();

                prevIV.setAlpha(255);
                historyIV.setAlpha(255);
                nextIV.setAlpha(255);

                ((SwipeRefreshLayout) ScheduleFragment.scheduleLayout).setRefreshing(false);
                break;
            /*case HeliniumStudentApp.ERR_UNDEFINED:
            case HeliniumStudentApp.ERR_OK:
             //FIXME HANDLE!!!
             break;*/
            }
            break;
        case HeliniumStudentApp.VIEW_GRADES:
            switch (action) {
            case HeliniumStudentApp.ACTION_ONLINE:
            case HeliniumStudentApp.ACTION_ONLINE_1:
                historyIV.setAlpha(255);

                switch (GradesFragment.termFocus) {
                case 1:
                    prevIV.setAlpha(130);
                    nextIV.setAlpha(255);
                    break;
                case 4:
                    prevIV.setAlpha(255);
                    nextIV.setAlpha(130);
                    break;
                default:
                    prevIV.setAlpha(255);
                    nextIV.setAlpha(255);
                    break;
                }
                break;
            case HeliniumStudentApp.ACTION_OFFLINE:
            case HeliniumStudentApp.ACTION_OFFLINE_1:
                final int databaseFocus = Integer.parseInt(PreferenceManager
                        .getDefaultSharedPreferences(mainContext).getString("pref_grades_term", "1"));

                prevIV.setAlpha(130);
                historyIV.setAlpha(130);
                nextIV.setAlpha(130);

                if (PreferenceManager.getDefaultSharedPreferences(mainContext).getString("html_grades",
                        null) != null) {
                    if (GradesFragment.yearFocus == 0 && GradesFragment.termFocus > databaseFocus)
                        prevIV.setAlpha(255);
                    if (GradesFragment.yearFocus != 0 || GradesFragment.termFocus != databaseFocus)
                        historyIV.setAlpha(255);
                    if (GradesFragment.yearFocus == 0 && GradesFragment.termFocus < databaseFocus)
                        nextIV.setAlpha(255);
                }
                break;
            case HeliniumStudentApp.ACTION_REFRESH_IN:
                drawerDL.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
                drawerDLtoggle.setToolbarNavigationClickListener(null);
                drawerDLtoggle.syncState();

                prevIV.setAlpha(130);
                historyIV.setAlpha(130);
                nextIV.setAlpha(130);

                ((SwipeRefreshLayout) GradesFragment.gradesLayout).setRefreshing(true);
                break;
            case HeliniumStudentApp.ACTION_REFRESH_OUT:
                drawerDL.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
                drawerDLtoggle.setToolbarNavigationClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        drawerDL.openDrawer(drawerNV);
                    }
                });
                drawerDLtoggle.syncState();

                historyIV.setAlpha(255);

                switch (GradesFragment.termFocus) {
                case 1:
                    prevIV.setAlpha(130);
                    nextIV.setAlpha(255);
                    break;
                case 4:
                    prevIV.setAlpha(255);
                    nextIV.setAlpha(130);
                    break;
                default:
                    prevIV.setAlpha(255);
                    nextIV.setAlpha(255);
                    break;
                }

                ((SwipeRefreshLayout) GradesFragment.gradesLayout).setRefreshing(false);
                break;
            /*case HeliniumStudentApp.ERR_UNDEFINED:
            case HeliniumStudentApp.ERR_OK:
             //FIXME HANDLE!!!
             break;*/
            }
            break;
        }
    }
}