Merge "Hiding search bar buttons when qsb is disabled. (5187969, 5201453)"
diff --git a/print_db.py b/print_db.py
index ebcba6c..4f90f94 100755
--- a/print_db.py
+++ b/print_db.py
@@ -9,6 +9,7 @@
SCREENS = 5
COLUMNS = 4
ROWS = 4
+HOTSEAT_SIZE = 5
CELL_SIZE = 110
DIR = "db_files"
@@ -70,6 +71,52 @@
"icon": print_icon
}
+def render_cell_info(out, cell, occupied):
+ if cell is None:
+ out.write(" <td width=%d height=%d></td>\n" %
+ (CELL_SIZE, CELL_SIZE))
+ elif cell == occupied:
+ pass
+ else:
+ cellX = cell["cellX"]
+ cellY = cell["cellY"]
+ spanX = cell["spanX"]
+ spanY = cell["spanY"]
+ intent = cell["intent"]
+ if intent:
+ title = "title=\"%s\"" % cgi.escape(cell["intent"], True)
+ else:
+ title = ""
+ out.write((" <td colspan=%d rowspan=%d width=%d height=%d"
+ + " bgcolor=#dddddd align=center valign=middle %s>") % (
+ spanX, spanY,
+ (CELL_SIZE*spanX), (CELL_SIZE*spanY),
+ title))
+ itemType = cell["itemType"]
+ if itemType == 0:
+ out.write("""<img src="icon_%d.png">\n""" % ( cell["_id"] ))
+ out.write("<br/>\n")
+ out.write(cgi.escape(cell["title"]) + " <br/><i>(app)</i>")
+ elif itemType == 1:
+ out.write("""<img src="icon_%d.png">\n""" % ( cell["_id"] ))
+ out.write("<br/>\n")
+ out.write(cgi.escape(cell["title"]) + " <br/><i>(shortcut)</i>")
+ elif itemType == 2:
+ out.write("""<i>folder</i>""")
+ elif itemType == 3:
+ out.write("""<i>live folder</i>""")
+ elif itemType == 4:
+ out.write("<i>widget %d</i><br/>\n" % cell["appWidgetId"])
+ elif itemType == 1000:
+ out.write("""<i>clock</i>""")
+ elif itemType == 1001:
+ out.write("""<i>search</i>""")
+ elif itemType == 1002:
+ out.write("""<i>photo frame</i>""")
+ else:
+ out.write("<b>unknown type: %d</b>" % itemType)
+ out.write("</td>\n")
+
def process_file(fn):
print "process_file: " + fn
conn = sqlite3.connect(fn)
@@ -119,6 +166,21 @@
out.write("""</table>
""")
+ # Hotseat
+ hotseat = []
+ for i in range(0, HOTSEAT_SIZE):
+ hotseat.append(None)
+ for row in data:
+ if row["container"] != -101:
+ continue
+ screen = row["screen"]
+ hotseat[screen] = row
+ out.write("<br/><b>Hotseat</b><br/>\n")
+ out.write("<table class=layout border=1 cellspacing=0 cellpadding=4>\n")
+ for cell in hotseat:
+ render_cell_info(out, cell, None)
+ out.write("</table>\n")
+
# Pages
screens = []
for i in range(0,SCREENS):
@@ -150,50 +212,7 @@
for m in screen:
out.write(" <tr>\n")
for cell in m:
- if cell is None:
- out.write(" <td width=%d height=%d></td>\n" %
- (CELL_SIZE, CELL_SIZE))
- elif cell == occupied:
- pass
- else:
- cellX = cell["cellX"]
- cellY = cell["cellY"]
- spanX = cell["spanX"]
- spanY = cell["spanY"]
- intent = cell["intent"]
- if intent:
- title = "title=\"%s\"" % cgi.escape(cell["intent"], True)
- else:
- title = ""
- out.write((" <td colspan=%d rowspan=%d width=%d height=%d"
- + " bgcolor=#dddddd align=center valign=middle %s>") % (
- spanX, spanY,
- (CELL_SIZE*spanX), (CELL_SIZE*spanY),
- title))
- itemType = cell["itemType"]
- if itemType == 0:
- out.write("""<img src="icon_%d.png">\n""" % ( cell["_id"] ))
- out.write("<br/>\n")
- out.write(cgi.escape(cell["title"]) + " <br/><i>(app)</i>")
- elif itemType == 1:
- out.write("""<img src="icon_%d.png">\n""" % ( cell["_id"] ))
- out.write("<br/>\n")
- out.write(cgi.escape(cell["title"]) + " <br/><i>(shortcut)</i>")
- elif itemType == 2:
- out.write("""<i>folder</i>""")
- elif itemType == 3:
- out.write("""<i>live folder</i>""")
- elif itemType == 4:
- out.write("<i>widget %d</i><br/>\n" % cell["appWidgetId"])
- elif itemType == 1000:
- out.write("""<i>clock</i>""")
- elif itemType == 1001:
- out.write("""<i>search</i>""")
- elif itemType == 1002:
- out.write("""<i>photo frame</i>""")
- else:
- out.write("<b>unknown type: %d</b>" % itemType)
- out.write("</td>\n")
+ render_cell_info(out, cell, occupied)
out.write("</tr>\n")
out.write("</table>\n")
i=i+1
diff --git a/proguard.flags b/proguard.flags
index c2b2c65..0cde28e 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -7,6 +7,8 @@
public void onClickConfigureButton(android.view.View);
public void onClickAllAppsButton(android.view.View);
public void onClickAppMarketButton(android.view.View);
+ public void dismissWorkspaceCling(android.view.View);
+ public void dismissAllAppsCling(android.view.View);
}
-keep class com.android.launcher2.CellLayout {
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 4f6bc41..55a25ec 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -61,4 +61,8 @@
<dimen name="apps_customize_widget_cell_height_gap">5dp</dimen>
<integer name="apps_customize_widget_cell_count_x">3</integer>
<integer name="apps_customize_widget_cell_count_y">2</integer>
+
+<!-- Folders -->
+ <!-- The size of the image which sits behind the preview of the folder contents -->
+ <dimen name="folder_preview_size">58dp</dimen>
</resources>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 949d872..0e442ea 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -315,7 +315,11 @@
private boolean testDataReady() {
// We only do this test once, and we default to the Applications page, so we only really
// have to wait for there to be apps.
- return !mApps.isEmpty();
+ if (mContentType == AppsCustomizePagedView.ContentType.Widgets) {
+ return !mApps.isEmpty() && !mWidgets.isEmpty();
+ } else {
+ return !mApps.isEmpty();
+ }
}
/** Restores the page for an item at the specified index */
@@ -574,7 +578,7 @@
public void setContentType(ContentType type) {
mContentType = type;
- invalidatePageData(0, true);
+ invalidatePageData(0, (type != ContentType.Applications));
}
public boolean isContentType(ContentType type) {
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index f1a1508..cde5d94 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -27,6 +27,7 @@
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -50,6 +51,7 @@
private Launcher mLauncher;
Folder mFolder;
FolderInfo mInfo;
+ private static boolean sStaticValuesDirty = true;
// The number of icons to display in the
private static final int NUM_ITEMS_IN_PREVIEW = 3;
@@ -132,18 +134,26 @@
folder.setFolderIcon(icon);
folder.bind(folderInfo);
icon.mFolder = folder;
- icon.mFolderRingAnimator = new FolderRingAnimator(launcher, icon);
-
- folderInfo.addListener(icon);
-
Resources res = launcher.getResources();
- if (sSharedFolderLeaveBehind == null) {
+
+ // We need to reload the static values when configuration changes in case they are
+ // different in another configuration
+ if (sStaticValuesDirty) {
sSharedFolderLeaveBehind = res.getDrawable(R.drawable.portal_ring_rest);
}
+ icon.mFolderRingAnimator = new FolderRingAnimator(launcher, icon);
+ folderInfo.addListener(icon);
+
return icon;
}
+ @Override
+ protected Parcelable onSaveInstanceState() {
+ sStaticValuesDirty = true;
+ return super.onSaveInstanceState();
+ }
+
public static class FolderRingAnimator {
public int mCellX;
public int mCellY;
@@ -167,15 +177,14 @@
mOuterRingDrawable = res.getDrawable(R.drawable.portal_ring_outer_holo);
mInnerRingDrawable = res.getDrawable(R.drawable.portal_ring_inner_holo);
- if (sPreviewSize < 0 || sPreviewPadding < 0) {
+ // We need to reload the static values when configuration changes in case they are
+ // different in another configuration
+ if (sStaticValuesDirty) {
sPreviewSize = res.getDimensionPixelSize(R.dimen.folder_preview_size);
sPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding);
- }
- if (sSharedOuterRingDrawable == null) {
sSharedOuterRingDrawable = res.getDrawable(R.drawable.portal_ring_outer_holo);
- }
- if (sSharedInnerRingDrawable == null) {
sSharedInnerRingDrawable = res.getDrawable(R.drawable.portal_ring_inner_holo);
+ sStaticValuesDirty = false;
}
}
@@ -554,6 +563,18 @@
va.start();
}
+ public void setTextVisible(boolean visible) {
+ if (visible) {
+ mFolderName.setVisibility(VISIBLE);
+ } else {
+ mFolderName.setVisibility(INVISIBLE);
+ }
+ }
+
+ public boolean getTextVisible() {
+ return mFolderName.getVisibility() == VISIBLE;
+ }
+
public void onItemsChanged() {
invalidate();
requestLayout();
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index b42a6f7..22a34e6 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -24,6 +24,7 @@
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.app.Activity;
+import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.SearchManager;
@@ -1060,6 +1061,8 @@
void closeSystemDialogs() {
getWindow().closeAllPanels();
+ /**
+ * We should remove this code when we remove all the dialog code.
try {
dismissDialog(DIALOG_CREATE_SHORTCUT);
// Unlock the workspace if the dialog was showing
@@ -1073,6 +1076,7 @@
} catch (Exception e) {
// An exception is thrown if the dialog is not visible, which is fine
}
+ */
// Whatever we were doing is hereby canceled.
mWaitingForResult = false;
@@ -2981,6 +2985,9 @@
// TEMPORARY: DISABLE CLINGS ON LARGE UI
if (LauncherApplication.isScreenLarge()) return;
+ // disable clings when running in a test harness
+ if(ActivityManager.isRunningInTestHarness()) return;
+
// Enable the clings only if they have not been dismissed before
SharedPreferences prefs =
getSharedPreferences("com.android.launcher2.prefs", Context.MODE_PRIVATE);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b6a1666..1c13f14 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -465,6 +465,11 @@
layout = mLauncher.getHotseat().getLayout();
child.setOnKeyListener(null);
+ // Hide folder title in the hotseat
+ if (child instanceof FolderIcon) {
+ ((FolderIcon) child).setTextVisible(false);
+ }
+
if (screen < 0) {
screen = mLauncher.getHotseat().getOrderInHotseat(x, y);
} else {
@@ -474,6 +479,11 @@
y = mLauncher.getHotseat().getCellYFromOrder(screen);
}
} else {
+ // Show folder title if not in the hotseat
+ if (child instanceof FolderIcon) {
+ ((FolderIcon) child).setTextVisible(true);
+ }
+
layout = (CellLayout) getChildAt(screen);
child.setOnKeyListener(new BubbleTextViewKeyEventListener());
}
@@ -1900,6 +1910,8 @@
final Rect clipRect = mTempRect;
v.getDrawingRect(clipRect);
+ boolean textVisible = false;
+
destCanvas.save();
if (v instanceof TextView && pruneToDrawable) {
Drawable d = ((TextView) v).getCompoundDrawables()[1];
@@ -1908,7 +1920,12 @@
d.draw(destCanvas);
} else {
if (v instanceof FolderIcon) {
- clipRect.bottom = getResources().getDimensionPixelSize(R.dimen.folder_preview_size);
+ // For FolderIcons the text can bleed into the icon area, and so we need to
+ // hide the text completely (which can't be achieved by clipping).
+ if (((FolderIcon) v).getTextVisible()) {
+ ((FolderIcon) v).setTextVisible(false);
+ textVisible = true;
+ }
} else if (v instanceof BubbleTextView) {
final BubbleTextView tv = (BubbleTextView) v;
clipRect.bottom = tv.getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V +
@@ -1921,6 +1938,11 @@
destCanvas.translate(-v.getScrollX() + padding / 2, -v.getScrollY() + padding / 2);
destCanvas.clipRect(clipRect, Op.REPLACE);
v.draw(destCanvas);
+
+ // Restore text visibility of FolderIcon if necessary
+ if (textVisible) {
+ ((FolderIcon) v).setTextVisible(true);
+ }
}
destCanvas.restore();
}