List of usage examples for android.animation ObjectAnimator start
@Override public void start()
From source file:com.stepstone.stepper.internal.widget.ColorableProgressBar.java
public void setProgressCompat(int progress, boolean animate) { if (animate) { final ObjectAnimator animator = ObjectAnimator.ofInt(this, PROGRESS_PROPERTY, getProgress(), progress * PROGRESS_RANGE_MULTIPLIER); animator.setDuration(PROGRESS_ANIM_DURATION); animator.setInterpolator(PROGRESS_ANIM_INTERPOLATOR); animator.start(); } else {/*from w w w .j a v a 2 s . c o m*/ setProgress(progress * PROGRESS_RANGE_MULTIPLIER); } }
From source file:im.actor.sdk.view.emoji.keyboard.emoji.EmojiKeyboard.java
@Override protected View createView() { final View emojiPagerView = LayoutInflater.from(activity).inflate(R.layout.emoji_smiles_pager, null); final ViewPager emojiPager = (ViewPager) emojiPagerView.findViewById(R.id.emoji_pager); final PagerSlidingTabStrip emojiPagerIndicator = (PagerSlidingTabStrip) emojiPagerView .findViewById(R.id.emoji_pager_indicator); View backspace = emojiPagerView.findViewById(R.id.backspace); final View backToSmiles = emojiPagerView.findViewById(R.id.back_to_smiles); final View indicatorContainer = emojiPagerView.findViewById(R.id.indicator_container); stickerIndicatorContainer = emojiPagerView.findViewById(R.id.sticker_indicator_container); stickerSwitchContainer = emojiPagerView.findViewById(R.id.sticker_switch_container); emojiPagerIndicator.setTabBackground(R.drawable.clickable_background); emojiPagerIndicator.setIndicatorColorResource(R.color.primary); emojiPagerIndicator.setIndicatorHeight(Screen.dp(2)); emojiPagerIndicator.setDividerColor(0x00000000); emojiPagerIndicator.setUnderlineHeight(0); emojiPagerIndicator.setTabLayoutParams(new LinearLayout.LayoutParams(Screen.dp(48), Screen.dp(48))); backspace.setOnTouchListener(new RepeatListener(500, 100, new OnClickListener() { @Override/* w w w . j a va 2 s .c o m*/ public void onClick(View v) { onBackspaceClick(v); } })); mEmojisAdapter = new SmilePagerAdapter(this); mEmojisAdapter.setTabs(emojiPagerIndicator); emojiPager.setAdapter(mEmojisAdapter); emojiPagerIndicator.setViewPager(emojiPager); backToSmiles.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { emojiPager.setCurrentItem(3, false); ObjectAnimator oa = ObjectAnimator.ofFloat(indicatorContainer, "translationX", 0, 0); oa.setDuration(0); oa.start(); if (stickerIndicatorContainer.getVisibility() == View.INVISIBLE) { stickerIndicatorContainer.setVisibility(View.VISIBLE); } ObjectAnimator oas = ObjectAnimator.ofFloat(stickerIndicatorContainer, "translationX", Screen.getWidth(), Screen.getWidth()); oas.setDuration(0); oas.start(); emojiPager.setCurrentItem(1, true); } }); final FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) stickerIndicatorContainer.getLayoutParams(); emojiPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 4) { ObjectAnimator oa = ObjectAnimator.ofFloat(indicatorContainer, "translationX", indicatorContainer.getX(), -positionOffsetPixels); oa.setDuration(0); oa.start(); if (stickerIndicatorContainer.getVisibility() == View.INVISIBLE) { stickerIndicatorContainer.setVisibility(View.VISIBLE); } ObjectAnimator oas = ObjectAnimator.ofFloat(stickerIndicatorContainer, "translationX", stickerIndicatorContainer.getX() + Screen.getWidth(), -positionOffsetPixels + Screen.getWidth()); oas.setDuration(0); oas.start(); } } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } }); //emojiPagerIndicator.setLayoutParams(new RelativeLayout.LayoutParams(Screen.dp(58 * mEmojisAdapter.getCount()), Screen.dp(48))); // emojiPager.postDelayed(new Runnable() { // @Override // public void run() { // emojiPager.setAlpha(0f); // emojiPagerIndicator.setAlpha(0f); // animateView(emojiPager); // animateView(emojiPagerIndicator); // emojiPager.setAdapter(mEmojisAdapter); // emojiPagerIndicator.setViewPager(emojiPager); // } // }, BINDING_DELAY); if (SmilesPack.getRecent().size() == 0) { emojiPager.setCurrentItem(1); } return emojiPagerView; }
From source file:com.joaquimley.faboptions.FabOptions.java
private void closeCompatAnimation() { ObjectAnimator anim = ObjectAnimator.ofFloat(mBackground, "scaleX", 0.0f); anim.setDuration(3000);/*from w w w. j av a 2s. c om*/ anim.start(); animateButtons(false); }
From source file:com.gigigo.vuforiaimplementation.VuforiaActivity.java
private void startBoringAnimation() { scanLine.setVisibility(View.VISIBLE); // Create animators for y axe if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { int yMax = 0; yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight(); yMax = (int) (yMax * 0.9);// 174; ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax); oay.setRepeatCount(Animation.INFINITE); oay.setDuration(ANIM_DURATION);/*from w w w . j a va2 s .c om*/ oay.setRepeatMode(Animation.REVERSE); oay.setInterpolator(new LinearInterpolator()); oay.start(); //for draw points near scanline markFakeFeaturePoint.setObjectAnimator(oay); } //scanAnimation. }
From source file:com.example.google.maps.folding_map.MainActivity.java
public void animateFold() { ObjectAnimator animator = ObjectAnimator.ofFloat(mFoldingLayout, "foldFactor", mFoldingLayout.getFoldFactor(), 1); animator.setRepeatMode(ValueAnimator.REVERSE); animator.setRepeatCount(1);/*from w w w. j ava 2 s .c om*/ animator.setDuration(FOLD_ANIMATION_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.start(); }
From source file:com.example.android.interpolator.InterpolatorFragment.java
/** * Start an animation on the sample view. * The view is animated using an {@link android.animation.ObjectAnimator} on the * {@link View#SCALE_X} and {@link View#SCALE_Y} properties, with its animation based on a path. * The only two paths defined here ({@link #mPathIn} and {@link #mPathOut}) scale the view * uniformly./*from w ww . j av a2 s. c o m*/ * * @param interpolator The interpolator to use for the animation. * @param duration Duration of the animation in ms. * @param path Path of the animation * @return The ObjectAnimator used for this animation * @see android.animation.ObjectAnimator#ofFloat(Object, String, String, android.graphics.Path) */ public ObjectAnimator startAnimation(Interpolator interpolator, long duration, Path path) { // This ObjectAnimator uses the path to change the x and y scale of the mView object. ObjectAnimator animator = ObjectAnimator.ofFloat(mView, View.SCALE_X, View.SCALE_Y, path); // Set the duration and interpolator for this animation animator.setDuration(duration); animator.setInterpolator(interpolator); animator.start(); return animator; }
From source file:com.joaquimley.faboptions.FabOptions.java
private void openCompatAnimation() { ObjectAnimator anim = ObjectAnimator.ofFloat(mBackground, "scaleX", 1.0f); anim.setDuration(30000); // duration 3 seconds anim.start(); }
From source file:com.gigigo.imagerecognition.vuforia.VuforiaActivity.java
private void startBoringAnimation() { scanLine.setVisibility(View.VISIBLE); // Create animators for y axe if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { int yMax = 0; yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight(); yMax = (int) (yMax * 0.9);// 174; ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax); oay.setRepeatCount(Animation.INFINITE); oay.setDuration(ANIM_DURATION);/* w w w . j a v a2s.co m*/ oay.setRepeatMode(ValueAnimator.REVERSE); oay.setInterpolator(new LinearInterpolator()); oay.start(); //for draw points near ir_scanline markFakeFeaturePoint.setObjectAnimator(oay); } //scanAnimation. }
From source file:com.stanzione.licensesmanagement.ui.CompanyRecyclerAdapter.java
@Override public void onBindViewHolder(final ViewHolder holder, int position) { final Company currentCompany = values.get(position); final int companyPosition = position; if (isFirstLoad) { originalEditIconPosition = holder.companyListItemEditIcon.getX(); originalRemoveIconPosition = holder.companyListItemRemoveIcon.getX(); //isFirstLoad = false; }// w w w . ja v a2 s . co m holder.companyListItemName.setText(currentCompany.getName()); holder.companyListItemAddress.setText(currentCompany.getAddress()); if (showEdit) { holder.companyListItemRemoveIcon.setVisibility(View.VISIBLE); holder.companyListItemEditIcon.setVisibility(View.VISIBLE); ObjectAnimator animEditIcon = ObjectAnimator.ofFloat(holder.companyListItemEditIcon, "translationX", holder.companyListItemEditIcon.getX(), originalEditIconPosition); animEditIcon.setDuration(500); animEditIcon.start(); ObjectAnimator animRemoveIcon = ObjectAnimator.ofFloat(holder.companyListItemRemoveIcon, "translationX", holder.companyListItemRemoveIcon.getX(), originalRemoveIconPosition); animRemoveIcon.setDuration(500); animRemoveIcon.setStartDelay(100); animRemoveIcon.start(); } else { if (isFirstLoad) { holder.companyListItemEditIcon.setVisibility(View.INVISIBLE); holder.companyListItemRemoveIcon.setVisibility(View.INVISIBLE); } else { holder.companyListItemEditIcon.setVisibility(View.VISIBLE); holder.companyListItemRemoveIcon.setVisibility(View.VISIBLE); } ObjectAnimator animEditIcon = ObjectAnimator.ofFloat(holder.companyListItemEditIcon, "translationX", originalEditIconPosition, originalEditIconPosition + 300); animEditIcon.setDuration(500); animEditIcon.setStartDelay(100); animEditIcon.start(); ObjectAnimator animRemoveIcon = ObjectAnimator.ofFloat(holder.companyListItemRemoveIcon, "translationX", originalRemoveIconPosition, originalRemoveIconPosition + 300); animRemoveIcon.setDuration(500); animRemoveIcon.start(); } holder.companyListItemRemoveIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Remove Company").setMessage( "Removing this company, any related Project and its Licenses will be removed as well. Do you want to continue?") .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton("Remove", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Log.d(TAG, "Removing company: " + currentCompany.getId() + " - " + currentCompany.getName()); removeCompany(companyPosition); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); builder.create().show(); } }); holder.companyListItemEditIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "selectedCompany ID: " + currentCompany.getId()); activity.get().onCompanyToEdit(companyPosition); } }); holder.companyListRelativeLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "selectedCompany ID: " + currentCompany.getId()); activity.get().onCompanySelected(companyPosition); } }); }
From source file:org.taurusxi.taurusxicommon.view.drawer.DrawerArrowDrawable.java
public void animateToBack() { ObjectAnimator backAnim = ObjectAnimator.ofFloat(this, "parameter", 0f, 1f); backAnim.setDuration(500);// www . j av a 2s . c o m backAnim.setInterpolator(LINEAR_INTERPOLATOR); backAnim.start(); }