Search in sources :

Example 1 with SlideInBottomAnimatorAdapter

use of it.gmariotti.recyclerview.adapter.SlideInBottomAnimatorAdapter 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 SlideInBottomAnimatorAdapter

use of it.gmariotti.recyclerview.adapter.SlideInBottomAnimatorAdapter 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

RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 Spinner (android.widget.Spinner)2 AlphaAnimatorAdapter (it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter)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