Show the drawer hamburger icon

This commit is contained in:
Bradlee Speice 2014-12-28 21:54:31 -05:00
parent 42bbbd00f7
commit d21cf4777f
3 changed files with 27 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -87,6 +88,14 @@ public class DownloadActivity extends BaseActivity implements
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
// Set up the hamburger menu
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout,
toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawerLayout.setDrawerListener(toggle);
toggle.syncState();
navigationContent.setAdapter( navigationContent.setAdapter(
new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
validCategories)); validCategories));

View File

@ -3,6 +3,7 @@ package org.bspeice.minimalbible.activity.viewer;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -89,7 +90,17 @@ public class BibleViewer extends BaseActivity implements Injector {
ButterKnife.inject(this); ButterKnife.inject(this);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
// Set up the hamburger menu
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout,
toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawerLayout.setDrawerListener(toggle);
toggle.syncState();
setInsetToolbar(toolbar); setInsetToolbar(toolbar);
bibleMenu.setBible(mainBook); bibleMenu.setBible(mainBook);
bibleContent.setBook(mainBook, prefs); bibleContent.setBook(mainBook, prefs);
} }

View File

@ -8,6 +8,8 @@
<item name="android:textColorSecondary">@color/textColorPrimary</item> <item name="android:textColorSecondary">@color/textColorPrimary</item>
<!-- Overflow menu text item color --> <!-- Overflow menu text item color -->
<item name="android:textColor">@color/textColor</item> <item name="android:textColor">@color/textColor</item>
<!-- Hamburger bar animation -->
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style> </style>
<!-- Almost re-use style from Widget.Holo.Button.Borderless --> <!-- Almost re-use style from Widget.Holo.Button.Borderless -->
@ -21,6 +23,11 @@
--> -->
</style> </style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@color/textColorPrimary</item>
</style>
<style name="MinimalBibleBase.NavigationDrawer" parent="MinimalBibleBase"> <style name="MinimalBibleBase.NavigationDrawer" parent="MinimalBibleBase">
<item name="android:background">@color/navigationBackground</item> <item name="android:background">@color/navigationBackground</item>
</style> </style>