Search in sources :

Example 1 with Element

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));
}
Also used : Element(it.neokree.materialnavigationdrawer.elements.Element) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 2 with Element

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));
}
Also used : ViewParent(android.view.ViewParent) Element(it.neokree.materialnavigationdrawer.elements.Element) LinearLayout(android.widget.LinearLayout)

Example 3 with Element

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);
}
Also used : Element(it.neokree.materialnavigationdrawer.elements.Element) ArrayList(java.util.ArrayList) MaterialAccount(it.neokree.materialnavigationdrawer.elements.MaterialAccount) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 4 with Element

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));
}
Also used : MaterialSubheader(it.neokree.materialnavigationdrawer.elements.MaterialSubheader) Element(it.neokree.materialnavigationdrawer.elements.Element)

Example 5 with Element

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));
}
Also used : Element(it.neokree.materialnavigationdrawer.elements.Element)

Aggregations

Element (it.neokree.materialnavigationdrawer.elements.Element)5 LinearLayout (android.widget.LinearLayout)2 SuppressLint (android.annotation.SuppressLint)1 Point (android.graphics.Point)1 View (android.view.View)1 ViewParent (android.view.ViewParent)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 MaterialAccount (it.neokree.materialnavigationdrawer.elements.MaterialAccount)1 MaterialSubheader (it.neokree.materialnavigationdrawer.elements.MaterialSubheader)1 ArrayList (java.util.ArrayList)1