Example usage for android.view.animation AnimationUtils loadAnimation

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

Introduction

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

Prototype

public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException 

Source Link

Document

Loads an Animation object from a resource

Usage

From source file:net.olejon.spotcommander.MainActivity.java

private void listComputers() {
    final String[] queryColumns = { MainSQLiteHelper.COLUMN_ID, MainSQLiteHelper.COLUMN_NAME };
    mCursor = mDatabase.query(MainSQLiteHelper.TABLE_COMPUTERS, queryColumns, null, null, null, null,
            MainSQLiteHelper.COLUMN_NAME + " COLLATE NOCASE");

    final String[] fromColumns = { MainSQLiteHelper.COLUMN_NAME };
    final int[] toViews = { R.id.main_list_item };

    mListView.setAdapter(new SimpleCursorAdapter(mContext, R.layout.activity_main_list_item, mCursor,
            fromColumns, toViews, 0));/*from   w  w w.j a  va  2  s . co  m*/

    mFloatingActionButton.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.fab));
    mFloatingActionButton.setVisibility(View.VISIBLE);
}

From source file:com.huewu.pla.lib.MultiColumnListFragment.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.
 * //  w w  w. ja v  a  2  s. com
 * @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(final boolean shown, final 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(getActivity(), android.R.anim.fade_out));
            mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
        } else {
            mProgressContainer.clearAnimation();
            mListContainer.clearAnimation();
        }
        mProgressContainer.setVisibility(View.GONE);
        mListContainer.setVisibility(View.VISIBLE);
    } else {
        if (animate) {
            mProgressContainer
                    .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
            mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
        } else {
            mProgressContainer.clearAnimation();
            mListContainer.clearAnimation();
        }
        mProgressContainer.setVisibility(View.VISIBLE);
        mListContainer.setVisibility(View.GONE);
    }
}

From source file:com.freshdigitable.udonroad.TimelineFragment.java

@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
    if (transit == FragmentTransaction.TRANSIT_FRAGMENT_OPEN) {
        if (!enter) {
            return AnimationUtils.loadAnimation(getContext(), android.R.anim.slide_out_right);
        }//from   w  w w.jav a2s . c o  m
    }
    if (transit == FragmentTransaction.TRANSIT_FRAGMENT_CLOSE) {
        if (enter) {
            return AnimationUtils.loadAnimation(getContext(), android.R.anim.slide_in_left);
        }
    }
    return super.onCreateAnimation(transit, enter, nextAnim);
}

From source file:com.artur.softwareproject.Main.java

private void stopRecording() {
    final Context context = this;

    AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
        @Override//from   w  w w.  ja  v  a 2s .  c o  m
        protected void onPreExecute() {
            pd = new ProgressDialog(context);
            pd.setTitle("Processing...");
            pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            pd.setMessage("Please wait.");
            pd.setCancelable(false);
            pd.setIndeterminate(true);
            pd.show();
        }

        @Override
        protected Void doInBackground(Void... params) {
            modelConstructed = rService.create3dModel();

            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            if (pd != null) {
                pd.dismiss();
            }

            if (rBound) {
                unbindService(mConnection);
                rBound = false;
            }

            MenuItem item = mainMenu.findItem(R.id.record_data);

            item.setIcon(R.drawable.ic_action_save);

            Animation a = AnimationUtils.loadAnimation(context, R.anim.textupslide);
            TextView tv = (TextView) findViewById(R.id.recordClock);
            tv.startAnimation(a);

            recordClock.setVisibility(View.GONE);

            recording = false;

            if (modelConstructed) {
                Toast.makeText(getApplicationContext(), "Recording stopped.\n3D model created.",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getApplicationContext(), "Recording stopped.\n3D model creation failed.",
                        Toast.LENGTH_LONG).show();
            }
        }
    };

    task.execute((Void[]) null);

}

