List of usage examples for android.view.animation AnimationSet AnimationSet
public AnimationSet(boolean shareInterpolator)
From source file:com.example.fragment.PrimitiveFragment.java
public void testAnimation(float destX, float destY) { this.mDestX = Factory.getAdjustedX(destX); this.mDestY = Factory.getAdjustedY(destY); // SELECT LAYER FrameLayout relate = (FrameLayout) mRootView.findViewById(R.id.FLBackLayer); // ScrollView relate = (ScrollView)mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;//from w w w . ja v a 2 s .com float toX = this.mDestX; float fromX = this.mSrcX; float toY = this.mDestY; float fromY = this.mSrcY; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(Constants.Animation.IPF_START); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
From source file:com.cachirulop.moneybox.fragment.MoneyboxFragment.java
/** * Create dynamically an android animation for a coin or a bill deleted from * the moneybox./*from ww w . ja v a 2s. c om*/ * * @param img * ImageView to receive the animation * @param layout * Layout that paint the image * @return Set of animations to apply to the image */ private AnimationSet createDeleteAnimation(ImageView img, View layout) { AnimationSet result; result = new AnimationSet(false); result.setFillAfter(true); // Fade out AlphaAnimation fadeOut; fadeOut = new AlphaAnimation(1.0f, 0.0f); fadeOut.setStartOffset(300); fadeOut.setDuration(300); result.addAnimation(fadeOut); return result; }
From source file:com.chinabike.plugins.mip.activity.LocalAlbumDetail.java
private void hideViewPager() { pagerContainer.setVisibility(View.GONE); gridView.setVisibility(View.VISIBLE); findViewById(FakeR.getId(this, "id", "album_title_bar")).setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); ScaleAnimation scaleAnimation = new ScaleAnimation(1, (float) 0.9, 1, (float) 0.9, pagerContainer.getWidth() / 2, pagerContainer.getHeight() / 2); scaleAnimation.setDuration(200);/* w w w . j a va2 s. c o m*/ set.addAnimation(scaleAnimation); AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0); alphaAnimation.setDuration(200); set.addAnimation(alphaAnimation); pagerContainer.startAnimation(set); ((BaseAdapter) gridView.getAdapter()).notifyDataSetChanged(); }
From source file:com.glabs.homegenie.StartActivity.java
public void hideLogo() { _islogovisible = false;/*from w w w .j a v a 2 s .co m*/ runOnUiThread(new Runnable() { @Override public void run() { Animation fadeOut = new AlphaAnimation(0.8f, 0); fadeOut.setInterpolator(new AccelerateInterpolator()); //and this fadeOut.setStartOffset(0); fadeOut.setDuration(500); // AnimationSet animation = new AnimationSet(false); //change to false animation.addAnimation(fadeOut); animation.setFillAfter(true); RelativeLayout ivlogo = (RelativeLayout) findViewById(R.id.logo); ivlogo.startAnimation(animation); } }); }
From source file:com.juick.android.MainActivity.java
public void closeNavigationMenu(boolean animate, boolean immediate) { if (!isNavigationMenuShown()) return;/*from w w w . j a va 2 s . c om*/ final ViewGroup navigationPanel = (ViewGroup) findViewById(R.id.navigation_panel); final View frag = findViewById(R.id.messagesfragment); final DragSortListView navigationList = (DragSortListView) findViewById(R.id.navigation_list); if (navigationList.isDragEnabled()) { navigationList.setDragEnabled(false); updateNavigation(); } if (animate) { final AnimationSet set = new AnimationSet(true); TranslateAnimation translate = new TranslateAnimation(0, -navigationPanel.getWidth(), 0, 0); translate.setFillAfter(false); translate.setFillEnabled(true); translate.setDuration(400); set.addAnimation(translate); set.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { //To change body of implemented methods use File | Settings | File Templates. } @Override public void onAnimationEnd(Animation animation) { navigationMenuShown = false; frag.clearAnimation(); layoutNavigationPane(); //navigationPanel.setVisibility(View.INVISIBLE); } @Override public void onAnimationRepeat(Animation animation) { //To change body of implemented methods use File | Settings | File Templates. } }); handler.postDelayed(new Runnable() { @Override public void run() { frag.startAnimation(set); getActivity().findViewById(R.id.layout_container).invalidate(); } }, immediate ? 1 : 200); // to smooth the slide } else { navigationMenuShown = false; layoutNavigationPane(); } }
From source file:com.glabs.homegenie.StartActivity.java
public void showLogo() { _islogovisible = true;/*from w w w . j a v a 2 s . c om*/ runOnUiThread(new Runnable() { @Override public void run() { Animation fadeIn = new AlphaAnimation(0, 0.8f); fadeIn.setInterpolator(new AccelerateInterpolator()); //and this fadeIn.setStartOffset(0); fadeIn.setDuration(500); // AnimationSet animation = new AnimationSet(false); //change to false animation.addAnimation(fadeIn); animation.setFillAfter(true); RelativeLayout ivlogo = (RelativeLayout) findViewById(R.id.logo); ivlogo.startAnimation(animation); } }); }
From source file:com.watasan.infospider.fragment.PrimitiveFragment.java
/** SCRIPT ACTION AREA --------------------------------------------------> */ public void testAnimation(float destX, float destY) { this.mDestX = Factory.getAdjustedX(destX); this.mDestY = Factory.getAdjustedY(destY); // SELECT LAYER FrameLayout relate = (FrameLayout) mRootView.findViewById(R.id.FLBackLayer); // ScrollView relate = (ScrollView)mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;/* w ww.ja v a 2 s .c o m*/ float toX = this.mDestX; float fromX = this.mSrcX; float toY = this.mDestY; float fromY = this.mSrcY; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(Constants.Animation.IPF_START); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
From source file:com.appassit.common.Utils.java
/** * ??//from www .j av a 2 s. c o m * * @return */ public static LayoutAnimationController getLayoutAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(50); set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(100); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); return controller; }
From source file:ly.kite.journey.selection.ProductOverviewFragment.java
/***************************************************** * * Returns the content view for this fragment * *****************************************************/ @Override//from w w w .java2s. c o m public View onCreateView(LayoutInflater layoutInflator, ViewGroup container, Bundle savedInstanceState) { boolean slidingDrawerIsExpanded = false; // Get any saved instance state if (savedInstanceState != null) { slidingDrawerIsExpanded = savedInstanceState.getBoolean(BUNDLE_KEY_SLIDING_DRAWER_IS_EXPANDED, false); } else { Analytics.getInstance(mKiteActivity).trackProductOverviewScreenViewed(mProduct); } // Set up the screen. Note that the SDK allows for different layouts to be used in place of the standard // one, so some of these views are optional and may not actually exist in the current layout. View view = layoutInflator.inflate(R.layout.screen_product_overview, container, false); mProductImageViewPager = (ViewPager) view.findViewById(R.id.view_pager); mOverlaidComponents = view.findViewById(R.id.overlaid_components); mPagingDots = (PagingDots) view.findViewById(R.id.paging_dots); mOverlaidStartButton = (Button) view.findViewById(R.id.overlaid_start_button); mSlidingOverlayFrame = (SlidingOverlayFrame) view.findViewById(R.id.sliding_overlay_frame); mDrawerControlLayout = view.findViewById(R.id.drawer_control_layout); mOpenCloseDrawerIconImageView = (ImageView) view.findViewById(R.id.open_close_drawer_icon_image_view); mProceedOverlayButton = (Button) view.findViewById(R.id.proceed_overlay_button); TextView priceTextView = (TextView) view.findViewById(R.id.price_text_view); TextView summaryDescriptionTextView = (TextView) view.findViewById(R.id.summary_description_text_view); TextView summaryShippingTextView = (TextView) view.findViewById(R.id.summary_shipping_text_view); View descriptionLayout = view.findViewById(R.id.description_layout); TextView descriptionTextView = (TextView) view.findViewById(R.id.description_text_view); View sizeLayout = view.findViewById(R.id.size_layout); TextView sizeTextView = (TextView) view.findViewById(R.id.size_text_view); View quantityLayout = view.findViewById(R.id.quantity_layout); TextView quantityTextView = (TextView) view.findViewById(R.id.quantity_text_view); TextView shippingTextView = (TextView) view.findViewById(R.id.shipping_text_view); // Paging dots Animation pagingDotOutAlphaAnimation = new AlphaAnimation(PAGING_DOT_ANIMATION_OPAQUE, PAGING_DOT_ANIMATION_TRANSLUCENT); pagingDotOutAlphaAnimation.setFillAfter(true); pagingDotOutAlphaAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS); Animation pagingDotOutScaleAnimation = new ScaleAnimation(0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, 0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); pagingDotOutScaleAnimation.setFillAfter(true); pagingDotOutScaleAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS); pagingDotOutScaleAnimation.setInterpolator(new BellInterpolator(1.0f, 0.8f, true)); AnimationSet pagingDotOutAnimation = new AnimationSet(false); pagingDotOutAnimation.addAnimation(pagingDotOutAlphaAnimation); pagingDotOutAnimation.addAnimation(pagingDotOutScaleAnimation); pagingDotOutAnimation.setFillAfter(true); Animation pagingDotInAlphaAnimation = new AlphaAnimation(PAGING_DOT_ANIMATION_TRANSLUCENT, PAGING_DOT_ANIMATION_OPAQUE); pagingDotInAlphaAnimation.setFillAfter(true); pagingDotInAlphaAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS); Animation pagingDotInScaleAnimation = new ScaleAnimation(0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, 0f, PAGING_DOT_ANIMATION_NORMAL_SCALE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); pagingDotInScaleAnimation.setFillAfter(true); pagingDotInScaleAnimation.setDuration(PAGING_DOT_ANIMATION_DURATION_MILLIS); pagingDotInScaleAnimation.setInterpolator(new BellInterpolator(1.0f, 1.2f)); AnimationSet pagingDotInAnimation = new AnimationSet(false); pagingDotInAnimation.addAnimation(pagingDotInAlphaAnimation); pagingDotInAnimation.addAnimation(pagingDotInScaleAnimation); pagingDotInAnimation.setFillAfter(true); mPagingDots.setProperties(mProduct.getImageURLList().size(), R.drawable.paging_dot_unselected, R.drawable.paging_dot_selected); mPagingDots.setOutAnimation(pagingDotOutAlphaAnimation); mPagingDots.setInAnimation(pagingDotInAnimation); mProductImageViewPager.setOnPageChangeListener(mPagingDots); mOverlaidComponents.setAlpha(slidingDrawerIsExpanded ? 0f : 1f); // If the drawer starts open, these components need to be invisible if (mSlidingOverlayFrame != null) { mSlidingOverlayFrame.snapToExpandedState(slidingDrawerIsExpanded); mSlidingOverlayFrame.setSlideAnimationDuration(SLIDE_ANIMATION_DURATION_MILLIS); mOpenCloseDrawerIconImageView.setRotation( slidingDrawerIsExpanded ? OPEN_CLOSE_ICON_ROTATION_DOWN : OPEN_CLOSE_ICON_ROTATION_UP); } SingleUnitSize size = mProduct.getSizeWithFallback(UnitOfLength.CENTIMETERS); boolean formatAsInt = size.getWidth() == (int) size.getWidth() && size.getHeight() == (int) size.getHeight(); String sizeFormatString = getString( formatAsInt ? R.string.product_size_format_string_int : R.string.product_size_format_string_float); String sizeString = String.format(sizeFormatString, size.getWidth(), size.getHeight(), size.getUnit().shortString(mKiteActivity)); int quantityPerSheet = mProduct.getQuantityPerSheet(); MultipleDestinationShippingCosts shippingCosts = mProduct.getShippingCosts(); Locale locale = Locale.getDefault(); Country country = Country.getInstance(locale); SingleCurrencyAmount singleCurrencyCost; // Price if (isVisible(priceTextView)) { singleCurrencyCost = mProduct.getCostWithFallback(locale); if (singleCurrencyCost != null) priceTextView.setText(singleCurrencyCost.getDisplayAmountForLocale(locale)); } // Summary description. This is a short description - not to be confused with the (full) description. if (isVisible(summaryDescriptionTextView)) { String summaryDescription = String.valueOf(quantityPerSheet) + " " + mProduct.getName() + (Product.isSensibleSize(size) ? " (" + sizeString + ")" : ""); summaryDescriptionTextView.setText(summaryDescription); } // (Full) description String description = mProduct.getDescription(); boolean haveDescription = (description != null && (!description.trim().equals(""))); if (haveDescription && descriptionLayout != null && descriptionTextView != null) { descriptionLayout.setVisibility(View.VISIBLE); descriptionTextView.setVisibility(View.VISIBLE); descriptionTextView.setText(description); } else { if (descriptionLayout != null) descriptionLayout.setVisibility(View.GONE); if (descriptionTextView != null) descriptionTextView.setVisibility(View.GONE); } // Size if (isVisible(sizeTextView)) { if (Product.isSensibleSize(size)) { sizeTextView.setText(String.format(sizeFormatString, size.getWidth(), size.getHeight(), size.getUnit().shortString(mKiteActivity))); } else { sizeLayout.setVisibility(View.GONE); } } // Quantity if (isVisible(quantityTextView)) { if (quantityPerSheet > 1) { quantityLayout.setVisibility(View.VISIBLE); quantityTextView.setText(getString(R.string.product_quantity_format_string, quantityPerSheet)); } else { quantityLayout.setVisibility(View.GONE); } } // Shipping description if (isVisible(summaryShippingTextView)) { // Currently we just check that shipping is free everywhere. If it isn't - we don't display // anything. boolean freeShippingEverywhere = true; MultipleDestinationShippingCosts multipleDestinationShippingCosts = shippingCosts; for (SingleDestinationShippingCost singleDestinationShippingCosts : multipleDestinationShippingCosts .asList()) { MultipleCurrencyAmount multipleCurrencyShippingCost = singleDestinationShippingCosts.getCost(); for (SingleCurrencyAmount singleCurrencyShippingCost : multipleCurrencyShippingCost .asCollection()) { if (singleCurrencyShippingCost.isNonZero()) { freeShippingEverywhere = false; } } } if (freeShippingEverywhere) { summaryShippingTextView.setText(R.string.product_free_worldwide_shipping); } else { summaryShippingTextView.setText(getString(R.string.product_shipping_summary_format_string, shippingCosts.getDisplayCost(locale))); } } // Shipping (postage) if (isVisible(shippingTextView)) { List<SingleDestinationShippingCost> sortedShippingCostList = mProduct.getSortedShippingCosts(country); StringBuilder shippingCostsStringBuilder = new StringBuilder(); String newlineString = ""; for (SingleDestinationShippingCost singleDestinationShippingCost : sortedShippingCostList) { // We want to prepend a new line for every shipping destination except the first shippingCostsStringBuilder.append(newlineString); newlineString = "\n"; // Get the cost in the default currency for the locale, and format the amount. singleCurrencyCost = singleDestinationShippingCost.getCost().getDefaultAmountWithFallback(); if (singleCurrencyCost != null) { String formatString = getString(R.string.product_shipping_format_string); String costString = (singleCurrencyCost.isNonZero() ? singleCurrencyCost.getDisplayAmountForLocale(locale) : getString(R.string.product_free_shipping)); shippingCostsStringBuilder.append(String.format(formatString, singleDestinationShippingCost.getDestinationDescription(mKiteActivity), costString)); } shippingTextView.setText(shippingCostsStringBuilder.toString()); } } if (mProceedOverlayButton != null) { mProceedOverlayButton.setText(R.string.product_overview_start_button_text); mProceedOverlayButton.setOnClickListener(this); } mProductImageViewPager.setOnClickListener(this); if (mDrawerControlLayout != null) mDrawerControlLayout.setOnClickListener(this); mOverlaidStartButton.setOnClickListener(this); return (view); }
From source file:de.Maxr1998.xposed.maxlock.ui.settings.appslist.AppListAdapter.java
@Override public void onBindViewHolder(final AppsListViewHolder hld, final int position) { final String sTitle = (String) mItemList.get(position).get("title"); final String key = (String) mItemList.get(position).get("key"); final Drawable dIcon = (Drawable) mItemList.get(position).get("icon"); hld.appName.setText(sTitle);//www. j a va2s . c o m hld.appIcon.setImageDrawable(dIcon); if (prefsPackages.getBoolean(key, false)) { hld.toggle.setChecked(true); hld.options.setVisibility(View.VISIBLE); } else { hld.toggle.setChecked(false); hld.options.setVisibility(View.GONE); } hld.appIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (key.equals("com.android.packageinstaller")) return; Intent it = mContext.getPackageManager().getLaunchIntentForPackage(key); it.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(it); } }); hld.options.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // AlertDialog View // Fake die checkbox View checkBoxView = View.inflate(mContext, R.layout.per_app_settings, null); CheckBox fakeDie = (CheckBox) checkBoxView.findViewById(R.id.cb_fake_die); fakeDie.setChecked(prefsPackages.getBoolean(key + "_fake", false)); fakeDie.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CheckBox cb = (CheckBox) v; boolean value = cb.isChecked(); prefsPackages.edit().putBoolean(key + "_fake", value).commit(); } }); // Custom password checkbox CheckBox customPassword = (CheckBox) checkBoxView.findViewById(R.id.cb_custom_pw); customPassword.setChecked(prefsPerApp.contains(key)); customPassword.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CheckBox cb = (CheckBox) v; boolean checked = cb.isChecked(); if (checked) { dialog.dismiss(); final AlertDialog.Builder choose_lock = new AlertDialog.Builder(mContext); CharSequence[] cs = new CharSequence[] { mContext.getString(R.string.pref_locking_type_password), mContext.getString(R.string.pref_locking_type_pin), mContext.getString(R.string.pref_locking_type_knockcode), mContext.getString(R.string.pref_locking_type_pattern) }; choose_lock.setItems(cs, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); Fragment frag = new Fragment(); switch (i) { case 0: Util.setPassword(mContext, key); break; case 1: frag = new PinSetupFragment(); break; case 2: frag = new KnockCodeSetupFragment(); break; case 3: Intent intent = new Intent(LockPatternActivity.ACTION_CREATE_PATTERN, null, mContext, LockPatternActivity.class); mFragment.startActivityForResult(intent, Util.getPatternCode(position)); break; } if (i == 1 || i == 2) { Bundle b = new Bundle(1); b.putString(Common.INTENT_EXTRAS_CUSTOM_APP, key); frag.setArguments(b); ((SettingsActivity) mContext).getSupportFragmentManager().beginTransaction() .replace(R.id.frame_container, frag).addToBackStack(null).commit(); } } }).show(); } else prefsPerApp.edit().remove(key).remove(key + Common.APP_KEY_PREFERENCE).apply(); } }); // Finish dialog dialog = new AlertDialog.Builder(mContext) .setTitle(mContext.getString(R.string.dialog_title_settings)).setIcon(dIcon) .setView(checkBoxView) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dlg, int id) { dlg.dismiss(); } }).setNeutralButton(R.string.dialog_button_exclude_activities, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new ActivityLoader().execute(key); } }) .show(); } }); hld.toggle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RadioButton rb = (RadioButton) v; boolean value = prefsPackages.getBoolean(key, false); if (!value) { prefsPackages.edit().putBoolean(key, true).commit(); AnimationSet anim = new AnimationSet(true); anim.addAnimation(AnimationUtils.loadAnimation(mContext, R.anim.appslist_settings_rotate)); anim.addAnimation(AnimationUtils.loadAnimation(mContext, R.anim.appslist_settings_translate)); hld.options.startAnimation(anim); hld.options.setVisibility(View.VISIBLE); rb.setChecked(true); } else { prefsPackages.edit().remove(key).commit(); rb.setChecked(true); AnimationSet animOut = new AnimationSet(true); animOut.addAnimation( AnimationUtils.loadAnimation(mContext, R.anim.appslist_settings_rotate_out)); animOut.addAnimation( AnimationUtils.loadAnimation(mContext, R.anim.appslist_settings_translate_out)); animOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { animation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 0.0f); animation.setDuration(1); hld.options.startAnimation(animation); hld.options.setVisibility(View.GONE); hld.options.clearAnimation(); } @Override public void onAnimationRepeat(Animation animation) { } }); hld.options.startAnimation(animOut); } notifyDataSetChanged(); } }); }