Merge "Fixing bug where the widget background enters into a focused state if a child calls requestFocus in xml" into ub-launcher3-burnaby-nyc
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 471c324..b43d965 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -208,8 +208,26 @@
});
mFolderName.setOnFocusChangeListener(this);
- // We disable action mode for now since it messes up the view on phones
- mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
+ if (!Utilities.ATLEAST_MARSHMALLOW) {
+ // We disable action mode in older OSes where floating selection menu is not yet
+ // available.
+ mFolderName.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
+ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+ return false;
+ }
+
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ return false;
+ }
+
+ public void onDestroyActionMode(ActionMode mode) {
+ }
+
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ return false;
+ }
+ });
+ }
mFolderName.setOnEditorActionListener(this);
mFolderName.setSelectAllOnFocus(true);
mFolderName.setInputType(mFolderName.getInputType() |
@@ -224,23 +242,6 @@
mFooterHeight = mFooter.getMeasuredHeight();
}
- private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
- public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
- return false;
- }
-
- public boolean onCreateActionMode(ActionMode mode, Menu menu) {
- return false;
- }
-
- public void onDestroyActionMode(ActionMode mode) {
- }
-
- public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
- return false;
- }
- };
-
public void onClick(View v) {
Object tag = v.getTag();
if (tag instanceof ShortcutInfo) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 0723628..95e639a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1972,6 +1972,15 @@
@Override
protected void onSaveInstanceState(Bundle outState) {
+ // Catches the case where our activity is created and immediately destroyed and our views
+ // are not yet fully bound. In this case, we can't trust the state of our activity and
+ // instead save our previous state (which hasn't yet been consumed / applied, a fact we
+ // know as it's not null)
+ if (isWorkspaceLoading() && mSavedState != null) {
+ outState.putAll(mSavedState);
+ return;
+ }
+
if (mWorkspace.getChildCount() > 0) {
outState.putInt(RUNTIME_STATE_CURRENT_SCREEN,
mWorkspace.getCurrentPageOffsetFromCustomContent());