List of usage examples for android.view.animation AnimationUtils loadAnimation
public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException
From source file:com.github.mobile.gauges.ui.ItemListFragment.java
private void showRefreshAnimation(MenuItem item) { hideRefreshAnimation();/* w w w . ja v a 2 s . c om*/ refreshItem = item; ImageView refreshActionView = (ImageView) getActivity().getLayoutInflater().inflate(layout.action_view, null); refreshActionView.setImageResource(drawable.ic_action_refresh); refreshItem.setActionView(refreshActionView); Animation animation = AnimationUtils.loadAnimation(getActivity(), anim.refresh); animation.setRepeatMode(RESTART); animation.setRepeatCount(INFINITE); refreshActionView.startAnimation(animation); }
From source file:com.hookedonplay.decoviewsample.SampleFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (getView() == null) { return;/*from www .j av a 2s . c om*/ } mInitialized = true; final View replay = getView().findViewById(R.id.imageReplay); final View swipe = getView().findViewById(R.id.imageSwipe); if (replay != null) { replay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_hide); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { swipe.setVisibility(View.INVISIBLE); replay.setEnabled(false); } @Override public void onAnimationEnd(Animation animation) { setDemoFinished(false); createAnimation(); replay.setEnabled(true); } @Override public void onAnimationRepeat(Animation animation) { } }); replay.startAnimation(animation); } }); } createAnimation(); }
From source file:com.king.base.BaseActivity.java
public void startShake(View view) { view.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.shake)); }
From source file:andlabs.lounge.lobby.ui.LobbyFragment.java
private void startAnimatingHostMode() { mPulseBeacon.setVisibility(View.VISIBLE); mStaticBeacon.setVisibility(View.INVISIBLE); Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.pulse); mPulseBeacon.startAnimation(animation); }
From source file:com.dm.material.dashboard.candybar.fragments.IconsBaseFragment.java
private void initTabs() { Animation slideDown = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_down_from_top); slideDown.setAnimationListener(new Animation.AnimationListener() { @Override//from w w w .j a v a2s . c o m public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { if (getActivity() == null) return; Animator.startAlphaAnimation(getActivity().findViewById(R.id.shadow), 200, View.VISIBLE); getIcons(); } @Override public void onAnimationRepeat(Animation animation) { } }); mTabLayout.startAnimation(slideDown); mTabLayout.setVisibility(View.VISIBLE); }
From source file:co.adrianblan.noraoke.SongNowPlayingFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_song_playing, container, false); ListView listView = (ListView) rootView.findViewById(R.id.now_playing_song_list); listView.setAdapter(new SongAdapter(getActivity(), 3)); //LinearLayout listHeaderView = (LinearLayout)inflater.inflate(R.layout.list_header, null); //listView.addHeaderView(listHeaderView); fab = (FloatingActionButton) rootView.findViewById(R.id.now_playing_fab); fab.attachToListView(listView);/*from www . j a va2 s .c om*/ fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), SongPlayingActivity.class); getActivity().startActivity(intent); } }); //Fulhaxx in order to preserve media player when fragment is destroyed if (mPlayer == null) { mPlayer = MediaPlayer.create(getActivity().getApplicationContext(), R.raw.iwantitthatway); } //Connect to the websocket if we don't have it if (mWebSocketClient == null) { connectWebSocket(); } View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { mPlayer.seekTo(0); } }; //Pressing the previous song button just starts it at the beginning final Button prev = (Button) rootView.findViewById(R.id.music_control_prev); prev.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, R.drawable.ic_skip_previous_black_24dp); prev.setOnClickListener(listener); final Button next = (Button) rootView.findViewById(R.id.music_control_next); next.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, R.drawable.ic_skip_next_black_24dp); next.setOnClickListener(listener); //Get music control play button play = (Button) rootView.findViewById(R.id.music_control_play); //Set the play button to its initial state if (mPlayer.isPlaying()) { play.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, R.drawable.ic_pause_black_24dp); } else { play.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, R.drawable.ic_play_arrow_black_24dp); } //Play and pause the song, also change the icons play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!mPlayer.isPlaying()) { //Send the time in milliseconds if (mWebSocketClient.getReadyState() == WebSocket.READYSTATE.OPEN) { mWebSocketClient.send(System.currentTimeMillis() + " - " + mPlayer.getCurrentPosition()); } mPlayer.start(); play.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, R.drawable.ic_pause_black_24dp); } else { if (mWebSocketClient.getReadyState() == WebSocket.READYSTATE.OPEN) { mWebSocketClient.send("STOP"); } mPlayer.pause(); play.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, R.drawable.ic_play_arrow_black_24dp); } } }); //Get music control playlist button Button playlist = (Button) rootView.findViewById(R.id.music_control_playlist); //We switch the playlist visibility when we press the playlist button playlist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LinearLayout playlist = (LinearLayout) rootView.findViewById(R.id.now_playing_playlist); if (playlist.getVisibility() != View.VISIBLE) { playlist.setVisibility(View.VISIBLE); Animation slideIn = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.slide_in); playlist.startAnimation(slideIn); fab.hide(); } else { Animation slideOut = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.slide_out); playlist.startAnimation(slideOut); playlist.setVisibility(View.GONE); fab.show(); } } }); rootView.findViewById(R.id.now_playing_playlist).setVisibility(View.GONE); ViewCompat.setElevation(rootView.findViewById(R.id.music_control), 50); return rootView; }
From source file:com.aniruddhc.acemusic.player.WelcomeActivity.WelcomeActivity.java
private void showBuildingLibraryProgress() { //Disables swiping events on the pager. welcomeViewPager.setCurrentItem(5);/*from w ww . ja va 2 s .c o m*/ welcomeViewPager.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { return true; } }); //Fade out the ViewPager indicator. Animation fadeOutAnim = AnimationUtils.loadAnimation(mContext, R.anim.fade_out); fadeOutAnim.setDuration(600); fadeOutAnim.setAnimationListener(fadeOutListener); indicator.startAnimation(fadeOutAnim); }
From source file:com.ricardotrujillo.appstore.viewmodel.adapter.StoreRecyclerViewAdapter.java
private void setAnimation(View viewToAnimate, int position) { if (position > lastPosition) { Animation animation = AnimationUtils.loadAnimation(activity, R.anim.slide_in_bottom); viewToAnimate.startAnimation(animation); lastPosition = position;/*from www . j a v a2s. c om*/ } }
From source file:com.svpino.longhorn.fragments.StockListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_stock_list, container, false); setHasOptionsMenu(true);//from www .j a v a2 s. c om if (isHoneycombOrLater()) { this.actionModeCallback = new ActionModeCallback(); } this.tableLayout = (TableLayout) view.findViewById(R.id.tableLayout); this.viewFlipper = (ViewFlipper) view.findViewById(R.id.viewFlipper); StockOverviewLayout stockOverviewLayout1 = new StockOverviewLayout(getActivity()); StockOverviewLayout stockOverviewLayout2 = new StockOverviewLayout(getActivity()); this.viewFlipper.addView(stockOverviewLayout1); this.viewFlipper.addView(stockOverviewLayout2); this.animateStockOverviewContentCallback = new AnimateStockOverviewContentCallback(); this.flipInNextAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.flip_in_next); this.flipInNextAnimation .setAnimationListener(new StockOverviewAnimationListener(this.animateStockOverviewContentCallback)); this.flipInPreviousAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.flip_in_previous); this.flipInPreviousAnimation .setAnimationListener(new StockOverviewAnimationListener(this.animateStockOverviewContentCallback)); this.flipOutNextAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.flip_out_next); this.flipOutPreviousAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.flip_out_previous); this.viewFlipperGestureDetector = new GestureDetector(getActivity(), new ViewFlipperGestureDetector()); this.viewFlipper.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (StockListFragment.this.viewFlipperGestureDetector.onTouchEvent(event)) { return false; } return true; } }); createDashboardTiles(true); return view; }
From source file:com.ricardotrujillo.prueba.viewmodel.adapter.StoreRecyclerViewAdapter.java
private void setAnimation(View viewToAnimate, int position) { if (position > lastPosition) { Animation animation = AnimationUtils.loadAnimation(activity, R.anim.slide_in_bottom); viewToAnimate.startAnimation(animation); lastPosition = position;//from ww w. j av a 2 s . co m } }