Skip to content

Repository files navigation

Material Design Library

Description

This library helps developers creating their Android Application with Material Design.
It offers a lot of Material Design classes easy to use like a CardView or a NavigationDrawerActivity that creates an Activity with a Material Design NavigationDrawer.

What's new

  • SearchBar in the ActionBar (can be used with any Activity)
  • SearchBar Auto Completion
  • NavigationDrawer Small Accounts Layout (to show only the current account)

Demo

Material Design Library on Google Play Store

NavigationDrawer with AccountsNavigationDrawer with Small Accounts LayoutCardView with Image on the TopSearchBar with Auto CompletionListView with Pull To RefreshViewPager with Tabs

Wiki

Read wiki here: Material Design Library Wiki

Usage

1. Add the dependency in your build.gradle.

dependencies {
compile 'com.blunderer:materialdesignlibrary:2.0.4'
}

2. In your values/styles.xml file, change the parent style and add your own colorPrimary/colorPrimaryDark colors:

<stylename="AppTheme"parent="@style/MaterialDesignLibraryTheme">
<itemname="colorPrimary">#3f51b5</item>
<itemname="colorPrimaryDark">#303f9f</item>
</style>

Or if you want the Light Theme:

<stylename="AppTheme"parent="@style/MaterialDesignLibraryTheme.Light">
<itemname="colorPrimary">#3f51b5</item>
<itemname="colorPrimaryDark">#303f9f</item>
</style>

3. Then you can:
-Extend your activity by one of mine (each activity will be in Material Design):

  • Activity
    Your Activity will be a basic Activity with Material Design.

  • ListViewActivity
    Your Activity will contain a ListView (with or not the Pull To Refresh).

  • ScrollViewActivity
    Your Activity will contain a ScrollView (with or not the Pull To Refresh).

  • NavigationDrawerActivity
    Your Activity will contain a NavigationDrawer (with or not Accounts).

  • ViewPagerActivity
    Your Activity will contain a ViewPager (with or not the indicator).

  • ViewPagerWithTabsActivity
    Your Activity will contain a ViewPager with tabs (expanded or not).

Example:
importcom.blunderer.materialdesignlibrary.activities.NavigationDrawerActivity;
publicclassMyActivityextendsNavigationDrawerActivity {
@OverridepublicNavigationDrawerStyleHandlergetNavigationDrawerStyleHandler() {
returnnewNavigationDrawerStyleHandler();
}
@OverridepublicNavigationDrawerAccountsHandlergetNavigationDrawerAccountsHandler() {
returnnewNavigationDrawerAccountsHandler()
.addAccount("Profile 1", "profile1@gmail.com",
R.drawable.profile1, R.drawable.profile1_background)
.addAccount("Profile 2", "profile2@gmail.com",
R.drawable.profile2, R.drawable.profile2_background);
}
@OverridepublicNavigationDrawerAccountsMenuHandlergetNavigationDrawerAccountsMenuHandler() {
returnnewNavigationDrawerAccountsMenuHandler(this)
.addAddAccount(newIntent(getApplicationContext(), AddAccountActivity.class))
.addManageAccounts(newIntent(getApplicationContext(), ManageAccountsActivity.class));
}
@OverridepublicvoidonNavigationDrawerAccountChange(Accountaccount) {
Toast.makeText(getApplicationContext(), "Account changed!", Toast.LENGTH_SHORT).show();
}
@OverridepublicNavigationDrawerTopHandlergetNavigationDrawerTopHandler() {
returnnewNavigationDrawerTopHandler()
.addItem(R.string.title_item1, newMainFragment())
.addItem(R.string.title_item2, newMainFragment())
.addSection(R.string.title_section2)
.addItem(R.string.title_item3, newMainFragment())
.addItem(R.string.title_item4, newIntent(this, MyActivity.class));
}
@OverridepublicNavigationDrawerBottomHandlergetNavigationDrawerBottomHandler() {
returnnewNavigationDrawerBottomHandler()
.addSettings(newView.OnClickListener() {
@OverridepublicvoidonClick(Viewview) {
Intentintent = newIntent(getApplicationContext(), SettingsActivity.class);
startActivity(intent);
}
})
.addHelpAndFeedback(newView.OnClickListener() {
@OverridepublicvoidonClick(Viewview) {
Intentintent = newIntent(getApplicationContext(), HelpAndFeedbackActivity.class);
startActivity(intent);
}
});
}
@OverridepublicbooleanoverlayActionBar() {
returntrue;
}
@OverridepublicbooleanreplaceActionBarTitleByNavigationDrawerItemTitle() {
returntrue;
}
@OverridepublicintdefaultNavigationDrawerItemSelectedPosition() {
return0;
}
@OverrideprotectedbooleanenableActionBarShadow() {
returntrue;
}
@OverrideprotectedActionBarHandlergetActionBarHandler() {
returnnewActionBarDefaultHandler(this);
}
}

- Or use my CardView:

  • Normal CardView
    Your CardView will be a basic CardView.

  • Left Image CardView
    Your CardView will contain an image on the left.

  • Top Image CardView
    Your CardView will contain an image on the top.

Example:
<com.blunderer.materialdesignlibrary.views.CardView
android:layout_width="match_parent"android:layout_height="wrap_content"app:mdl_title="CardView"app:mdl_description="A Left Image CardView"app:mdl_normalButton="Normal"app:mdl_highlightButton="Highlight"app:mdl_imagePosition="left"app:mdl_image="@drawable/image" />

Developed by

About

A library that helps developers creating their Android Application with Material Design.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages