Example usage for android.view.animation AnimationSet addAnimation

List of usage examples for android.view.animation AnimationSet addAnimation

Introduction

In this page you can find the example usage for android.view.animation AnimationSet addAnimation.

Prototype

public void addAnimation(Animation a) 

Source Link

Document

Add a child animation to this animation set.

Usage

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);//from w  w w  .ja  v a 2s . c om
    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();
        }

    });
}

From source file:com.alibaba.weex.extend.component.WXParallax.java

@Override
public void onScrolled(View view, int dx, int dy) {
    if (ViewCompat.isInLayout(view)) {
        if (mBindingComponent == null && mBindingRef != null) {
            mBindingComponent = findComponent(mBindingRef);
        }/*  ww w . jav  a2s  . c o m*/
        if (mBindingComponent instanceof BasicListComponent && view instanceof RecyclerView) {
            BasicListComponent listComponent = (BasicListComponent) mBindingComponent;
            mOffsetY = Math.abs(listComponent.calcContentOffset((RecyclerView) view));
        } else if (mBindingComponent instanceof WXRecyclerTemplateList && view instanceof RecyclerView) {
            WXRecyclerTemplateList listComponent = (WXRecyclerTemplateList) mBindingComponent;
            mOffsetY = Math.abs(listComponent.calcContentOffset((RecyclerView) view));
        }
    } else {
        mOffsetY = mOffsetY + dy;
    }

    AnimationSet animationSet = new AnimationSet(true);
    boolean hasAnimation = false;
    for (int i = 0; i < mTransformPropArrayList.size(); i++) {
        TransformCreator creator = mTransformPropArrayList.get(i);
        Animation animation = creator.getAnimation(dx, dy);
        if (animation != null) {
            animationSet.addAnimation(animation);
            hasAnimation = true;
        }
    }

    if (hasAnimation) {
        animationSet.setFillAfter(true);
        if (getHostView() != null) {
            getHostView().startAnimation(animationSet);
        }
    }

    if (mBackgroundColor != null) {
        int color = mBackgroundColor.getColor(dx, dy);
        if (mBackGroundColor != color) {
            getHostView().setBackgroundColor(color);
            mBackGroundColor = color;
        }
    }
}

From source file:com.example.fragment.ScreenSlidePageFragment.java

