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.adityarathi.muo.ui.activities.NowPlayingActivity.java
@SuppressLint("NewApi") @Override/*from w w w. j av a 2 s .c om*/ protected void onCreate(Bundle savedInstanceState) { mContext = getApplicationContext(); mApp = (Common) getApplicationContext(); mApp.setNowPlayingActivity(this); setNowPlayingActivityListener(mApp.getPlaybackKickstarter()); mFadeInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.slide_in_from_top); mFadeInAnimation.setDuration(700); super.onCreate(savedInstanceState); setContentView(R.layout.activity_now_playing); //Set the volume stream for this activity. this.setVolumeControlStream(AudioManager.STREAM_MUSIC); //ViewPager. mViewPager = (ViewPager) findViewById(R.id.nowPlayingPlaylistPager); //Seekbar indicator. mSeekbarIndicatorLayoutParent = (RelativeLayout) findViewById(R.id.seekbarIndicatorParent); mSeekbarIndicatorLayout = (RelativeLayout) findViewById(R.id.seekbarIndicator); mSeekbarIndicatorText = (TextView) findViewById(R.id.seekbarIndicatorText); mSeekbarIndicatorLayoutParent.setVisibility(View.GONE); //Playback Controls. mControlsLayoutHeaderParent = (RelativeLayout) findViewById(R.id.now_playing_controls_header_parent); mControlsLayoutHeader = (RelativeLayout) findViewById(R.id.now_playing_controls_header); mPlayPauseButtonBackground = (RelativeLayout) findViewById(R.id.playPauseButtonBackground); mPlayPauseButton = (ImageButton) findViewById(R.id.playPauseButton); mNextButton = (ImageButton) findViewById(R.id.nextButton); mPreviousButton = (ImageButton) findViewById(R.id.previousButton); mShuffleButton = (ImageButton) findViewById(R.id.shuffleButton); mRepeatButton = (ImageButton) findViewById(R.id.repeatButton); //Song info/seekbar elements. mSeekbar = (SeekBar) findViewById(R.id.nowPlayingSeekBar); mStreamingProgressBar = (ProgressBar) findViewById(R.id.startingStreamProgressBar); mStreamingProgressBar.setVisibility(View.GONE); try { mSeekbar.setThumb(getResources().getDrawable(R.drawable.transparent_drawable)); } catch (Exception e) { e.printStackTrace(); } if (mApp.getCurrentTheme() == Common.DARK_THEME) { mNextButton.setAlpha(1f); mPreviousButton.setAlpha(1f); } //KitKat specific layout code. setKitKatTranslucentBars(); //Set the control buttons and background. //setControlButtonsBackground(); setPlayPauseButton(); setShuffleButtonIcon(); setRepeatButtonIcon(); //Set the click listeners. mSeekbar.setOnSeekBarChangeListener(seekBarChangeListener); mNextButton.setOnClickListener(mOnClickNextListener); mPreviousButton.setOnClickListener(mOnClickPreviousListener); mPlayPauseButton.setOnClickListener(playPauseClickListener); mPlayPauseButtonBackground.setOnClickListener(playPauseClickListener); mShuffleButton.setOnClickListener(shuffleButtonClickListener); mRepeatButton.setOnClickListener(repeatButtonClickListener); //Apply haptic feedback to the play/pause button. mPlayPauseButtonBackground.setHapticFeedbackEnabled(true); mPlayPauseButton.setHapticFeedbackEnabled(true); }
From source file:com.kobi.metalsexchange.app.ExchangeRatesFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMetalId = getArguments().getString(METAL_ID); // Add this line in order for this fragment to handle menu events. setHasOptionsMenu(true);//w w w .j a v a2 s .co m /* Attach a rotating ImageView to the refresh item as an ActionView */ inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); refreshImageView = (ImageView) inflater.inflate(R.layout.refresh_action_view, null); rotation = AnimationUtils.loadAnimation(getActivity(), R.anim.clockwise_refresh); rotation.setRepeatCount(Animation.INFINITE); }
From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.common.DialogPassword.java
private void setPassword(final String pass1, final String pass2) { if (pass1 != null && !pass1.isEmpty() && pass1.equals(pass2)) { PreferenceManager.getDefaultSharedPreferences(getActivity()).edit() .putString(DialogPasswordSettings.KEY_PASSWORD, pass1).commit(); if (listener != null) { listener.onPasswordConfirmed(); }/*from ww w . j a va 2s . c o m*/ dismiss(); } else { Animation shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake); binding.passwordVerificationField.startAnimation(shake); Toast.makeText(getActivity(), getText(R.string.passwords_dont_match), Toast.LENGTH_SHORT).show(); } }
From source file:heartware.com.heartware_master.ProfileFragment.java
/** * start the animation on the graph// w ww . java2 s .com */ private void triggerAnimation() { // set up animation Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.animated_view); animation.setRepeatMode(Animation.REVERSE); animation.setRepeatCount(Animation.INFINITE); mGraph.startAnimation(animation); }
From source file:com.nexus.nsnik.randomno.view.fragments.CoinTossFragment.java
@Override public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { Animation animation = super.onCreateAnimation(transit, enter, nextAnim); if (animation == null && nextAnim != 0) { animation = AnimationUtils.loadAnimation(getActivity(), nextAnim); }/*from w w w . j av a2s . c o m*/ if (animation != null) { if (getView() != null) { getView().setLayerType(View.LAYER_TYPE_HARDWARE, null); } animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } public void onAnimationEnd(Animation animation) { if (getView() != null) { getView().setLayerType(View.LAYER_TYPE_NONE, null); } } @Override public void onAnimationRepeat(Animation animation) { } }); } return animation; }
From source file:com.ae.apps.messagecounter.fragments.MessageChartFragment.java
private void updateMessagesChart() { try {//from w ww .j ava 2 s. c o m // Reports of IllegalStateExceptions are received mTitleText.setText(getResources().getString(R.string.str_chart_title)); // Get the preference value for including message counts from non contacts boolean includeNonContactMessages = getIncludeNonContactMessagesPref(); // Do we need to show the other senders text? if (includeNonContactMessages) { mOtherSendersText.setVisibility(View.INVISIBLE); } else { mOtherSendersText.setVisibility(View.VISIBLE); } GraphData graphData = MessageCounterUtils.getMessageCountDegrees(mContactMessageList, mInboxMessageCount, AppConstants.MAX_ROWS_IN_CHART, includeNonContactMessages); View graphView = new SimpleGraphView(mContext, graphData.getValueInDegrees(), graphData.getLabels(), AppConstants.CHART_COLORFUL); // If we are updating, remove the previous graphView if (mGraphContainer.getChildCount() > 0) { mGraphContainer.removeAllViews(); } // Create a new SimpleGraphView and add it to the graphContainer Animation fadeInAnimation = AnimationUtils.loadAnimation(mContext, R.animator.fade_in); fadeInAnimation.setStartOffset(150); graphView.startAnimation(fadeInAnimation); mGraphContainer.addView(graphView); } catch (Exception e) { Log.e(TAG, e.getMessage()); } }
From source file:com.example.android.home.Home.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); setContentView(R.layout.home);/*from ww w . j a v a 2 s. c om*/ //setContentView(R.layout.home_main_panel); registerIntentReceivers(); //setDefaultWallpaper(); getWindow().setBackgroundDrawableResource(R.drawable.bg_android); loadApplications(true); bindApplications(); //bindFavorites(true); //bindRecents(); //bindButtons(); mGridEntry = AnimationUtils.loadAnimation(this, R.anim.grid_entry); mGridExit = AnimationUtils.loadAnimation(this, R.anim.grid_exit); // Set up page adapter HomePagerAdapter adapter = new HomePagerAdapter(getApplicationContext(), new ApplicationsAdapter(this, mApplications)); myPager = (ViewPager) findViewById(R.id.three_panel_pager); myPager.setAdapter(adapter); myPager.setCurrentItem(HomePagerAdapter.SCREEN_CENTER); }
From source file:com.lithiumli.fiction.LibraryActivity.java
private void showPlayerInfo() { View bab = findViewById(R.id.bab); View bab_hr = findViewById(R.id.bab_hr); if (bab.getVisibility() == View.GONE) { bab.setVisibility(View.VISIBLE); Animation showBab = AnimationUtils.loadAnimation(this, R.anim.bab); bab.startAnimation(showBab);//from ww w .java2 s . c o m bab_hr.startAnimation(showBab); } }
From source file:com.example.gangzhang.myapplication.VideoPlayerActivity.java
/** * * Called when the activity is first created. *///from ww w .j a v a 2 s . c om @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Log.d(TAG, "onCreate"); requestWindowFeature(Window.FEATURE_NO_TITLE);//?? Vitamio.isInitialized(this.getApplicationContext()); setContentView(R.layout.videoview); mPreview = (SurfaceView) findViewById(R.id.surface); mPreview.setClickable(false); holder = mPreview.getHolder(); holder.addCallback(this); holder.setFormat(PixelFormat.RGBA_8888); mProgressBar = (ImageView) findViewById(R.id.loading); mPlayImageView = (ImageView) findViewById(R.id.play); mPlayImageView.setOnClickListener(this); mImageCapture = (Button) findViewById(R.id.capture); mImageCapture.setOnClickListener(this); mImageCapture.setEnabled(false); mImageRecord = (Button) findViewById(R.id.record); mImageRecord.setOnClickListener(this); extras = getIntent().getExtras(); operatingAnim = AnimationUtils.loadAnimation(this, R.anim.loading_anim); LinearInterpolator lin = new LinearInterpolator(); operatingAnim.setInterpolator(lin); sp = getSharedPreferences(SettingFragment.KEY_SETTING, PreferenceActivity.MODE_PRIVATE); hardEnabled = sp.getBoolean(SettingFragment.KEY_HARD_DECODER, false); // byte[] bt= new byte[]{}; // load(); // initH264(bt); }
From source file:com.android.calculator2.Fragment.java
/** * Control whether the view is being displayed. You can make it not * displayed if you are waiting for the initial data to show in it. * During this time an indeterminant progress indicator will be * shown instead.// ww w . j a va 2 s . c o m * * @param shown If true, the view is shown; If false, the progress indicator. * The initial value is true. * * @param animate If true, an animation will be used to transition to the new state. */ private void setViewShown(boolean shown, boolean animate) { ensureView(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mViewShown == shown) { return; } mViewShown = shown; if (shown) { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mViewContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mViewContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mViewContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mViewContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mViewContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mViewContainer.setVisibility(View.GONE); } }