Search in sources :

Example 1 with AlphaAnimatorAdapter

use of it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter in project RecyclerViewItemAnimators by gabrielemariotti.

the class AnimationGridActivity method setupSpinner.

private void setupSpinner() {
    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.adapters, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
            switch(position) {
                case 0:
                    AlphaAnimatorAdapter animatorAdapter = new AlphaAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(animatorAdapter);
                    break;
                case 1:
                    SlideInLeftAnimatorAdapter slideInLeftAnimationRecyclerViewAdapter = new SlideInLeftAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInLeftAnimationRecyclerViewAdapter);
                    break;
                case 2:
                    SlideInRightAnimatorAdapter slideInRightAnimatorAdapter = new SlideInRightAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInRightAnimatorAdapter);
                    break;
                case 3:
                    SlideInBottomAnimatorAdapter slideInBottomAnimatorAdapter = new SlideInBottomAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInBottomAnimatorAdapter);
                    break;
                case 4:
                    ScaleInAnimatorAdapter scaleInRecyclerViewAnimationAdapter = new ScaleInAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(scaleInRecyclerViewAnimationAdapter);
                    break;
                case 5:
                    SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(swingBottomInAnimationAdapter);
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
}
Also used : Spinner(android.widget.Spinner) SwingBottomInAnimationAdapter(it.gmariotti.recyclerview.adapter.SwingBottomInAnimationAdapter) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) SlideInBottomAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInBottomAnimatorAdapter) ScaleInAnimatorAdapter(it.gmariotti.recyclerview.adapter.ScaleInAnimatorAdapter) SlideInLeftAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInLeftAnimatorAdapter) AlphaAnimatorAdapter(it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter) AdapterView(android.widget.AdapterView) SlideInRightAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInRightAnimatorAdapter)

Example 2 with AlphaAnimatorAdapter

use of it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter in project RecyclerViewItemAnimators by gabrielemariotti.

the class AnimationGridActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler);
    //Setup Spinner
    setupSpinner();
    //Setup RecyclerView
    mRecyclerView = (RecyclerView) findViewById(R.id.list);
    //mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(new GridLayoutManager(this, 5));
    mAdapter = new AnimationGridAdapter(this);
    AlphaAnimatorAdapter animatorAdapter = new AlphaAnimatorAdapter(mAdapter, mRecyclerView);
    animatorAdapter.getViewAnimator().setInitialDelayMillis(500);
    mRecyclerView.setAdapter(animatorAdapter);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) AlphaAnimatorAdapter(it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter) AnimationGridAdapter(it.gmariotti.recyclerview.itemanimator.demo.adapter.AnimationGridAdapter)

Example 3 with AlphaAnimatorAdapter

use of it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter in project RecyclerViewItemAnimators by gabrielemariotti.

the class AnimationListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler);
    //Setup Spinner
    setupSpinner();
    //Setup RecyclerView
    mRecyclerView = (RecyclerView) findViewById(R.id.list);
    //mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new AnimationListAdapter(this);
    AlphaAnimatorAdapter animatorAdapter = new AlphaAnimatorAdapter(mAdapter, mRecyclerView);
    mRecyclerView.setAdapter(animatorAdapter);
}
Also used : AlphaAnimatorAdapter(it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter) AnimationListAdapter(it.gmariotti.recyclerview.itemanimator.demo.adapter.AnimationListAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 4 with AlphaAnimatorAdapter

use of it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter in project RecyclerViewItemAnimators by gabrielemariotti.

the class AnimationListActivity method setupSpinner.

private void setupSpinner() {
    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.adapters, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
            switch(position) {
                case 0:
                    AlphaAnimatorAdapter animatorAdapter = new AlphaAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(animatorAdapter);
                    break;
                case 1:
                    SlideInLeftAnimatorAdapter slideInLeftAnimationRecyclerViewAdapter = new SlideInLeftAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInLeftAnimationRecyclerViewAdapter);
                    break;
                case 2:
                    SlideInRightAnimatorAdapter slideInRightAnimatorAdapter = new SlideInRightAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInRightAnimatorAdapter);
                    break;
                case 3:
                    SlideInBottomAnimatorAdapter slideInBottomAnimatorAdapter = new SlideInBottomAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInBottomAnimatorAdapter);
                    break;
                case 4:
                    ScaleInAnimatorAdapter scaleInRecyclerViewAnimationAdapter = new ScaleInAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(scaleInRecyclerViewAnimationAdapter);
                    break;
                case 5:
                    SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(swingBottomInAnimationAdapter);
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
}
Also used : Spinner(android.widget.Spinner) SwingBottomInAnimationAdapter(it.gmariotti.recyclerview.adapter.SwingBottomInAnimationAdapter) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) SlideInBottomAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInBottomAnimatorAdapter) ScaleInAnimatorAdapter(it.gmariotti.recyclerview.adapter.ScaleInAnimatorAdapter) SlideInLeftAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInLeftAnimatorAdapter) AlphaAnimatorAdapter(it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter) AdapterView(android.widget.AdapterView) SlideInRightAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInRightAnimatorAdapter)

Aggregations

AlphaAnimatorAdapter (it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter)4 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 Spinner (android.widget.Spinner)2 ScaleInAnimatorAdapter (it.gmariotti.recyclerview.adapter.ScaleInAnimatorAdapter)2 SlideInBottomAnimatorAdapter (it.gmariotti.recyclerview.adapter.SlideInBottomAnimatorAdapter)2 SlideInLeftAnimatorAdapter (it.gmariotti.recyclerview.adapter.SlideInLeftAnimatorAdapter)2 SlideInRightAnimatorAdapter (it.gmariotti.recyclerview.adapter.SlideInRightAnimatorAdapter)2 SwingBottomInAnimationAdapter (it.gmariotti.recyclerview.adapter.SwingBottomInAnimationAdapter)2 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 AnimationGridAdapter (it.gmariotti.recyclerview.itemanimator.demo.adapter.AnimationGridAdapter)1 AnimationListAdapter (it.gmariotti.recyclerview.itemanimator.demo.adapter.AnimationListAdapter)1