summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2012-03-22 17:47:27 -0700
committerAdam Powell <adamp@google.com>2012-04-05 11:45:10 -0700
commitdd8fab2629131b09367df747afd9a61e42dd1992 (patch)
tree933cb43fba2098c3e55ef6aa12f150d04f2c21f9 /core/java/com
parentd9966c4c21c9d3a49454b1267e43907e0256a414 (diff)
downloadframeworks_base-dd8fab2629131b09367df747afd9a61e42dd1992.zip
frameworks_base-dd8fab2629131b09367df747afd9a61e42dd1992.tar.gz
frameworks_base-dd8fab2629131b09367df747afd9a61e42dd1992.tar.bz2
TaskStackBuilder and Activity navigation features for framework
Promote navigation helpers from the support library to the core platform. The support library's meta-data element has been replaced with a first-class parentActivityName attribute. This attribute is valid on both activity and activity-alias elements. An activity-alias will inherit the target activity's parentActivityName if one is not explicitly specified. Automatic Up navigation for Activities Add the public method onNavigateUp() to Activity. The default implementation will use the metadata supplied in the manifest about an activity's hierarchical parent (parentActivityName) to do the right thing. If any activities in the parent chain require special Intent arguments, the Activity subclass should override onNavigateUp() to properly implement Up navigation for the app, supplying such arguments as needed. If automatic Up navigation within the same task can't find an activity matching the supplied intent in the current task stack, it will act as an in-app "home" and return to the root activity (presumably the app's front page) in that task. (From this state, pressing "back" with default behavior will return to the launcher.) Change-Id: If163e27e59587f7af36975a09c986cb117ec3bc6
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/app/ActionBarImpl.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index 3115eff..f1dffa1 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -85,6 +85,8 @@ public class ActionBarImpl extends ActionBar {
private TabImpl mSelectedTab;
private int mSavedTabPosition = INVALID_POSITION;
+ private boolean mDisplayHomeAsUpSet;
+
ActionModeImpl mActionMode;
ActionMode mDeferredDestroyActionMode;
ActionMode.Callback mDeferredModeDestroyCallback;
@@ -375,11 +377,17 @@ public class ActionBarImpl extends ActionBar {
}
public void setDisplayOptions(int options) {
+ if ((options & DISPLAY_HOME_AS_UP) != 0) {
+ mDisplayHomeAsUpSet = true;
+ }
mActionView.setDisplayOptions(options);
}
public void setDisplayOptions(int options, int mask) {
final int current = mActionView.getDisplayOptions();
+ if ((mask & DISPLAY_HOME_AS_UP) != 0) {
+ mDisplayHomeAsUpSet = true;
+ }
mActionView.setDisplayOptions((options & mask) | (current & ~mask));
}
@@ -1072,4 +1080,10 @@ public class ActionBarImpl extends ActionBar {
public void setLogo(Drawable logo) {
mActionView.setLogo(logo);
}
+
+ public void setDefaultDisplayHomeAsUpEnabled(boolean enable) {
+ if (!mDisplayHomeAsUpSet) {
+ setDisplayHomeAsUpEnabled(enable);
+ }
+ }
}