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.chalmers.feedlr.activity.FeedActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_view_flipper); // get helpers from android system res = getResources();//from www . j a v a 2s. c o m lbm = LocalBroadcastManager.getInstance(this); inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); // add intent filter to be used by broadcast reciever intentFilter = new IntentFilter(); intentFilter.addAction(TWITTER_USERS_UPDATED); intentFilter.addAction(TWITTER_USERS_PROBLEM_UPDATING); intentFilter.addAction(FACEBOOK_TIMELINE_UPDATED); intentFilter.addAction(FACEBOOK_USERS_UPDATED); intentFilter.addAction(FACEBOOK_USERS_PROBLEM_UPDATING); intentFilter.addAction(FACEBOOK_USER_NEWS_UPDATED); intentFilter.addAction(FEED_PROBLEM_UPDATING); // instanciate database helper db = new DatabaseHelper(this); // load typefaces from assets Typeface robotoMedium = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf"); // find views inflated from xml mainViewFlipper = (ViewFlipper) findViewById(R.id.main_view_flipper); feedViewSwiper = (ViewPager) findViewById(R.id.feed_view_pager); settingsViewFlipper = (ViewAnimator) findViewById(R.id.settings_view_flipper); facebookAuthButton = (Button) findViewById(R.id.button_facebook); twitterAuthButton = (Button) findViewById(R.id.button_twitter); Button cfb = (Button) findViewById(R.id.button_create_feed); Button s = (Button) findViewById(R.id.button_settings); settingsViewFlipper.getBackground().setDither(true); feedTitleTextView = (TextView) findViewById(R.id.feed_action_bar_title); // Set typefaces manually since Android can't handle custom typefaces in // xml in any way whatsoever. Shame on them. twitterAuthButton.setTypeface(robotoMedium); facebookAuthButton.setTypeface(robotoMedium); feedTitleTextView = (TextView) findViewById(R.id.feed_action_bar_title); cfb.setTypeface(robotoMedium); s.setTypeface(robotoMedium); feedTitleTextView.setTypeface(robotoMedium); // set adapters feedAdapter = new PageAdapter(getSupportFragmentManager(), db, this); feedViewSwiper.setAdapter(feedAdapter); // lets 3 feedsviews to each side of the current one be retained in an // idle state. feedViewSwiper.setOffscreenPageLimit(3); CirclePageIndicator circleIndicator = (CirclePageIndicator) findViewById(R.id.indicator); circleIndicator.setViewPager(feedViewSwiper); circleIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int feedIndex) { String feedTitle = feedAdapter.getFeedTitle(feedIndex); feedTitleTextView.setText(feedTitle); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub' } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); // instanciate client and service helpers clientHandler = new ClientHandler(this); feedService = new DataServiceHelper(this); feedService.startService(); // load animations from res/anim slideOutLeft = AnimationUtils.loadAnimation(this, R.anim.slide_out_left); slideOutRight = AnimationUtils.loadAnimation(this, R.anim.slide_out_right); slideInLeft = AnimationUtils.loadAnimation(this, R.anim.slide_in_left); slideInRight = AnimationUtils.loadAnimation(this, R.anim.slide_in_right); // Display name correct if (feedAdapter.getCount() > 0) { String feedTitle = feedAdapter.getFeedTitle(0); feedTitleTextView.setText(feedTitle); } // misc settingsViewFlipper.setInAnimation(slideInRight); settingsViewFlipper.setOutAnimation(slideOutLeft); updateOverlay(); }
From source file:com.teleca.jamendo.activity.PlayerActivity.java
/** Called when the activity is first created. */ @Override// ww w . j a v a 2 s .c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(JamendoApplication.TAG, "PlayerActivity.onCreate"); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.player); // XML binding mBetterRes = getResources().getString(R.string.better_res); mArtistTextView = (TextView) findViewById(R.id.ArtistTextView); mSongTextView = (TextView) findViewById(R.id.SongTextView); //AutoScrolling of long song titles mSongTextView.setEllipsize(TruncateAt.MARQUEE); mSongTextView.setHorizontallyScrolling(true); mSongTextView.setSelected(true); mCurrentTimeTextView = (TextView) findViewById(R.id.CurrentTimeTextView); mTotalTimeTextView = (TextView) findViewById(R.id.TotalTimeTextView); mRatingBar = (RatingBar) findViewById(R.id.TrackRowRatingBar); mCoverImageView = (RemoteImageView) findViewById(R.id.CoverImageView); mCoverImageView.setOnClickListener(mCoverOnClickListener); mCoverImageView.setDefaultImage(R.drawable.no_cd_300); mProgressBar = (ProgressBar) findViewById(R.id.ProgressBar); mReflectableLayout = (ReflectableLayout) findViewById(R.id.ReflectableLayout); mReflectiveSurface = (ReflectiveSurface) findViewById(R.id.ReflectiveSurface); if (mReflectableLayout != null && mReflectiveSurface != null) { mReflectableLayout.setReflectiveSurface(mReflectiveSurface); mReflectiveSurface.setReflectableLayout(mReflectableLayout); } handleIntent(); //used for Fade Out Animation handle control mHandlerOfFadeOutAnimation = new Handler(); mRunnableOfFadeOutAnimation = new Runnable() { public void run() { if (mFadeInAnimation.hasEnded()) mPlayImageButton.startAnimation(mFadeOutAnimation); } }; mPlayImageButton = (ImageButton) findViewById(R.id.PlayImageButton); mPlayImageButton.setOnClickListener(mPlayOnClickListener); mNextImageButton = (ImageButton) findViewById(R.id.NextImageButton); mNextImageButton.setOnTouchListener(mOnForwardTouchListener); mPrevImageButton = (ImageButton) findViewById(R.id.PrevImageButton); mPrevImageButton.setOnTouchListener(mOnRewindTouchListener); mStopImageButton = (ImageButton) findViewById(R.id.StopImageButton); mStopImageButton.setOnClickListener(mStopOnClickListener); mShuffleImageButton = (ImageButton) findViewById(R.id.ShuffleImageButton); mShuffleImageButton.setOnClickListener(mShuffleOnClickListener); mRepeatImageButton = (ImageButton) findViewById(R.id.RepeatImageButton); mRepeatImageButton.setOnClickListener(mRepeatOnClickListener); mFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_in); mFadeInAnimation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { mHandlerOfFadeOutAnimation.removeCallbacks(mRunnableOfFadeOutAnimation); mHandlerOfFadeOutAnimation.postDelayed(mRunnableOfFadeOutAnimation, 7500); } @Override public void onAnimationRepeat(Animation animation) { // nothing here } @Override public void onAnimationStart(Animation animation) { setMediaVisible(); } }); mFadeOutAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_out); mFadeOutAnimation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { setMediaGone(); } @Override public void onAnimationRepeat(Animation animation) { // nothing here } @Override public void onAnimationStart(Animation animation) { setFadeOutAnimation(); } }); mLicenseImageView = (RemoteImageView) findViewById(R.id.LicenseImageView); mCurrentAlbum = null; mSlidingDrawer = (SlidingDrawer) findViewById(R.id.drawer); // cupcake backwards compability int sdkVersion = Integer.parseInt(Build.VERSION.SDK); if (sdkVersion == Build.VERSION_CODES.CUPCAKE) { new CupcakeListener(); } mGesturesOverlayView = (GestureOverlayView) findViewById(R.id.gestures); mGesturesOverlayView .addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler()); }
From source file:com.hamsik2046.password.view.SingleInputFormActivity.java
private void setupError() { mErrorSwitcher.setInAnimation(AnimationUtils.loadAnimation(activity, android.R.anim.slide_in_left)); mErrorSwitcher.setOutAnimation(AnimationUtils.loadAnimation(activity, android.R.anim.slide_out_right)); mErrorSwitcher.setFactory(new ViewSwitcher.ViewFactory() { @Override//from w ww.j av a2s . co m public View makeView() { TextView view = (TextView) activity.getLayoutInflater().inflate(R.layout.view_error, null); if (view != null) { view.setTextColor(mErrorTextColor); } return view; } }); mErrorSwitcher.setText(""); }
From source file:br.com.oficinatablet.chats.fragments.ChatSectionFragment.java
/** * Here is the key method to apply the animation *///w w w . j ava 2 s . c o m private void setAnimation(View viewToAnimate, int position) { // If the bound view wasn't previously displayed on screen, it's animated if (position > lastPosition) { Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_down); viewToAnimate.startAnimation(animation); lastPosition = position; } }
From source file:fr.music.overallbrothers.activity.PlayerActivity.java
/** Called when the activity is first created. */ @Override/* w w w. j a va 2s.c om*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(JamendoApplication.TAG, "PlayerActivity.onCreate"); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.player); // XML binding mBetterRes = getResources().getString(R.string.better_res); mArtistTextView = (TextView) findViewById(R.id.ArtistTextView); mSongTextView = (TextView) findViewById(R.id.SongTextView); //AutoScrolling of long song titles mSongTextView.setEllipsize(TruncateAt.MARQUEE); mSongTextView.setHorizontallyScrolling(true); mSongTextView.setSelected(true); mCurrentTimeTextView = (TextView) findViewById(R.id.CurrentTimeTextView); mTotalTimeTextView = (TextView) findViewById(R.id.TotalTimeTextView); mRatingBar = (RatingBar) findViewById(R.id.TrackRowRatingBar); mCoverImageView = (RemoteImageView) findViewById(R.id.CoverImageView); mCoverImageView.setOnClickListener(mCoverOnClickListener); mCoverImageView.setDefaultImage(R.drawable.no_cd_300); mProgressBar = (ProgressBar) findViewById(R.id.ProgressBar); mReflectableLayout = (ReflectableLayout) findViewById(R.id.ReflectableLayout); mReflectiveSurface = (ReflectiveSurface) findViewById(R.id.ReflectiveSurface); if (mReflectableLayout != null && mReflectiveSurface != null) { mReflectableLayout.setReflectiveSurface(mReflectiveSurface); mReflectiveSurface.setReflectableLayout(mReflectableLayout); } handleIntent(); //used for Fade Out Animation handle control mHandlerOfFadeOutAnimation = new Handler(); mRunnableOfFadeOutAnimation = new Runnable() { public void run() { if (mFadeInAnimation.hasEnded()) mPlayImageButton.startAnimation(mFadeOutAnimation); } }; mPlayImageButton = (ImageButton) findViewById(R.id.PlayImageButton); mPlayImageButton.setOnClickListener(mPlayOnClickListener); mNextImageButton = (ImageButton) findViewById(R.id.NextImageButton); mNextImageButton.setOnTouchListener(mOnForwardTouchListener); mPrevImageButton = (ImageButton) findViewById(R.id.PrevImageButton); mPrevImageButton.setOnTouchListener(mOnRewindTouchListener); mStopImageButton = (ImageButton) findViewById(R.id.StopImageButton); mStopImageButton.setOnClickListener(mStopOnClickListener); mPrevListImageButton = (ImageButton) findViewById(R.id.PrevListImageButton); mPrevListImageButton.setOnClickListener(mPrevListOnClickListener); mShuffleImageButton = (ImageButton) findViewById(R.id.ShuffleImageButton); mShuffleImageButton.setOnClickListener(mShuffleOnClickListener); mRepeatImageButton = (ImageButton) findViewById(R.id.RepeatImageButton); mRepeatImageButton.setOnClickListener(mRepeatOnClickListener); mFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_in); mFadeInAnimation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { mHandlerOfFadeOutAnimation.removeCallbacks(mRunnableOfFadeOutAnimation); mHandlerOfFadeOutAnimation.postDelayed(mRunnableOfFadeOutAnimation, 7500); } @Override public void onAnimationRepeat(Animation animation) { // nothing here } @Override public void onAnimationStart(Animation animation) { setMediaVisible(); } }); mFadeOutAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_out); mFadeOutAnimation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { setMediaGone(); } @Override public void onAnimationRepeat(Animation animation) { // nothing here } @Override public void onAnimationStart(Animation animation) { setFadeOutAnimation(); } }); mLicenseImageView = (RemoteImageView) findViewById(R.id.LicenseImageView); mCurrentAlbum = null; mSlidingDrawer = (SlidingDrawer) findViewById(R.id.drawer); // cupcake backwards compability int sdkVersion = Integer.parseInt(Build.VERSION.SDK); if (sdkVersion == Build.VERSION_CODES.CUPCAKE) { new CupcakeListener(); } mGesturesOverlayView = (GestureOverlayView) findViewById(R.id.gestures); mGesturesOverlayView .addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler()); }
From source file:com.example.bufferandroidproject.abs.ItemListFragment.java
private ItemListFragment<E> fadeIn(final View view, final boolean animate) { if (view != null) if (animate) view.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); else// www . jav a 2s . c om view.clearAnimation(); return this; }
From source file:com.cattle.PhotoViewerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_photo_viewer); mContentView = (ViewGroup) findViewById(R.id.fl_root); mController = PhotoUploadController.getFromContext(this); EventBus.getDefault().register(this); final Intent intent = getIntent(); mMode = intent.getIntExtra(EXTRA_MODE, MODE_ALL_VALUE); if (mMode == MODE_ALL_VALUE) { mBucketId = intent.getStringExtra(EXTRA_BUCKET_ID); }/*from ww w.j av a2 s. c om*/ mViewPager = (ViewPager) findViewById(R.id.vp_photos); mViewPager.setOffscreenPageLimit(2); mViewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.viewpager_margin)); mViewPager.setOnPageChangeListener(this); if (mMode == MODE_ALL_VALUE) { mAdapter = new UserPhotosViewPagerAdapter(this, this, this); getSupportLoaderManager().initLoader(0, null, this); } else { mAdapter = new SelectedPhotosViewPagerAdapter(this, this, this); } mViewPager.setAdapter(mAdapter); if (intent.hasExtra(EXTRA_POSITION)) { mRequestedPosition = intent.getIntExtra(EXTRA_POSITION, 0); mViewPager.setCurrentItem(mRequestedPosition); } mFadeOutAnimation = AnimationUtils.loadAnimation(this, R.anim.photo_fade_out); mFriendsFragment = new FriendsListFragment(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(" "); /** * Nasty hack, basically we need to know when the ViewPager is laid out, * we then manually call onPageSelected. This is to fix onPageSelected * not being called on the first item. */ mViewPager.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @SuppressWarnings("deprecation") public void onGlobalLayout() { mViewPager.getViewTreeObserver().removeGlobalOnLayoutListener(this); onPageSelected(mViewPager.getCurrentItem()); showTapToTagPrompt(); } }); }
From source file:com.hemou.android.ui.base._ItemListFragment.java
private _ItemListFragment<E> fadeIn(final View view, final boolean animate) { if (view != null) if (animate) view.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); else/*from w ww . j ava 2s . co m*/ view.clearAnimation(); return this; }
From source file:com.guoxiaoxing.kitty.ui.MainActivity.java
@Override public void onTabChanged(String tabId) { final int size = mTabHost.getTabWidget().getTabCount(); for (int i = 0; i < size; i++) { View view = mTabHost.getTabWidget().getChildAt(i); if (i == mTabHost.getCurrentTab()) { view.setSelected(true);/*from www .j a v a 2s .com*/ Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.btn_zoom_in); view.startAnimation(animation); } else { view.setSelected(false); } } if (tabId.equals(getString(MainTab.MINE.getResName()))) { mBvNotice.setText(""); mBvNotice.hide(); } supportInvalidateOptionsMenu(); }
From source file:com.android.incallui.CallCardFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mPulseAnimation = AnimationUtils.loadAnimation(view.getContext(), R.anim.call_status_pulse); mPhoneNumber = (TextView) view.findViewById(R.id.phoneNumber); mPrimaryName = (TextView) view.findViewById(R.id.name); mNumberLabel = (TextView) view.findViewById(R.id.label); mSecondaryCallInfo = view.findViewById(R.id.secondary_call_info); mSecondaryCallProviderInfo = view.findViewById(R.id.secondary_call_provider_info); mCallCardContent = view.findViewById(R.id.call_card_content); mPhotoLarge = (ImageView) view.findViewById(R.id.photoLarge); mPhotoLarge.setOnClickListener(new View.OnClickListener() { @Override//from w ww. java 2s . c o m public void onClick(View v) { getPresenter().onContactPhotoClick(); } }); mContactContext = view.findViewById(R.id.contact_context); mContactContextTitle = (TextView) view.findViewById(R.id.contactContextTitle); mContactContextListView = (ListView) view.findViewById(R.id.contactContextInfo); // This layout stores all the list header layouts so they can be easily removed. mContactContextListHeaders = new LinearLayout(getView().getContext()); mContactContextListView.addHeaderView(mContactContextListHeaders); mCallStateIcon = (ImageView) view.findViewById(R.id.callStateIcon); mCallStateVideoCallIcon = (ImageView) view.findViewById(R.id.videoCallIcon); mWorkProfileIcon = (ImageView) view.findViewById(R.id.workProfileIcon); mCallStateLabel = (TextView) view.findViewById(R.id.callStateLabel); mHdAudioIcon = (ImageView) view.findViewById(R.id.hdAudioIcon); mForwardIcon = (ImageView) view.findViewById(R.id.forwardIcon); mCallNumberAndLabel = view.findViewById(R.id.labelAndNumber); mCallTypeLabel = (TextView) view.findViewById(R.id.callTypeLabel); mElapsedTime = (TextView) view.findViewById(R.id.elapsedTime); mPrimaryCallCardContainer = view.findViewById(R.id.primary_call_info_container); mPrimaryCallInfo = (ViewGroup) view.findViewById(R.id.primary_call_banner); mCallButtonsContainer = view.findViewById(R.id.callButtonFragment); mPhotoSmall = (ImageView) view.findViewById(R.id.photoSmall); mPhotoSmall.setVisibility(View.GONE); mInCallMessageLabel = (TextView) view.findViewById(R.id.connectionServiceMessage); mProgressSpinner = view.findViewById(R.id.progressSpinner); mFloatingActionButtonContainer = view.findViewById(R.id.floating_end_call_action_button_container); mFloatingActionButton = (ImageButton) view.findViewById(R.id.floating_end_call_action_button); mFloatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getPresenter().endCallClicked(); } }); mFloatingActionButtonController = new FloatingActionButtonController(getActivity(), mFloatingActionButtonContainer, mFloatingActionButton); mSecondaryCallInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getPresenter().secondaryInfoClicked(); updateFabPositionForSecondaryCallInfo(); } }); mCallStateButton = view.findViewById(R.id.callStateButton); mCallStateButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { getPresenter().onCallStateButtonTouched(); return false; } }); mManageConferenceCallButton = view.findViewById(R.id.manage_conference_call_button); mManageConferenceCallButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { InCallActivity activity = (InCallActivity) getActivity(); activity.showConferenceFragment(true); } }); mPrimaryName.setElegantTextHeight(false); mCallStateLabel.setElegantTextHeight(false); mCallSubject = (TextView) view.findViewById(R.id.callSubject); }