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.example.angel.parkpanda.MainActivity.java
@Override public boolean onNavigationItemSelected(MenuItem item) { int id = item.getItemId(); showhideFootWindow(0);/*from w w w . java2s .c o m*/ if (id == R.id.nav_menu_findparking) { Intent intent = new Intent(getApplicationContext(), Find_Park.class); startActivityForResult(intent, 2);// Activity is started with requestCode 2 // finish(); } if (id == R.id.nav_menu_account) { initViewSetting(false); if (LOGININFO.flag == 10) { Fragment fragment = new my_account(); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction FT = fragmentManager.beginTransaction(); FT.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left); FT.replace(R.id.flContent, fragment).commit(); } else { Fragment fragment = new log_in(); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction FT = fragmentManager.beginTransaction(); FT.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left); FT.replace(R.id.flContent, fragment).commit(); } } if (id == R.id.nav_menu_help) { int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion > 21) { showhideFootWindow(0); initViewSetting(true); LayoutInflater inflater = (LayoutInflater) getSystemService(Activity.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.ly_my_help, null); layout.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popupanim)); PopupWindow optionspu = new PopupWindow(layout, DrawerLayout.LayoutParams.WRAP_CONTENT, DrawerLayout.LayoutParams.WRAP_CONTENT); optionspu.setFocusable(true); optionspu.showAtLocation(layout, Gravity.CENTER, 0, 0); optionspu.update(0, 0, DrawerLayout.LayoutParams.WRAP_CONTENT, DrawerLayout.LayoutParams.WRAP_CONTENT); optionspu.setAnimationStyle(R.anim.popupanim); } else { // initViewSetting(false); /* Fragment fragment = new help_dialog(); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction FT = fragmentManager.beginTransaction(); FT.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left); FT.replace(R.id.flContent, fragment).commit();*/ LayoutInflater layoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.fragment_help_dialog, null); final PopupWindow optionspu = new PopupWindow(popupView, DrawerLayout.LayoutParams.WRAP_CONTENT, DrawerLayout.LayoutParams.WRAP_CONTENT); optionspu.setFocusable(true); optionspu.showAtLocation(popupView, Gravity.CENTER, 0, 0); Button btnDismiss = (Button) popupView.findViewById(R.id.btn_help_close); btnDismiss.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { // Toast.makeText(getApplicationContext(), "dsdsa", Toast.LENGTH_SHORT).show(); optionspu.dismiss(); plotMarkers(mMyMarkersArray); initViewSetting(true); } }); } } drawer.closeDrawer(GravityCompat.START); return true; }
From source file:com.benefit.buy.library.http.query.callback.BitmapAjaxCallback.java
private static void setBmAnimate(ImageView iv, Bitmap bm, Bitmap preset, int fallback, int animation, float ratio, float anchor, int source) { bm = filter(iv, bm, fallback);/*from www.ja v a2 s . co m*/ if (bm == null) { iv.setImageBitmap(null); return; } Drawable d = makeDrawable(iv, bm, ratio, anchor); Animation anim = null; if (fadeIn(animation, source)) { if (preset == null) { anim = new AlphaAnimation(0, 1); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(FADE_DUR); } else { Drawable pd = makeDrawable(iv, preset, ratio, anchor); Drawable[] ds = new Drawable[] { pd, d }; TransitionDrawable td = new TransitionDrawable(ds); td.setCrossFadeEnabled(true); td.startTransition(FADE_DUR); d = td; } } else if (animation > 0) { anim = AnimationUtils.loadAnimation(iv.getContext(), animation); } iv.setImageDrawable(d); if (anim != null) { anim.setStartTime(AnimationUtils.currentAnimationTimeMillis()); iv.startAnimation(anim); } else { iv.setAnimation(null); } }
From source file:com.android.dialer.DialtactsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.e(TAG, " --- onCreate(Bundle savedInstanceState) --- start "); Trace.beginSection(TAG + " onCreate"); View retView = null;/* w w w . java 2 s.c om*/ super.onCreateView(inflater, container, savedInstanceState); //?? iControlDeleteBtn = (IControlDeleteBtn) getActivity(); //mFirstLaunch = true; final Resources resources = getResources(); int temp = resources.getDimensionPixelSize(R.dimen.floating_action_button_width); //?actionbar mActionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height_large); Trace.beginSection(TAG + " setContentView"); //setContentView(R.layout.dialtacts_activity); retView = inflater.inflate(R.layout.dialtacts_activity, container, false); Trace.endSection(); Trace.beginSection(TAG + " setup Views"); final ActionBar actionBar = getActivity().getActionBar(); //actionbar? //actionBar.setCustomView(R.layout.dialtacts_actionbar); //actionBar.setDisplayShowCustomEnabled(true); TextView actionbarNameTxt = (TextView) actionBar.getCustomView().findViewById(R.id.actionbar_name); actionbarNameTxt.setOnClickListener(this); ImageView actionbarMenu = (ImageView) actionBar.getCustomView().findViewById(R.id.actionbar_menu); actionbarMenu.setOnClickListener(this); TextView editerToCalldetail = (TextView) actionBar.getCustomView() .findViewById(R.id.actionbar_call_dialtacts_action_editer); editerToCalldetail.setOnClickListener(this); TextView cancelTxt = (TextView) actionBar.getCustomView() .findViewById(R.id.actionbar_call_dialtacts_action_cancel); cancelTxt.setOnClickListener(this); actionbarNameTxt.setText(getString(R.string.all_calls)); mSearchView = (EditText) actionBar.getCustomView().findViewById(R.id.edittext); mSearchView.setVisibility(View.GONE); mDialtactsActionBarController = new DialtactsActionBarController(actionbarMenu, editerToCalldetail, cancelTxt, actionbarNameTxt, this); // actionBar.setBackgroundDrawable(null); SearchEditTextLayout searchEditTextLayout = (SearchEditTextLayout) actionBar.getCustomView() .findViewById(R.id.search_view_container); // searchEditTextLayout.setPreImeKeyListener(mSearchEditTextLayoutListener); // mActionBarController = new DialtactsActionBarController(this, searchEditTextLayout); // mSearchView = (EditText) searchEditTextLayout.findViewById(R.id.search_view); mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener); // mVoiceSearchButton = searchEditTextLayout.findViewById(R.id.voice_search_button); // mSearchView.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; // 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) { getChildFragmentManager().beginTransaction() .add(R.id.dialtacts_container, new DialpadFragment(getActivity()), TAG_DIALPAD_FRAGMENT) // .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(getActivity(), isLayoutRtl ? R.anim.dialpad_slide_in_left : R.anim.dialpad_slide_in_right); mSlideOut = AnimationUtils.loadAnimation(getActivity(), isLayoutRtl ? R.anim.dialpad_slide_out_left : R.anim.dialpad_slide_out_right); } else { mSlideIn = AnimationUtils.loadAnimation(getActivity(), R.anim.dialpad_slide_in_bottom); mSlideOut = AnimationUtils.loadAnimation(getActivity(), R.anim.dialpad_slide_out_bottom); } // mSlideIn.setInterpolator(AnimUtils.EASE_IN); mSlideOut.setInterpolator(AnimUtils.EASE_OUT); mSlideIn.setAnimationListener(mSlideInListener); mSlideOut.setAnimationListener(mSlideOutListener); Trace.endSection(); Trace.beginSection(TAG + " initialize smart dialing"); mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(getActivity()); SmartDialPrefix.initializeNanpSettings(getActivity()); Trace.endSection(); Trace.endSection(); initFlushHandler(); Log.e(TAG, " onCreate() dialerFragment " + mIsDialpadShown); return retView; }
From source file:com.lcl.designsnackbar.tsnackbar.TSnackbar.java
private void animateViewOut(final int event) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.animate(mView).translationY(-mView.getHeight()) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).setDuration(ANIMATION_DURATION) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override/* w w w . jav a 2s. c o m*/ public void onAnimationStart(View view) { mView.animateChildrenOut(0, ANIMATION_FADE_DURATION); } @Override public void onAnimationEnd(View view) { onViewHidden(event); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), com.lcl.designsnackbar.R.anim.design_tsnackbar_out); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewHidden(event); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.appbase.androidquery.callback.BitmapAjaxCallback.java
private static void setBmAnimate(ImageView iv, Bitmap bm, Bitmap preset, int fallback, int animation, float ratio, float anchor, int source) { bm = filter(iv, bm, fallback);//www . j a va2 s. co m if (bm == null) { iv.setImageBitmap(null); return; } Drawable d = makeDrawable(iv, bm, ratio, anchor); Animation anim = null; if (fadeIn(animation, source)) { if (preset == null) { anim = new AlphaAnimation(0, 1); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(FADE_DUR); } else { Drawable pd = makeDrawable(iv, preset, ratio, anchor); Drawable[] ds = new Drawable[] { pd, d }; TransitionDrawable td = new TransitionDrawable(ds); td.setCrossFadeEnabled(true); td.startTransition(FADE_DUR); d = td; } } else if (animation > 0) { anim = AnimationUtils.loadAnimation(iv.getContext(), animation); } iv.setImageDrawable(d); if (anim != null) { anim.setStartTime(AnimationUtils.currentAnimationTimeMillis()); iv.startAnimation(anim); } else { iv.setAnimation(null); } }
From source file:android.support.designox.widget.Snackbar.java
private void animateViewOut(final int event) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.animate(mView).translationY(mView.getHeight()).setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setDuration(ANIMATION_DURATION).setListener(new ViewPropertyAnimatorListenerAdapter() { boolean mEndCalled = false; @Override/*from w w w . ja va2 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.animateChildrenOut(0, ANIMATION_FADE_DURATION); } } @Override public void onAnimationEnd(View view) { onViewHidden(event); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_out_ox); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewHidden(event); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.jekyll.wu.widget.FreeSnackBar.java
void animateViewIn() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.setTranslationY(mView, gravity == TOP ? -mView.getHeight() : mView.getHeight()); ViewCompat.animate(mView).translationY(0f).setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setDuration(ANIMATION_DURATION).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override//from w w w .j ava 2s . c o m public void onAnimationStart(View view) { 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(), gravity == TOP ? R.anim.my_design_snackbar_in : R.anim.my_design_snackbar_bottom_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.qiscus.sdk.ui.fragment.QiscusBaseChatFragment.java
protected Animation onLoadAnimation() { return AnimationUtils.loadAnimation(getActivity(), R.anim.qiscus_simple_grow); }
From source file:com.fa.imaged.activity.DetailActivityV2.java
/** * Load the item's image into our {@link ImageView}. *///from w ww . java 2 s .c o m private void loadImage() { Picasso.with(this).load(getIntent().getStringExtra(EXTRA_IMAGE)).noFade() .placeholder(android.R.color.background_light).into(detailImageV2, new Callback() { @Override public void onError() { // TODO Auto-generated method stub } @Override public void onSuccess() { Bitmap bitmap = ((BitmapDrawable) detailImageV2.getDrawable()).getBitmap(); Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() { @Override public void onGenerated(Palette palette) { Palette.Swatch vibrant = palette.getVibrantSwatch(); if (vibrant != null) { // If we have a vibrant color // update the title TextView detailUserInfo.setBackgroundColor(vibrant.getRgb()); } } }); Picasso.with(getApplicationContext()).load(detailImageLoaderv2.standard_resolution).noFade() .placeholder(detailImageV2.getDrawable()).into(detailImageV2); LinearLayout detailSlideUp = (LinearLayout) findViewById(R.id.detail_slide_up); detailSlideUp.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), android.support.v7.appcompat.R.anim.abc_slide_in_bottom)); if (detailImageLoaderv2.video) { PlayVideo(); } } }); }
From source file:com.evandroid.musica.fragment.LocalLyricsFragment.java
public void setListShown(final boolean visible) { final Animation fadeIn = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in); final Animation fadeOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out); Animation.AnimationListener listener = new Animation.AnimationListener() { @Override/* w w w. j ava2s .c o m*/ public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { progressBar.setVisibility(visible ? View.GONE : View.VISIBLE); megaListView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }; fadeIn.setAnimationListener(listener); fadeOut.setAnimationListener(listener); progressBar.startAnimation(visible ? fadeOut : fadeIn); megaListView.startAnimation(visible ? fadeIn : fadeOut); }