use of it.neokree.materialnavigationdrawer.elements.Element in project MaterialNavigationDrawer by neokree.
the class MaterialNavigationDrawer method addDivisor.
public void addDivisor() {
View view = new View(this);
view.setBackgroundColor(Color.parseColor("#8f8f8f"));
// height 1 px
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1);
params.setMargins(0, (int) (8 * density), 0, (int) (8 * density));
sections.addView(view, params);
// add the element to the list
elementsList.add(new Element(Element.TYPE_DIVISOR, view));
}
use of it.neokree.materialnavigationdrawer.elements.Element in project MaterialNavigationDrawer by neokree.
the class MaterialNavigationDrawer method addSection.
public void addSection(MaterialSection section) {
// section.setPosition(sectionList.size());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (48 * density));
section.setTypeface(fontManager.getRobotoMedium());
sectionList.add(section);
ViewParent parent = section.getView().getParent();
sections.addView(section.getView(), params);
// add the element to the list
elementsList.add(new Element(Element.TYPE_SECTION, section));
}
use of it.neokree.materialnavigationdrawer.elements.Element in project MaterialNavigationDrawer by neokree.
the class MaterialNavigationDrawer method onSaveInstanceState.
@Override
protected void onSaveInstanceState(Bundle outState) {
int position = 0;
int type = 0;
Element e = findElementBySection(currentSection);
switch(e.getType()) {
default:
case Element.TYPE_SECTION:
position = sectionList.indexOf(currentSection);
break;
case Element.TYPE_BOTTOM_SECTION:
position = bottomSectionList.indexOf(currentSection);
break;
}
type = e.getType();
outState.putInt(STATE_LIST, type);
outState.putInt(STATE_SECTION, position);
ArrayList<Integer> list = new ArrayList<>();
for (MaterialAccount account : accountManager) list.add(account.getAccountNumber());
outState.putIntegerArrayList(STATE_ACCOUNT, list);
super.onSaveInstanceState(outState);
}
use of it.neokree.materialnavigationdrawer.elements.Element in project MaterialNavigationDrawer by neokree.
the class MaterialNavigationDrawer method addSubheader.
public void addSubheader(CharSequence title) {
MaterialSubheader subheader = new MaterialSubheader(this);
subheader.setTitle(title);
subheader.setTitleFont(fontManager.getRobotoRegular());
subheaderList.add(subheader);
sections.addView(subheader.getView());
// add the element to the list
elementsList.add(new Element(Element.TYPE_SUBHEADER, subheader));
}
use of it.neokree.materialnavigationdrawer.elements.Element in project MaterialNavigationDrawer by neokree.
the class MaterialNavigationDrawer method addBottomSection.
public void addBottomSection(MaterialSection section) {
// section.setPosition(BOTTOM_SECTION_START + bottomSectionList.size());
section.setTypeface(fontManager.getRobotoRegular());
bottomSectionList.add(section);
// add the element to the list
elementsList.add(new Element(Element.TYPE_BOTTOM_SECTION, section));
}
Aggregations