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.heinrichreimersoftware.materialintro.view.InkPageIndicator.java

private ValueAnimator createMoveSelectedAnimator(final float moveTo, int was, int now, int steps) {

    // create the actual move animator
    ValueAnimator moveSelected = ValueAnimator.ofFloat(selectedDotX, moveTo);

    // also set up a pending retreat anim  this starts when the move is 75% complete
    retreatAnimation = new PendingRetreatAnimator(was, now, steps,
            now > was ? new RightwardStartPredicate(moveTo - ((moveTo - selectedDotX) * 0.25f))
                    : new LeftwardStartPredicate(moveTo + ((selectedDotX - moveTo) * 0.25f)));
    retreatAnimation.addListener(new AnimatorListenerAdapter() {
        @Override//from   www . j a v  a 2 s.c  o  m
        public void onAnimationEnd(Animator animation) {
            resetState();
            pageChanging = false;
        }
    });
    moveSelected.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            selectedDotX = (Float) valueAnimator.getAnimatedValue();
            retreatAnimation.startIfNecessary(selectedDotX);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                postInvalidateOnAnimation();
            } else {
                postInvalidate();
            }
        }
    });
    moveSelected.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            // set a flag so that we continue to draw the unselected dot in the target position
            // until the selected dot has finished moving into place
            selectedDotInPosition = false;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            // set a flag when anim finishes so that we don't draw both selected & unselected
            // page dots
            selectedDotInPosition = true;
        }
    });
    // slightly delay the start to give the joins a chance to run
    // unless dot isn't in position yet  then don't delay!
    moveSelected.setStartDelay(selectedDotInPosition ? animDuration / 4L : 0L);
    moveSelected.setDuration(animDuration * 3L / 4L);
    moveSelected.setInterpolator(interpolator);
    return moveSelected;
}

From source file:com.me.harris.androidanimations._06_touch.swipelistview.SwipeListViewTouchListener.java

/**
 * Perform dismiss action//from   ww w . j  a  va 2  s  .  c  o m
 * @param dismissView View
 * @param dismissPosition Position of list
 */
private void performDismiss(final View dismissView, final int dismissPosition) {
    final ViewGroup.LayoutParams lp = dismissView.getLayoutParams();
    final int originalHeight = dismissView.getHeight();

    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(animationTime);

    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            --dismissAnimationRefCount;
            if (dismissAnimationRefCount == 0) {
                // No active animations, process all pending dismisses.
                // Sort by descending position
                Collections.sort(pendingDismisses);

                int[] dismissPositions = new int[pendingDismisses.size()];
                for (int i = pendingDismisses.size() - 1; i >= 0; i--) {
                    dismissPositions[i] = pendingDismisses.get(i).position;
                }
                swipeListView.onDismiss(dismissPositions);

                ViewGroup.LayoutParams lp;
                for (PendingDismissData pendingDismiss : pendingDismisses) {
                    // Reset view presentation
                    ViewCompat.setAlpha(pendingDismiss.view, 1f);
                    ViewCompat.setTranslationX(pendingDismiss.view, 0);
                    lp = pendingDismiss.view.getLayoutParams();
                    lp.height = originalHeight;
                    pendingDismiss.view.setLayoutParams(lp);
                }

                pendingDismisses.clear();
            }
        }
    });

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            dismissView.setLayoutParams(lp);
        }
    });

    pendingDismisses.add(new PendingDismissData(dismissPosition, dismissView));
    animator.start();
}

From source file:com.github.cpmproto.categorystepfragment.base.GuidedStepListFragment.java

@Override
public void onKeyPressLeft() {
    try {//from  w  w w  .j a  v  a 2 s . co m
        final View conteintView = getView();

        conteintView.animate().translationX(-conteintView.getWidth()).setDuration(800)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationStart(Animator animation) {
                        super.onAnimationStart(animation);
                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        conteintView.setVisibility(View.GONE);
                    }
                });
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:com.betterAlarm.deskclock.timer.TimerFragment.java

@Override
public void onRightButtonClick(View view) {
    // Respond to add another timer
    final AnimatorListenerAdapter adapter = new AnimatorListenerAdapter() {
        @Override//from   w ww  . j  a  v a 2s . c o m
        public void onAnimationEnd(Animator animation) {
            mSetupView.reset();
            mTimerView.setScaleX(1.0f); // Reset the scale for timer view
            goToSetUpView();
        }
    };
    createRotateAnimator(adapter, true).start();
}

From source file:com.italankin.dictionary.ui.main.MainActivity.java

