summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-07-14 16:39:04 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-07-14 16:39:04 -0700
commit0d60b96a8fecae55907bb07f49a267c23965617e (patch)
tree6edaa90214cacc8038be37f924f146bc2d994a88 /core
parent7ba6617a53424b85711313478459a0a8cda8c3da (diff)
parent29ed7575c2129974a57ad77b3531bc5995940c6c (diff)
downloadframeworks_base-0d60b96a8fecae55907bb07f49a267c23965617e.zip
frameworks_base-0d60b96a8fecae55907bb07f49a267c23965617e.tar.gz
frameworks_base-0d60b96a8fecae55907bb07f49a267c23965617e.tar.bz2
Merge "Bug 2841148 - Add accessors for action bar context mode state."
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/ActionBar.java18
-rw-r--r--core/java/com/android/internal/app/ActionBarImpl.java18
-rw-r--r--core/java/com/android/internal/widget/ActionBarContextView.java8
3 files changed, 44 insertions, 0 deletions
diff --git a/core/java/android/app/ActionBar.java b/core/java/android/app/ActionBar.java
index d0b3ac4..3cd2b9e 100644
--- a/core/java/android/app/ActionBar.java
+++ b/core/java/android/app/ActionBar.java
@@ -368,6 +368,24 @@ public abstract class ActionBar {
* @return The context mode's menu.
*/
public abstract Menu getMenu();
+
+ /**
+ * Returns the current title of this context mode.
+ * @return Title text
+ */
+ public abstract CharSequence getTitle();
+
+ /**
+ * Returns the current subtitle of this context mode.
+ * @return Subtitle text
+ */
+ public abstract CharSequence getSubtitle();
+
+ /**
+ * Returns the current custom view for this context mode.
+ * @return The current custom view
+ */
+ public abstract View getCustomView();
}
/**
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index c6be7c2..f37021b 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -34,6 +34,7 @@ import android.widget.LinearLayout;
import android.widget.SpinnerAdapter;
import android.widget.ViewAnimator;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
/**
@@ -338,6 +339,7 @@ public class ActionBarImpl extends ActionBar {
public class ContextMode extends ActionBar.ContextMode {
private ContextModeCallback mCallback;
private ActionMenu mMenu;
+ private WeakReference<View> mCustomView;
public ContextMode(ContextModeCallback callback) {
mCallback = callback;
@@ -375,6 +377,7 @@ public class ActionBarImpl extends ActionBar {
@Override
public void setCustomView(View view) {
mUpperContextView.setCustomView(view);
+ mCustomView = new WeakReference<View>(view);
}
@Override
@@ -386,7 +389,22 @@ public class ActionBarImpl extends ActionBar {
public void setTitle(CharSequence title) {
mUpperContextView.setTitle(title);
}
+
+ @Override
+ public CharSequence getTitle() {
+ return mUpperContextView.getTitle();
+ }
+
+ @Override
+ public CharSequence getSubtitle() {
+ return mUpperContextView.getSubtitle();
+ }
+ @Override
+ public View getCustomView() {
+ return mCustomView != null ? mCustomView.get() : null;
+ }
+
public void dispatchOnContextItemClicked(MenuItem item) {
ActionMenuItem actionItem = (ActionMenuItem) item;
if (!actionItem.invoke()) {
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java
index 0f895f0..b57b7a8 100644
--- a/core/java/com/android/internal/widget/ActionBarContextView.java
+++ b/core/java/com/android/internal/widget/ActionBarContextView.java
@@ -105,6 +105,14 @@ public class ActionBarContextView extends ViewGroup {
initTitle();
}
+ public CharSequence getTitle() {
+ return mTitle;
+ }
+
+ public CharSequence getSubtitle() {
+ return mSubtitle;
+ }
+
private void initTitle() {
if (mTitleLayout == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());