summaryrefslogtreecommitdiff
path: root/core/java/android/app/Activity.java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-07-28 11:25:01 -0700
committerAdam Powell <adamp@google.com>2011-07-28 11:44:41 -0700
commit88ab69780f58e4b32d497266b2ad646a4d74827b (patch)
treed36e0e71b965baf33f4f515310d4fbe24c5294a4 /core/java/android/app/Activity.java
parentb03c4af05ea367d7d9f792403ac7235be562aa5e (diff)
Fix bug 5087752 - Maintain correct contrast against action bars in
inverse-bar themes Add the actionBarWidgetTheme theme attribute. This lets a theme specify a wrapper theme that can be used to create views that will end up in the action bar so that the rest of the code can ignore differences in contrast. (e.g. the inverse action bar themes.) Apps can use ActionBar#getThemedContext() to obtain a Context with a proper theme for views that will end up in the action bar. MenuInflaters generated by Activities will automatically use this to properly theme inflated action views. Change-Id: Ib28c82bf47c25d446cca2a63f617b8a4a0afa6b2
Diffstat (limited to 'core/java/android/app/Activity.java')
-rw-r--r--core/java/android/app/Activity.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 8d03ac70f802..c6c4025db89b 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -32,6 +32,7 @@ import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.content.res.Resources.Theme;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -54,6 +55,7 @@ import android.util.AttributeSet;
import android.util.EventLog;
import android.util.Log;
import android.util.SparseArray;
+import android.util.TypedValue;
import android.view.ActionMode;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -672,6 +674,7 @@ public class Activity extends ContextThemeWrapper
/*package*/ int mConfigChangeFlags;
/*package*/ Configuration mCurrentConfig;
private SearchManager mSearchManager;
+ private MenuInflater mMenuInflater;
static final class NonConfigurationInstances {
Object activity;
@@ -3083,7 +3086,16 @@ public class Activity extends ContextThemeWrapper
* Returns a {@link MenuInflater} with this context.
*/
public MenuInflater getMenuInflater() {
- return new MenuInflater(this);
+ // Make sure that action views can get an appropriate theme.
+ if (mMenuInflater == null) {
+ initActionBar();
+ if (mActionBar != null) {
+ mMenuInflater = new MenuInflater(mActionBar.getThemedContext());
+ } else {
+ mMenuInflater = new MenuInflater(this);
+ }
+ }
+ return mMenuInflater;
}
@Override