/**
 * Hide the progress bar.//from   w  ww.j  a  v  a  2s.  co  m
 */
private void hideProgressBar() {
    if (mProgressBar.getVisibility() == View.VISIBLE) {
        mProgressBar.animate().alpha(0).setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                mProgressBar.setVisibility(View.INVISIBLE);
            }
        }).setDuration(PROGRESS_ANIM_DURATION).start();
    }
}

From source file:com.android.deskclock.alarms.AlarmActivity.java

private Animator getAlertAnimator(final View source, final int titleResId, final String infoText,
        final String accessibilityText, final int revealColor, final int backgroundColor) {
    final ViewGroup containerView = (ViewGroup) findViewById(android.R.id.content);

    final Rect sourceBounds = new Rect(0, 0, source.getHeight(), source.getWidth());
    containerView.offsetDescendantRectToMyCoords(source, sourceBounds);

    final int centerX = sourceBounds.centerX();
    final int centerY = sourceBounds.centerY();

    final int xMax = Math.max(centerX, containerView.getWidth() - centerX);
    final int yMax = Math.max(centerY, containerView.getHeight() - centerY);

    final float startRadius = Math.max(sourceBounds.width(), sourceBounds.height()) / 2.0f;
    final float endRadius = (float) Math.sqrt(xMax * xMax + yMax * yMax);

    final CircleView revealView = new CircleView(this).setCenterX(centerX).setCenterY(centerY)
            .setFillColor(revealColor);/*from  www.java 2s  . co m*/
    containerView.addView(revealView);

    // TODO: Fade out source icon over the reveal (like LOLLIPOP version).

    final Animator revealAnimator = ObjectAnimator.ofFloat(revealView, CircleView.RADIUS, startRadius,
            endRadius);
    revealAnimator.setDuration(ALERT_REVEAL_DURATION_MILLIS);
    revealAnimator.setInterpolator(REVEAL_INTERPOLATOR);
    revealAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animator) {
            mAlertView.setVisibility(View.VISIBLE);
            mAlertTitleView.setText(titleResId);

            if (infoText != null) {
                mAlertInfoView.setText(infoText);
                mAlertInfoView.setVisibility(View.VISIBLE);
            }
            mContentView.setVisibility(View.GONE);

            getWindow().setBackgroundDrawable(new ColorDrawable(backgroundColor));
        }
    });

    final ValueAnimator fadeAnimator = ObjectAnimator.ofFloat(revealView, View.ALPHA, 0.0f);
    fadeAnimator.setDuration(ALERT_FADE_DURATION_MILLIS);
    fadeAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            containerView.removeView(revealView);
        }
    });

    final AnimatorSet alertAnimator = new AnimatorSet();
    alertAnimator.play(revealAnimator).before(fadeAnimator);
    alertAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animator) {
            mAlertView.announceForAccessibility(accessibilityText);
            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    finish();
                }
            }, ALERT_DISMISS_DELAY_MILLIS);
        }
    });

    return alertAnimator;
}

From source file:com.fada21.android.hydralist.expandable.ExpandingListViewDelegate.java

/**
 * This method collapses the view that was clicked and animates all the views around it to close around the collapsing view. There are several steps
 * required to do this which are outlined below.
 * //from w  w w . j  a  v a 2s  . c  om
 * <li>Update the layout parameters of the view clicked so as to minimize its height to the original collapsed (default) state.</li> <li>After invoking a
 * layout, the listview will shift all the cells so as to display them most efficiently. Therefore, during the first predraw pass, the listview must be
 * offset by some amount such that given the custom bound change upon collapse, all the cells that need to be on the screen after the layout are rendered by
 * the listview.</li> <li>On the second predraw pass, all the items are first returned to their original location (before the first layout).</li> <li>The
 * collapsing view's bounds are animated to what the final values should be.</li> <li>The bounds above the collapsing view are animated downwards while the
 * bounds below the collapsing view are animated upwards.</li> <li>The extra text is faded out as its contents become visible throughout the animation
 * process.</li>
 * 
 * @param view
 *            collapsing view
 * @param position
 *            item position in list
 * @param id
 *            item id
 */
