Search in sources :

Example 1 with ParallaxRecyclerAdapter

use of com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter in project AdvancedMaterialDrawer by madcyph3r.

the class HeadItemTypesFragment method createAdapter.

private void createAdapter(RecyclerView recyclerView) {
    final List<ExampleData> content = new ArrayList<>();
    content.add(new ExampleData("One Item Example", HeadItemOneActivity.class));
    content.add(new ExampleData("(One Item) Below Toolbar", HeadItemOneBelowToolbarActivity.class));
    content.add(new ExampleData("(One Item) Black Theme", HeadItemOneBlackThemeActivity.class));
    content.add(new ExampleData("(Three Item)", HeadItemThreeActivity.class));
    content.add(new ExampleData("(Five Item)", HeadItemFiveActivity.class));
    content.add(new ExampleData("(Five Item) With Extra Menu", HeadItemFiveExtraMenuActivity.class));
    content.add(new ExampleData("(Two Items) With Extra Menu", HeadItemTwoExtraMenuActivity.class));
    content.add(new ExampleData("(Three Items) Don't Close Drawer On Change", HeadItemThreeDontCloseOnChangeActivity.class));
    content.add(new ExampleData("(Five Items) Don't Close Drawer On Change", HeadItemFiveDontCloseOnChangeActivity.class));
    content.add(new ExampleData("Add And Remove Menu Items At Runtime", AddRemoveMenuItemsActivity.class));
    content.add(new ExampleData("(Two Items) Only First Item Has a Menu", HeadItemTwoOnlyOneHasMenuActivity.class));
    content.add(new ExampleData("(Two Items) Fragment Doesn't Change On HeadItem Change", HeadItemTwoNoFragmentLoadOnChangeActivity.class));
    content.add(new ExampleData("100 Head Items With Static Background", HeadItem100StaticBackgroundActivity.class));
    final ParallaxRecyclerAdapter<ExampleData> adapter = new ParallaxRecyclerAdapter<>(content);
    View header = getActivity().getLayoutInflater().inflate(R.layout.recycleview_header, recyclerView, false);
    ImageView headerImage = (ImageView) header.findViewById(R.id.imageViewHeader);
    headerImage.setImageResource(R.drawable.l_5);
    adapter.setParallaxHeader(header, recyclerView);
    adapter.setData(content);
    adapter.implementRecyclerAdapterMethods(new ParallaxRecyclerAdapter.RecyclerAdapterMethods() {

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
            ((ViewHolder) viewHolder).textView.setText(adapter.getData().get(i).getTitle());
        }

        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, final int i) {
            final ViewHolder holder = new ViewHolder(getActivity().getLayoutInflater().inflate(R.layout.recycleview_row, viewGroup, false));
            return holder;
        }

        @Override
        public int getItemCount() {
            return content.size();
        }
    });
    adapter.setOnParallaxScroll(new ParallaxRecyclerAdapter.OnParallaxScroll() {

        @Override
        public void onParallaxScroll(float percentage, float offset, View view) {
            ((MainActivity) getActivity()).setActionBarAlpha(percentage);
        }
    });
    adapter.setOnClickEvent(new ParallaxRecyclerAdapter.OnClickEvent() {

        @Override
        public void onClick(View view, int i) {
            if (i >= 0) {
                Intent intent = new Intent(getActivity(), adapter.getData().get(i).getClazz());
                startActivity(intent);
            }
        }
    });
    recyclerView.setAdapter(adapter);
}
Also used : ExampleData(de.madcyph3r.example.data.ExampleData) HeadItemOneBelowToolbarActivity(de.madcyph3r.example.example.headerTypes.HeadItemOneBelowToolbarActivity) HeadItem100StaticBackgroundActivity(de.madcyph3r.example.example.headItemTypes.HeadItem100StaticBackgroundActivity) ArrayList(java.util.ArrayList) HeadItemThreeDontCloseOnChangeActivity(de.madcyph3r.example.example.headItemTypes.HeadItemThreeDontCloseOnChangeActivity) HeadItemThreeActivity(de.madcyph3r.example.example.headerTypes.HeadItemThreeActivity) HeadItemFiveExtraMenuActivity(de.madcyph3r.example.example.headItemTypes.HeadItemFiveExtraMenuActivity) HeadItemTwoNoFragmentLoadOnChangeActivity(de.madcyph3r.example.example.headItemTypes.HeadItemTwoNoFragmentLoadOnChangeActivity) AddRemoveMenuItemsActivity(de.madcyph3r.example.example.menu.AddRemoveMenuItemsActivity) ParallaxRecyclerAdapter(com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter) HeadItemTwoOnlyOneHasMenuActivity(de.madcyph3r.example.example.headItemTypes.HeadItemTwoOnlyOneHasMenuActivity) HeadItemTwoExtraMenuActivity(de.madcyph3r.example.example.headItemTypes.HeadItemTwoExtraMenuActivity) ImageView(android.widget.ImageView) HeadItemOneActivity(de.madcyph3r.example.example.headerTypes.HeadItemOneActivity) ViewGroup(android.view.ViewGroup) HeadItemOneBlackThemeActivity(de.madcyph3r.example.example.headItemTypes.HeadItemOneBlackThemeActivity) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) HeadItemFiveActivity(de.madcyph3r.example.example.headerTypes.HeadItemFiveActivity) HeadItemFiveDontCloseOnChangeActivity(de.madcyph3r.example.example.headItemTypes.HeadItemFiveDontCloseOnChangeActivity) RecyclerView(android.support.v7.widget.RecyclerView)

