當前位置: 首頁>>代碼示例>>Java>>正文


Java Animator.addListener方法代碼示例

本文整理匯總了Java中android.animation.Animator.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Animator.addListener方法的具體用法?Java Animator.addListener怎麽用?Java Animator.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.animation.Animator的用法示例。


在下文中一共展示了Animator.addListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: animateDragViewToOriginalPosition

import android.animation.Animator; //導入方法依賴的package包/類
private void animateDragViewToOriginalPosition() {
    if (mDragView != null) {
        Animator anim = new LauncherViewPropertyAnimator(mDragView)
                .translationX(0)
                .translationY(0)
                .scaleX(1)
                .scaleY(1)
                .setDuration(REORDERING_DROP_REPOSITION_DURATION);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                onPostReorderingAnimationCompleted();
            }
        });
        anim.start();
    }
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:18,代碼來源:PagedView.java

示例2: animateDragViewToOriginalPosition

import android.animation.Animator; //導入方法依賴的package包/類
private void animateDragViewToOriginalPosition() {
    if (mDragView != null) {
        Animator anim = LauncherAnimUtils.ofPropertyValuesHolder(mDragView,
                new PropertyListBuilder()
                        .scale(1)
                        .translationX(0)
                        .translationY(0)
                        .build())
                .setDuration(REORDERING_DROP_REPOSITION_DURATION);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                onPostReorderingAnimationCompleted();
            }
        });
        anim.start();
    }
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:19,代碼來源:PagedView.java

示例3: removeViewFromIconRow

import android.animation.Animator; //導入方法依賴的package包/類
private void removeViewFromIconRow(View child) {
    mIconRow.removeView(child);
    mNotifications.remove((NotificationInfo) child.getTag());
    updateOverflowEllipsisVisibility();
    if (mIconRow.getChildCount() == 0) {
        // There are no more icons in the footer, so hide it.
        PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen(
                Launcher.getLauncher(getContext()));
        if (popup != null) {
            Animator collapseFooter = popup.reduceNotificationViewHeight(getHeight(),
                    getResources().getInteger(R.integer.config_removeNotificationViewDuration));
            collapseFooter.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    ((ViewGroup) getParent()).removeView(NotificationFooterLayout.this);
                }
            });
            collapseFooter.start();
        }
    }
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:22,代碼來源:NotificationFooterLayout.java

示例4: createHideItemAnimator

import android.animation.Animator; //導入方法依賴的package包/類
private Animator createHideItemAnimator(final View item) {
  float dx = fab.getX() - item.getX();
  float dy = fab.getY() - item.getY();

  Animator anim = ObjectAnimator.ofPropertyValuesHolder(
      item,
      AnimatorUtils.rotation(720f, 0f),
      AnimatorUtils.translationX(0f, dx),
      AnimatorUtils.translationY(0f, dy)
  );

  anim.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      super.onAnimationEnd(animation);
      item.setTranslationX(0f);
      item.setTranslationY(0f);
    }
  });

  return anim;
}
 
開發者ID:xzg8023,項目名稱:ArcLayout-master,代碼行數:23,代碼來源:DemoLikePathActivity.java

示例5: setDimVisibility

import android.animation.Animator; //導入方法依賴的package包/類
private void setDimVisibility(final boolean visible) {
    Animator animator;
    if (visible) {
        dimView.setVisibility(VISIBLE);
        animator = ObjectAnimator.ofFloat(dimView, "alpha", 0.0f, 1.0f);
    } else {
        animator = ObjectAnimator.ofFloat(dimView, "alpha", 1.0f, 0.0f);
    }
    animator.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (!visible) {
                dimView.setVisibility(GONE);
            }
        }
    });
    animator.setDuration(200);
    animator.start();
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:20,代碼來源:PhotoPaintView.java

示例6: animateShowHideView