private void collapseView(final View view, int position, long id) {
    final ExpandableListItem item = (ExpandableListItem) nlv.getItemAtPosition(nlv.getPositionForView(view));

    /* Store the original top and bottom bounds of all the cells. */
    final int oldTop = view.getTop();
    final int oldBottom = view.getBottom();

    final HashMap<View, int[]> oldCoordinates = new HashMap<View, int[]>();

    int childCount = nlv.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View v = nlv.getChildAt(i);
        ViewCompat.setHasTransientState(v, true);
        oldCoordinates.put(v, new int[] { v.getTop(), v.getBottom() });
    }

    /* Update the layout so the extra content becomes invisible. */
    view.setLayoutParams(
            new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, item.getCollapsedHeight()));

    /* Add an onPreDraw listener. */
    final ViewTreeObserver observer = nlv.getViewTreeObserver();
    observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override
        public boolean onPreDraw() {

            if (!mShouldRemoveObserver) {
                /*
                 * Same as for expandingView, the parameters for setSelectionFromTop must
                 * be determined such that the necessary cells of the ListView are rendered
                 * and added to it.
                 */
                mShouldRemoveObserver = true;

                int newTop = view.getTop();
                int newBottom = view.getBottom();

                int newHeight = newBottom - newTop;
                int oldHeight = oldBottom - oldTop;
                int deltaHeight = oldHeight - newHeight;

                mTranslate = getTopAndBottomTranslations(oldTop, oldBottom, deltaHeight, false);

                int currentTop = view.getTop();
                int futureTop = oldTop + mTranslate[0];

                int firstChildStartTop = nlv.getChildAt(0).getTop();
                int firstVisiblePosition = nlv.getFirstVisiblePosition();
                int deltaTop = currentTop - futureTop;

                int i;
                int childCount = nlv.getChildCount();
                for (i = 0; i < childCount; i++) {
                    View v = nlv.getChildAt(i);
                    int height = v.getBottom() - Math.max(0, v.getTop());
                    if (deltaTop - height > 0) {
                        firstVisiblePosition++;
                        deltaTop -= height;
                    } else {
                        break;
                    }
                }

                if (i > 0) {
                    firstChildStartTop = 0;
                }

                nlv.setSelectionFromTop(firstVisiblePosition, firstChildStartTop - deltaTop);

                nlv.requestLayout();

                return false;
            }

            mShouldRemoveObserver = false;
            observer.removeOnPreDrawListener(this);

            int yTranslateTop = mTranslate[0];
            int yTranslateBottom = mTranslate[1];

            int index = nlv.indexOfChild(view);
            int childCount = nlv.getChildCount();
            for (int i = 0; i < childCount; i++) {
                View v = nlv.getChildAt(i);
                int[] old = oldCoordinates.get(v);
                if (old != null) {
                    /*
                     * If the cell was present in the ListView before the collapse and
                     * after the collapse then the bounds are reset to their old values.
                     */
                    v.setTop(old[0]);
                    v.setBottom(old[1]);
                    ViewCompat.setHasTransientState(v, false);
                } else {
                    /*
                     * If the cell is present in the ListView after the collapse but
                     * not before the collapse then the bounds are calculated using
                     * the bottom and top translation of the collapsing cell.
                     */
                    int delta = i > index ? yTranslateBottom : -yTranslateTop;
                    v.setTop(v.getTop() + delta);
                    v.setBottom(v.getBottom() + delta);
                }
            }

            final View expandingLayout = view
                    .findViewById(getExpandingAdapter().getExpandingHelper().getExpandingLayout());

            /* Animates all the cells present on the screen after the collapse. */
            ArrayList<Animator> animations = new ArrayList<Animator>();
            for (int i = 0; i < childCount; i++) {
                View v = nlv.getChildAt(i);
                if (v != view) {
                    float diff = i > index ? -yTranslateBottom : yTranslateTop;
                    if (diff != 0f)
                        animations.add(getAnimation(v, diff, diff));
                }
            }

            /* Adds animation for collapsing the cell that was clicked. */
            animations.add(getAnimation(view, yTranslateTop, -yTranslateBottom));

            /* Adds an animation for fading out the extra content. */
            animations.add(ObjectAnimator.ofFloat(expandingLayout, View.ALPHA, 1, 0));

            /* Disabled the ListView for the duration of the animation. */
            nlv.setEnabled(false);
            nlv.setClickable(false);

            /* Play all the animations created above together at the same time. */
            AnimatorSet s = new AnimatorSet();
            s.playTogether(animations);
            s.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    expandingLayout.setVisibility(View.GONE);
                    view.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
                            AbsListView.LayoutParams.WRAP_CONTENT));
                    item.setExpanded(false);
                    nlv.setEnabled(true);
                    nlv.setClickable(true);
                    /*
                     * Note that alpha must be set back to 1 in case this view is reused
                     * by a cell that was expanded, but not yet collapsed, so its state
                     * should persist in an expanded state with the extra content visible.
                     */
                    expandingLayout.setAlpha(1);
                }
            });
            s.start();

            return true;
        }
    });
}

