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

Commit

Permalink
Add ability to disable drawer indicator in new ArrowDrawer
Browse files Browse the repository at this point in the history
Bug: 17380258
Bug: 17378817
Change-Id: Ia38048abbf0c699c3ea2cda5212296477949164c
  • Loading branch information
yigit committed Sep 5, 2014
1 parent cfa220b commit 239e759
Show file tree
Hide file tree
Showing 5 changed files with 430 additions and 43 deletions.
2 changes: 1 addition & 1 deletion v7/appcompat/res/values/styles_base.xml
Expand Up @@ -387,7 +387,7 @@
</style>

<style name="Base.Widget.AppCompat.DrawerArrowToggle" parent="">
<item name="color">?android:attr/textColorPrimary</item>
<item name="color">?android:attr/textColorSecondary</item>
<item name="thickness">2dp</item>
<item name="barSize">18dp</item>
<item name="gapBetweenBars">3dp</item>
Expand Down
12 changes: 11 additions & 1 deletion v7/appcompat/src/android/support/v7/app/ActionBarActivity.java
Expand Up @@ -54,7 +54,8 @@
* </div>
*/
public class ActionBarActivity extends FragmentActivity implements ActionBar.Callback,
TaskStackBuilder.SupportParentable, ActionBarDrawerToggle.DelegateProvider {
TaskStackBuilder.SupportParentable, ActionBarDrawerToggle.DelegateProvider,
android.support.v7.app.ActionBarDrawerToggle.TmpDelegateProvider {

private ActionBarActivityDelegate mDelegate;

Expand Down Expand Up @@ -482,6 +483,15 @@ public final ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() {
return getDelegate().getDrawerToggleDelegate();
}

@Nullable
@Override
/**
* Temporary method until ActionBarDrawerToggle transition from v4 to v7 is complete.
*/
public android.support.v7.app.ActionBarDrawerToggle.Delegate getV7DrawerToggleDelegate() {
return getDelegate().getV7DrawerToggleDelegate();
}

/**
* Use {@link #onSupportContentChanged()} instead.
*/
Expand Down
Expand Up @@ -191,6 +191,10 @@ final ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() {
return new ActionBarDrawableToggleImpl();
}

final android.support.v7.app.ActionBarDrawerToggle.Delegate getV7DrawerToggleDelegate() {
return new ActionBarDrawableToggleImpl();
}

abstract int getHomeAsUpIndicatorAttrId();

abstract void onContentChanged();
Expand Down Expand Up @@ -224,16 +228,23 @@ protected final Context getActionBarThemedContext() {
return context;
}

private class ActionBarDrawableToggleImpl implements ActionBarDrawerToggle.Delegate {
private class ActionBarDrawableToggleImpl implements
android.support.v7.app.ActionBarDrawerToggle.Delegate,
ActionBarDrawerToggle.Delegate {
@Override
public Drawable getThemeUpIndicator() {
final TypedArray a = getActionBarThemedContext()
final TypedArray a = ActionBarActivityDelegate.this.getActionBarThemedContext()
.obtainStyledAttributes(new int[]{ getHomeAsUpIndicatorAttrId() });
final Drawable result = a.getDrawable(0);
a.recycle();
return result;
}

@Override
public Context getActionBarThemedContext() {
return ActionBarActivityDelegate.this.getActionBarThemedContext();
}

@Override
public void setActionBarUpIndicator(Drawable upDrawable, int contentDescRes) {
ActionBar ab = getSupportActionBar();
Expand Down

0 comments on commit 239e759

Please sign in to comment.