use of android.view.animation.AccelerateInterpolator in project smartmodule by carozhu.
the class FloatingActionMenu method init.
private void init() {
mOvershootInterpolator = new OvershootInterpolator();
mAccelerateInterpolator = new AccelerateInterpolator();
initCover();
}
use of android.view.animation.AccelerateInterpolator in project android_frameworks_base by crdroidandroid.
the class PhoneStatusBar method setAreThereNotifications.
@Override
protected void setAreThereNotifications() {
if (SPEW) {
final boolean clearable = hasActiveNotifications() && hasActiveClearableNotifications();
Log.d(TAG, "setAreThereNotifications: N=" + mNotificationData.getActiveNotifications().size() + " any=" + hasActiveNotifications() + " clearable=" + clearable);
}
final View nlo = mStatusBarView.findViewById(R.id.notification_lights_out);
final boolean showDot = hasActiveNotifications() && !areLightsOn();
if (showDot != (nlo.getAlpha() == 1.0f)) {
if (showDot) {
nlo.setAlpha(0f);
nlo.setVisibility(View.VISIBLE);
}
nlo.animate().alpha(showDot ? 1 : 0).setDuration(showDot ? 750 : 250).setInterpolator(new AccelerateInterpolator(2.0f)).setListener(showDot ? null : new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator _a) {
nlo.setVisibility(View.GONE);
}
}).start();
}
findAndUpdateMediaNotifications();
}
use of android.view.animation.AccelerateInterpolator in project floatingsearchview by arimorty.
the class MenuView method hideIfRoomItems.
/**
* Hides all the menu items flagged with "ifRoom"
*
* @param withAnim
*/
public void hideIfRoomItems(boolean withAnim) {
if (mMenu == -1) {
return;
}
mActionShowAlwaysItems.clear();
cancelChildAnimListAndClear();
List<MenuItemImpl> showAlwaysActionItems = filter(mMenuItems, new MenuItemImplPredicate() {
@Override
public boolean apply(MenuItemImpl menuItem) {
return menuItem.getIcon() != null && menuItem.requiresActionButton();
}
});
int actionItemIndex;
for (actionItemIndex = 0; actionItemIndex < mActionItems.size() && actionItemIndex < showAlwaysActionItems.size(); actionItemIndex++) {
final MenuItemImpl showAlwaysActionItem = showAlwaysActionItems.get(actionItemIndex);
// reset action item image if needed
if (mActionItems.get(actionItemIndex).getItemId() != showAlwaysActionItem.getItemId()) {
ImageView action = (ImageView) getChildAt(actionItemIndex);
action.setImageDrawable(showAlwaysActionItem.getIcon());
Util.setIconColor(action, mOverflowIconColor);
action.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mMenuCallback != null) {
mMenuCallback.onMenuItemSelected(mMenuBuilder, showAlwaysActionItem);
}
}
});
}
mActionShowAlwaysItems.add(showAlwaysActionItem);
}
final int diff = mActionItems.size() - actionItemIndex + (mHasOverflow ? 1 : 0);
anims = new ArrayList<>();
// add anims for moving showAlwaysItem views to the right
for (int i = 0; i < actionItemIndex; i++) {
final View currentChild = getChildAt(i);
final float destTransX = (ACTION_DIMENSION_PX * diff) - (mHasOverflow ? Util.dpToPx(8) : 0);
anims.add(ViewPropertyObjectAnimator.animate(currentChild).setDuration(withAnim ? HIDE_IF_ROOM_ITEMS_ANIM_DURATION : 0).setInterpolator(new AccelerateInterpolator()).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
currentChild.setTranslationX(destTransX);
}
}).translationXBy(destTransX).get());
}
// add anims for moving to right and/or zooming out previously shown items
for (int i = actionItemIndex; i < (diff + actionItemIndex); i++) {
final View currentView = getChildAt(i);
currentView.setClickable(false);
// move to right
if (i != (getChildCount() - 1)) {
anims.add(ViewPropertyObjectAnimator.animate(currentView).setDuration(withAnim ? HIDE_IF_ROOM_ITEMS_ANIM_DURATION : 0).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
currentView.setTranslationX(ACTION_DIMENSION_PX);
}
}).translationXBy(ACTION_DIMENSION_PX).get());
}
// scale and zoom out
anims.add(ViewPropertyObjectAnimator.animate(currentView).setDuration(withAnim ? HIDE_IF_ROOM_ITEMS_ANIM_DURATION : 0).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
currentView.setScaleX(0.5f);
}
}).scaleX(.5f).get());
anims.add(ViewPropertyObjectAnimator.animate(currentView).setDuration(withAnim ? HIDE_IF_ROOM_ITEMS_ANIM_DURATION : 0).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
currentView.setScaleY(0.5f);
}
}).scaleY(.5f).get());
anims.add(ViewPropertyObjectAnimator.animate(currentView).setDuration(withAnim ? HIDE_IF_ROOM_ITEMS_ANIM_DURATION : 0).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
currentView.setAlpha(0.0f);
}
}).alpha(0.0f).get());
}
final int actionItemsCount = actionItemIndex;
// finally, run animation
if (!anims.isEmpty()) {
AnimatorSet animSet = new AnimatorSet();
if (!withAnim) {
// temporary, from laziness
animSet.setDuration(0);
}
animSet.playTogether(anims.toArray(new ObjectAnimator[anims.size()]));
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (mOnVisibleWidthChangedListener != null) {
mVisibleWidth = ((int) ACTION_DIMENSION_PX * actionItemsCount);
mOnVisibleWidthChangedListener.onItemsMenuVisibleWidthChanged(mVisibleWidth);
}
}
});
animSet.start();
}
}
use of android.view.animation.AccelerateInterpolator in project PreviewSeekBar by rubensousa.
the class PreviewAnimatorLollipopImpl method startUnreveal.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startUnreveal() {
Animator animator = ViewAnimationUtils.createCircularReveal(previewChildView, getCenterX(previewChildView), getCenterY(previewChildView), getRadius(previewChildView), morphView.getWidth() * 2);
animator.setTarget(previewChildView);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
previewChildView.animate().setListener(null);
frameView.setVisibility(View.INVISIBLE);
previewChildView.setVisibility(View.INVISIBLE);
morphView.setVisibility(View.VISIBLE);
morphView.animate().y(getHideY()).scaleY(0.5f).scaleX(0.5f).setDuration(UNMORPH_MOVE_DURATION).setInterpolator(new AccelerateInterpolator()).setListener(hideListener);
}
});
frameView.animate().alpha(1f).setDuration(UNMORPH_UNREVEAL_DURATION).setInterpolator(new AccelerateInterpolator());
animator.setDuration(UNMORPH_UNREVEAL_DURATION).setInterpolator(new AccelerateInterpolator());
animator.start();
}
use of android.view.animation.AccelerateInterpolator in project AndriodDesignPattern by Shimingli.
the class StrategyModelFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
FivePriceStrategy fivePriceStrategy = new FivePriceStrategy();
ContextPrice contextPrice = new ContextPrice(fivePriceStrategy);
int i = contextPrice.setNewPrice(10);
SevenPriceStrategy sevenPriceStrategy = new SevenPriceStrategy();
contextPrice.setNewStrategy(sevenPriceStrategy);
int i1 = contextPrice.setNewPrice(20);
mTextView = (TextView) getView().findViewById(R.id.tvdes);
final TextView viewById1 = (TextView) getView().findViewById(R.id.tv_text);
mTextView.setText("第一种策略模式实现的价格:\n原价是10 减半后" + i + "\n" + "第二种策略模式实现的价格\n原价是20 7折后" + i1);
// 时间差值器,也是策略模式
final Button viewById = (Button) getView().findViewById(R.id.btn);
viewById.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(viewById1, View.ALPHA, 0, 1);
// 这里就相当于策略模式实现的
// 加速
objectAnimator.setInterpolator(new AccelerateInterpolator());
// huilai
objectAnimator.setInterpolator(new OvershootInterpolator());
objectAnimator.start();
}
});
}
Aggregations