From source file:cn.oddcloud.www.navigationtabbar.ntb.NavigationTabBar.java

public void setOnTabBarSelectedIndexListener(
        final OnTabBarSelectedIndexListener onTabBarSelectedIndexListener) {
    mOnTabBarSelectedIndexListener = onTabBarSelectedIndexListener;

    if (mAnimatorListener == null)
        mAnimatorListener = new AnimatorListenerAdapter() {
            @Override/*from  w  ww . j  a va 2  s.  c  o  m*/
            public void onAnimationStart(final Animator animation) {
                if (mOnTabBarSelectedIndexListener != null)
                    mOnTabBarSelectedIndexListener.onStartTabSelected(mModels.get(mIndex), mIndex);

                animation.removeListener(this);
                animation.addListener(this);
            }

            @Override
            public void onAnimationEnd(final Animator animation) {
                if (mIsViewPagerMode)
                    return;

                animation.removeListener(this);
                animation.addListener(this);

                if (mOnTabBarSelectedIndexListener != null)
                    mOnTabBarSelectedIndexListener.onEndTabSelected(mModels.get(mIndex), mIndex);
            }
        };
    mAnimator.removeListener(mAnimatorListener);
    mAnimator.addListener(mAnimatorListener);
}

From source file:com.android.settings.widget.DotsPageIndicator.java

private ValueAnimator createMoveSelectedAnimator(final float moveTo, int was, int now, int steps) {
    // create the actual move animator
    ValueAnimator moveSelected = ValueAnimator.ofFloat(selectedDotX, moveTo);

    // also set up a pending retreat anim  this starts when the move is 75% complete
    retreatAnimation = new PendingRetreatAnimator(was, now, steps,
            now > was ? new RightwardStartPredicate(moveTo - ((moveTo - selectedDotX) * 0.25f))
                    : new LeftwardStartPredicate(moveTo + ((selectedDotX - moveTo) * 0.25f)));

    moveSelected.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override/*from w w  w .  ja v  a 2  s. c  om*/
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            // todo avoid autoboxing
            selectedDotX = (Float) valueAnimator.getAnimatedValue();
            retreatAnimation.startIfNecessary(selectedDotX);
            postInvalidateOnAnimation();
        }
    });

    moveSelected.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            // set a flag so that we continue to draw the unselected dot in the target position
            // until the selected dot has finished moving into place
            selectedDotInPosition = false;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            // set a flag when anim finishes so that we don't draw both selected & unselected
            // page dots
            selectedDotInPosition = true;
        }
    });

    // slightly delay the start to give the joins a chance to run
    // unless dot isn't in position yet  then don't delay!
    moveSelected.setStartDelay(selectedDotInPosition ? animDuration / 4L : 0L);
    moveSelected.setDuration(animDuration * 3L / 4L);
    moveSelected.setInterpolator(interpolator);
    return moveSelected;
}

From source file:com.jforce.chapelhillnextbus.ExpandingListView.java

/**
 * This method collapses the view that was clicked and animates all the
 * views around it to close around the collapsing view. There are several
 * steps required to do this which are outlined below.
 * <p/>//from  w w w  .  ja va  2s . c  o m
 * 1. Update the layout parameters of the view clicked so as to minimize its
 * height to the original collapsed (default) state. 2. After invoking a
 * layout, the listview will shift all the cells so as to display them most
 * efficiently. Therefore, during the first predraw pass, the listview must
 * be offset by some amount such that given the custom bound change upon
 * collapse, all the cells that need to be on the screen after the layout
 * are rendered by the listview. 3. On the second predraw pass, all the
 * items are first returned to their original location (before the first
 * layout). 4. The collapsing view's bounds are animated to what the final
 * values should be. 5. The bounds above the collapsing view are animated
 * downwards while the bounds below the collapsing view are animated
 * upwards. 6. The extra text is faded out as its contents become visible
 * throughout the animation process.
 */