Example 2 with ParallaxRecyclerAdapter

use of com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter in project AdvancedMaterialDrawer by madcyph3r.

the class HeaderTypesFragment method createAdapter.

private void createAdapter(RecyclerView recyclerView) {
    final List<ExampleData> content = new ArrayList<>();
    content.add(new ExampleData("No Header", NoHeaderActivity.class));
    content.add(new ExampleData("No Header Below Toolbar", NoHeaderBelowToolbarActivity.class));
    content.add(new ExampleData("Image Header", ImageHeaderActivity.class));
    content.add(new ExampleData("Image Header Below Toolbar", ImageHeaderBelowToolbarActivity.class));
    //content.add(new ExampleData("Image Header With Custom Height", ImageHeaderCustomHeightActivity.class));
    content.add(new ExampleData("Custom Header", CustomHeaderActivity.class));
    content.add(new ExampleData("Custom Header Below Toolbar", CustomHeaderBelowToolbarActivity.class));
    //content.add(new ExampleData("Custom Header With Custom Height", CustomHeaderCustomHeightActivity.class));
    content.add(new ExampleData("Head Item Style (One Item)", HeadItemOneActivity.class));
    content.add(new ExampleData("Head Item Style (Three Item)", HeadItemThreeActivity.class));
    content.add(new ExampleData("Head Item Style (Five Item)", HeadItemFiveActivity.class));
    final ParallaxRecyclerAdapter<ExampleData> adapter = new ParallaxRecyclerAdapter<>(content);
    View header = getActivity().getLayoutInflater().inflate(R.layout.recycleview_header, recyclerView, false);
    ImageView headerImage = (ImageView) header.findViewById(R.id.imageViewHeader);
    headerImage.setImageResource(R.drawable.l_4);
    adapter.setParallaxHeader(header, recyclerView);
    adapter.setData(content);
    adapter.implementRecyclerAdapterMethods(new ParallaxRecyclerAdapter.RecyclerAdapterMethods() {

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
            ((ViewHolder) viewHolder).textView.setText(adapter.getData().get(i).getTitle());
        }

        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, final int i) {
            final ViewHolder holder = new ViewHolder(getActivity().getLayoutInflater().inflate(R.layout.recycleview_row, viewGroup, false));
            return holder;
        }

        @Override
        public int getItemCount() {
            return content.size();
        }
    });
    adapter.setOnParallaxScroll(new ParallaxRecyclerAdapter.OnParallaxScroll() {

        @Override
        public void onParallaxScroll(float percentage, float offset, View view) {
            ((MainActivity) getActivity()).setActionBarAlpha(percentage);
        }
    });
    adapter.setOnClickEvent(new ParallaxRecyclerAdapter.OnClickEvent() {

        @Override
        public void onClick(View view, int i) {
            if (i >= 0) {
                Intent intent = new Intent(getActivity(), adapter.getData().get(i).getClazz());
                startActivity(intent);
            }
        }
    });
    recyclerView.setAdapter(adapter);
}
Also used : ExampleData(de.madcyph3r.example.data.ExampleData) CustomHeaderBelowToolbarActivity(de.madcyph3r.example.example.headerTypes.CustomHeaderBelowToolbarActivity) ArrayList(java.util.ArrayList) HeadItemThreeActivity(de.madcyph3r.example.example.headerTypes.HeadItemThreeActivity) ParallaxRecyclerAdapter(com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter) NoHeaderActivity(de.madcyph3r.example.example.headerTypes.NoHeaderActivity) CustomHeaderActivity(de.madcyph3r.example.example.headerTypes.CustomHeaderActivity) ImageView(android.widget.ImageView) HeadItemOneActivity(de.madcyph3r.example.example.headerTypes.HeadItemOneActivity) NoHeaderBelowToolbarActivity(de.madcyph3r.example.example.headerTypes.NoHeaderBelowToolbarActivity) ImageHeaderBelowToolbarActivity(de.madcyph3r.example.example.headerTypes.ImageHeaderBelowToolbarActivity) ViewGroup(android.view.ViewGroup) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ImageHeaderActivity(de.madcyph3r.example.example.headerTypes.ImageHeaderActivity) HeadItemFiveActivity(de.madcyph3r.example.example.headerTypes.HeadItemFiveActivity) RecyclerView(android.support.v7.widget.RecyclerView)