From source file:com.origamilabs.library.app.StaggeredGridFragment.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  w w  w  . j  a va2s.  c o  m*/
 * @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 setGridShown(final boolean shown, final 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(getActivity(), android.R.anim.fade_out));
            mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
        } else {
            mProgressContainer.clearAnimation();
            mListContainer.clearAnimation();
        }
        mProgressContainer.setVisibility(View.GONE);
        mListContainer.setVisibility(View.VISIBLE);
    } else {
        if (animate) {
            mProgressContainer
                    .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
            mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
        } else {
            mProgressContainer.clearAnimation();
            mListContainer.clearAnimation();
        }
        mProgressContainer.setVisibility(View.VISIBLE);
        mListContainer.setVisibility(View.GONE);
    }
}

From source file:com.svpino.longhorn.fragments.StockListFragment.java

private void displayStockOverview(Integer position, boolean animate) {
    if (position != null) {
        setCurrentTile(position);//  w ww.j av  a  2 s . com
        setStockOverviewState(StockOverviewState.OVERVIEW);
    }

    displayStockInViewFlipper(position);

    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            Extensions.dpToPixels(getResources(), STOCK_OVERVIEW_HEIGHT));
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    this.viewFlipper.setLayoutParams(layoutParams);

    if (animate) {
        Animation animation = AnimationUtils.loadAnimation(getActivity().getApplicationContext(),
                R.anim.slide_in_from_bottom);
        animation.setAnimationListener(
                new StockOverviewAnimationListener(this.animateStockOverviewContentCallback));
        this.viewFlipper.setVisibility(View.VISIBLE);
        this.viewFlipper.startAnimation(animation);
    } else {
        this.viewFlipper.setVisibility(View.VISIBLE);
    }

    collapseSearchActionView();
    invalidateOptionsMenu();
}

From source file:com.daiv.android.twitter.settings.SettingsActivityOld.java

private void switchToSettingsList(boolean settings) {
    if (settings && settingsList.getVisibility() != View.VISIBLE) {
        // animate the settings list showing and other list hiding
        Animation in = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
        Animation out = AnimationUtils.loadAnimation(this, R.anim.slide_out_right);
        in.setDuration(ANIM_TIME * 2);//from ww  w  .ja  va2  s. c  o  m
        out.setDuration(ANIM_TIME);
        in.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
                settingsList.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationEnd(Animation animation) {
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        out.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
                otherList.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                otherList.setVisibility(View.GONE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        settingsList.startAnimation(in);
        otherList.startAnimation(out);
    } else if (!settings && otherList.getVisibility() != View.VISIBLE) {
        // animate the other list showing and settings list hiding
        Animation in = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
        Animation out = AnimationUtils.loadAnimation(this, R.anim.slide_out_left);
        in.setDuration(ANIM_TIME * 2);
        out.setDuration(ANIM_TIME);
        in.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
                otherList.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationEnd(Animation animation) {
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        out.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
                settingsList.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                settingsList.setVisibility(View.GONE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        settingsList.startAnimation(out);
        otherList.startAnimation(in);
    }
}

From source file:at.wada811.app.fragment.ExpandableListFragment.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  o m*/
 * @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(final boolean shown, final 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(getActivity(), android.R.anim.fade_out));
            mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
        } else {
            mProgressContainer.clearAnimation();
            mListContainer.clearAnimation();
        }
        mProgressContainer.setVisibility(View.GONE);
        mListContainer.setVisibility(View.VISIBLE);
    } else {
        if (animate) {
            mProgressContainer
                    .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
            mListContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out));
        } else {
            mProgressContainer.clearAnimation();
            mListContainer.clearAnimation();
        }
        mProgressContainer.setVisibility(View.VISIBLE);
        mListContainer.setVisibility(View.GONE);
    }
}

From source file:com.karma.konnect.BeaconConfigFragment.java

/**
 * Show the card that displays the address and url of the currently-being-configured beacon.
 *//*  w w w.j  a  v  a  2  s  . c  o m*/
private void showConfigurableBeaconCard() {
    mEditCard.setVisibility(View.VISIBLE);
    Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.fade_in_and_slide_up);
    mEditCard.startAnimation(animation);
}

From source file:com.raja.knowme.FragmentProfile.java

private void nextDetail() {
    count++;//  w  ww .  jav  a2 s  .  com
    mHeaderSwitcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_left_in));
    mHeaderSwitcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_left_out));
    mBodySwitcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_left_in));
    mBodySwitcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_left_out));
    setUIData(count);
    mScrollview.scrollTo(0, 0);
}