public void startAnimation() {
    // SELECT LAYER
    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. j av a2  s .c om
    float toX = -8.0f / 100.0f;//0.0f;
    float fromX = 0.0f;//-8.0f / 100.0f;
    float toY = 0.0f;
    float fromY = 29.0f / 100.0f;
    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(2000);
    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.fabernovel.alertevoirie.HomeActivity.java

@Override
public void onRequestcompleted(int requestCode, Object result) {
    try {//  w  ww  .  jav a2 s . c om
        JSONArray responses;
        //Log.d(Constants.PROJECT_TAG, (String) result);
        responses = new JSONArray((String) result);

        JSONObject response = responses.getJSONObject(0);

        final AnimationSet set = new AnimationSet(false);

        final float centerX = findViewById(R.id.LinearLayout02).getWidth() / 2;
        final float centerY = findViewById(R.id.LinearLayout02).getHeight() / 2;
        final Flip3dAnimation animation = new Flip3dAnimation(0, 360, centerX, centerY);
        animation.setDuration(500);
        set.setFillAfter(true);
        set.setFillBefore(true);
        animation.setInterpolator(new AccelerateInterpolator());

        set.addAnimation(animation);

        if (requestCode == AVService.REQUEST_JSON) {
            if (JsonData.VALUE_REQUEST_GET_INCIDENTS_STATS.equals(response.getString(JsonData.PARAM_REQUEST))) {
                Last_Location.Incidents = response.getJSONObject(JsonData.PARAM_ANSWER);
                int resolved_incidents = response.getJSONObject(JsonData.PARAM_ANSWER)
                        .getInt(JsonData.PARAM_RESOLVED_INCIDENTS);
                int ongoing_incidents = response.getJSONObject(JsonData.PARAM_ANSWER)
                        .getInt(JsonData.PARAM_ONGOING_INCIDENTS);
                int updated_incidents = response.getJSONObject(JsonData.PARAM_ANSWER)
                        .getInt(JsonData.PARAM_UPDATED_INCIDENTS);

                ((TextView) findViewById(R.id.Home_TextView_Solved)).setText(getResources().getQuantityString(
                        R.plurals.home_label_solved, resolved_incidents, resolved_incidents));
                ((TextView) findViewById(R.id.Home_TextView_Current)).setText(getResources()
                        .getQuantityString(R.plurals.home_label_current, ongoing_incidents, ongoing_incidents));
                ((TextView) findViewById(R.id.Home_TextView_Update)).setText(getResources()
                        .getQuantityString(R.plurals.home_label_update, updated_incidents, updated_incidents));
            }
        }

        findViewById(R.id.LinearLayout02).startAnimation(set);
        findViewById(R.id.LinearLayout04).startAnimation(set);
        findViewById(R.id.LinearLayout03).startAnimation(set);
    } catch (JSONException e) {
        Log.e(Constants.PROJECT_TAG, "JSONException", e);
    } catch (ClassCastException e) {
        Log.e(Constants.PROJECT_TAG, "Invalid result. Trying to cast " + result.getClass() + "into String", e);
    } finally {
        if (hidedialog)
            dismissDialog(DIALOG_PROGRESS);
        dialog_shown = false;
    }
}

From source file:com.cachirulop.moneybox.fragment.MoneyboxFragment.java

/**
 * Create dynamically an android animation for a coin or a bill droping into
 * the moneybox.//from   w  w w .j  a v a 2  s .  c o  m
 * 
 * @param img
 *            ImageView to receive the animation
 * @param layout
 *            Layout that paint the image
 * @param curr
 *            Currency value of the image
 * @return Set of animations to apply to the image
 */
private AnimationSet createDropAnimation(ImageView img, View layout, CurrencyValueDef curr) {
    AnimationSet result;

    result = new AnimationSet(false);
    result.setFillAfter(true);

    // Fade in
    AlphaAnimation fadeIn;

    fadeIn = new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setDuration(300);
    result.addAnimation(fadeIn);

    // drop
    TranslateAnimation drop;
    int bottom;

    bottom = Math.abs(layout.getHeight() - img.getLayoutParams().height);
    drop = new TranslateAnimation(1.0f, 1.0f, 1.0f, bottom);
    drop.setStartOffset(300);
    drop.setDuration(1500);

    if (curr.getType() == CurrencyValueDef.MoneyType.COIN) {
        drop.setInterpolator(new BounceInterpolator());
    } else {
        // drop.setInterpolator(new DecelerateInterpolator(0.7f));
        drop.setInterpolator(new AnticipateOvershootInterpolator());
    }

    result.addAnimation(drop);

    return result;
}

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 w w  w  .  j ava 2 s .c  o m*/
 * 
 * @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:ly.kite.journey.selection.ProductOverviewFragment.java

/*****************************************************
 *
 * Returns the content view for this fragment
 *
 *****************************************************/
@Override//  w w  w.  ja v a2  s  .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: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.jav a 2s.  com*/
    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.cachirulop.moneybox.fragment.MoneyboxFragment.java

/**
 * Create dynamically an android animation for a coin or a bill getting from
 * the moneybox.//from  w ww.  j  a  va2 s . co  m
 * 
 * @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 createGetAnimation(ImageView img, View layout) {
    AnimationSet result;

    result = new AnimationSet(false);
    result.setFillAfter(true);

    // get
    TranslateAnimation get;
    int bottom;

    bottom = Math.abs(layout.getHeight() - img.getLayoutParams().height);
    get = new TranslateAnimation(1.0f, 1.0f, bottom, 1.0f);
    get.setDuration(1500);
    result.addAnimation(get);

    // Fade out
    AlphaAnimation fadeOut;

    fadeOut = new AlphaAnimation(1.0f, 0.0f);
    fadeOut.setDuration(300);
    fadeOut.setStartOffset(1500);

    result.addAnimation(fadeOut);

    return result;
}

From source file:com.chinabike.plugins.mip.activity.LocalAlbumDetail.java

private void showViewPager(int index) {
    pagerContainer.setVisibility(View.VISIBLE);
    gridView.setVisibility(View.GONE);
    findViewById(FakeR.getId(this, "id", "album_title_bar")).setVisibility(View.GONE);
    viewpager.setAdapter(viewpager.new LocalViewPagerAdapter(currentFolder));
    viewpager.setCurrentItem(index);//from w  w w.ja  v a2  s. c om
    mCountView.setText((index + 1) + "/" + currentFolder.size());
    //?
    if (index == 0) {
        checkBox.setTag(currentFolder.get(index));
        checkBox.setChecked(checkedItems.contains(currentFolder.get(index)));
    }
    AnimationSet set = new AnimationSet(true);
    ScaleAnimation scaleAnimation = new ScaleAnimation((float) 0.9, 1, (float) 0.9, 1,
            pagerContainer.getWidth() / 2, pagerContainer.getHeight() / 2);
    scaleAnimation.setDuration(300);
    set.addAnimation(scaleAnimation);
    AlphaAnimation alphaAnimation = new AlphaAnimation((float) 0.1, 1);
    alphaAnimation.setDuration(200);
    set.addAnimation(alphaAnimation);
    pagerContainer.startAnimation(set);
}