Added icons to navigation drawer. #47

Settings now inline with rest of menu

@Bind is onelined

Added icons to navigation drawer. Moved settings to the bottom of nav drawer.

Settings now inline with rest of menu

@Bind is onelined

Added icons to navigation drawer. #47
pull/77/head
NoodleMage 9 years ago
parent 0c9bc97fe8
commit ef03ca22d1

@ -129,6 +129,8 @@ dependencies {
compile('com.mikepenz:materialdrawer:4.6.4@aar') { compile('com.mikepenz:materialdrawer:4.6.4@aar') {
transitive = true transitive = true
} }
compile 'com.mikepenz:google-material-typeface:2.1.0.1.original@aar'
compile('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') { compile('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') {
transitive = true transitive = true
} }

@ -8,8 +8,10 @@ import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.materialdrawer.Drawer; import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder; import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import butterknife.Bind; import butterknife.Bind;
@ -29,12 +31,11 @@ public class MainActivity extends BaseActivity {
@Bind(R.id.appbar) AppBarLayout appBar; @Bind(R.id.appbar) AppBarLayout appBar;
@Bind(R.id.toolbar) Toolbar toolbar; @Bind(R.id.toolbar) Toolbar toolbar;
@Bind(R.id.drawer_container) FrameLayout container; @Bind(R.id.drawer_container) FrameLayout container;
@State
int selectedItem;
private Drawer drawer; private Drawer drawer;
private FragmentStack fragmentStack; private FragmentStack fragmentStack;
@State int selectedItem;
@Override @Override
protected void onCreate(Bundle savedState) { protected void onCreate(Bundle savedState) {
super.onCreate(savedState); super.onCreate(savedState);
@ -53,7 +54,7 @@ public class MainActivity extends BaseActivity {
fragmentStack = new FragmentStack(this, getSupportFragmentManager(), R.id.content_layout, fragmentStack = new FragmentStack(this, getSupportFragmentManager(), R.id.content_layout,
fragment -> { fragment -> {
if (fragment instanceof ViewWithPresenter) if (fragment instanceof ViewWithPresenter)
((ViewWithPresenter)fragment).getPresenter().destroy(); ((ViewWithPresenter) fragment).getPresenter().destroy();
}); });
drawer = new DrawerBuilder() drawer = new DrawerBuilder()
@ -71,20 +72,27 @@ public class MainActivity extends BaseActivity {
.addDrawerItems( .addDrawerItems(
new PrimaryDrawerItem() new PrimaryDrawerItem()
.withName(R.string.label_library) .withName(R.string.label_library)
.withIdentifier(R.id.nav_drawer_library), .withIdentifier(R.id.nav_drawer_library)
.withIcon(GoogleMaterial.Icon.gmd_book),
new PrimaryDrawerItem() new PrimaryDrawerItem()
.withName(R.string.label_recent_updates) .withName(R.string.label_recent_updates)
.withIdentifier(R.id.nav_drawer_recent_updates), .withIdentifier(R.id.nav_drawer_recent_updates)
.withIcon(GoogleMaterial.Icon.gmd_update),
new PrimaryDrawerItem() new PrimaryDrawerItem()
.withName(R.string.label_catalogues) .withName(R.string.label_catalogues)
.withIdentifier(R.id.nav_drawer_catalogues), .withIdentifier(R.id.nav_drawer_catalogues)
.withIcon(GoogleMaterial.Icon.gmd_explore),
new PrimaryDrawerItem() new PrimaryDrawerItem()
.withName(R.string.label_download_queue) .withName(R.string.label_download_queue)
.withIdentifier(R.id.nav_drawer_downloads), .withIdentifier(R.id.nav_drawer_downloads)
.withIcon(GoogleMaterial.Icon.gmd_file_download),
new DividerDrawerItem(),
new PrimaryDrawerItem() new PrimaryDrawerItem()
.withName(R.string.label_settings) .withName(R.string.label_settings)
.withIdentifier(R.id.nav_drawer_settings) .withIdentifier(R.id.nav_drawer_settings)
.withSelectable(false) .withSelectable(false)
.withIcon(GoogleMaterial.Icon.gmd_settings)
) )
.withSavedInstance(savedState) .withSavedInstance(savedState)
.withOnDrawerItemClickListener( .withOnDrawerItemClickListener(

Loading…
Cancel
Save