• Stars
    star
    597
  • Rank 74,716 (Top 2 %)
  • Language
    Java
  • License
    MIT License
  • Created almost 10 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Custom drawer implementation for Material design apps.

Icon

material-drawer

Android Arsenal JitPack Build Status License

Custom drawer implementation for Material design apps.

Demo

A demo app is available on Google Play:

Get it on Google Play

Screenshots

material-drawer material-drawer material-drawer
Fixed items Select profile Custom theme

Dependency

material-drawer is available on jitpack.io

Gradle dependency:

repositories {
    // ...
    maven { url 'https://jitpack.io' }
}
dependencies {
    compile 'com.heinrichreimersoftware:material-drawer:2.3.3'
}

Get the latest dependency at jitpack.io.

How-To-Use

Step 1: Let your Activity extend DrawerActivity:

public class MainActivity extends DrawerActivity {}

Step 2: Set your content:

setContentView(R.layout.activity_main);

Step 3: Add a profile:

addProfile(
        new DrawerProfile()
                .setRoundedAvatar((BitmapDrawable)getResources().getDrawable(R.drawable.profile_avatar))
                .setBackground(getResources().getDrawable(R.drawable.profile_cover))
                .setName(getString(R.string.profile_name))
                .setDescription(getString(R.string.profile_description))
                .setOnProfileClickListener(new DrawerProfile.OnProfileClickListener() {
                    @Override
                    public void onClick(DrawerProfile drawerProfile, long id) {
                        Toast.makeText(MainActivity.this, "Clicked profile #" + id, Toast.LENGTH_SHORT).show();
                    }
                })
        );

Step 4: Populate your drawer list:

addItem(
        new DrawerItem()
                .setImage(getResources().getDrawable(R.drawable.ic_first_item))
                .setTextPrimary(getString(R.string.title_first_item))
                .setTextSecondary(getString(R.string.description_first_item))
                .setOnItemClickListener(new DrawerItem.OnItemClickListener() {
                    @Override
                    public void onClick(DrawerItem drawerItem, long id, int position) {
                        Toast.makeText(MainActivity.this, "Clicked first item #" + id, Toast.LENGTH_SHORT).show();
                    }
                })
 ย  ย  ย  ย );
addDivider();
addItem(
        new DrawerItem()
                .setImage(getResources().getDrawable(R.drawable.ic_second_item))
                .setTextPrimary(getString(R.string.title_second_item))
                .setOnItemClickListener(new DrawerItem.OnItemClickListener() {
                    @Override
                    public void onClick(DrawerItem drawerItem, long id, int position) {
                        Toast.makeText(MainActivity.this, "Clicked second item #" + id, Toast.LENGTH_SHORT).show();
                    }
                })
        );

Step 5: Add actionBarStyle to your theme:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/color_primary</item>
    <item name="colorPrimaryDark">@color/color_primary_dark</item>
    <item name="colorAccent">@color/color_accent</item>
    <item name="actionBarStyle">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>

Step 6 (Optional): Change the drawer theme:

The drawer gets themed based on your selected app theme but you can also modify it.

setDrawerTheme(
        new DrawerTheme(this)
                .setBackgroundColorRes(R.color.background)
                .setTextColorPrimaryRes(R.color.primary_text)
                .setTextColorSecondaryRes(R.color.secondary_text)
                .setTextColorPrimaryInverseRes(R.color.primary_text_inverse)
                .setTextColorSecondaryInverseRes(R.color.secondary_text_inverse)
                .setHighlightColorRes(R.color.highlight)
);

Step 7 (Optional): Set your own Toolbar:

You can set your own Toolbar as you do with ActionBarActivity.

setSupportActionBar(toolbar);

Pro Tip: Lollipop status bar

Step 1: Make your status bar transparent:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

That's it! material-drawer takes care of the rest.

Info: DrawerFrameLayout & DrawerView

Of course you can use DrawerFrameLayout and DrawerView alone too. See the comments in the Java files for further information.

Open source libraries

material-drawer uses the following open source libraries or files:

License

Copyright 2015 Heinrich Reimer

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

material-intro

A simple material design app intro with cool animations and a fluent API.
Java
1,737
star
2

material-singleinputform

A single EditText instead of a classical form. Library that implements flavienlaurent's singleinputform
Java
194
star
3

android-issue-reporter

A powerful and simple library to open issues on GitHub directly from your app.
Java
119
star
4

open-source-library-request-manager

A place to share ideas for open source library with other developers.
32
star
5

progressbar-ktx

โณ Kotlin extensions for the progressbar JVM library.
Kotlin
28
star
6

android-canteen-balance

Helper library to read out the current balance of canteen cards using NFC.
Java
12
star
7