import android.animation.Animator; //導入方法依賴的package包/類
private void animateShowHideView(int index, final View view, boolean show) {
    Animator animator = new LauncherViewPropertyAnimator(view).alpha(show ? 1 : 0).withLayer();
    if (show) {
        view.setVisibility(View.VISIBLE);
    } else {
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.INVISIBLE);
            }
        });
    }
    startAnimator(index, animator, THRESHOLD_ANIM_DURATION);
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:15,代碼來源:PinchAnimationManager.java

示例7: setAnimatorEndAction

import android.animation.Animator; //導入方法依賴的package包/類
@SuppressLint("NewApi")
private void setAnimatorEndAction(Animator animator, final Runnable endAction) {
    if (endAction != null) {
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                endAction.run();
            }
        });
    }
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:12,代碼來源:ListViewItemAnimations.java

示例8: hideCircularReveal

import android.animation.Animator; //導入方法依賴的package包/類
public static void hideCircularReveal(final Context context,
                                      final View view,
                                      final RevealAnimationSetting revealSettings,
                                      final int startColor,
                                      final int endColor,
                                      final Dismissible.OnDismissedListener listener) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int cx = revealSettings.getCenterX();
        int cy = revealSettings.getCenterY();
        int width = revealSettings.getWidth();
        int height = revealSettings.getHeight();
        int duration =
                context.getResources().getInteger(android.R.integer.config_mediumAnimTime);

        float initRadius = (float) Math.sqrt(width * width + height * height);
        Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initRadius, 0);
        anim.setDuration(duration);
        anim.setInterpolator(new FastOutSlowInInterpolator());
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
                listener.onDismissed();
            }
        });
        anim.start();
        recolorBackground(view, startColor, endColor, duration);
    } else {
        listener.onDismissed();
    }
}
 
開發者ID:interactiveservices,項目名稱:utils-android,代碼行數:32,代碼來源:AnimUtils.java

示例9: startAnimation

import android.animation.Animator; //導入方法依賴的package包/類
public static void startAnimation(WXSDKInstance mWXSDKInstance, WXComponent component,
                                  @NonNull WXAnimationBean animationBean, @Nullable String callback) {
  if(component == null){
    return;
  }
  if (component.getHostView() == null) {
    AnimationHolder holder = new AnimationHolder(animationBean, callback);
    component.postAnimation(holder);
    return;
  }
  try {
    Animator animator = createAnimator(animationBean, component.getHostView(),mWXSDKInstance.getViewPortWidth());
    if (animator != null) {
      Animator.AnimatorListener animatorCallback = createAnimatorListener(mWXSDKInstance, callback);
      if(Build.VERSION.SDK_INT<Build.VERSION_CODES.JELLY_BEAN_MR2) {
        component.getHostView().setLayerType(View.LAYER_TYPE_HARDWARE, null);
      }
      Interpolator interpolator = createTimeInterpolator(animationBean);
      if (animatorCallback != null) {
        animator.addListener(animatorCallback);
      }
      if (interpolator != null) {
        animator.setInterpolator(interpolator);
      }
      animator.setDuration(animationBean.duration);
      animator.start();
    }
  } catch (RuntimeException e) {
    e.printStackTrace();
    WXLogUtils.e("", e);
  }
}
 
開發者ID:erguotou520,項目名稱:weex-uikit,代碼行數:33,代碼來源:WXAnimationModule.java

示例10: hide

import android.animation.Animator; //導入方法依賴的package包/類
/**
 * 由滿向中間收縮,直到隱藏。
 */
@SuppressLint("NewApi")
public static void hide(final View myView, float endRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.INVISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;
    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 進一法
    int initialRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, endRadius);
    anim.setDuration(durationMills);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            myView.setVisibility(View.INVISIBLE);
        }
    });

    anim.start();
}
 
開發者ID:InnoFang,項目名稱:FamilyBond,代碼行數:32,代碼來源:CircularAnimUtils.java

示例11: circleReveal

