Search in sources :

Example 6 with SlideDownAlphaAnimator

use of com.mikepenz.itemanimators.SlideDownAlphaAnimator in project AboutLibraries by mikepenz.

the class CustomApplication method onCreate.

@Override
public void onCreate() {
    //define an itemAnimator for our AboutLibs
    LibsConfiguration.getInstance().setItemAnimator(new SlideDownAlphaAnimator());
    //register our font
    Iconics.registerFont(new MaterialDesignIconic());
    super.onCreate();
}
Also used : MaterialDesignIconic(com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic) SlideDownAlphaAnimator(com.mikepenz.itemanimators.SlideDownAlphaAnimator)

Example 7 with SlideDownAlphaAnimator

use of com.mikepenz.itemanimators.SlideDownAlphaAnimator in project FastAdapter by mikepenz.

the class SampleActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    //create the activity
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle("");
    //Create the drawer
    mResult = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withHasStableIds(true).withSavedInstance(savedInstanceState).withShowDrawerOnFirstLaunch(true).addDrawerItems(new PrimaryDrawerItem().withName(R.string.sample_icon_grid).withDescription(R.string.sample_icon_grid_descr).withSelectable(false).withIdentifier(8).withIcon(MaterialDesignIconic.Icon.gmi_grid), new PrimaryDrawerItem().withName(R.string.sample_simple_item_list).withDescription(R.string.sample_simple_item_list_descr).withSelectable(false).withIdentifier(6).withIcon(MaterialDesignIconic.Icon.gmi_format_align_justify), new PrimaryDrawerItem().withName(R.string.sample_image_list).withDescription(R.string.sample_image_list_descr).withSelectable(false).withIdentifier(5).withIcon(MaterialDesignIconic.Icon.gmi_wallpaper), new PrimaryDrawerItem().withName(R.string.sample_multi_select).withDescription(R.string.sample_multi_select_descr).withSelectable(false).withIdentifier(1).withIcon(MaterialDesignIconic.Icon.gmi_select_all), new PrimaryDrawerItem().withName(R.string.sample_collapsible).withDescription(R.string.sample_collapsible_descr).withSelectable(false).withIdentifier(2).withIcon(MaterialDesignIconic.Icon.gmi_check_all), new PrimaryDrawerItem().withName(R.string.sample_sticky_header).withDescription(R.string.sample_sticky_header_descr).withSelectable(false).withIdentifier(3).withIcon(MaterialDesignIconic.Icon.gmi_format_align_left), new PrimaryDrawerItem().withName(R.string.sample_advanced).withDescription(R.string.sample_advanced_descr).withSelectable(false).withIdentifier(4).withIcon(MaterialDesignIconic.Icon.gmi_coffee), new PrimaryDrawerItem().withName(R.string.sample_generic_item).withDescription(R.string.sample_generic_item_descr).withSelectable(false).withIdentifier(7).withIcon(MaterialDesignIconic.Icon.gmi_font), new PrimaryDrawerItem().withName(R.string.sample_multi_generic_item).withDescription(R.string.sample_multi_generic_item_descr).withSelectable(false).withIdentifier(9).withIcon(MaterialDesignIconic.Icon.gmi_format_list_numbered), new PrimaryDrawerItem().withName(R.string.sample_checkbox_item).withDescription(R.string.sample_checkbox_item_descr).withSelectable(false).withIdentifier(10).withIcon(CommunityMaterial.Icon.cmd_checkbox_marked), new PrimaryDrawerItem().withName(R.string.sample_radiobutton_item).withDescription(R.string.sample_radiobutton_item_descr).withSelectable(false).withIdentifier(11).withIcon(CommunityMaterial.Icon.cmd_radiobox_marked), new PrimaryDrawerItem().withName(R.string.sample_swipe_list).withDescription(R.string.sample_swipe_list_descr).withSelectable(false).withIdentifier(12).withIcon(MaterialDesignIconic.Icon.gmi_format_align_left), new PrimaryDrawerItem().withName(R.string.sample_endless_scroll_list).withDescription(R.string.sample_endless_scroll_list_descr).withSelectable(false).withIdentifier(13).withIcon(MaterialDesignIconic.Icon.gmi_long_arrow_down), new PrimaryDrawerItem().withName(R.string.sample_sort).withDescription(R.string.sample_sort_descr).withSelectable(false).withIdentifier(14).withIcon(MaterialDesignIconic.Icon.gmi_sort_by_alpha), new PrimaryDrawerItem().withName(R.string.sample_mopub).withDescription(R.string.sample_mopub_descr).withSelectable(false).withIdentifier(15).withIcon(MaterialDesignIconic.Icon.gmi_accounts_list), new PrimaryDrawerItem().withName(R.string.sample_realm_list).withDescription(R.string.sample_realm_list_descr).withSelectable(false).withIdentifier(16).withIcon(MaterialDesignIconic.Icon.gmi_format_color_text), new PrimaryDrawerItem().withName(R.string.sample_collapsible_multi_select_delete).withDescription(R.string.sample_collapsible_multi_select_delete_descr).withSelectable(false).withIdentifier(17).withIcon(MaterialDesignIconic.Icon.gmi_check_all), new DividerDrawerItem(), new PrimaryDrawerItem().withName(R.string.open_source).withSelectable(false).withIdentifier(100).withIcon(MaterialDesignIconic.Icon.gmi_github)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

        @Override
        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
            if (drawerItem != null) {
                Intent intent = null;
                if (drawerItem.getIdentifier() == 1) {
                    intent = new Intent(SampleActivity.this, MultiselectSampleActivity.class);
                } else if (drawerItem.getIdentifier() == 2) {
                    intent = new Intent(SampleActivity.this, ExpandableSampleActivity.class);
                } else if (drawerItem.getIdentifier() == 3) {
                    intent = new Intent(SampleActivity.this, StickyHeaderSampleActivity.class);
                } else if (drawerItem.getIdentifier() == 4) {
                    intent = new Intent(SampleActivity.this, AdvancedSampleActivity.class);
                } else if (drawerItem.getIdentifier() == 5) {
                    intent = new Intent(SampleActivity.this, ImageListActivity.class);
                } else if (drawerItem.getIdentifier() == 6) {
                    intent = new Intent(SampleActivity.this, SimpleItemListActivity.class);
                } else if (drawerItem.getIdentifier() == 7) {
                    intent = new Intent(SampleActivity.this, GenericItemActivity.class);
                } else if (drawerItem.getIdentifier() == 8) {
                    intent = new Intent(SampleActivity.this, IconGridActivity.class);
                } else if (drawerItem.getIdentifier() == 9) {
                    intent = new Intent(SampleActivity.this, MultiTypeGenericItemActivity.class);
                } else if (drawerItem.getIdentifier() == 10) {
                    intent = new Intent(SampleActivity.this, CheckBoxSampleActivity.class);
                } else if (drawerItem.getIdentifier() == 11) {
                    intent = new Intent(SampleActivity.this, RadioButtonSampleActivity.class);
                } else if (drawerItem.getIdentifier() == 12) {
                    intent = new Intent(SampleActivity.this, SwipeListActivity.class);
                } else if (drawerItem.getIdentifier() == 13) {
                    intent = new Intent(SampleActivity.this, EndlessScrollListActivity.class);
                } else if (drawerItem.getIdentifier() == 14) {
                    intent = new Intent(SampleActivity.this, SortActivity.class);
                } else if (drawerItem.getIdentifier() == 15) {
                    intent = new Intent(SampleActivity.this, MopubAdsActivity.class);
                } else if (drawerItem.getIdentifier() == 16) {
                    intent = new Intent(SampleActivity.this, RealmActivity.class);
                } else if (drawerItem.getIdentifier() == 17) {
                    intent = new Intent(SampleActivity.this, ExpandableMultiselectDeleteSampleActivity.class);
                } else if (drawerItem.getIdentifier() == 100) {
                    intent = new LibsBuilder().withFields(R.string.class.getFields()).withActivityTitle(getString(R.string.open_source)).withActivityStyle(Libs.ActivityStyle.LIGHT).withAboutIconShown(true).withVersionShown(true).withAboutVersionShown(true).intent(SampleActivity.this);
                }
                if (intent != null) {
                    SampleActivity.this.startActivity(intent);
                }
            }
            return false;
        }
    }).withSelectedItemByPosition(-1).build();
    //create our FastAdapter which will manage everything
    mFastAdapter = new FastAdapter<>();
    mFastAdapter.withSelectable(true);
    mFastAdapter.withMultiSelect(true);
    mFastAdapter.withSelectOnLongClick(false);
    //create our ItemAdapter which will host our items
    mItemAdapter = new ItemAdapter<>();
    //configure our fastAdapter
    //get our recyclerView and do basic setup
    mRecyclerView = (RecyclerView) findViewById(R.id.rv);
    //mRecyclerView.setLayoutManager(new GridLayoutManager(this, 3));
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setAdapter(mItemAdapter.wrap(mFastAdapter));
    mRecyclerView.setItemAnimator(new SlideDownAlphaAnimator());
    mRecyclerView.getItemAnimator().setAddDuration(500);
    mRecyclerView.getItemAnimator().setRemoveDuration(500);
    //if we do this. the first added items will be animated :D
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            //add some dummy data
            mItemAdapter.add(ImageDummyData.getSimpleImageItems());
            //restore selections (this has to be done after the items were added
            mFastAdapter.withSavedInstanceState(savedInstanceState);
        }
    }, 50);
}
Also used : PrimaryDrawerItem(com.mikepenz.materialdrawer.model.PrimaryDrawerItem) IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) DividerDrawerItem(com.mikepenz.materialdrawer.model.DividerDrawerItem) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SlideDownAlphaAnimator(com.mikepenz.itemanimators.SlideDownAlphaAnimator) LibsBuilder(com.mikepenz.aboutlibraries.LibsBuilder) Toolbar(android.support.v7.widget.Toolbar) Handler(android.os.Handler) Intent(android.content.Intent) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder)