latex-postage

๐Ÿ“„ Franking letters with ยปDeutsche Postยซ's online postage service ยปInternetmarkeยซ.
TeX
8
star
8

website

๐ŸŒ Personal portfolio website.
SCSS
6
star
9

wayback-api

๐Ÿ•ฐ๏ธ Java wrapper for the Internet Archive's Wayback API.
Kotlin
6
star
10

zotero-git-sync

๐Ÿ“š Simple CLI to sync a collection's Zotero publications to a Git repository.
Python
5
star
11

modern-talking

๐Ÿ—ฃ๏ธ Key-Point Analysis using Pretrained Encoders
Jupyter Notebook
5
star
12

android-wg-planer

Vertretungsplan und Stundenplan des Wilhelm-Gymnasiums
Java
4
star
13

android-shape-touch-listener

Touch listener which only reacts in a given shape.
Java
3
star
14

song-analysis

Analysing the Million Song Dataset.
Kotlin
2
star
15

thuringian-field-names

๐Ÿž๏ธ Explorer for the Thuringian Field Name Archive.
TypeScript
2
star
16

website-orgelverein

๐ŸŒ Orgelverein am Braunschweiger Dom e.V. website.
SCSS
2
star
17

grimjack

๐Ÿคบ Argument retrieval using axiomatic re-ranking and query reformulation.
TeX
2
star
18

website-wedding

๐Ÿ’๏ธ Wedding website for Lena & Heini.
HTML
2
star
19

ghost-theme-material

๐Ÿ‘ป Ghost theme implementing Material design guidelines.
HTML
2
star
20

latex-els-cas-templates

๐Ÿ“„ Copy of Elsevier updated LATEX templates.
TeX
2
star
21

web-archive-api

๐Ÿ—ƒ๏ธ Unified access to web archive CDX and Memento APIs.
Python
2
star
22

Search.jl

Ad hoc information retrieval toolkit for Julia.
Julia
1
star
23

alexa-top-1m

๐ŸŒ Easy access to Alexa top 1M websites.
Kotlin
1
star
24

study-computer-science

๐Ÿ“ฝ๏ธ Video player for the "Informatik studieren" advertisement movie.
TypeScript
1
star
25

text-summarization-reproducability

๐Ÿ“ Reproducability study on "Text Summarization with Pretrained Encoders".
HTML
1
star
26

warc-s3

๐Ÿ’พ Scalable and easy WARC records storage on S3.
Python
1
star
27

elasticsearch-ktx

๐Ÿ”Ž Kotlin Extensions for the Elasticsearch Java High Level REST Client.
Kotlin
1
star
28

france-accidents

๐Ÿšจ Visualizing accidents in France from 2005 to 2020.
Elm
1
star
29

android-meine-mensa

Deine Mensen des Studentenwerks Halle.
Java
1
star
30

jsonl-serialization

๐Ÿ—œ๏ธ Kotlin serialization for the JSON Lines format.
Kotlin
1
star
31

domain-ktx

๐ŸŒ Kotlin extensions for domains.
Kotlin
1
star
32

hadoop-ktx

๐Ÿ’พ Kotlin Extensions for Apache Hadoop (MapReduce).
Kotlin
1
star
33

todoist-git-sync

โœ… Simple CLI to sync a project's Todoist tasks to a Git repository.
Python
1
star
34

wayback-gradle-plugin

๐Ÿ•ฐ๏ธ Gradle plugin for the Internet Archive's Wayback API.
Kotlin
1
star
35

reimersoftware-portfolio

๐ŸŒ Reimer Software's portfolio website.
SCSS
1
star
36

spark-ktx

๐Ÿ’พ Kotlin extensions for Apache Spark.
Kotlin
1
star
37

website-lenamerker

๐ŸŒ Lena Merker's personal website.
HTML
1
star
38

website-kreativwerkstatt

๐ŸŒ Kreativ Werkstatt Reimer's portfolio website.
SCSS
1
star
39

ghost-theme-johannesfoto

๐Ÿ‘ป The Johannes Foto blog Ghost theme.
Handlebars
1
star
40

spark-gradle-plugin

๐Ÿ’พ Gradle plugin for launching Spark applications.
Kotlin
1
star
41

java-ktx

๐Ÿงฐ Kotlin extensions for the JVM.
Kotlin
1
star
42

android-elliptic-curve-chiffre

App to test implementation of elliptic curve chiffre Diffie-Hellman key exchange.
Java
1
star
43

bibtexer

๐Ÿ“š An opinionated BibTeX file cleaner for computer science.
Python
1
star
44

url-canonicalization

๐Ÿ”— Canonicalize URLs based on HTML canonical link relations.
Kotlin
1
star