ActionBarDrawerToggleHoneycombpublic class ActionBarDrawerToggleHoneycomb extends Object This class encapsulates some awful hacks.
Before JB-MR2 (API 18) it was not possible to change the home-as-up indicator glyph
in an action bar without some really gross hacks. Since the MR2 SDK is not published as of
this writing, the new API is accessed via reflection here if available.
Moved from Support-v4 |
Fields Summary |
---|
private static final String | TAG | private static final int[] | THEME_ATTRS |
Methods Summary |
---|
public static android.graphics.drawable.Drawable | getThemeUpIndicator(android.app.Activity activity)
final TypedArray a = activity.obtainStyledAttributes(THEME_ATTRS);
final Drawable result = a.getDrawable(0);
a.recycle();
return result;
| public static android.support.v7.app.ActionBarDrawerToggleHoneycomb$SetIndicatorInfo | setActionBarDescription(android.support.v7.app.ActionBarDrawerToggleHoneycomb$SetIndicatorInfo info, android.app.Activity activity, int contentDescRes)
if (info == null) {
info = new SetIndicatorInfo(activity);
}
if (info.setHomeAsUpIndicator != null) {
try {
final ActionBar actionBar = activity.getActionBar();
info.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
if (Build.VERSION.SDK_INT <= 19) {
// For API 19 and earlier, we need to manually force the
// action bar to generate a new content description.
actionBar.setSubtitle(actionBar.getSubtitle());
}
} catch (Exception e) {
Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
}
}
return info;
| public static android.support.v7.app.ActionBarDrawerToggleHoneycomb$SetIndicatorInfo | setActionBarUpIndicator(android.support.v7.app.ActionBarDrawerToggleHoneycomb$SetIndicatorInfo info, android.app.Activity activity, android.graphics.drawable.Drawable drawable, int contentDescRes)
if (true || info == null) {
info = new SetIndicatorInfo(activity);
}
if (info.setHomeAsUpIndicator != null) {
try {
final ActionBar actionBar = activity.getActionBar();
info.setHomeAsUpIndicator.invoke(actionBar, drawable);
info.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
} catch (Exception e) {
Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);
}
} else if (info.upIndicatorView != null) {
info.upIndicatorView.setImageDrawable(drawable);
} else {
Log.w(TAG, "Couldn't set home-as-up indicator");
}
return info;
|
|