Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Create a new ActionBarDrawerToggle with arrow and hamburger menu
Browse files Browse the repository at this point in the history
Bug: 16514897
Bug: 17353988

Change-Id: Ia3c39b6accf3923bd297740b24e48dba35820b37
  • Loading branch information
yigit committed Sep 3, 2014
1 parent ce221d9 commit 058467c
Show file tree
Hide file tree
Showing 7 changed files with 668 additions and 0 deletions.
5 changes: 5 additions & 0 deletions v4/java/android/support/v4/app/ActionBarDrawerToggle.java
Expand Up @@ -36,6 +36,9 @@
import android.view.View;

/**
* @deprecated Please use ActionBarDrawerToggle in support-v7-appcompat.
*
* <p>
* This class provides a handy way to tie together the functionality of
* {@link DrawerLayout} and the framework <code>ActionBar</code> to implement the recommended
* design for navigation drawers.
Expand All @@ -56,7 +59,9 @@
* <p><code>ActionBarDrawerToggle</code> can be used directly as a
* {@link DrawerLayout.DrawerListener}, or if you are already providing your own listener,
* call through to each of the listener methods from your own.</p>
*
*/
@Deprecated
public class ActionBarDrawerToggle implements DrawerLayout.DrawerListener {

/**
Expand Down
21 changes: 21 additions & 0 deletions v7/appcompat/res/values/attrs.xml
Expand Up @@ -744,4 +744,25 @@
<attr name="android:dropDownHorizontalOffset" />
</declare-styleable>

<declare-styleable name="DrawerArrowToggle">
<!-- The drawing color for the bars -->
<attr name="color" format="color"/>
<!-- Whether bars should rotate or not during transition -->
<attr name="spinBars" format="boolean"/>
<!-- The total size of the drawable -->
<attr name="drawableSize" format="dimension"/>
<!-- The max gap between the bars when they are parallel to each other -->
<attr name="gapBetweenBars" format="dimension"/>
<!-- The size of the top and bottom bars when they merge to the middle bar to form an arrow -->
<attr name="topBottomBarArrowSize" format="dimension"/>
<!-- The size of the middle bar when top and bottom bars merge into middle bar to form an arrow -->
<attr name="middleBarArrowSize" format="dimension"/>
<!-- The size of the bars when they are parallel to each other -->
<attr name="barSize" format="dimension"/>
<!-- The thickness (stroke size) for the bar paint -->
<attr name="thickness" format="dimension"/>
</declare-styleable>

<attr name="drawerArrowStyle" format="reference" />

</resources>
5 changes: 5 additions & 0 deletions v7/appcompat/res/values/styles.xml
Expand Up @@ -99,6 +99,11 @@
parent="Base.Widget.AppCompat.ActionBar.TabText">
</style>

<style name="Widget.AppCompat.DrawerArrowToggle"
parent="Base.Widget.AppCompat.DrawerArrowToggle">
<item name="color">?attr/colorControlNormal</item>
</style>

<style name="Widget.AppCompat.Light.ActionBar.TabText"
parent="Base.Widget.AppCompat.Light.ActionBar.TabText">
</style>
Expand Down
11 changes: 11 additions & 0 deletions v7/appcompat/res/values/styles_base.xml
Expand Up @@ -386,4 +386,15 @@
<item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
</style>

<style name="Base.Widget.AppCompat.DrawerArrowToggle" parent="">
<item name="color">?android:attr/textColorPrimary</item>
<item name="thickness">2dp</item>
<item name="barSize">18dp</item>
<item name="gapBetweenBars">3dp</item>
<item name="topBottomBarArrowSize">11.31dp</item>
<item name="middleBarArrowSize">16dp</item>
<item name="drawableSize">24dp</item>
<item name="spinBars">true</item>
</style>

</resources>
2 changes: 2 additions & 0 deletions v7/appcompat/res/values/themes.xml
Expand Up @@ -28,11 +28,13 @@
<!-- Platform-independent theme providing an action bar in a dark-themed activity. -->
<style name="Theme.AppCompat"
parent="Base.Theme.AppCompat">
<item name="drawerArrowStyle">@style/Widget.AppCompat.DrawerArrowToggle</item>
</style>

<!-- Platform-independent theme providing an action bar in a light-themed activity. -->
<style name="Theme.AppCompat.Light"
parent="Base.Theme.AppCompat.Light">
<item name="drawerArrowStyle">@style/Widget.AppCompat.DrawerArrowToggle</item>
</style>

<!-- Platform-independent theme providing an action bar in a dark-themed activity. -->
Expand Down

1 comment on commit 058467c

@zackygaurav
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome... Works Perfectly...

Please sign in to comment.