Example 8 with SlideDownAlphaAnimator

use of com.mikepenz.itemanimators.SlideDownAlphaAnimator in project FastAdapter by mikepenz.

the class GenericItemActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);
    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(R.string.sample_generic_item);
    //style our ui
    new MaterializeBuilder().withActivity(this).build();
    //create our FastAdapter which will manage everything
    fastAdapter = new FastAdapter();
    fastAdapter.withSelectable(true);
    //get our recyclerView and do basic setup
    RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
    //init our gridLayoutManager and configure RV
    GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3);
    GenericItemAdapter<IconModel, GenericIconItem> itemAdapter = new GenericItemAdapter<>(GenericIconItem.class, IconModel.class);
    final FastScrollIndicatorAdapter<GenericIconItem> fastScrollIndicatorAdapter = new FastScrollIndicatorAdapter<>();
    rv.setAdapter(fastScrollIndicatorAdapter.wrap(itemAdapter.wrap(fastAdapter)));
    DragScrollBar materialScrollBar = new DragScrollBar(this, rv, true);
    materialScrollBar.setHandleColour(ContextCompat.getColor(this, R.color.colorAccent));
    materialScrollBar.setHandleOffColour(ContextCompat.getColor(this, R.color.colorAccent));
    materialScrollBar.addIndicator(new CustomIndicator(this), true);
    rv.setLayoutManager(gridLayoutManager);
    rv.setItemAnimator(new SlideDownAlphaAnimator());
    //order fonts by their name
    List<ITypeface> mFonts = new ArrayList<>(Iconics.getRegisteredFonts(this));
    Collections.sort(mFonts, new Comparator<ITypeface>() {

        @Override
        public int compare(final ITypeface object1, final ITypeface object2) {
            return object1.getFontName().compareTo(object2.getFontName());
        }
    });
    //add all icons of all registered Fonts to the list
    ArrayList<IconModel> models = new ArrayList<>();
    for (ITypeface font : mFonts) {
        for (String icon : font.getIcons()) {
            models.add(new IconModel(font.getIcon(icon)));
        }
    }
    //fill with some sample data
    itemAdapter.addModel(models);
    //restore selections (this has to be done after the items were added
    fastAdapter.withSavedInstanceState(savedInstanceState);
    //set the back arrow in the toolbar
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(false);
}
Also used : FastScrollIndicatorAdapter(com.mikepenz.fastadapter.app.adapters.FastScrollIndicatorAdapter) IconModel(com.mikepenz.fastadapter.app.generic.IconModel) DragScrollBar(com.turingtechnologies.materialscrollbar.DragScrollBar) GenericIconItem(com.mikepenz.fastadapter.app.generic.GenericIconItem) ArrayList(java.util.ArrayList) CustomIndicator(com.turingtechnologies.materialscrollbar.CustomIndicator) MaterializeBuilder(com.mikepenz.materialize.MaterializeBuilder) GridLayoutManager(android.support.v7.widget.GridLayoutManager) SlideDownAlphaAnimator(com.mikepenz.itemanimators.SlideDownAlphaAnimator) GenericItemAdapter(com.mikepenz.fastadapter.adapters.GenericItemAdapter) ITypeface(com.mikepenz.iconics.typeface.ITypeface) RecyclerView(android.support.v7.widget.RecyclerView) FastAdapter(com.mikepenz.fastadapter.FastAdapter) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