Example 3 with ParallaxRecyclerAdapter

use of com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter in project AdvancedMaterialDrawer by madcyph3r.

the class ThemeFragment method createAdapter.

private void createAdapter(RecyclerView recyclerView) {
    final List<ExampleData> content = new ArrayList<>();
    content.add(new ExampleData("Dark Theme", DarkThemeActivity.class));
    content.add(new ExampleData("Light Theme", LightThemeActivity.class));
    content.add(new ExampleData("My Theme", MyThemeActivity.class));
    content.add(new ExampleData("Unique Toolbar Color", UniqueToolbarColorActivity.class));
    content.add(new ExampleData("Actionbar Overlay", ActionBarOverlayActivity.class));
    content.add(new ExampleData("KitKat Translucent Statusbar", KitKatTranslucentStatusBarActivity.class));
    content.add(new ExampleData("Actionbar Own Font", ActionBarOwnFontActivity.class));
    content.add(new ExampleData("Own Drawer Width", OwnDrawerWidthActivity.class));
    content.add(new ExampleData("Only Icons Menu", OnlyIconsActivity.class));
    final ParallaxRecyclerAdapter<ExampleData> adapter = new ParallaxRecyclerAdapter<>(content);
    View header = getActivity().getLayoutInflater().inflate(R.layout.recycleview_header, recyclerView, false);
    ImageView headerImage = (ImageView) header.findViewById(R.id.imageViewHeader);
    headerImage.setImageResource(R.drawable.l_8);
    adapter.setParallaxHeader(header, recyclerView);
    adapter.setData(content);
    adapter.implementRecyclerAdapterMethods(new ParallaxRecyclerAdapter.RecyclerAdapterMethods() {

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
            ((ViewHolder) viewHolder).textView.setText(adapter.getData().get(i).getTitle());
        }

        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, final int i) {
            final ViewHolder holder = new ViewHolder(getActivity().getLayoutInflater().inflate(R.layout.recycleview_row, viewGroup, false));
            return holder;
        }

        @Override
        public int getItemCount() {
            return content.size();
        }
    });
    adapter.setOnParallaxScroll(new ParallaxRecyclerAdapter.OnParallaxScroll() {

        @Override
        public void onParallaxScroll(float percentage, float offset, View view) {
            ((MainActivity) getActivity()).setActionBarAlpha(percentage);
        }
    });
    adapter.setOnClickEvent(new ParallaxRecyclerAdapter.OnClickEvent() {

        @Override
        public void onClick(View view, int i) {
            if (i >= 0) {
                Intent intent = new Intent(getActivity(), adapter.getData().get(i).getClazz());
                startActivity(intent);
            }
        }
    });
    recyclerView.setAdapter(adapter);
}
Also used : ExampleData(de.madcyph3r.example.data.ExampleData) KitKatTranslucentStatusBarActivity(de.madcyph3r.example.example.theme.KitKatTranslucentStatusBarActivity) ArrayList(java.util.ArrayList) ActionBarOwnFontActivity(de.madcyph3r.example.example.theme.ActionBarOwnFontActivity) ParallaxRecyclerAdapter(com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter) DarkThemeActivity(de.madcyph3r.example.example.theme.DarkThemeActivity) ImageView(android.widget.ImageView) ActionBarOverlayActivity(de.madcyph3r.example.example.theme.ActionBarOverlayActivity) ViewGroup(android.view.ViewGroup) OwnDrawerWidthActivity(de.madcyph3r.example.example.theme.OwnDrawerWidthActivity) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) MyThemeActivity(de.madcyph3r.example.example.theme.MyThemeActivity) OnlyIconsActivity(de.madcyph3r.example.example.theme.OnlyIconsActivity) UniqueToolbarColorActivity(de.madcyph3r.example.example.theme.UniqueToolbarColorActivity) RecyclerView(android.support.v7.widget.RecyclerView) LightThemeActivity(de.madcyph3r.example.example.theme.LightThemeActivity)