private void collapseView(final View view) {
    final ExpandableListItem viewObject = (ExpandableListItem) getItemAtPosition(getPositionForView(view));

    /* Store the original top and bottom bounds of all the cells. */
    final int oldTop = view.getTop();
    final int oldBottom = view.getBottom();

    final HashMap<View, int[]> oldCoordinates = new HashMap<View, int[]>();

    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        View v = getChildAt(i);
        ViewCompat.setHasTransientState(v, true);
        oldCoordinates.put(v, new int[] { v.getTop(), v.getBottom() });
    }

    /* Update the layout so the extra content becomes invisible. */
    view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, viewObject.getCollapsedHeight()));

    /* Add an onPreDraw listener. */
    final ViewTreeObserver observer = getViewTreeObserver();
    observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override
        public boolean onPreDraw() {

            if (!mShouldRemoveObserver) {
                /*
                 * Same as for expandingView, the parameters for
                 * setSelectionFromTop must be determined such that the
                 * necessary cells of the ListView are rendered and added to
                 * it.
                 */
                mShouldRemoveObserver = true;

                int newTop = view.getTop();
                int newBottom = view.getBottom();

                int newHeight = newBottom - newTop;
                int oldHeight = oldBottom - oldTop;
                int deltaHeight = oldHeight - newHeight;

                mTranslate = getTopAndBottomTranslations(oldTop, oldBottom, deltaHeight, false);

                int currentTop = view.getTop();
                int futureTop = oldTop + mTranslate[0];

                int firstChildStartTop = getChildAt(0).getTop();
                int firstVisiblePosition = getFirstVisiblePosition();
                int deltaTop = currentTop - futureTop;

                int i;
                int childCount = getChildCount();
                for (i = 0; i < childCount; i++) {
                    View v = getChildAt(i);
                    int height = v.getBottom() - Math.max(0, v.getTop());
                    if (deltaTop - height > 0) {
                        firstVisiblePosition++;
                        deltaTop -= height;
                    } else {
                        break;
                    }
                }

                if (i > 0) {
                    firstChildStartTop = 0;
                }

                setSelectionFromTop(firstVisiblePosition, firstChildStartTop - deltaTop);

                requestLayout();

                return false;
            }

            mShouldRemoveObserver = false;
            observer.removeOnPreDrawListener(this);

            int yTranslateTop = mTranslate[0];
            int yTranslateBottom = mTranslate[1];

            int index = indexOfChild(view);
            int childCount = getChildCount();
            for (int i = 0; i < childCount; i++) {
                View v = getChildAt(i);
                int[] old = oldCoordinates.get(v);
                if (old != null) {
                    /*
                     * If the cell was present in the ListView before the
                     * collapse and after the collapse then the bounds are
                     * reset to their old values.
                     */
                    v.setTop(old[0]);
                    v.setBottom(old[1]);
                    ViewCompat.setHasTransientState(v, false);
                } else {
                    /*
                     * If the cell is present in the ListView after the
                     * collapse but not before the collapse then the bounds
                     * are calculated using the bottom and top translation
                     * of the collapsing cell.
                     */
                    int delta = i > index ? yTranslateBottom : -yTranslateTop;
                    v.setTop(v.getTop() + delta);
                    v.setBottom(v.getBottom() + delta);
                }
            }

            final View expandingLayout = view.findViewById(R.id.expanding_layout);

            /*
             * Animates all the cells present on the screen after the
             * collapse.
             */
            ArrayList<Animator> animations = new ArrayList<Animator>();
            for (int i = 0; i < childCount; i++) {
                View v = getChildAt(i);
                if (v != view) {
                    float diff = i > index ? -yTranslateBottom : yTranslateTop;
                    animations.add(getAnimation(v, diff, diff));
                }
            }

            /* Adds animation for collapsing the cell that was clicked. */
            animations.add(getAnimation(view, yTranslateTop, -yTranslateBottom));

            /* Adds an animation for fading out the extra content. */
            animations.add(ObjectAnimator.ofFloat(expandingLayout, View.ALPHA, 1, 0));

            /* Disabled the ListView for the duration of the animation. */
            setEnabled(false);
            setClickable(false);

            /*
             * Play all the animations created above together at the same
             * time.
             */
            AnimatorSet s = new AnimatorSet();
            s.playTogether(animations);
            s.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    expandingLayout.setVisibility(View.GONE);
                    view.setLayoutParams(
                            new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
                    viewObject.setExpanded(false);
                    setEnabled(true);
                    setClickable(true);
                    /*
                     * Note that alpha must be set back to 1 in case this
                     * view is reused by a cell that was expanded, but not
                     * yet collapsed, so its state should persist in an
                     * expanded state with the extra content visible.
                     */
                    expandingLayout.setAlpha(1);
                }
            });
            s.start();

            return true;
        }
    });
}