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.teitsmch.hearthmaker.MainActivity.java
private void setBarDownAnimation(View viewToAnimate) { Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_in_down); viewToAnimate.startAnimation(animation); }
From source file:android.support.design.widget.BaseTransientBottomBar.java
void animateViewIn() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.setTranslationY(mView, mView.getHeight()); ViewCompat.animate(mView).translationY(0f).setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setDuration(ANIMATION_DURATION).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override/*from w ww . j a v a 2 s . co m*/ public void onAnimationStart(View view) { mContentViewCallback.animateContentIn(ANIMATION_DURATION - ANIMATION_FADE_DURATION, ANIMATION_FADE_DURATION); } @Override public void onAnimationEnd(View view) { onViewShown(); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_in); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewShown(); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.android.dialer.DialtactsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Trace.beginSection(TAG + " onCreate"); super.onCreate(savedInstanceState); mFirstLaunch = true;/*from w ww . ja v a 2s.c om*/ final Resources resources = getResources(); mActionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height_large); Trace.beginSection(TAG + " setContentView"); setContentView(R.layout.dialtacts_activity); Trace.endSection(); getWindow().setBackgroundDrawable(null); Trace.beginSection(TAG + " setup Views"); final ActionBar actionBar = getSupportActionBar(); actionBar.setCustomView(R.layout.search_edittext); actionBar.setDisplayShowCustomEnabled(true); actionBar.setBackgroundDrawable(null); SearchEditTextLayout searchEditTextLayout = (SearchEditTextLayout) actionBar.getCustomView() .findViewById(R.id.search_view_container); searchEditTextLayout.setPreImeKeyListener(mSearchEditTextLayoutListener); mActionBarController = new ActionBarController(this, searchEditTextLayout); mSearchView = (EditText) searchEditTextLayout.findViewById(R.id.search_view); mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener); mVoiceSearchButton = searchEditTextLayout.findViewById(R.id.voice_search_button); searchEditTextLayout.findViewById(R.id.search_magnifying_glass) .setOnClickListener(mSearchViewOnClickListener); searchEditTextLayout.findViewById(R.id.search_box_start_search) .setOnClickListener(mSearchViewOnClickListener); searchEditTextLayout.setOnClickListener(mSearchViewOnClickListener); searchEditTextLayout.setCallback(new SearchEditTextLayout.Callback() { @Override public void onBackButtonClicked() { onBackPressed(); } @Override public void onSearchViewClicked() { // Hide FAB, as the keyboard is shown. mFloatingActionButtonController.scaleOut(); } }); mIsLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; mPreviouslySelectedTabIndex = ListsFragment.TAB_INDEX_SPEED_DIAL; final View floatingActionButtonContainer = findViewById(R.id.floating_action_button_container); ImageButton floatingActionButton = (ImageButton) findViewById(R.id.floating_action_button); floatingActionButton.setOnClickListener(this); mFloatingActionButtonController = new FloatingActionButtonController(this, floatingActionButtonContainer, floatingActionButton); ImageButton optionsMenuButton = (ImageButton) searchEditTextLayout .findViewById(R.id.dialtacts_options_menu_button); optionsMenuButton.setOnClickListener(this); mOverflowMenu = buildOptionsMenu(searchEditTextLayout); optionsMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener()); // Add the favorites fragment but only if savedInstanceState is null. Otherwise the // fragment manager is responsible for recreating it. if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.dialtacts_frame, new ListsFragment(), TAG_FAVORITES_FRAGMENT).commit(); } else { mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY); mInRegularSearch = savedInstanceState.getBoolean(KEY_IN_REGULAR_SEARCH_UI); mInDialpadSearch = savedInstanceState.getBoolean(KEY_IN_DIALPAD_SEARCH_UI); mFirstLaunch = savedInstanceState.getBoolean(KEY_FIRST_LAUNCH); mShowDialpadOnResume = savedInstanceState.getBoolean(KEY_IS_DIALPAD_SHOWN); mActionBarController.restoreInstanceState(savedInstanceState); } final boolean isLayoutRtl = DialerUtils.isRtl(); if (mIsLandscape) { mSlideIn = AnimationUtils.loadAnimation(this, isLayoutRtl ? R.anim.dialpad_slide_in_left : R.anim.dialpad_slide_in_right); mSlideOut = AnimationUtils.loadAnimation(this, isLayoutRtl ? R.anim.dialpad_slide_out_left : R.anim.dialpad_slide_out_right); } else { mSlideIn = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_in_bottom); mSlideOut = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_out_bottom); } mSlideIn.setInterpolator(AnimUtils.EASE_IN); mSlideOut.setInterpolator(AnimUtils.EASE_OUT); mSlideIn.setAnimationListener(mSlideInListener); mSlideOut.setAnimationListener(mSlideOutListener); mParentLayout = (CoordinatorLayout) findViewById(R.id.dialtacts_mainlayout); mParentLayout.setOnDragListener(new LayoutOnDragListener()); floatingActionButtonContainer.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { final ViewTreeObserver observer = floatingActionButtonContainer.getViewTreeObserver(); if (!observer.isAlive()) { return; } observer.removeOnGlobalLayoutListener(this); int screenWidth = mParentLayout.getWidth(); mFloatingActionButtonController.setScreenWidth(screenWidth); mFloatingActionButtonController.align(getFabAlignment(), false /* animate */); } }); Trace.endSection(); Trace.beginSection(TAG + " initialize smart dialing"); mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this); SmartDialPrefix.initializeNanpSettings(this); Trace.endSection(); Trace.endSection(); }
From source file:com.oginotihiro.snackbar.Snackbar.java
private void animateViewOut(final int event) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewPropertyAnimatorCompat vpac = ViewCompat.animate(mView); if (mDirection == LEFT_RIGHT) { vpac.translationX(-mView.getWidth()); } else if (mDirection == TOP_BOTTOM) { vpac.translationY(-mView.getHeight()); } else if (mDirection == RIGHT_LEFT) { vpac.translationX(mView.getWidth()); } else if (mDirection == BOTTOM_TOP) { vpac.translationY(mView.getHeight()); }/*from w ww.ja v a 2s .co m*/ vpac.setInterpolator(new FastOutSlowInInterpolator()).setDuration(mAnimDuration) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationStart(View view) { mView.animateChildrenOut(0, mAnimFadeDuration); } @Override public void onAnimationEnd(View view) { onViewHidden(event); } }).start(); } else { Animation anim = null; if (mDirection == LEFT_RIGHT) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_left_out); } else if (mDirection == TOP_BOTTOM) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_top_out); } else if (mDirection == RIGHT_LEFT) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_right_out); } else if (mDirection == BOTTOM_TOP) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_bottom_out); } if (anim == null) return; anim.setInterpolator(new FastOutSlowInInterpolator()); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { onViewHidden(event); } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.heinrichreimersoftware.materialdrawer.DrawerView.java
private void updateProfile() { Log.d(TAG, "updateProfile()"); if (mProfileAdapter.getCount() > 0) { final DrawerProfile currentProfile = mProfileAdapter.getItem(0); if (mProfileAdapter.getCount() > 2) { /* More than two profiles. Should show a little badge. */ imageViewProfileAvatarSecondary.setVisibility(GONE); textViewProfileAvatarCount.setVisibility(VISIBLE); textViewProfileAvatarCount.setText("+" + (mProfileAdapter.getCount() - 1)); textViewProfileAvatarCount.setOnClickListener(new OnClickListener() { @Override/* w ww .ja v a 2s . c om*/ public void onClick(View v) { openProfileList(); } }); if (currentProfile.getBackground() instanceof BitmapDrawable) { Palette.generateAsync(((BitmapDrawable) currentProfile.getBackground()).getBitmap(), new Palette.PaletteAsyncListener() { @Override public void onGenerated(Palette palette) { Palette.Swatch vibrantSwatch = palette.getVibrantSwatch(); if (vibrantSwatch != null) { textViewProfileAvatarCount.setTextColor(vibrantSwatch.getTitleTextColor()); textViewProfileAvatarCount.getBackground() .setColorFilter(vibrantSwatch.getRgb(), PorterDuff.Mode.SRC_IN); } } }); } } else if (mProfileAdapter.getCount() == 2) { /* Two profiles. Should show the second profile avatar. */ final DrawerProfile secondProfile = mProfileAdapter.getItem(1); imageViewProfileAvatarSecondary.setVisibility(VISIBLE); imageViewProfileAvatarSecondary.setImageDrawable(secondProfile.getAvatar()); imageViewProfileAvatarSecondary.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectProfile(secondProfile); } }); textViewProfileAvatarCount.setVisibility(GONE); closeProfileList(); } if (currentProfile.getAvatar() != null) { imageViewProfileAvatar.setImageDrawable(currentProfile.getAvatar()); } if (currentProfile.getName() != null && !currentProfile.getName().equals("")) { textViewProfileName.setText(currentProfile.getName()); } if (currentProfile.getBackground() != null) { imageViewProfileBackground.setImageDrawable(currentProfile.getBackground()); } else { int colorPrimary = getResources().getColor(R.color.primary_dark_material_light); TypedArray a = getContext().getTheme().obtainStyledAttributes(new int[] { R.attr.colorPrimary }); try { colorPrimary = a.getColor(0, 0); } finally { a.recycle(); } imageViewProfileBackground.setImageDrawable(new ColorDrawable(colorPrimary)); } if (currentProfile.getDescription() != null && !currentProfile.getDescription().equals("")) { textViewProfileDescription.setVisibility(VISIBLE); textViewProfileDescription.setText(currentProfile.getDescription()); } else { textViewProfileDescription.setVisibility(GONE); } if (currentProfile.hasOnProfileClickListener()) { frameLayoutProfile.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { currentProfile.getOnProfileClickListener().onClick(currentProfile, currentProfile.getId()); } }); frameLayoutProfile.setEnabled(true); } else { if (hasOnProfileClickListener()) { frameLayoutProfile.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { getOnProfileClickListener().onClick(currentProfile, currentProfile.getId()); } }); frameLayoutProfile.setEnabled(true); } else { frameLayoutProfile.setEnabled(false); } } if (getWidth() > 0 && frameLayoutProfile.getVisibility() != View.VISIBLE) { frameLayoutProfile .startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.abc_slide_in_top)); } frameLayoutProfile.setVisibility(VISIBLE); layout.setPadding(0, 0, 0, 0); } else { frameLayoutProfile.setVisibility(GONE); layout.setPadding(0, statusBarHeight, 0, 0); closeProfileList(); } }
From source file:com.raja.knowme.FragmentWorkExp.java
private void previousComapny() { count--;//from ww w .j a v a2 s .c om mCompanyNameSwitcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_in)); mCompanyNameSwitcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_out)); mCompanySpanSwitcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_in)); mCompanySpanSwitcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_out)); mCompanySummarySwitcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_in)); mCompanySummarySwitcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_out)); mCompanyNameSwitcher.setText(mData.get(count).getCompanyName()); mCompanySpanSwitcher.setText(mData.get(count).getWorkSpan()); mCompanySummarySwitcher.setText(mData.get(count).getWorkDetails()); mScrollContainer.scrollTo(0, 0); }
From source file:com.ingenia.fasttrack.SnackBar.MultilineSnackbar.java
private void animateViewIn() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.setTranslationY(mView, mView.getHeight()); ViewCompat.animate(mView).translationY(0f) .setInterpolator(com.ingenia.fasttrack.SnackBar.AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR) .setDuration(ANIMATION_DURATION).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override//w ww . j a v a2 s . com public void onAnimationStart(View view) { if (!mAccessibilityManager.isEnabled()) { // Animating the children in causes Talkback to think that they're // not visible when the TYPE_WINDOW_CONTENT_CHANGED event if fired. // Fixed by skipping the animation when an accessibility manager // is enabled mView.animateChildrenIn(ANIMATION_DURATION - ANIMATION_FADE_DURATION, ANIMATION_FADE_DURATION); } } @Override public void onAnimationEnd(View view) { onViewShown(); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), android.support.design.R.anim.design_snackbar_in); anim.setInterpolator(com.ingenia.fasttrack.SnackBar.AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewShown(); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.iw.flirten.snackbar.Snackbar.MultilineSnackbar.java
private void animateViewIn() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.setTranslationY(mView, mView.getHeight()); ViewCompat.animate(mView).translationY(0f) .setInterpolator(com.iw.flirten.snackbar.Snackbar.AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR) .setDuration(ANIMATION_DURATION).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override//w w w. ja va 2 s . c o m public void onAnimationStart(View view) { if (!mAccessibilityManager.isEnabled()) { // Animating the children in causes Talkback to think that they're // not visible when the TYPE_WINDOW_CONTENT_CHANGED event if fired. // Fixed by skipping the animation when an accessibility manager // is enabled mView.animateChildrenIn(ANIMATION_DURATION - ANIMATION_FADE_DURATION, ANIMATION_FADE_DURATION); } } @Override public void onAnimationEnd(View view) { onViewShown(); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), android.support.design.R.anim.design_snackbar_in); anim.setInterpolator(com.iw.flirten.snackbar.Snackbar.AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewShown(); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.example.android.tryanimationt.TryAnimationFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mCardView = (CardView) view.findViewById(R.id.cardview); fab1st = (android.widget.ImageButton) view.findViewById(R.id.fabBt); fab2nd = (android.widget.ImageButton) view.findViewById(R.id.fabBt2); fab3rd = (android.widget.ImageButton) view.findViewById(R.id.fab3); footer = view.findViewById(R.id.footer); animButtons(fab1st, true, 2500, 0);//from w w w . ja v a 2 s . co m animButtons(fab2nd, true, 1000, 150); animButtons(fab3rd, true, 2000, 250); fab1st.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AnimatorSet animSet = new AnimatorSet(); ObjectAnimator anim2 = ObjectAnimator.ofFloat(fab1st, "rotationX", 0, 359); anim2.setDuration(1500); ObjectAnimator anim3 = ObjectAnimator.ofFloat(fab1st, "rotationY", 0, 359); anim3.setDuration(1500); ObjectAnimator animTrx = ObjectAnimator.ofFloat(fab1st, "translationX", 0, -20); animTrx.setDuration(2500); ObjectAnimator animTry = ObjectAnimator.ofFloat(fab1st, "translationY", 0, -20); animTry.setDuration(2500); animSet.setInterpolator(new BounceInterpolator()); animSet.playTogether(anim2, anim3, animTry, animTrx); animSet.start(); } }); fab1st.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { int size = getResources().getDimensionPixelSize(R.dimen.fab_size); outline.setOval(0, 0, size, size); outline.setRoundRect(0, 0, size, size, size / 2); } }); fab1st.setClipToOutline(true); final View vImage = view.findViewById(R.id.image); final View vCard = view.findViewById(R.id.cardview); final View vCardTextPart = view.findViewById(R.id.cardview_textpart2); final View vCardContentContainer = view.findViewById(R.id.cardContentContainer); vCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), // Now we provide a list of Pair items which contain the view we can transitioning // from, and the name of the view it is transitioning to, in the launched activity android.support.v4.util.Pair.create(vImage, "photo_hero"), android.support.v4.util.Pair.create(vCardTextPart, "sharedSceneTrasintionText")); Intent intent = new Intent(getActivity(), sceneTransitionActivity.class); intent.putExtra("photo_hero", R.drawable.image1); ActivityCompat.startActivity(getActivity(), intent, options.toBundle()); } }); fab2nd.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { int size = getResources().getDimensionPixelSize(R.dimen.fab_size); outline.setOval(0, 0, size, size); outline.setRoundRect(0, 0, size, size, size / 2); } }); fab2nd.setClipToOutline(true); final AnimationDrawable[] animDrawables = new AnimationDrawable[2]; animDrawables[0] = (AnimationDrawable) getResources().getDrawable(R.drawable.anim_off_to_on); animDrawables[1] = (AnimationDrawable) getResources().getDrawable(R.drawable.anim_on_to_off); animDrawables[0].setOneShot(true); animDrawables[1].setOneShot(true); fab2nd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final int fab2InconIndex = mAnimationStateIndex; mAnimationStateIndex = (mAnimationStateIndex + 1) % 2; /*****************************************************/ // animate the card //final Animation myRotation = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_anim); //mCardView.startAnimation(myRotation); int start; int end; if (mAnimationStateIndex == 0) { start = Color.rgb(0x71, 0xc3, 0xde); end = Color.rgb(0x68, 0xe8, 0xee); } else { start = Color.rgb(0x68, 0xe8, 0xee); end = Color.rgb(0x71, 0xc3, 0xde); } AnimatorSet animSet = new AnimatorSet(); ValueAnimator valueAnimator = ObjectAnimator.ofInt(vCardContentContainer, "backgroundColor", start, end); valueAnimator.setInterpolator(new BounceInterpolator()); valueAnimator.setDuration(2000); valueAnimator.setEvaluator(new ArgbEvaluator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int animProgress = (Integer) animation.getAnimatedValue(); } }); valueAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mCardView.setRadius(8); //mCardView.setElevation(0); } }); float rotateStart, rotateEnd; float scaleXStart, scaleXEnd; float rotateXStart, rotateXEnd; float rotateYStart, rotateYEnd; float transitionXStart, transitionXEnd; float transitionYStart, transitionYEnd; if (mAnimationStateIndex == 0) { rotateStart = 0f; rotateEnd = 80f; scaleXStart = 1f; scaleXEnd = 0.66f; rotateXStart = 0f; rotateXEnd = 30f; rotateYStart = 0f; rotateYEnd = 30f; transitionYStart = 0f; transitionYEnd = -100f; transitionXStart = 0f; transitionXEnd = 100f; } else { rotateStart = 80f; rotateEnd = 0f; scaleXStart = 0.66f; scaleXEnd = 1; rotateXStart = 30; rotateXEnd = 0f; rotateYStart = 30f; rotateYEnd = 0f; transitionYStart = -100f; transitionYEnd = 0f; transitionXStart = 100f; transitionXEnd = 0f; } ObjectAnimator anim = ObjectAnimator.ofFloat(mCardView, "rotation", rotateStart, rotateEnd); anim.setDuration(2000); ObjectAnimator anim1 = ObjectAnimator.ofFloat(mCardView, "scaleX", scaleXStart, scaleXEnd); anim1.setDuration(2000); ObjectAnimator anim2 = ObjectAnimator.ofFloat(mCardView, "rotationX", rotateXStart, rotateXEnd); anim2.setDuration(2000); ObjectAnimator anim3 = ObjectAnimator.ofFloat(mCardView, "rotationY", rotateYStart, rotateYEnd); anim3.setDuration(2000); ObjectAnimator animTry = ObjectAnimator.ofFloat(mCardView, "translationY", transitionYStart, transitionYEnd); animTry.setDuration(2000); ObjectAnimator animTrx = ObjectAnimator.ofFloat(mCardView, "translationX", transitionXStart, transitionXEnd); animTrx.setDuration(2000); animSet.setInterpolator(new BounceInterpolator()); animSet.playTogether(valueAnimator, anim, anim2, anim3, anim1, animTry, animTrx); float controlX1, controlY1, controlX2, controlY2; if (mAnimationStateIndex == 0) { controlX1 = 0f; controlY1 = 0.25f; controlX2 = 1; controlY2 = 1; } else { controlX1 = 1; controlY1 = 1; controlX2 = 0.25f; controlY2 = 1; } PathInterpolator pathInterpolator = new PathInterpolator(controlX1, controlY1, controlX2, controlY2); animTrx.setInterpolator(pathInterpolator); animSet.start(); /*****************************************************/ // animate rotate white button RotateAnimation r = new RotateAnimation(0, 359, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); r.setDuration(2000); r.setFillAfter(true); r.setInterpolator(new BounceInterpolator()); fab2nd.startAnimation(r); // change 2nd button image fab2nd.setImageDrawable(animDrawables[fab2InconIndex]); animDrawables[fab2InconIndex].start(); /*****************************************************/ // animate changing 3rd button image fab3rd.setImageDrawable(animDrawables[mAnimationStateIndex]); animDrawables[mAnimationStateIndex].start(); /*****************************************************/ // using AnimatedStateListDrawable to animate the 1st button image by its state { Drawable drawable = getActivity().getResources().getDrawable(R.drawable.icon_anim); fab1st.setImageDrawable(drawable); final int[] STATE_CHECKED = new int[] { android.R.attr.state_checked }; final int[] STATE_UNCHECKED = new int[] {}; // set state fab1st.setImageState((mAnimationStateIndex != 0) ? STATE_UNCHECKED : STATE_CHECKED, false); drawable.jumpToCurrentState(); // change to state fab1st.setImageState((mAnimationStateIndex != 0) ? STATE_CHECKED : STATE_UNCHECKED, false); } } }); fab3rd.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { int size = getResources().getDimensionPixelSize(R.dimen.fab_size); outline.setOval(0, 0, size, size); outline.setRoundRect(0, 0, size, size, size / 2); } }); fab3rd.setClipToOutline(true); final CheckBox circleFadeout = (CheckBox) view.findViewById(R.id.circleFadeout); circleFadeout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (((CheckBox) v).isChecked()) { } } }); final ImageButton vLogoBt = fab3rd; vLogoBt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { animButtons(fab1st, false, 2000, 0); animButtons(fab2nd, false, 600, 150); animButtons(fab3rd, false, 1500, 250); Handler delayHandler = new Handler(); delayHandler.postDelayed(new Runnable() { @Override public void run() { Intent logoIntent = new Intent(getActivity(), LogoActivity.class); logoIntent.putExtra(LogoActivity.LOGO_VIEW_IMAGE_FADEOUT, (circleFadeout.isChecked() ? 1 : 0)); logoIntent.putExtra(LogoActivity.LOGO_VIEW_TRANSTION_TYPE, logoActivityTransitionType); startActivityForResult(logoIntent, mRequestCode, ActivityOptions.makeSceneTransitionAnimation(getActivity()).toBundle()); } }, 1000); // footer slide down slideView(footer, false); } }); mRadioGrp = (RadioGroup) view.findViewById(R.id.radioGroup); mRadioGrp.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { int selectedId = mRadioGrp.getCheckedRadioButtonId(); String transitionType = "using"; switch (selectedId) { case R.id.radioFade: logoActivityTransitionType = 0; transitionType = transitionType + " Fade"; break; case R.id.radioExplode: logoActivityTransitionType = 1; transitionType = transitionType + " Explode"; break; default: logoActivityTransitionType = 2; transitionType = transitionType + " Slide"; } mSwitcher.setText(transitionType + " transition"); } }); mSwitcher = (TextSwitcher) view.findViewById(R.id.textSwitcher); mSwitcher.setFactory(mFactory); Animation in = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_top); Animation out = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_out_top); mSwitcher.setInAnimation(in); mSwitcher.setOutAnimation(out); mSwitcher.setCurrentText("using Fade transition"); // footer slide up slideView(footer, true); }
From source file:com.scoreflex.ScoreflexView.java
protected View openNewView(String resource, Scoreflex.RequestParams params, boolean forceFullScreen) { int gravity = getLayoutGravity(); int anim = (Gravity.TOP == (gravity & Gravity.VERTICAL_GRAVITY_MASK)) ? R.anim.scoreflex_enter_slide_down : R.anim.scoreflex_enter_slide_up; Animation animation = AnimationUtils.loadAnimation(mParentActivity, anim); ScoreflexView webview = new ScoreflexView(mParentActivity); webview.setResource(resource, params, forceFullScreen); ViewGroup contentView = (ViewGroup) mParentActivity.getWindow().getDecorView() .findViewById(android.R.id.content); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, gravity); webview.setLayoutParams(layoutParams); contentView.addView(webview);// www . jav a2 s . c o m webview.startAnimation(animation); Scoreflex.setCurrentScoreflexView(this); return webview; }