Example 4 with ParallaxRecyclerAdapter

use of com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter in project AdvancedMaterialDrawer by madcyph3r.

the class BackPatternFragment method createAdapter.

private void createAdapter(RecyclerView recyclerView) {
    final List<ExampleData> content = new ArrayList<>();
    content.add(new ExampleData("Custom Back Pattern", BackPatternCustomActivity.class));
    content.add(new ExampleData("Default Back Pattern", BackPatternDefaultActivity.class));
    content.add(new ExampleData("StartIndex Back Pattern", BackPatternStartIndexActivity.class));
    content.add(new ExampleData("Last Section Fragment Back Pattern", BackPatternLastSectionActivity.class));
    final ParallaxRecyclerAdapter<ExampleData> adapter = new ParallaxRecyclerAdapter<>(content);
    View header = getActivity().getLayoutInflater().inflate(R.layout.recycleview_header, recyclerView, false);
    ImageView headerImage = (ImageView) header.findViewById(R.id.imageViewHeader);
    headerImage.setImageResource(R.drawable.l_1);
    adapter.setParallaxHeader(header, recyclerView);
    adapter.setData(content);
    adapter.implementRecyclerAdapterMethods(new ParallaxRecyclerAdapter.RecyclerAdapterMethods() {

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
            ((ViewHolder) viewHolder).textView.setText(adapter.getData().get(i).getTitle());
        }

        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, final int i) {
            final ViewHolder holder = new ViewHolder(getActivity().getLayoutInflater().inflate(R.layout.recycleview_row, viewGroup, false));
            return holder;
        }

        @Override
        public int getItemCount() {
            return content.size();
        }
    });
    adapter.setOnParallaxScroll(new ParallaxRecyclerAdapter.OnParallaxScroll() {

        @Override
        public void onParallaxScroll(float percentage, float offset, View view) {
            ((MainActivity) getActivity()).setActionBarAlpha(percentage);
        }
    });
    adapter.setOnClickEvent(new ParallaxRecyclerAdapter.OnClickEvent() {

        @Override
        public void onClick(View view, int i) {
            if (i >= 0) {
                Intent intent = new Intent(getActivity(), adapter.getData().get(i).getClazz());
                startActivity(intent);
            }
        }
    });
    recyclerView.setAdapter(adapter);
}
Also used : ExampleData(de.madcyph3r.example.data.ExampleData) BackPatternLastSectionActivity(de.madcyph3r.example.example.backPattern.BackPatternLastSectionActivity) BackPatternCustomActivity(de.madcyph3r.example.example.backPattern.BackPatternCustomActivity) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) Intent(android.content.Intent) BackPatternDefaultActivity(de.madcyph3r.example.example.backPattern.BackPatternDefaultActivity) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) ParallaxRecyclerAdapter(com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter) RecyclerView(android.support.v7.widget.RecyclerView) ImageView(android.widget.ImageView) BackPatternStartIndexActivity(de.madcyph3r.example.example.backPattern.BackPatternStartIndexActivity)

Example 5 with ParallaxRecyclerAdapter

use of com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter in project AdvancedMaterialDrawer by madcyph3r.

the class ListenerFragment method createAdapter.

