List of usage examples for android.animation ObjectAnimator start
@Override public void start()
From source file:com.arlib.floatingsearchview.FloatingSearchView.java
/** * Shows a circular progress on top of the * menu action button.//from ww w . ja va 2 s . c o m * * <p>Call hidProgress() * to change back to normal and make the menu * action visible.</p> */ public void showProgress() { mMenuSearchOrExitButton.setVisibility(View.GONE); mSearchProgress.setVisibility(View.VISIBLE); ObjectAnimator fadeInProgress = new ObjectAnimator().ofFloat(mSearchProgress, "alpha", 0.0f, 1.0f); fadeInProgress.start(); }
From source file:com.arlib.floatingsearchview.FloatingSearchView.java
/** * Hides the progress bar after// ww w . j a v a 2s . c o m * a prior call to showProgress() */ public void hideProgress() { mMenuSearchOrExitButton.setVisibility(View.VISIBLE); mSearchProgress.setVisibility(View.GONE); ObjectAnimator fadeInExit = new ObjectAnimator().ofFloat(mMenuSearchOrExitButton, "alpha", 0.0f, 1.0f); fadeInExit.start(); }
From source file:com.arlib.floatingsearchview.FloatingSearchView.java
private void changeIcon(ImageView imageView, Drawable newIcon, boolean withAnim) { imageView.setImageDrawable(newIcon); if (withAnim) { ObjectAnimator fadeInVoiceInputOrClear = new ObjectAnimator().ofFloat(imageView, "alpha", 0.0f, 1.0f); fadeInVoiceInputOrClear.start(); } else {/*w w w . j av a 2 s . c o m*/ imageView.setAlpha(1.0f); } }
From source file:com.waz.zclient.pages.main.participants.ParticipantFragment.java
@Override public void onShowPickUser(IPickUserController.Destination destination, View anchorView) { if (LayoutSpec.isPhone(getActivity())) { return;/*from w w w.j av a2 s.c o m*/ } if (!getCurrentPickerDestination().equals(destination)) { onHidePickUser(getCurrentPickerDestination(), true); return; } FragmentManager fragmentManager = getChildFragmentManager(); int pickUserAnimation = LayoutSpec.isTablet(getActivity()) ? R.anim.fade_in : R.anim.slide_in_from_bottom_pick_user; if (!groupConversation && otherUser != null) { getControllerFactory().getPickUserController().addUser(otherUser); } fragmentManager.beginTransaction().setCustomAnimations(pickUserAnimation, R.anim.fade_out) .add(R.id.fl__add_to_conversation__pickuser__container, PickUserFragment.newInstance(true, groupConversation), PickUserFragment.TAG) .addToBackStack(PickUserFragment.TAG).commit(); if (LayoutSpec.isPhone(getActivity())) { getControllerFactory().getNavigationController().setRightPage(Page.PICK_USER_ADD_TO_CONVERSATION, TAG); } final ObjectAnimator hideParticipantsAnimator = ObjectAnimator.ofFloat(participantsContainerView, View.ALPHA, 1f, 0f); hideParticipantsAnimator.setInterpolator(new Quart.EaseOut()); hideParticipantsAnimator .setDuration(getResources().getInteger(R.integer.framework_animation_duration_medium)); hideParticipantsAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { participantsContainerView.setVisibility(View.GONE); } }); hideParticipantsAnimator.start(); }
From source file:com.klinker.android.sliding.MultiShrinkScroller.java
/** * Scroll the activity off the bottom of the screen. *///from w w w .j a v a 2 s . co m public void scrollOffBottom() { isTouchDisabledForDismissAnimation = true; scroller.forceFinished(true); if (!willUseReverseExpansion()) { final Interpolator interpolator = new AcceleratingFlingInterpolator(EXIT_FLING_ANIMATION_DURATION_MS, getCurrentVelocity(), getScrollUntilOffBottom()); ObjectAnimator translateAnimation = ObjectAnimator.ofInt(this, "scroll", getScroll() - getScrollUntilOffBottom()); translateAnimation.setRepeatCount(0); translateAnimation.setInterpolator(interpolator); translateAnimation.setDuration(EXIT_FLING_ANIMATION_DURATION_MS); translateAnimation.addListener(exitAnimationListner); translateAnimation.start(); } else { reverseExpansionAnimation(); } if (listener != null) { listener.onStartScrollOffBottom(); } }
From source file:com.gsoc.ijosa.liquidgalaxycontroller.PW.NearbyBeaconsFragment.java
private void showListView() { if (getListView() != null) { if (getListView().getVisibility() == View.VISIBLE) { return; }//from w ww. j a v a 2 s . co m mSwipeRefreshWidget.setRefreshing(false); getListView().setAlpha(0f); getListView().setVisibility(View.VISIBLE); safeNotifyChange(); ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(getListView(), "alpha", 0f, 1f); alphaAnimation.setDuration(400); alphaAnimation.setInterpolator(new DecelerateInterpolator()); alphaAnimation.addListener(new AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mScanningAnimationTextView.setAlpha(0f); mScanningAnimationDrawable.stop(); arrowDownLayout.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationCancel(Animator animation) { } }); alphaAnimation.start(); } }
From source file:us.phyxsi.gameshelf.ui.FeedAdapter.java
private void bindBoardgameHolder(final Boardgame game, final BoardgameHolder holder) { final int[] imageSize = { 400, 400 }; Glide.with(host).load("http:" + game.image).listener(new RequestListener<String, GlideDrawable>() { @Override/*from w ww . j a v a 2 s . c o m*/ public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { if (!game.hasFadedIn) { holder.image.setHasTransientState(true); final ObservableColorMatrix cm = new ObservableColorMatrix(); ObjectAnimator saturation = ObjectAnimator.ofFloat(cm, ObservableColorMatrix.SATURATION, 0f, 1f); saturation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { // just animating the color matrix does not invalidate the // drawable so need this update listener. Also have to create a // new CMCF as the matrix is immutable :( if (holder.image.getDrawable() != null) { holder.image.getDrawable().setColorFilter(new ColorMatrixColorFilter(cm)); } } }); saturation.setDuration(1000); saturation.setInterpolator( AnimationUtils.loadInterpolator(host, android.R.interpolator.fast_out_slow_in)); saturation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { holder.image.setHasTransientState(false); } }); saturation.start(); game.hasFadedIn = true; } return false; } @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { return false; } }).placeholder(shotLoadingPlaceholders[holder.getAdapterPosition() % shotLoadingPlaceholders.length]) .diskCacheStrategy(DiskCacheStrategy.SOURCE).centerCrop().override(imageSize[0], imageSize[1]) .into(new BoardgameTarget(holder.image, false)); }
From source file:com.android.calendar.AllInOneActivity.java
@Override public void handleEvent(EventInfo event) { long displayTime = -1; if (event.eventType == EventType.GO_TO) { if ((event.extraLong & CalendarController.EXTRA_GOTO_BACK_TO_PREVIOUS) != 0) { mBackToPreviousView = true;//from www . ja v a 2 s . c o m } else if (event.viewType != mController.getPreviousViewType() && event.viewType != ViewType.EDIT) { // Clear the flag is change to a different view type mBackToPreviousView = false; } setMainPane(null, R.id.main_pane, event.viewType, event.startTime.toMillis(false), false); if (mSearchView != null) { mSearchView.clearFocus(); } if (mShowCalendarControls) { int animationSize = (mOrientation == Configuration.ORIENTATION_LANDSCAPE) ? mControlsAnimateWidth : mControlsAnimateHeight; boolean noControlsView = event.viewType == ViewType.MONTH || event.viewType == ViewType.AGENDA; if (mControlsMenu != null) { mControlsMenu.setVisible(!noControlsView); mControlsMenu.setEnabled(!noControlsView); } if (noControlsView || mHideControls) { // hide minimonth and calendar frag mShowSideViews = false; if (!mHideControls) { final ObjectAnimator slideAnimation = ObjectAnimator.ofInt(this, "controlsOffset", 0, animationSize); slideAnimation.addListener(mSlideAnimationDoneListener); slideAnimation.setDuration(mCalendarControlsAnimationTime); ObjectAnimator.setFrameDelay(0); slideAnimation.start(); } else { mMiniMonth.setVisibility(View.GONE); mCalendarsList.setVisibility(View.GONE); mMiniMonthContainer.setVisibility(View.GONE); } } else { // show minimonth and calendar frag mShowSideViews = true; mMiniMonth.setVisibility(View.VISIBLE); mCalendarsList.setVisibility(View.VISIBLE); mMiniMonthContainer.setVisibility(View.VISIBLE); if (!mHideControls && (mController.getPreviousViewType() == ViewType.MONTH || mController.getPreviousViewType() == ViewType.AGENDA)) { final ObjectAnimator slideAnimation = ObjectAnimator.ofInt(this, "controlsOffset", animationSize, 0); slideAnimation.setDuration(mCalendarControlsAnimationTime); ObjectAnimator.setFrameDelay(0); slideAnimation.start(); } } } displayTime = event.selectedTime != null ? event.selectedTime.toMillis(true) : event.startTime.toMillis(true); if (!mIsTabletConfig) { refreshActionbarTitle(displayTime); } } else if (event.eventType == EventType.VIEW_EVENT) { // If in Agenda view and "show_event_details_with_agenda" is "true", // do not create the event info fragment here, it will be created by the Agenda // fragment if (mCurrentView == ViewType.AGENDA && mShowEventDetailsWithAgenda) { if (event.startTime != null && event.endTime != null) { // Event is all day , adjust the goto time to local time if (event.isAllDay()) { Utils.convertAlldayUtcToLocal(event.startTime, event.startTime.toMillis(false), mTimeZone); Utils.convertAlldayUtcToLocal(event.endTime, event.endTime.toMillis(false), mTimeZone); } mController.sendEvent(this, EventType.GO_TO, event.startTime, event.endTime, event.selectedTime, event.id, ViewType.AGENDA, CalendarController.EXTRA_GOTO_TIME, null, null); } else if (event.selectedTime != null) { mController.sendEvent(this, EventType.GO_TO, event.selectedTime, event.selectedTime, event.id, ViewType.AGENDA); } } else { // TODO Fix the temp hack below: && mCurrentView != // ViewType.AGENDA if (event.selectedTime != null && mCurrentView != ViewType.AGENDA) { mController.sendEvent(this, EventType.GO_TO, event.selectedTime, event.selectedTime, -1, ViewType.CURRENT); } int response = event.getResponse(); if ((mCurrentView == ViewType.AGENDA && mShowEventInfoFullScreenAgenda) || ((mCurrentView == ViewType.DAY || (mCurrentView == ViewType.WEEK) || mCurrentView == ViewType.MONTH) && mShowEventInfoFullScreen)) { // start event info as activity Intent intent = new Intent(Intent.ACTION_VIEW); Uri eventUri = ContentUris.withAppendedId(Events.CONTENT_URI, event.id); intent.setData(eventUri); intent.setClass(this, EventInfoActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.putExtra(EXTRA_EVENT_BEGIN_TIME, event.startTime.toMillis(false)); intent.putExtra(EXTRA_EVENT_END_TIME, event.endTime.toMillis(false)); intent.putExtra(ATTENDEE_STATUS, response); startActivity(intent); } else { // start event info as a dialog EventInfoFragment fragment = new EventInfoFragment(this, event.id, event.startTime.toMillis(false), event.endTime.toMillis(false), response, true, EventInfoFragment.DIALOG_WINDOW_STYLE, null /* No reminders to explicitly pass in. */); fragment.setDialogParams(event.x, event.y, mActionBar.getHeight()); FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); // if we have an old popup replace it Fragment fOld = fm.findFragmentByTag(EVENT_INFO_FRAGMENT_TAG); if (fOld != null && fOld.isAdded()) { ft.remove(fOld); } ft.add(fragment, EVENT_INFO_FRAGMENT_TAG); ft.commit(); } } displayTime = event.startTime.toMillis(true); } else if (event.eventType == EventType.UPDATE_TITLE) { setTitleInActionBar(event); if (!mIsTabletConfig) { refreshActionbarTitle(mController.getTime()); } } updateSecondaryTitleFields(displayTime); }
From source file:com.hannesdorfmann.FeedAdapter.java
private void bindDribbbleShotView(final Shot shot, final DribbbleShotHolder holder, final int position) { final BadgedFourThreeImageView iv = (BadgedFourThreeImageView) holder.itemView; Glide.with(host).load(shot.images.best()).listener(new RequestListener<String, GlideDrawable>() { @Override/* w w w. j av a 2 s . co m*/ public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { if (!shot.hasFadedIn) { iv.setHasTransientState(true); final ObservableColorMatrix cm = new ObservableColorMatrix(); ObjectAnimator saturation = ObjectAnimator.ofFloat(cm, ObservableColorMatrix.SATURATION, 0f, 1f); saturation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { // just animating the color matrix does not invalidate the // drawable so need this update listener. Also have to create a // new CMCF as the matrix is immutable :( if (iv.getDrawable() != null) { iv.getDrawable().setColorFilter(new ColorMatrixColorFilter(cm)); } } }); saturation.setDuration(2000); saturation.setInterpolator( AnimationUtils.loadInterpolator(host, android.R.interpolator.fast_out_slow_in)); saturation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { iv.setHasTransientState(false); } }); saturation.start(); shot.hasFadedIn = true; } return false; } @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { return false; } }).placeholder(shotLoadingPlaceholders[position % shotLoadingPlaceholders.length]) .diskCacheStrategy(DiskCacheStrategy.ALL).into(new DribbbleTarget(iv, false)); iv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { iv.setTransitionName(iv.getResources().getString(R.string.transition_shot)); iv.setBackgroundColor(ContextCompat.getColor(host, R.color.background_light)); Intent intent = new Intent(); intent.setClass(host, DribbbleShot.class); intent.putExtra(DribbbleShot.EXTRA_SHOT, shot); ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host, Pair.create(view, host.getString(R.string.transition_shot)), Pair.create(view, host.getString(R.string.transition_shot_background))); host.startActivity(intent, options.toBundle()); } }); }
From source file:com.borax12.materialdaterangepicker.date.DatePickerDialog.java
private void setCurrentView(final int viewIndex) { long millis = mCalendar.getTimeInMillis(); long millisEnd = mCalendarEnd.getTimeInMillis(); switch (viewIndex) { case MONTH_AND_DAY_VIEW: ObjectAnimator pulseAnimator = Utils.getPulseAnimator(mMonthAndDayView, 0.9f, 1.05f); ObjectAnimator pulseAnimatorTwo = Utils.getPulseAnimator(mMonthAndDayViewEnd, 0.9f, 1.05f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); pulseAnimatorTwo.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false;//from w w w . ja va 2 s . c o m } mDayPickerView.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayView.setSelected(true); mMonthAndDayViewEnd.setSelected(true); mYearView.setSelected(false); mYearViewEnd.setSelected(false); mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW); mAnimatorEnd.setDisplayedChild(MONTH_AND_DAY_VIEW); mCurrentView = viewIndex; } pulseAnimator.start(); pulseAnimatorTwo.start(); int flags = DateUtils.FORMAT_SHOW_DATE; String dayString = DateUtils.formatDateTime(getActivity(), millis, flags); String dayStringEnd = DateUtils.formatDateTime(getActivity(), millisEnd, flags); mAnimator.setContentDescription(mDayPickerDescription + ": " + dayString); mAnimatorEnd.setContentDescription(mDayPickerDescription + ": " + dayStringEnd); Utils.tryAccessibilityAnnounce(mAnimator, mSelectDay); Utils.tryAccessibilityAnnounce(mAnimatorEnd, mSelectDay); break; case YEAR_VIEW: pulseAnimator = Utils.getPulseAnimator(mYearView, 0.85f, 1.1f); pulseAnimatorTwo = Utils.getPulseAnimator(mYearViewEnd, 0.85f, 1.1f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); pulseAnimatorTwo.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; } mYearPickerView.onDateChanged(); mYearPickerViewEnd.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayView.setSelected(false); mYearView.setSelected(true); mAnimator.setDisplayedChild(YEAR_VIEW); mCurrentView = viewIndex; mMonthAndDayViewEnd.setSelected(false); mYearViewEnd.setSelected(true); mAnimatorEnd.setDisplayedChild(YEAR_VIEW); mCurrentViewEnd = viewIndex; } pulseAnimator.start(); pulseAnimatorTwo.start(); CharSequence yearString = YEAR_FORMAT.format(millis); CharSequence yearStringEnd = YEAR_FORMAT.format(millisEnd); mAnimator.setContentDescription(mYearPickerDescription + ": " + yearString); mAnimatorEnd.setContentDescription(mYearPickerDescription + ": " + yearStringEnd); Utils.tryAccessibilityAnnounce(mAnimator, mSelectYear); Utils.tryAccessibilityAnnounce(mAnimatorEnd, mSelectYear); break; } }