Example usage for android.view.animation LayoutAnimationController LayoutAnimationController

List of usage examples for android.view.animation LayoutAnimationController LayoutAnimationController

Introduction

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

Prototype

public LayoutAnimationController(Animation animation, float delay) 

Source Link

Document

Creates a new layout animation controller with the specified delay and the specified animation.

Usage

From source file:Main.java

public static void setAnimListView(ListView listView) {
    AlphaAnimation animation = new AlphaAnimation(0, 1f);
    animation.setDuration(4000);//from w  ww  . j a v a2 s.com
    LayoutAnimationController controller = new LayoutAnimationController(animation, 0.5f);
    listView.setLayoutAnimation(controller);
}

From source file:Main.java

public static void makeViewGroupAnimation(ViewGroup viewGroup) {
    AnimationSet set = new AnimationSet(true);

    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(50);// w w  w .ja  va 2  s .c  om
    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(150);
    set.addAnimation(animation);

    LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f);
    viewGroup.setLayoutAnimation(controller);
}

From source file:com.manning.androidhacks.hack006.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getListView().setLayoutAnimation(/*from   w  w  w.ja  v  a  2s  .  c o m*/
            new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_animation), 0.5f));

    setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, Countries.COUNTRIES));
}

From source file:Main.java

private static LayoutAnimationController createLayoutAnimationFromXml(Context c, XmlPullParser parser,
        AttributeSet attrs) throws XmlPullParserException, IOException {

    LayoutAnimationController controller = null;

    int type;// w w w .j  a v  a2s  . c o m
    int depth = parser.getDepth();

    while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
            && type != XmlPullParser.END_DOCUMENT) {

        if (type != XmlPullParser.START_TAG) {
            continue;
        }

        String name = parser.getName();

        if ("layoutAnimation".equals(name)) {
            controller = new LayoutAnimationController(c, attrs);
        } else if ("gridLayoutAnimation".equals(name)) {
            controller = new GridLayoutAnimationController(c, attrs);
        } else {
            throw new RuntimeException("Unknown layout animation name: " + name);
        }
    }

    return controller;
}

From source file:com.example.demo_highlights.slidingmenu.fragment.PageFragment1.java

private LayoutAnimationController getListAnim() {
    AnimationSet set = new AnimationSet(true);
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(200);//from w  ww.  jav a  2 s .  c  om
    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(200);
    set.addAnimation(animation);

    Animation inAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f);
    inAnimation.setDuration(200);
    inAnimation.setFillAfter(true);
    set.addAnimation(inAnimation);

    Animation outAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f);
    outAnimation.setDuration(200);
    outAnimation.setFillAfter(true);
    // 
    LayoutAnimationController inController = new LayoutAnimationController(inAnimation, 0.3f);
    // 
    LayoutAnimationController outController = new LayoutAnimationController(outAnimation, 0.3f);

    LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f);
    return controller;
}

From source file:eu.thedarken.rootvalidator.ValidatorFragment.java

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    AnimationSet set = new AnimationSet(true);
    Animation fadeIn = new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setDuration(350);/*from ww w  .j a v a  2  s.  c o m*/
    set.addAnimation(fadeIn);
    Animation dropDown = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF,
            0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    dropDown.setDuration(400);
    set.addAnimation(dropDown);
    LayoutAnimationController controller = new LayoutAnimationController(set, 0.2f);
    mRecyclerView.setLayoutAnimation(controller);

    mFab.attachToRecyclerView(mRecyclerView);
    mFab.setVisibility(View.INVISIBLE);
    mEmptyStartView.setVisibility(View.GONE);
    mEmptyWorkingView.setVisibility(View.GONE);
    mListContainer.addView(mEmptyStartView);
    mListContainer.addView(mEmptyWorkingView);
    mRecyclerView.setEmptyView(mEmptyStartView);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
}

From source file:com.appassit.common.Utils.java

/**
 * ??/*  ww  w.  ja  v  a2  s .com*/
 * 
 * @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:com.money.manager.ex.fragment.HomeFragment.java

public LayoutAnimationController setAnimationView(View view) {
    AnimationSet set = new AnimationSet(true);

    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(250);/*  w w  w.j a  v  a 2 s  .  com*/
    set.addAnimation(animation);

    animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    animation.setDuration(150);
    set.addAnimation(animation);

    LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f);

    return controller;
}

From source file:com.PPRZonDroid.MainActivity.java

/**
 * Refresh block lisst on right//from w w w.  j  av a2 s  .  com
 */
private void refresh_block_list() {

    int i;
    BlList.clear();

    for (i = 0; i < AC_DATA.AircraftData[AC_DATA.SelAcInd].BlockCount; i++) {
        BlList.add(new BlockModel(AC_DATA.AircraftData[AC_DATA.SelAcInd].AC_Blocks[i].BlName));
    }
    mBlListAdapter.BlColor = AC_DATA.muiGraphics.get_color(AC_DATA.AircraftData[AC_DATA.SelAcInd].AC_Color);
    mBlListAdapter.SelectedInd = AC_DATA.AircraftData[AC_DATA.SelAcInd].SelectedBlock;

    AnimationSet set = new AnimationSet(true);

    Animation animation = new AlphaAnimation(0.0f, 1.0f);

    animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, +1.0f, Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    animation.setDuration(250);
    set.addAnimation(animation);

    LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f);
    BlListView.setLayoutAnimation(controller);

    mBlListAdapter.notifyDataSetChanged();
}