List of usage examples for android.animation Animator start
public void start()
From source file:com.rks.musicx.ui.adapters.ArtistListAdapter.java
@Override public void onBindViewHolder(ArtistViewHolder holder, int position) { Artist artists = getItem(position);//from w w w . j a v a 2 s . co m Helper helper = new Helper(getContext()); if (layoutID == R.layout.item_grid_view) { int pos = holder.getAdapterPosition(); if (lastpos < pos) { for (Animator animator : Helper.getAnimator(holder.backgroundColor)) { animator.setDuration(duration); animator.setInterpolator(interpolator); animator.start(); } } holder.ArtistsArtwork.setTransitionName("TransitionArtworks" + position); holder.ArtistName.setText(getContext().getResources().getQuantityString(R.plurals.albums_count, artists.getAlbumCount(), artists.getAlbumCount())); holder.AlbumCount.setText(artists.getName()); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, helper.loadArtistImage(artists.getName()), new palette() { @Override public void palettework(Palette palette) { final int[] colors = Helper.getAvailableColor(getContext(), palette); holder.backgroundColor.setBackgroundColor(colors[0]); holder.ArtistName.setTextColor(Helper.getTitleTextColor(colors[0])); holder.AlbumCount.setTextColor(Helper.getTitleTextColor(colors[0])); Helper.animateViews(getContext(), holder.backgroundColor, colors[0]); } }, holder.ArtistsArtwork); holder.menu.setVisibility(View.GONE); } if (layoutID == R.layout.item_list_view) { holder.ArtistListName.setText(artists.getName()); holder.ArtistListAlbumCount.setText(getContext().getResources() .getQuantityString(R.plurals.albums_count, artists.getAlbumCount(), artists.getAlbumCount())); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, helper.loadArtistImage(artists.getName()), new palette() { @Override public void palettework(Palette palette) { } }, holder.ArtistListArtwork); if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) { holder.ArtistListName.setTextColor(Color.WHITE); holder.ArtistListAlbumCount .setTextColor(ContextCompat.getColor(getContext(), R.color.darkthemeTextColor)); } } }
From source file:com.example.toolbardemo.Fragment.CircularRevealFragment.java
/** * {@inheritDoc}/* w w w .j a va2s .c om*/ * @see android.support.v4.app.Fragment#onActivityCreated(android.os.Bundle) */ @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); tv1 = (TextView) getActivity().findViewById(R.id.textView1); tv2 = (TextView) getActivity().findViewById(R.id.textView2); tv3 = (TextView) getActivity().findViewById(R.id.textView3); tv4 = (TextView) getActivity().findViewById(R.id.textView4); tv1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animator animator = ViewAnimationUtils.createCircularReveal(tv1, tv1.getWidth() / 2, tv1.getHeight() / 2, tv1.getWidth(), 0); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(1000); animator.start(); } }); tv2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animator animator = ViewAnimationUtils.createCircularReveal(tv2, 0, 0, 0, (float) Math.hypot(tv2.getWidth(), tv2.getHeight())); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(1000); animator.start(); } }); tv3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animator animator = ViewAnimationUtils.createCircularReveal(tv3, tv3.getWidth() / 2, tv3.getHeight() / 2, 0, tv3.getWidth()); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(1000); animator.start(); } }); tv4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animator animator = ViewAnimationUtils.createCircularReveal(tv4, 0, 0, (float) Math.hypot(tv4.getWidth(), tv4.getHeight()), 0); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(1000); animator.start(); } }); }
From source file:com.example.android.revealeffectbasic.RevealEffectBasicFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.reveal_effect_basic, container, false); View button = rootView.findViewById(R.id.button); // Set a listener to reveal the view when clicked. button.setOnClickListener(new View.OnClickListener() { @Override/* w ww . j a v a 2 s .c o m*/ public void onClick(View view) { View shape = rootView.findViewById(R.id.circle); // Create a reveal {@link Animator} that starts clipping the view from // the top left corner until the whole view is covered. Animator animator = ViewAnimationUtils.createCircularReveal(shape, 0, 0, 0, (float) Math.hypot(shape.getWidth(), shape.getHeight())); // Set a natural ease-in/ease-out interpolator. animator.setInterpolator(new AccelerateDecelerateInterpolator()); // Finally start the animation animator.start(); Log.d(TAG, "Starting Reveal animation"); } }); return rootView; }
From source file:com.chrynan.guitartuner.PitchFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public void circularReveal(final float x, final float y) { if (x != -1 && y != -1) { float finalRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, (int) x, (int) y, 0, finalRadius); //viewRoot.setBackgroundColor(getActivity().getResources().getColor(R.color.white)); anim.setInterpolator(new DecelerateInterpolator(2f)); anim.setDuration(1000);//w w w .j av a 2 s . com anim.start(); } }
From source file:org.chromium.chrome.browser.physicalweb.ListUrlsActivity.java
private void showBottomBar() { mBottomBar.setTranslationY(mBottomBar.getHeight()); mBottomBar.setVisibility(View.VISIBLE); Animator animator = createTranslationYAnimator(mBottomBar, 0f, DURATION_SLIDE_UP_MS); animator.start(); }
From source file:tech.salroid.filmy.fragment.FullReadFragment.java
@Nullable @Override/* www . j av a2 s .c o m*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.read_full_layout, container, false); ButterKnife.bind(this, view); crossButton.setOnClickListener(this); // To run the animation as soon as the view is layout in the view hierarchy we add this // listener and remove it // as soon as it runs to prevent multiple animations if the view changes bounds view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { v.removeOnLayoutChangeListener(this); int cx = getArguments().getInt("cx"); int cy = getArguments().getInt("cy"); // get the hypothenuse so the radius is from one corner to the other int radius = (int) Math.hypot(right, bottom); Animator reveal; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { reveal = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, radius); reveal.setInterpolator(new DecelerateInterpolator(2f)); reveal.setDuration(1000); reveal.start(); } } }); return view; }
From source file:ooo.oxo.apps.materialize.SearchPanelController.java
public void close() { if (container.getVisibility() == View.INVISIBLE) { return;//from w w w . j av a 2 s . c o m } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Animator animator = makeSearchPanelAnimator(true); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { container.setVisibility(View.INVISIBLE); keyword.clearFocus(); } }); animator.start(); } else { container.setVisibility(View.INVISIBLE); } softInputManager.hide(); }
From source file:com.rks.musicx.ui.adapters.SongListAdapter.java
@Override public void onBindViewHolder(SongListAdapter.SongViewHolder holder, int position) { Song song = getItem(position);/*w ww. ja v a2s . c o m*/ if (layout == R.layout.song_list) { holder.SongTitle.setText(song.getTitle()); holder.SongArtist.setText(song.getArtist()); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, song.getAlbum(), song.getAlbumId(), new palette() { @Override public void palettework(Palette palette) { } }, holder.SongArtwork); holder.menu.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_menu)); Drawable drawable = holder.menu.getDrawable(); int accentColor = Config.accentColor(getContext(), Helper.getATEKey(getContext())); if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) { drawable.setTint(Color.WHITE); holder.SongTitle.setTextColor(Color.WHITE); holder.SongArtist.setTextColor(ContextCompat.getColor(getContext(), R.color.darkthemeTextColor)); holder.itemView.setBackgroundColor(storeChecked.get(position) ? ContextCompat.getColor(getContext(), R.color.translucent_white_8p) : Color.TRANSPARENT); } else { drawable.setTint(ContextCompat.getColor(getContext(), R.color.MaterialGrey)); holder.SongTitle.setTextColor(Color.BLACK); holder.SongArtist.setTextColor(Color.DKGRAY); holder.itemView .setBackgroundColor(storeChecked.get(position) ? Helper.getColorWithAplha(accentColor, 0.7f) : Color.TRANSPARENT); } } if (layout == R.layout.detail_list) { holder.SongTitle.setText(song.getTitle()); holder.SongArtist.setText(song.getArtist()); holder.number.setText(position + 1 + "."); holder.menu.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_menu)); Drawable drawable = holder.menu.getDrawable(); if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) { drawable.setTint(Color.WHITE); holder.SongTitle.setTextColor(Color.WHITE); holder.number.setTextColor(Color.WHITE); holder.SongArtist.setTextColor(ContextCompat.getColor(getContext(), R.color.darkthemeTextColor)); } else { drawable.setTint(ContextCompat.getColor(getContext(), R.color.MaterialGrey)); holder.SongTitle.setTextColor(Color.BLACK); holder.number.setTextColor(Color.BLACK); holder.SongArtist.setTextColor(Color.DKGRAY); } } if (layout == R.layout.item_grid_view || layout == R.layout.recent_list) { int pos = holder.getAdapterPosition(); if (lastpos < pos) { for (Animator animator : getAnimator(holder.songView)) { animator.setDuration(duration); animator.setInterpolator(interpolator); animator.start(); } } holder.SongTitle.setText(song.getTitle()); holder.SongArtist.setText(song.getArtist()); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, song.getAlbum(), song.getAlbumId(), new palette() { @Override public void palettework(Palette palette) { final int[] colors = Helper.getAvailableColor(getContext(), palette); holder.songView.setBackgroundColor(colors[0]); holder.SongTitle.setTextColor(Helper.getTitleTextColor(colors[0])); holder.SongArtist.setTextColor(Helper.getTitleTextColor(colors[0])); Helper.animateViews(getContext(), holder.itemView, colors[0]); } }, holder.songGridArtwork); holder.menu.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_menu)); holder.menu.setVisibility(View.VISIBLE); Drawable drawable = holder.menu.getDrawable(); if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) { drawable.setTint(Color.WHITE); } } }
From source file:com.hippo.vectorold.drawable.AnimatedVectorDrawable.java
@Override public void start() { final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators; final int size = animators.size(); for (int i = 0; i < size; i++) { final Animator animator = animators.get(i); if (!animator.isStarted()) { animator.start(); }/* w w w . j av a 2 s.co m*/ } invalidateSelf(); }
From source file:tech.salroid.filmy.fragment.AllTrailerFragment.java
@Nullable @Override// w w w . j a v a 2 s. c o m public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); nightMode = sp.getBoolean("dark", false); View view = inflater.inflate(R.layout.all_trailer_layout, container, false); ButterKnife.bind(this, view); if (!nightMode) allThemeLogic(); else { nightModeLogic(); } crossButton.setOnClickListener(this); // To run the animation as soon as the view is layout in the view hierarchy we add this // listener and remove it // as soon as it runs to prevent multiple animations if the view changes bounds view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { v.removeOnLayoutChangeListener(this); int cx = getArguments().getInt("cx"); int cy = getArguments().getInt("cy"); // get the hypothenuse so the radius is from one corner to the other int radius = (int) Math.hypot(right, bottom); Animator reveal; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { reveal = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, radius); reveal.setInterpolator(new DecelerateInterpolator(2f)); reveal.setDuration(1000); reveal.start(); } } }); init(view); return view; }