SlideDownAlphaAnimator (com.mikepenz.itemanimators.SlideDownAlphaAnimator)8 RecyclerView (android.support.v7.widget.RecyclerView)7 Toolbar (android.support.v7.widget.Toolbar)7 MaterializeBuilder (com.mikepenz.materialize.MaterializeBuilder)6 ArrayList (java.util.ArrayList)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 FastAdapter (com.mikepenz.fastadapter.FastAdapter)4 GridLayoutManager (android.support.v7.widget.GridLayoutManager)3 View (android.view.View)3 IItem (com.mikepenz.fastadapter.IItem)3 IconicsLayoutInflater (com.mikepenz.iconics.context.IconicsLayoutInflater)3 ITypeface (com.mikepenz.iconics.typeface.ITypeface)3 ActionMode (android.support.v7.view.ActionMode)2 GenericItemAdapter (com.mikepenz.fastadapter.adapters.GenericItemAdapter)2 GenericIconItem (com.mikepenz.fastadapter.app.generic.GenericIconItem)2 IconModel (com.mikepenz.fastadapter.app.generic.IconModel)2 SimpleSubExpandableItem (com.mikepenz.fastadapter.app.items.expandable.SimpleSubExpandableItem)2 SimpleSubItem (com.mikepenz.fastadapter.app.items.expandable.SimpleSubItem)2 ActionModeHelper (com.mikepenz.fastadapter_extensions.ActionModeHelper)2 LinkedList (java.util.LinkedList)2