List of usage examples for android.animation AnimatorSet setInterpolator
@Override public void setInterpolator(TimeInterpolator interpolator)
From source file:support.plus.reportit.rv.FragmentActivity.java
private void createCustomAnimation() { final FloatingActionMenu menu3 = (FloatingActionMenu) findViewById(R.id.menuShareReport); AnimatorSet set = new AnimatorSet(); ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleX", 1.0f, 0.2f); ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleY", 1.0f, 0.2f); ObjectAnimator scaleInX = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleX", 0.2f, 1.0f); ObjectAnimator scaleInY = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleY", 0.2f, 1.0f); scaleOutX.setDuration(50);//from w w w .ja va 2 s . c om scaleOutY.setDuration(50); scaleInX.setDuration(150); scaleInY.setDuration(150); scaleInX.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { menu3.getMenuIconView().setImageResource( menu3.isOpened() ? R.drawable.ic_unarchive_white_24dp : R.drawable.ic_done_white_24dp); } }); set.play(scaleOutX).with(scaleOutY); set.play(scaleInX).with(scaleInY).after(scaleOutX); set.setInterpolator(new OvershootInterpolator(2)); menu3.setIconToggleAnimatorSet(set); }
From source file:com.androidinspain.deskclock.alarms.dataadapter.ExpandedAlarmViewHolder.java
@Override public Animator onAnimateChange(List<Object> payloads, int fromLeft, int fromTop, int fromRight, int fromBottom, long duration) { if (payloads == null || payloads.isEmpty() || !payloads.contains(ANIMATE_REPEAT_DAYS)) { return null; }//from w w w . j a v a 2s . c o m final boolean isExpansion = repeatDays.getVisibility() == View.VISIBLE; final int height = repeatDays.getHeight(); setTranslationY(isExpansion ? -height : 0f, isExpansion ? -height : height); repeatDays.setVisibility(View.VISIBLE); repeatDays.setAlpha(isExpansion ? 0f : 1f); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether( AnimatorUtils.getBoundsAnimator(itemView, fromLeft, fromTop, fromRight, fromBottom, itemView.getLeft(), itemView.getTop(), itemView.getRight(), itemView.getBottom()), ObjectAnimator.ofFloat(repeatDays, View.ALPHA, isExpansion ? 1f : 0f), ObjectAnimator.ofFloat(repeatDays, TRANSLATION_Y, isExpansion ? 0f : -height), ObjectAnimator.ofFloat(ringtone, TRANSLATION_Y, 0f), ObjectAnimator.ofFloat(vibrate, TRANSLATION_Y, 0f), ObjectAnimator.ofFloat(editLabel, TRANSLATION_Y, 0f), ObjectAnimator.ofFloat(preemptiveDismissButton, TRANSLATION_Y, 0f), ObjectAnimator.ofFloat(hairLine, TRANSLATION_Y, 0f), ObjectAnimator.ofFloat(delete, TRANSLATION_Y, 0f), ObjectAnimator.ofFloat(arrow, TRANSLATION_Y, 0f)); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { setTranslationY(0f, 0f); repeatDays.setAlpha(1f); repeatDays.setVisibility(isExpansion ? View.VISIBLE : View.GONE); itemView.requestLayout(); } }); animatorSet.setDuration(duration); animatorSet.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); return animatorSet; }
From source file:org.mariotaku.twidere.fragment.AccountsDashboardFragment.java
private void onAccountSelected(AccountProfileImageViewHolder holder, @NonNull final ParcelableAccount account) { if (mSwitchAccountAnimationPlaying) return;//from w w w . j a v a 2s . com final ImageView snapshotView = mFloatingProfileImageSnapshotView; final ShapedImageView profileImageView = mAccountProfileImageView; final ShapedImageView clickedImageView = holder.getIconView(); // Reset snapshot view position snapshotView.setPivotX(0); snapshotView.setPivotY(0); snapshotView.setTranslationX(0); snapshotView.setTranslationY(0); final Matrix matrix = new Matrix(); final RectF sourceBounds = new RectF(), destBounds = new RectF(), snapshotBounds = new RectF(); getLocationOnScreen(clickedImageView, sourceBounds); getLocationOnScreen(profileImageView, destBounds); getLocationOnScreen(snapshotView, snapshotBounds); final float finalScale = destBounds.width() / sourceBounds.width(); final Bitmap snapshotBitmap = TransitionUtils.createViewBitmap(clickedImageView, matrix, new RectF(0, 0, sourceBounds.width(), sourceBounds.height())); final ViewGroup.LayoutParams lp = snapshotView.getLayoutParams(); lp.width = clickedImageView.getWidth(); lp.height = clickedImageView.getHeight(); snapshotView.setLayoutParams(lp); // Copied from MaterialNavigationDrawer: https://github.com/madcyph3r/AdvancedMaterialDrawer/ AnimatorSet set = new AnimatorSet(); set.play(ObjectAnimator.ofFloat(snapshotView, View.TRANSLATION_X, sourceBounds.left - snapshotBounds.left, destBounds.left - snapshotBounds.left)) .with(ObjectAnimator.ofFloat(snapshotView, View.TRANSLATION_Y, sourceBounds.top - snapshotBounds.top, destBounds.top - snapshotBounds.top)) .with(ObjectAnimator.ofFloat(snapshotView, View.SCALE_X, 1, finalScale)) .with(ObjectAnimator.ofFloat(snapshotView, View.SCALE_Y, 1, finalScale)) .with(ObjectAnimator.ofFloat(profileImageView, View.ALPHA, 1, 0)) .with(ObjectAnimator.ofFloat(clickedImageView, View.SCALE_X, 0, 1)) .with(ObjectAnimator.ofFloat(clickedImageView, View.SCALE_Y, 0, 1)); final long animationTransition = 400; set.setDuration(animationTransition); set.setInterpolator(new DecelerateInterpolator()); set.addListener(new AnimatorListener() { private Drawable clickedDrawable; private int[] clickedColors; @Override public void onAnimationStart(Animator animation) { snapshotView.setVisibility(View.VISIBLE); snapshotView.setImageBitmap(snapshotBitmap); final Drawable profileDrawable = profileImageView.getDrawable(); clickedDrawable = clickedImageView.getDrawable(); clickedColors = clickedImageView.getBorderColors(); final ParcelableAccount oldSelectedAccount = mAccountsAdapter.getSelectedAccount(); if (oldSelectedAccount == null) return; mMediaLoader.displayDashboardProfileImage(clickedImageView, oldSelectedAccount, profileDrawable); clickedImageView.setBorderColors(profileImageView.getBorderColors()); displayAccountBanner(account); mSwitchAccountAnimationPlaying = true; } @Override public void onAnimationEnd(Animator animation) { finishAnimation(); } @Override public void onAnimationCancel(Animator animation) { finishAnimation(); } @Override public void onAnimationRepeat(Animator animation) { } private void finishAnimation() { final Editor editor = mPreferences.edit(); editor.putString(KEY_DEFAULT_ACCOUNT_KEY, account.account_key.toString()); editor.apply(); mAccountsAdapter.setSelectedAccount(account); updateAccountActions(); displayCurrentAccount(clickedDrawable); snapshotView.setVisibility(View.INVISIBLE); snapshotView.setImageDrawable(null); profileImageView.setImageDrawable(clickedDrawable); profileImageView.setBorderColors(clickedColors); profileImageView.setAlpha(1f); clickedImageView.setScaleX(1); clickedImageView.setScaleY(1); clickedImageView.setAlpha(1f); mSwitchAccountAnimationPlaying = false; } }); set.start(); }
From source file:com.android.launcher2.AsyncTaskCallback.java
@Override public void onClick(View v) { // When we have exited all apps or are in transition, disregard clicks if (!mLauncher.isAllAppsVisible() || mLauncher.getWorkspace().isSwitchingState()) return;//from w w w. ja v a 2 s . c o m if (v instanceof PagedViewIcon) { // Animate some feedback to the click final ApplicationInfo appInfo = (ApplicationInfo) v.getTag(); // Lock the drawable state to pressed until we return to Launcher if (mPressedIcon != null) { mPressedIcon.lockDrawableState(); } // NOTE: We want all transitions from launcher to act as if the wallpaper were enabled // to be consistent. So re-enable the flag here, and we will re-disable it as necessary // when Launcher resumes and we are still in AllApps. mLauncher.updateWallpaperVisibility(true); mLauncher.startActivitySafely(v, appInfo.intent, appInfo); } else if (v instanceof PagedViewWidget) { // Let the user know that they have to long press to add a widget if (mWidgetInstructionToast != null) { mWidgetInstructionToast.cancel(); } mWidgetInstructionToast = Toast.makeText(getContext(), R.string.long_press_widget_to_add, Toast.LENGTH_SHORT); mWidgetInstructionToast.show(); // Create a little animation to show that the widget can move float offsetY = getResources().getDimensionPixelSize(R.dimen.dragViewOffsetY); final ImageView p = (ImageView) v.findViewById(R.id.widget_preview); AnimatorSet bounce = LauncherAnimUtils.createAnimatorSet(); ValueAnimator tyuAnim = LauncherAnimUtils.ofFloat(p, "translationY", offsetY); tyuAnim.setDuration(125); ValueAnimator tydAnim = LauncherAnimUtils.ofFloat(p, "translationY", 0f); tydAnim.setDuration(100); bounce.play(tyuAnim).before(tydAnim); bounce.setInterpolator(new AccelerateInterpolator()); bounce.start(); } }
From source file:com.phonemetra.turbo.launcher.AsyncTaskCallback.java
@Override public void onClick(View v) { // When we have exited all apps or are in transition, disregard clicks if (!mLauncher.isAllAppsVisible() || mLauncher.getWorkspace().isSwitchingState()) return;//from ww w . ja va 2 s. c o m if (v instanceof PagedViewIcon) { // Animate some feedback to the click final AppInfo appInfo = (AppInfo) v.getTag(); // Lock the drawable state to pressed until we return to Launcher if (mPressedIcon != null) { mPressedIcon.lockDrawableState(); } mLauncher.startActivitySafely(v, appInfo.intent, appInfo); mLauncher.getStats().recordLaunch(appInfo.intent); } else if (v instanceof PagedViewWidget) { // Let the user know that they have to long press to add a widget if (mWidgetInstructionToast != null) { mWidgetInstructionToast.cancel(); } mWidgetInstructionToast = Toast.makeText(getContext(), R.string.long_press_widget_to_add, Toast.LENGTH_SHORT); mWidgetInstructionToast.show(); // Create a little animation to show that the widget can move float offsetY = getResources().getDimensionPixelSize(R.dimen.dragViewOffsetY); final ImageView p = (ImageView) v.findViewById(R.id.widget_preview); AnimatorSet bounce = LauncherAnimUtils.createAnimatorSet(); ValueAnimator tyuAnim = LauncherAnimUtils.ofFloat(p, "translationY", offsetY); tyuAnim.setDuration(125); ValueAnimator tydAnim = LauncherAnimUtils.ofFloat(p, "translationY", 0f); tydAnim.setDuration(100); bounce.play(tyuAnim).before(tydAnim); bounce.setInterpolator(new AccelerateInterpolator()); bounce.start(); } }
From source file:cc.flydev.launcher.Page.java
private void onDropToDelete() { final View dragView = mDragView; final float toScale = 0f; final float toAlpha = 0f; // Create and start the complex animation ArrayList<Animator> animations = new ArrayList<Animator>(); AnimatorSet motionAnim = new AnimatorSet(); motionAnim.setInterpolator(new DecelerateInterpolator(2)); motionAnim.playTogether(ObjectAnimator.ofFloat(dragView, "scaleX", toScale), ObjectAnimator.ofFloat(dragView, "scaleY", toScale)); animations.add(motionAnim);//from ww w.ja v a2 s.c o m AnimatorSet alphaAnim = new AnimatorSet(); alphaAnim.setInterpolator(new LinearInterpolator()); alphaAnim.playTogether(ObjectAnimator.ofFloat(dragView, "alpha", toAlpha)); animations.add(alphaAnim); final Runnable onAnimationEndRunnable = createPostDeleteAnimationRunnable(dragView); AnimatorSet anim = new AnimatorSet(); anim.playTogether(animations); anim.setDuration(DRAG_TO_DELETE_FADE_OUT_DURATION); anim.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animation) { onAnimationEndRunnable.run(); } }); anim.start(); mDeferringForDelete = true; }
From source file:com.aliyun.homeshell.Folder.java
public void showSelectApps(int[] pos) { if (mRunningAnimatorSet != null) { if (!mRunningIsShow) { mRunningAnimatorSet.end();/* w w w . ja va 2 s. c om*/ } else { return; } } if (mAppsSelectView == null) { mAppsSelectView = (FolderAppsSelectView) LayoutInflater.from(getContext()) .inflate(R.layout.folder_apps_select, null); mAppsSelectView.init(this, mInfo, mLauncher); mLauncher.getDragLayer().addView(mAppsSelectView); } mAppsSelectView.initSelectedState(mInfo); mAppsSelectView.setScaleX(0); mAppsSelectView.setScaleY(0); mAppsSelectView.setPivotX(pos[0]); mAppsSelectView.setPivotY(pos[1]); ObjectAnimator visToInvis = ObjectAnimator.ofFloat(this, "alpha", 1, 0); visToInvis.setDuration(mAnimatorDuration); ObjectAnimator invisToVisX = ObjectAnimator.ofFloat(mAppsSelectView, "scaleX", 0, 1); invisToVisX.setDuration(mAnimatorDuration); ObjectAnimator invisToVisY = ObjectAnimator.ofFloat(mAppsSelectView, "scaleY", 0, 1); invisToVisY.setDuration(mAnimatorDuration); List<Animator> animList = new ArrayList<Animator>(); animList.add(visToInvis); animList.add(invisToVisX); animList.add(invisToVisY); final AnimatorSet as = new AnimatorSet(); as.setInterpolator(new LinearInterpolator()); as.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { mAppsSelectView.setVisibility(View.VISIBLE); mRunningAnimatorSet = as; mRunningIsShow = true; } @Override public void onAnimationEnd(Animator animator) { mRunningAnimatorSet = null; mRunningIsShow = false; Folder.this.setVisibility(View.INVISIBLE); mAppsSelectView.setVisibility(View.VISIBLE); DisplayMetrics metric = new DisplayMetrics(); mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metric); int width = metric.widthPixels; int height = metric.heightPixels; mAppsSelectView.setPivotX(width / 2); mAppsSelectView.setPivotY(height / 2); mAppsSelectView.setFocusableInTouchMode(true); mAppsSelectView.setFocusable(true); mAppsSelectView.requestFocus(); } }); as.playTogether(animList); as.start(); }
From source file:org.telegram.ui.Components.ChatAttachAlert.java
@SuppressLint("NewApi") private void startRevealAnimation(final boolean open) { containerView.setTranslationY(0);/*from ww w.j a v a2 s .com*/ final AnimatorSet animatorSet = new AnimatorSet(); View view = delegate.getRevealView(); if (view.getVisibility() == View.VISIBLE && ((ViewGroup) view.getParent()).getVisibility() == View.VISIBLE) { final int coords[] = new int[2]; view.getLocationInWindow(coords); float top; if (Build.VERSION.SDK_INT <= 19) { top = AndroidUtilities.displaySize.y - containerView.getMeasuredHeight() - AndroidUtilities.statusBarHeight; } else { top = containerView.getY(); } revealX = coords[0] + view.getMeasuredWidth() / 2; revealY = (int) (coords[1] + view.getMeasuredHeight() / 2 - top); if (Build.VERSION.SDK_INT <= 19) { revealY -= AndroidUtilities.statusBarHeight; } } else { revealX = AndroidUtilities.displaySize.x / 2 + backgroundPaddingLeft; revealY = (int) (AndroidUtilities.displaySize.y - containerView.getY()); } int corners[][] = new int[][] { { 0, 0 }, { 0, AndroidUtilities.dp(304) }, { containerView.getMeasuredWidth(), 0 }, { containerView.getMeasuredWidth(), AndroidUtilities.dp(304) } }; int finalRevealRadius = 0; int y = revealY - scrollOffsetY + backgroundPaddingTop; for (int a = 0; a < 4; a++) { finalRevealRadius = Math.max(finalRevealRadius, (int) Math.ceil(Math.sqrt((revealX - corners[a][0]) * (revealX - corners[a][0]) + (y - corners[a][1]) * (y - corners[a][1])))); } int finalRevealX = revealX <= containerView.getMeasuredWidth() ? revealX : containerView.getMeasuredWidth(); ArrayList<Animator> animators = new ArrayList<>(3); animators.add(ObjectAnimator.ofFloat(this, "revealRadius", open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0)); animators.add(ObjectAnimator.ofInt(backDrawable, "alpha", open ? 51 : 0)); if (Build.VERSION.SDK_INT >= 21) { try { animators.add(ViewAnimationUtils.createCircularReveal(containerView, finalRevealX, revealY, open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0)); } catch (Exception e) { FileLog.e("tmessages", e); } animatorSet.setDuration(320); } else { if (!open) { animatorSet.setDuration(200); containerView.setPivotX( revealX <= containerView.getMeasuredWidth() ? revealX : containerView.getMeasuredWidth()); containerView.setPivotY(revealY); animators.add(ObjectAnimator.ofFloat(containerView, "scaleX", 0.0f)); animators.add(ObjectAnimator.ofFloat(containerView, "scaleY", 0.0f)); animators.add(ObjectAnimator.ofFloat(containerView, "alpha", 0.0f)); } else { animatorSet.setDuration(250); containerView.setScaleX(1); containerView.setScaleY(1); containerView.setAlpha(1); if (Build.VERSION.SDK_INT <= 19) { animatorSet.setStartDelay(20); } } } animatorSet.playTogether(animators); animatorSet.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animation) { if (currentSheetAnimation != null && currentSheetAnimation.equals(animation)) { currentSheetAnimation = null; onRevealAnimationEnd(open); containerView.invalidate(); containerView.setLayerType(View.LAYER_TYPE_NONE, null); if (!open) { try { dismissInternal(); } catch (Exception e) { FileLog.e("tmessages", e); } } } } @Override public void onAnimationCancel(Animator animation) { if (currentSheetAnimation != null && animatorSet.equals(animation)) { currentSheetAnimation = null; } } }); if (open) { innerAnimators.clear(); NotificationCenter.getInstance() .setAllowedNotificationsDutingAnimation(new int[] { NotificationCenter.dialogsNeedReload }); NotificationCenter.getInstance().setAnimationInProgress(true); revealAnimationInProgress = true; int count = Build.VERSION.SDK_INT <= 19 ? 11 : 8; for (int a = 0; a < count; a++) { if (Build.VERSION.SDK_INT <= 19) { if (a < 8) { views[a].setScaleX(0.1f); views[a].setScaleY(0.1f); } views[a].setAlpha(0.0f); } else { views[a].setScaleX(0.7f); views[a].setScaleY(0.7f); } InnerAnimator innerAnimator = new InnerAnimator(); int buttonX = views[a].getLeft() + views[a].getMeasuredWidth() / 2; int buttonY = views[a].getTop() + attachView.getTop() + views[a].getMeasuredHeight() / 2; float dist = (float) Math.sqrt( (revealX - buttonX) * (revealX - buttonX) + (revealY - buttonY) * (revealY - buttonY)); float vecX = (revealX - buttonX) / dist; float vecY = (revealY - buttonY) / dist; views[a].setPivotX(views[a].getMeasuredWidth() / 2 + vecX * AndroidUtilities.dp(20)); views[a].setPivotY(views[a].getMeasuredHeight() / 2 + vecY * AndroidUtilities.dp(20)); innerAnimator.startRadius = dist - AndroidUtilities.dp(27 * 3); views[a].setTag(R.string.AppName, 1); animators = new ArrayList<>(); final AnimatorSet animatorSetInner; if (a < 8) { animators.add(ObjectAnimator.ofFloat(views[a], "scaleX", 0.7f, 1.05f)); animators.add(ObjectAnimator.ofFloat(views[a], "scaleY", 0.7f, 1.05f)); animatorSetInner = new AnimatorSet(); animatorSetInner.playTogether(ObjectAnimator.ofFloat(views[a], "scaleX", 1.0f), ObjectAnimator.ofFloat(views[a], "scaleY", 1.0f)); animatorSetInner.setDuration(100); animatorSetInner.setInterpolator(decelerateInterpolator); } else { animatorSetInner = null; } if (Build.VERSION.SDK_INT <= 19) { animators.add(ObjectAnimator.ofFloat(views[a], "alpha", 1.0f)); } innerAnimator.animatorSet = new AnimatorSet(); innerAnimator.animatorSet.playTogether(animators); innerAnimator.animatorSet.setDuration(150); innerAnimator.animatorSet.setInterpolator(decelerateInterpolator); innerAnimator.animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (animatorSetInner != null) { animatorSetInner.start(); } } }); innerAnimators.add(innerAnimator); } } currentSheetAnimation = animatorSet; animatorSet.start(); }
From source file:com.zyk.launcher.AsyncTaskCallback.java
@Override public void onClick(View v) { // When we have exited all apps or are in transition, disregard clicks if (!mLauncher.isAllAppsVisible() || mLauncher.getWorkspace().isSwitchingState() || !(v instanceof PagedViewWidget)) return;/*ww w . jav a 2s. c om*/ // Let the user know that they have to long press to add a widget if (mWidgetInstructionToast != null) { mWidgetInstructionToast.cancel(); } mWidgetInstructionToast = Toast.makeText(getContext(), R.string.long_press_widget_to_add, Toast.LENGTH_SHORT); mWidgetInstructionToast.show(); // Create a little animation to show that the widget can move float offsetY = getResources().getDimensionPixelSize(R.dimen.dragViewOffsetY); final ImageView p = (ImageView) v.findViewById(R.id.widget_preview); AnimatorSet bounce = LauncherAnimUtils.createAnimatorSet(); ValueAnimator tyuAnim = LauncherAnimUtils.ofFloat(p, "translationY", offsetY); tyuAnim.setDuration(125); ValueAnimator tydAnim = LauncherAnimUtils.ofFloat(p, "translationY", 0f); tydAnim.setDuration(100); bounce.play(tyuAnim).before(tydAnim); bounce.setInterpolator(new AccelerateInterpolator()); bounce.start(); }
From source file:org.telegram.ui.Components.ChatAttachAlert.java
private boolean processTouchEvent(MotionEvent event) { if (!pressed && event.getActionMasked() == MotionEvent.ACTION_DOWN || event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) { if (!takingPhoto) { pressed = true;//from w ww . ja v a 2 s . c om maybeStartDraging = true; lastY = event.getY(); } } else if (pressed) { if (event.getActionMasked() == MotionEvent.ACTION_MOVE) { float newY = event.getY(); float dy = (newY - lastY); if (maybeStartDraging) { if (Math.abs(dy) > AndroidUtilities.getPixelsInCM(0.4f, false)) { maybeStartDraging = false; } } else { cameraView.setTranslationY(cameraView.getTranslationY() + dy); lastY = newY; if (cameraPanel.getTag() == null) { cameraPanel.setTag(1); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(ObjectAnimator.ofFloat(cameraPanel, "alpha", 0.0f), ObjectAnimator.ofFloat(flashModeButton[0], "alpha", 0.0f), ObjectAnimator.ofFloat(flashModeButton[1], "alpha", 0.0f)); animatorSet.setDuration(200); animatorSet.start(); } } } else if (event.getActionMasked() == MotionEvent.ACTION_CANCEL || event.getActionMasked() == MotionEvent.ACTION_UP || event.getActionMasked() == MotionEvent.ACTION_POINTER_UP) { pressed = false; if (Math.abs(cameraView.getTranslationY()) > cameraView.getMeasuredHeight() / 6.0f) { closeCamera(true); } else { AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(ObjectAnimator.ofFloat(cameraView, "translationY", 0.0f), ObjectAnimator.ofFloat(cameraPanel, "alpha", 1.0f), ObjectAnimator.ofFloat(flashModeButton[0], "alpha", 1.0f), ObjectAnimator.ofFloat(flashModeButton[1], "alpha", 1.0f)); animatorSet.setDuration(250); animatorSet.setInterpolator(interpolator); animatorSet.start(); cameraPanel.setTag(null); } } } return true; }