import android.animation.Animator; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void circleReveal(final boolean isShow) {

    int width = toolbar.getWidth();
    width -= (getResources().getDimensionPixelSize(R.dimen.abc_action_button_min_width_material) / 2);

    int cx = width;
    int cy = toolbar.getHeight() / 2;

    Animator anim;
    if (isShow)
        anim = ViewAnimationUtils.createCircularReveal(searchToolbar, cx, cy, 0, (float) width);
    else
        anim = ViewAnimationUtils.createCircularReveal(searchToolbar, cx, cy, (float) width, 0);

    anim.setDuration(250L);

    // make the view invisible when the animation is done
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (!isShow) {
                super.onAnimationEnd(animation);
                searchToolbar.setVisibility(View.INVISIBLE);
            }
        }
    });

    // make the view visible and start the animation
    if (isShow) {
        searchToolbar.setVisibility(View.VISIBLE);
        notifySearchExpanded();
    } else {
        notifySearchCallapsed();
    }

    // start the animation
    anim.start();
}
 
開發者ID:UdiOshi85,項目名稱:libSearchToolbar,代碼行數:40,代碼來源:SearchAnimationToolbar.java

示例12: showBottom

import android.animation.Animator; //導入方法依賴的package包/類
private void showBottom(View view, Animator.AnimatorListener listener) {

        view.setVisibility(View.VISIBLE);
        Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(view,
                PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, view.getHeight(), 0f));
        iconAnim.setDuration(VIEW_ANIMATION);
        iconAnim.addListener(listener);
        iconAnim.start();
    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:10,代碼來源:SearchPlaceActivity.java

示例13: getPausePlayAnimator

import android.animation.Animator; //導入方法依賴的package包/類
public Animator getPausePlayAnimator() {
	final Animator anim = ObjectAnimator.ofFloat(this, PROGRESS, mIsPlay ? 1 : 0, mIsPlay ? 0 : 1);
	anim.addListener(new AnimatorListenerAdapter() {
		@Override
		public void onAnimationEnd(Animator animation) {
			mIsPlay = !mIsPlay;
		}
	});
	return anim;
}
 
開發者ID:dibakarece,項目名稱:DMAudioStreamer,代碼行數:11,代碼來源:PlayPauseDrawable.java

示例14: createDismissAnimator

import android.animation.Animator; //導入方法依賴的package包/類
private Animator createDismissAnimator(final Key key, final KeyPreviewView keyPreviewView) {
    final Animator dismissAnimator = mParams.createDismissAnimator(keyPreviewView);
    dismissAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(final Animator animator) {
            dismissKeyPreview(key, false /* withAnimation */);
        }
    });
    return dismissAnimator;
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:11,代碼來源:KeyPreviewChoreographer.java

示例15: onReveal

import android.animation.Animator; //導入方法依賴的package包/類
@OnClick(R.id.reveal)
public void onReveal() {

    // get the center for the clipping circle
    int cx = revealContainer.getWidth() / 2;
    int cy = revealContainer.getHeight() / 2;

    // get the radius for the clipping circle
    float radius = (float) Math.hypot(cx, cy);
    Animator anim;

    if (animateForward) {
        // create the animator for this view (the start radius is zero)
        anim = ViewAnimationUtils.createCircularReveal(revealContainer, cx, cy, 0, radius);

        // make the view visible and start the animation
        revealContainer.setVisibility(View.VISIBLE);
    } else {
        // create the animation (the final radius is zero)
        anim = ViewAnimationUtils.createCircularReveal(revealContainer, cx, cy, radius, 0);

        // make the view invisible when the animation is done
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                revealContainer.setVisibility(View.INVISIBLE);
            }
        });
    }

    anim.start();
    animateForward = !animateForward;
}
 
開發者ID:zawadz88,項目名稱:AnimationShowcase,代碼行數:35,代碼來源:RevealActivity.java


注:本文中的android.animation.Animator.addListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。