private void createAdapter(RecyclerView recyclerView) {
    final List<ExampleData> content = new ArrayList<>();
    content.add(new ExampleData("Head Item Style (One Item), Avatar OnClick Listener", HeadItemOneAvatarOnClickListenerActivity.class));
    content.add(new ExampleData("Head Item Style (One Item), Background OnClick Listener", HeadItemOneBackgroundOnClickListenerActivity.class));
    content.add(new ExampleData("Section Change Listener", SectionChangeListenerActivity.class));
    content.add(new ExampleData("Drawer Listener", DrawerListenerActivity.class));
    content.add(new ExampleData("HeadItem Change Listener", HeadItemThreeChangeListenerActivity.class));
    final ParallaxRecyclerAdapter<ExampleData> adapter = new ParallaxRecyclerAdapter<>(content);
    View header = getActivity().getLayoutInflater().inflate(R.layout.recycleview_header, recyclerView, false);
    ImageView headerImage = (ImageView) header.findViewById(R.id.imageViewHeader);
    headerImage.setImageResource(R.drawable.l_6);
    adapter.setParallaxHeader(header, recyclerView);
    adapter.setData(content);
    adapter.implementRecyclerAdapterMethods(new ParallaxRecyclerAdapter.RecyclerAdapterMethods() {

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
            ((ViewHolder) viewHolder).textView.setText(adapter.getData().get(i).getTitle());
        }

        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, final int i) {
            final ViewHolder holder = new ViewHolder(getActivity().getLayoutInflater().inflate(R.layout.recycleview_row, viewGroup, false));
            return holder;
        }

        @Override
        public int getItemCount() {
            return content.size();
        }
    });
    adapter.setOnParallaxScroll(new ParallaxRecyclerAdapter.OnParallaxScroll() {

        @Override
        public void onParallaxScroll(float percentage, float offset, View view) {
            ((MainActivity) getActivity()).setActionBarAlpha(percentage);
        }
    });
    adapter.setOnClickEvent(new ParallaxRecyclerAdapter.OnClickEvent() {

        @Override
        public void onClick(View view, int i) {
            if (i >= 0) {
                Intent intent = new Intent(getActivity(), adapter.getData().get(i).getClazz());
                startActivity(intent);
            }
        }
    });
    recyclerView.setAdapter(adapter);
}
Also used : ExampleData(de.madcyph3r.example.data.ExampleData) ViewGroup(android.view.ViewGroup) HeadItemOneAvatarOnClickListenerActivity(de.madcyph3r.example.example.listener.HeadItemOneAvatarOnClickListenerActivity) ArrayList(java.util.ArrayList) DrawerListenerActivity(de.madcyph3r.example.example.listener.DrawerListenerActivity) Intent(android.content.Intent) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) HeadItemThreeChangeListenerActivity(de.madcyph3r.example.example.listener.HeadItemThreeChangeListenerActivity) ParallaxRecyclerAdapter(com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter) SectionChangeListenerActivity(de.madcyph3r.example.example.listener.SectionChangeListenerActivity) RecyclerView(android.support.v7.widget.RecyclerView) ImageView(android.widget.ImageView) HeadItemOneBackgroundOnClickListenerActivity(de.madcyph3r.example.example.listener.HeadItemOneBackgroundOnClickListenerActivity)

Aggregations

Intent (android.content.Intent)8 RecyclerView (android.support.v7.widget.RecyclerView)8 View (android.view.View)8 ViewGroup (android.view.ViewGroup)8 ImageView (android.widget.ImageView)8 TextView (android.widget.TextView)8 ParallaxRecyclerAdapter (com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter)8 ExampleData (de.madcyph3r.example.data.ExampleData)8 ArrayList (java.util.ArrayList)8 HeadItemThreeActivity (de.madcyph3r.example.example.headerTypes.HeadItemThreeActivity)3 AddRemoveMenuItemsActivity (de.madcyph3r.example.example.menu.AddRemoveMenuItemsActivity)3 HeadItemTwoNoFragmentLoadOnChangeActivity (de.madcyph3r.example.example.headItemTypes.HeadItemTwoNoFragmentLoadOnChangeActivity)2 HeadItemTwoOnlyOneHasMenuActivity (de.madcyph3r.example.example.headItemTypes.HeadItemTwoOnlyOneHasMenuActivity)2 HeadItemFiveActivity (de.madcyph3r.example.example.headerTypes.HeadItemFiveActivity)2 HeadItemOneActivity (de.madcyph3r.example.example.headerTypes.HeadItemOneActivity)2 NoHeaderActivity (de.madcyph3r.example.example.headerTypes.NoHeaderActivity)2 NoHeaderBelowToolbarActivity (de.madcyph3r.example.example.headerTypes.NoHeaderBelowToolbarActivity)2 OnlyIconsActivity (de.madcyph3r.example.example.theme.OnlyIconsActivity)2 OwnDrawerWidthActivity (de.madcyph3r.example.example.theme.OwnDrawerWidthActivity)2 BackPatternCustomActivity (de.madcyph3r.example.example.backPattern.BackPatternCustomActivity)1