Example usage for android.view.animation AnimationUtils makeInAnimation

List of usage examples for android.view.animation AnimationUtils makeInAnimation

Introduction

In this page you can find the example usage for android.view.animation AnimationUtils makeInAnimation.

Prototype

public static Animation makeInAnimation(Context c, boolean fromLeft) 

Source Link

Document

Make an animation for objects becoming visible.

Usage

From source file:edu.mit.mobile.android.livingpostcards.CardDetailsFragment.java

private void setMapDrawable(Drawable image, boolean animate) {

    mStaticMap.setImageDrawable(image);/* ww w.  j  av a2s. co m*/

    if (animate) {
        mStaticMap.startAnimation(AnimationUtils.makeInAnimation(getActivity(), true));
    }
    mStaticMap.setVisibility(View.VISIBLE);
}

From source file:info.staticfree.android.units.Units.java

public void addToHistory(String haveExpr, String wantExpr, Double result, boolean reciprocal) {
    haveExpr = haveExpr.trim();//from w  ww.  j a v a2  s. co  m
    wantExpr = wantExpr.trim();
    new AddToUsageTask().execute(haveExpr, wantExpr);
    haveExpr = reciprocal ? "1(" + haveExpr + ")" : haveExpr;
    resultView.setText(HistoryEntry.toCharSequence(haveExpr, wantExpr, result));

    // done on a new thread to avoid hanging the UI while the DB is being updated.
    new Thread(new AddToHistoryRunnable(haveExpr, wantExpr, result)).start();

    final View reciprocalNotice = findViewById(R.id.reciprocal_notice);
    if (reciprocal) {
        resultView.requestFocus();

        reciprocalNotice.setVisibility(View.VISIBLE);
        reciprocalNotice.startAnimation(AnimationUtils.makeInAnimation(this, true));
    } else {
        reciprocalNotice.setVisibility(View.GONE);
        resultView.setError(null);
    }
}

From source file:com.soomla.example.ExampleSocialActivity.java

private void showView(final View view, boolean show) {
    final Animation animation = show ? AnimationUtils.makeInAnimation(view.getContext(), true)
            : AnimationUtils.makeOutAnimation(view.getContext(), true);
    animation.setFillAfter(true);//from   w  ww .  jav a  2  s . c o m
    animation.setDuration(500);
    view.startAnimation(animation);
}

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

private void initPager() {
    mViewPager = ((OpenViewPager) findViewById(R.id.content_pager));
    TabPageIndicator indicator = null;/*  w w w.j  a  v a2 s  .  c o m*/
    if (mViewPagerEnabled && mViewPager != null) {
        setViewVisibility(false, false, R.id.content_frag, R.id.title_text, R.id.title_path,
                R.id.title_bar_inner, R.id.title_underline_2);
        setViewVisibility(true, false, R.id.content_pager, R.id.content_pager_indicator);
        mViewPager.setOnPageChangeListener(this);
        //mViewPager.setOnPageIndicatorChangeListener(this);
        View indicator_frame = findViewById(R.id.content_pager_indicator);
        try {
            //LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.makeInAnimation(getApplicationContext(), false));
            if (indicator_frame != null)
                indicator_frame.setAnimation(AnimationUtils.makeInAnimation(getApplicationContext(), false));
        } catch (Resources.NotFoundException e) {
            Logger.LogError("Couldn't load pager animation.", e);
        }
        indicator = (TabPageIndicator) findViewById(R.id.content_pager_indicator);
        if (indicator != null)
            mViewPager.setIndicator(indicator);
        else
            Logger.LogError("Couldn't find indicator!");
        //mViewPager = new ViewPager(getApplicationContext());
        //((ViewGroup)findViewById(R.id.content_frag)).addView(mViewPager);
        //findViewById(R.id.content_frag).setId(R.id.fake_content_id);
    } else {
        //mViewPagerEnabled = false;
        mViewPager = null; //(ViewPager)findViewById(R.id.content_pager);
        setViewVisibility(false, false, R.id.content_pager, R.id.content_pager_indicator);
        setViewVisibility(true, false, R.id.content_frag, R.id.title_text, R.id.title_path,
                R.id.title_bar_inner, R.id.title_underline_2);
    }

    if (mViewPager != null && mViewPagerEnabled) {
        if (DEBUG && IS_DEBUG_BUILD)
            Logger.LogDebug("Setting up ViewPager");
        mViewPagerAdapter = //new PagerTabsAdapter(this, mViewPager, indicator);
                new ArrayPagerAdapter(this, mViewPager);
        mViewPagerAdapter.setOnPageTitleClickListener(this);
        setViewPageAdapter(mViewPagerAdapter);
    }

}

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

public void setViewVisibility(final boolean visible, final boolean allowAnimation, int... ids) {
    for (int id : ids) {
        final View v = findViewById(id);
        if (v != null && visible != (v.getVisibility() == View.VISIBLE)) {
            if (allowAnimation) {
                Animation anim;/*from   w  w  w.j ava2 s.c om*/
                if (visible)
                    anim = AnimationUtils.makeInAnimation(getApplicationContext(), true);
                else
                    anim = AnimationUtils.makeOutAnimation(getApplicationContext(), false);
                anim.setAnimationListener(new Animation.AnimationListener() {
                    @Override
                    public void onAnimationStart(Animation animation) {
                        if (visible)
                            v.setVisibility(View.VISIBLE);
                    }

                    @Override
                    public void onAnimationRepeat(Animation animation) {
                    }

                    @Override
                    public void onAnimationEnd(Animation animation) {
                        if (!visible)
                            v.setVisibility(View.GONE);
                        else
                            v.setVisibility(View.VISIBLE);
                    }
                });
                v.startAnimation(anim);
            } else
                v.setVisibility(visible ? View.VISIBLE : View.GONE);
        }
    }
}