use of de.madcyph3r.example.data.ExampleData 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);
}
use of de.madcyph3r.example.data.ExampleData 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);
}
use of de.madcyph3r.example.data.ExampleData 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);
}
use of de.madcyph3r.example.data.ExampleData 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);
}
use of de.madcyph3r.example.data.ExampleData 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);
}
Aggregations