Merge "Spread out overview buttons in landscape" into ub-launcher3-dorval-polish
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 27e190e..b6e7328 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -16,10 +16,10 @@
package com.android.launcher3;
+import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
-import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -30,6 +30,7 @@
import android.graphics.Region;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
import android.util.Property;
import android.util.TypedValue;
@@ -119,6 +120,19 @@
}
};
+ private static final Property<BubbleTextView, Integer> TEXT_ALPHA_PROPERTY
+ = new Property<BubbleTextView, Integer>(Integer.class, "textAlpha") {
+ @Override
+ public Integer get(BubbleTextView bubbleTextView) {
+ return bubbleTextView.getTextAlpha();
+ }
+
+ @Override
+ public void set(BubbleTextView bubbleTextView, Integer alpha) {
+ bubbleTextView.setTextAlpha(alpha);
+ }
+ };
+
@ViewDebug.ExportedProperty(category = "launcher")
private boolean mStayPressed;
@ViewDebug.ExportedProperty(category = "launcher")
@@ -533,14 +547,29 @@
}
public void setTextVisibility(boolean visible) {
- Resources res = getResources();
if (visible) {
super.setTextColor(mTextColor);
} else {
- super.setTextColor(res.getColor(android.R.color.transparent));
+ setTextAlpha(0);
}
}
+ private void setTextAlpha(int alpha) {
+ super.setTextColor(ColorUtils.setAlphaComponent(mTextColor, alpha));
+ }
+
+ private int getTextAlpha() {
+ return Color.alpha(getCurrentTextColor());
+ }
+
+ /**
+ * Creates an animator to fade the text in or out.
+ * @param fadeIn Whether the text should fade in or fade out.
+ */
+ public Animator createTextAlphaAnimator(boolean fadeIn) {
+ return ObjectAnimator.ofInt(this, TEXT_ALPHA_PROPERTY, fadeIn ? Color.alpha(mTextColor) : 0);
+ }
+
@Override
public void cancelLongPress() {
super.cancelLongPress();
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 9e30550..5794004 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -356,13 +356,14 @@
@Override
public boolean onBackKey() {
- mFolderName.setHint(sHintText);
// Convert to a string here to ensure that no other state associated with the text field
// gets saved.
String newTitle = mFolderName.getText().toString();
mInfo.setTitle(newTitle);
mLauncher.getModelWriter().updateItemInDatabase(mInfo);
+ mFolderName.setHint(sDefaultFolderName.contentEquals(newTitle) ? sHintText : null);
+
Utilities.sendCustomAccessibilityEvent(
this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
getContext().getString(R.string.folder_renamed, newTitle));
@@ -459,8 +460,10 @@
if (!sDefaultFolderName.contentEquals(mInfo.title)) {
mFolderName.setText(mInfo.title);
+ mFolderName.setHint(null);
} else {
mFolderName.setText("");
+ mFolderName.setHint(sHintText);
}
// In case any children didn't come across during loading, clean up the folder accordingly
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 5463ef7..293bab4 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -827,6 +827,9 @@
revealAnim.setDuration((long) res.getInteger(R.integer.config_popupOpenCloseDuration));
revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
+ // Animate original icon's text back in.
+ closeAnim.play(mOriginalIcon.createTextAlphaAnimator(true /* fadeIn */));
+
closeAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {