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.battlelancer.seriesguide.ui.NowFragment.java
private void showError(boolean show, @StringRes int titleResId) { if (titleResId != 0) { snackbarText.setText(titleResId); }//from ww w . j a v a 2 s. c o m if (snackbar.getVisibility() == (show ? View.VISIBLE : View.GONE)) { // already in desired state, avoid replaying animation return; } snackbar.startAnimation( AnimationUtils.loadAnimation(snackbar.getContext(), show ? R.anim.fade_in : R.anim.fade_out)); snackbar.setVisibility(show ? View.VISIBLE : View.GONE); }
From source file:com.raja.knowme.FragmentQualification.java
private void previousInstitution() { count--;/*from w w w.j a v a 2 s . c o m*/ institution_switcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_in)); institution_switcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_out)); qualification_list.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.rail_out)); institution_switcher.setText(mQualificationData.get(count).getInstitutionName()); adapter.notifyDataSetChanged(); adapter.setListData(mQualificationData.get(count).getQualificationDescription()); qualification_list.setAdapter(adapter); }
From source file:com.forrestguice.suntimeswidget.EquinoxView.java
private void initAnimations(Context context) { anim_card_inNext = AnimationUtils.loadAnimation(context, R.anim.fade_in); anim_card_inPrev = AnimationUtils.loadAnimation(context, R.anim.fade_in); anim_card_outNext = AnimationUtils.loadAnimation(context, R.anim.fade_out); anim_card_outPrev = AnimationUtils.loadAnimation(context, R.anim.fade_out); }
From source file:com.brandao.tictactoe.board.BoardFragment.java
public void finishMove(int symble) { boolean animate = mPrefs.getBoolean(Settings.PREF_ANIMATE, true); int[] winSpots = checkForWin(symble); final int tempSymble = symble; if (winSpots != null) { Animation animOut = AnimationUtils.loadAnimation(getActivity(), R.anim.shake); animOut.setAnimationListener(new AnimationListener() { @Override//from w w w . ja v a 2s . c om public void onAnimationStart(Animation animation) { mAnimating = true; } @Override public void onAnimationEnd(Animation animation) { mAnimating = false; setWinner(tempSymble); } @Override public void onAnimationRepeat(Animation animation) { } }); if (animate) { for (int winSpot : winSpots) { mScreens[winSpot].startAnimation(animOut); } } else { setWinner(tempSymble); } } else { if (checkForTie()) { setWinner(C.SYMBLE_NULL); } else { switch (mGameState) { case C.STATE_PLAYER_ONE_TURN: { symble = C.SYMBLE_PLAYER_TWO; break; } case C.STATE_PLAYER_TWO_TURN: { symble = C.SYMBLE_PLAYER_ONE; break; } } mMenuItemReplay.setEnabled(true); mMenuItemHint.setEnabled(true); nextTurn(symble); } } }
From source file:org.dvbviewer.controller.ui.fragments.Remote.java
/** * Inititalize./* www.ja va 2s. c om*/ * * @author RayBa * @date 07.04.2013 */ private void inititalize() { detector = new GestureDetector(getGestureListener()); flipper = (ViewFlipper) content.findViewById(R.id.flipper); flipper.setOnTouchListener(this); btnMoveDown = (Button) content.findViewById(R.id.ButtonMoveDown); btnMoveDown.setOnTouchListener(this); btnMoveDown.setOnClickListener(this); btnMoveUp = (Button) content.findViewById(R.id.ButtonMoveUp); btnMoveUp.setOnTouchListener(this); btnMoveUp.setOnClickListener(this); btnOk = (Button) content.findViewById(R.id.ButtonOK); btnOk.setOnTouchListener(this); btnOk.setOnClickListener(this); btnMoveLeft = (Button) content.findViewById(R.id.ButtonMoveLeft); btnMoveLeft.setOnTouchListener(this); btnMoveLeft.setOnClickListener(this); btnMoveRight = (Button) content.findViewById(R.id.ButtonMoveRight); btnMoveRight.setOnTouchListener(this); btnMoveRight.setOnClickListener(this); btnBack = (Button) content.findViewById(R.id.ButtonBack); btnBack.setOnTouchListener(this); btnBack.setOnClickListener(this); btnMenu = (Button) content.findViewById(R.id.ButtonMenu); btnMenu.setOnTouchListener(this); btnMenu.setOnClickListener(this); btnMenu.setOnLongClickListener(this); btnVideos = (Button) content.findViewById(R.id.ButtonVideos); btnVideos.setOnTouchListener(this); btnVideos.setOnClickListener(this); btnStepFoward = (Button) content.findViewById(R.id.ButtonStepForward); btnStepFoward.setOnTouchListener(this); btnStepFoward.setOnClickListener(this); btnStepBack = (Button) content.findViewById(R.id.ButtonStepBack); btnStepBack.setOnTouchListener(this); btnStepBack.setOnClickListener(this); btnText = (Button) content.findViewById(R.id.ButtonText); btnText.setOnTouchListener(this); btnText.setOnClickListener(this); btnPause = (Button) content.findViewById(R.id.ButtonPause); btnPause.setOnTouchListener(this); btnPause.setOnClickListener(this); btnStop = (Button) content.findViewById(R.id.ButtonStop); btnStop.setOnTouchListener(this); btnStop.setOnClickListener(this); btnRed = (Button) content.findViewById(R.id.ButtonRed); btnRed.setOnTouchListener(this); btnRed.setOnClickListener(this); btnGreen = (Button) content.findViewById(R.id.ButtonGreen); btnGreen.setOnTouchListener(this); btnGreen.setOnClickListener(this); btnYellow = (Button) content.findViewById(R.id.ButtonYellow); btnYellow.setOnTouchListener(this); btnYellow.setOnClickListener(this); btnBlue = (Button) content.findViewById(R.id.ButtonBlue); btnBlue.setOnTouchListener(this); btnBlue.setOnClickListener(this); // Number Buttons btnOne = (Button) content.findViewById(R.id.ButtonOne); btnOne.setOnTouchListener(this); btnOne.setOnClickListener(this); btnTwo = (Button) content.findViewById(R.id.ButtonTwo); btnTwo.setOnTouchListener(this); btnTwo.setOnClickListener(this); btnThree = (Button) content.findViewById(R.id.ButtonThree); btnThree.setOnTouchListener(this); btnThree.setOnClickListener(this); btnFour = (Button) content.findViewById(R.id.ButtonFour); btnFour.setOnTouchListener(this); btnFour.setOnClickListener(this); btnFive = (Button) content.findViewById(R.id.ButtonFive); btnFive.setOnTouchListener(this); btnFive.setOnClickListener(this); btnSix = (Button) content.findViewById(R.id.ButtonSix); btnSix.setOnTouchListener(this); btnSix.setOnClickListener(this); btnSeven = (Button) content.findViewById(R.id.ButtonSeven); btnSeven.setOnTouchListener(this); btnSeven.setOnClickListener(this); btnEight = (Button) content.findViewById(R.id.ButtonEight); btnEight.setOnTouchListener(this); btnEight.setOnClickListener(this); btnNine = (Button) content.findViewById(R.id.ButtonNine); btnNine.setOnTouchListener(this); btnNine.setOnClickListener(this); btnZero = (Button) content.findViewById(R.id.ButtonZero); btnZero.setOnTouchListener(this); btnZero.setOnClickListener(this); btnNumberBack = (Button) content.findViewById(R.id.ButtonStepBack_Numbers); btnNumberBack.setOnTouchListener(this); btnNumberBack.setOnClickListener(this); btnNumberForward = (Button) content.findViewById(R.id.ButtonStepForward_Numbers); btnNumberForward.setOnTouchListener(this); btnNumberForward.setOnClickListener(this); inFromLeft = AnimationUtils.loadAnimation(getActivity(), R.anim.in_from_left); outToLeft = AnimationUtils.loadAnimation(getActivity(), R.anim.out_to_left); inFromRight = AnimationUtils.loadAnimation(getActivity(), R.anim.in_from_right); outToRight = AnimationUtils.loadAnimation(getActivity(), R.anim.out_to_right); }
From source file:com.friedran.appengine.dashboard.gui.DashboardLoadFragment.java
private void updateChartImage(View chartView, Bitmap image, boolean animate) { ImageView chartImageView = (ImageView) chartView.findViewById(R.id.load_chart_image); if (image != null) { chartImageView.setImageBitmap(image); } else {/* ww w . ja va2 s . c o m*/ chartImageView.setImageResource(android.R.color.transparent); Toast.makeText(mActivity, "Failed downloading charts, please make sure you have Internet connectivity and try refreshing", 2000).show(); } ViewSwitcher viewSwitcher = (ViewSwitcher) chartView.findViewById(R.id.load_chart_switcher); if (viewSwitcher.getDisplayedChild() != 1) { if (animate) { viewSwitcher.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.fadein)); } else viewSwitcher.setAnimation(null); viewSwitcher.showNext(); } // Mark the refresh UI as complete once anyone of the charts has been loaded. mPullToRefreshAttacher.setRefreshComplete(); }
From source file:com.draekko.traypreferences.TrayListFragment.java
/** * Control whether the list 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. * /*from ww w . j a v a 2 s .c om*/ * @param shown If true, the list 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 setListShown(boolean shown, boolean animate) { ensureList(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mListShown == shown) { return; } mListShown = shown; if (shown) { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.fade_out)); mListContainer.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mListContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mListContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.fade_in)); mListContainer.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mListContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mListContainer.setVisibility(View.GONE); } }
From source file:com.silentcircle.common.util.ViewUtil.java
public static void animateImageChange(final Context context, final ImageView imageView, final int newImage) { final Animation animOut = AnimationUtils.loadAnimation(context, android.R.anim.fade_out); final Animation animIn = AnimationUtils.loadAnimation(context, android.R.anim.fade_in); animOut.setAnimationListener(new Animation.AnimationListener() { @Override// w w w . j ava 2 s .co m public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { imageView.setImageResource(newImage); animIn.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { } }); imageView.startAnimation(animIn); } }); imageView.startAnimation(animOut); }
From source file:com.mina.breathitout.AnalyzeActivity.java
private void moveRight() { AnalyzeActivity.this.runOnUiThread(new Runnable() { @Override//from w ww . ja v a 2 s . c o m public void run() { mViewFlipper.setInAnimation(AnimationUtils.loadAnimation(mContext, R.anim.left_in)); mViewFlipper.setOutAnimation(AnimationUtils.loadAnimation(mContext, R.anim.left_out)); // controlling animation mViewFlipper.getInAnimation().setAnimationListener(mAnimationListener); if (android.os.Build.VERSION.SDK_INT >= 11) { // will update the "progress" propriety of seekbar until it reaches progress ObjectAnimator progressAnimation = ObjectAnimator.ofInt(progressBar, "progress", lastMaxTime, 0); progressAnimation.setDuration(1000); // 0.5 second progressAnimation.setInterpolator(new DecelerateInterpolator()); progressAnimation.start(); } else progressBar.setProgress(0); // no animation on Gingerbread or lower mViewFlipper.showNext(); } }); }
From source file:com.gunz.carrental.Fragments.CarsFragment.java
private void addCar(final boolean isAddCar, final int position) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.custom_dialog_car); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false);/* w w w. jav a 2 s . c o m*/ TextView lblTitle = (TextView) dialog.findViewById(R.id.lblTitle); final MaterialEditText txBrand = (MaterialEditText) dialog.findViewById(R.id.txBrand); final MaterialEditText txModel = (MaterialEditText) dialog.findViewById(R.id.txModel); final MaterialEditText txLicense = (MaterialEditText) dialog.findViewById(R.id.txLicense); final MaterialEditText txFare = (MaterialEditText) dialog.findViewById(R.id.txFare); Button btnSave = (Button) dialog.findViewById(R.id.btnSave); ImageView imgClose = (ImageView) dialog.findViewById(R.id.imgClose); dialog.show(); clearErrorMsg(dialog); if (!isAddCar) { lblTitle.setText(getActivity().getResources().getString(R.string.update_car_title)); txBrand.setText(cars.get(position).brand); txModel.setText(cars.get(position).type); txLicense.setText(cars.get(position).licensePlat); txFare.setText(String.valueOf((int) cars.get(position).farePerDay)); } else { lblTitle.setText(getActivity().getResources().getString(R.string.add_new_car_title)); } btnSave.setOnClickListener(new OnOneClickListener() { @Override public void onOneClick(View v) { if (TextUtils.isEmpty(txBrand.getText().toString().trim())) { txBrand.setText(""); txBrand.setError(getActivity().getResources().getString(R.string.validation_required)); txBrand.requestFocus(); } else if (TextUtils.isEmpty(txModel.getText().toString().trim())) { txModel.setText(""); txModel.setError(getActivity().getResources().getString(R.string.validation_required)); txModel.requestFocus(); } else if (TextUtils.isEmpty(txLicense.getText().toString().trim())) { txLicense.setText(""); txLicense.setError(getActivity().getResources().getString(R.string.validation_required)); txLicense.requestFocus(); } else if (TextUtils.isEmpty(txFare.getText().toString().trim())) { txFare.setText(""); txFare.setError(getActivity().getResources().getString(R.string.validation_required)); txFare.requestFocus(); } else { String confirmText; if (isAddCar) { confirmText = getActivity().getResources().getString(R.string.dialog_add_car_question); } else { confirmText = getActivity().getResources().getString(R.string.dialog_update_car_question); } new SweetAlertDialog(getActivity(), SweetAlertDialog.NORMAL_TYPE) .setTitleText(getActivity().getResources().getString(R.string.dialog_confirmation)) .setContentText(confirmText) .setCancelText(getActivity().getResources().getString(R.string.btn_cancel)) .setConfirmText(getActivity().getResources().getString(R.string.btn_save)) .showCancelButton(true) .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { if (isAddCar) { saveNewCar(dialog, txBrand.getText().toString().trim(), txModel.getText().toString().trim(), Integer.parseInt(txFare.getText().toString().trim()), txLicense.getText().toString().trim()); } else { updateCar(dialog, cars.get(position).id, txBrand.getText().toString().trim(), txModel.getText().toString().trim(), Integer.parseInt(txFare.getText().toString().trim()), txLicense.getText().toString().trim()); } sweetAlertDialog.dismiss(); } }).show(); } } }); imgClose.setOnClickListener(new OnOneClickListener() { @Override public void onOneClick(View v) { Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.bounce); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { dialog.dismiss(); } @Override public void onAnimationRepeat(Animation animation) { } }); v.startAnimation(animation); } }); }