Merge "Make expanded system shortcuts clickable" into ub-launcher3-dorval
diff --git a/proguard.flags b/proguard.flags
index 6cbab08..8ee6ccd 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -94,3 +94,7 @@
-keep interface com.android.launcher3.userevent.nano.LauncherLogProto.** {
*;
}
+
+-keep interface com.android.launcher3.model.nano.LauncherDumpProto.** {
+ *;
+}
diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto
index 909a429..93e09ae 100644
--- a/protos/launcher_log.proto
+++ b/protos/launcher_log.proto
@@ -156,4 +156,5 @@
optional int64 elapsed_session_millis = 6;
optional bool is_in_multi_window_mode = 7;
+ optional bool is_in_landscape_mode = 8;
}
diff --git a/res/layout/all_apps_discovery_item.xml b/res/layout/all_apps_discovery_item.xml
index 1a7eaa7..3350530 100644
--- a/res/layout/all_apps_discovery_item.xml
+++ b/res/layout/all_apps_discovery_item.xml
@@ -51,11 +51,12 @@
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
- android:layout_gravity="center_vertical"/>
+ android:layout_gravity="center_vertical"
+ android:includeFontPadding="false"/>
<com.android.launcher3.discovery.RatingView
android:id="@+id/rating_view"
- android:layout_width="80dp"
+ android:layout_width="70dp"
android:layout_height="16dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
diff --git a/res/layout/all_apps_discovery_loading_divider.xml b/res/layout/all_apps_discovery_loading_divider.xml
index c7b5ad2..1ad5521 100644
--- a/res/layout/all_apps_discovery_loading_divider.xml
+++ b/res/layout/all_apps_discovery_loading_divider.xml
@@ -15,7 +15,7 @@
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="20dp"
+ android:layout_height="6dp"
android:paddingLeft="@dimen/container_fastscroll_thumb_max_width"
android:paddingRight="@dimen/container_fastscroll_thumb_max_width">
@@ -34,7 +34,7 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@drawable/all_apps_divider"
- android:layout_gravity="center"
+ android:layout_gravity="bottom"
android:visibility="invisible"/>
</FrameLayout>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 58717c2..2589308 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -41,6 +41,8 @@
<color name="notification_icon_default_color">#757575</color> <!-- Gray 600 -->
<color name="notification_color_beneath">#E0E0E0</color> <!-- Gray 300 -->
+ <color name="badge_color">#1DE9B6</color> <!-- Teal A400 -->
+
<!-- System shortcuts -->
<color name="system_shortcuts_icon_color">@android:color/tertiary_text_light</color>
diff --git a/res/values/config.xml b/res/values/config.xml
index 19966f6..ee9c238 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -18,20 +18,18 @@
<string-array name="icon_shape_override_paths_values">
<item></item>
<item translatable="false">M50,0L100,0 100,100 0,100 0,0z</item>
- <item translatable="false">M50,0L80,0 A20,20,0,0 1 100,20 L100,80 A20,20,0,0 1 80,100 L20,100 A20,20,0,0 1 0,80 L 0,20 A20,20,0,0 1 20,0z</item>
<item translatable="false">M50,0 C10,0 0,10 0,50 0,90 10,100 50,100 90,100 100,90 100,50 100,10 90,0 50,0 Z</item>
<item translatable="false">M50 0A50 50,0,1,1,50 100A50 50,0,1,1,50 0</item>
- <item translatable="false">M50,0A50,30 0,0,1 100,30V70A50,30 0,0,1 0,70V30A50,30 0,0,1 50,0z</item>
+ <item translatable="false">M50,0A50,50,0,0 1 100,50 L100,85 A15,15,0,0 1 85,100 L50,100 A50,50,0,0 1 50,0z</item>
</string-array>
<string-array name="icon_shape_override_paths_names">
<!-- Option to not change the icon shape on home screen. [CHAR LIMIT=50] -->
- <item>@string/icon_shape_no_override</item>
+ <item>@string/icon_shape_system_default</item>
<item translatable="false">Square</item>
- <item translatable="false">Rounded corner rect</item>
<item translatable="false">Squircle</item>
<item translatable="false">Circle</item>
- <item translatable="false">Cylinder</item>
+ <item translatable="false">Teardrop</item>
</string-array>
<!-- DragController -->
<item type="id" name="drag_event_parity" />
@@ -135,4 +133,5 @@
<item type="id" name="action_move_screen_forwards" />
<item type="id" name="action_resize" />
<item type="id" name="action_deep_shortcuts" />
+ <item type="id" name="action_dismiss_notification" />
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4bee87d..1fe33ae 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -172,6 +172,12 @@
<string name="allow_rotation_desc">When phone is rotated</string>
<!-- Text explaining that rotation is disabled in Display settings. 'Display' refers to the Display section in system settings [CHAR LIMIT=100] -->
<string name="allow_rotation_blocked_desc">Current Display setting doesn\'t permit rotation</string>
+ <!-- Title for Icon Badging setting. Tapping this will link to the system Notifications Settings screen where the user can turn off badging globally. [CHAR LIMIT=50] -->
+ <string name="icon_badging_title">Icon badging</string>
+ <!-- Text to indicate that the system icon badging setting is on [CHAR LIMIT=100] -->
+ <string name="icon_badging_desc_on">On for all apps</string>
+ <!-- Text to indicate that the system icon badging setting is off [CHAR LIMIT=100] -->
+ <string name="icon_badging_desc_off">Off for all apps</string>
<!-- Label for the setting that allows the automatic placement of launcher shortcuts for applications and games installed on the device [CHAR LIMIT=40] -->
<string name="auto_add_shortcuts_label">Add icon to Home screen</string>
@@ -180,8 +186,8 @@
<!-- Developer setting to change the shape of icons on home screen. [CHAR LIMIT=50] -->
<string name="icon_shape_override_label">Change icon shape</string>
- <!-- Option to not change the icon shape on home screen. [CHAR LIMIT=50] -->
- <string name="icon_shape_no_override">Do not change</string>
+ <!-- Option to not change the icon shape on home screen and use the system default setting instead. [CHAR LIMIT=50] -->
+ <string name="icon_shape_system_default">Use system default</string>
<!-- Message shown in the progress dialog when the icon shape override is being applied [CHAR LIMIT=100]-->
<string name="icon_shape_override_progress">Applying icon shape changes</string>
@@ -286,5 +292,13 @@
<!-- Accessibility description for the shortcuts menu shown for an app. -->
<string name="shortcuts_menu_description"><xliff:g id="number_of_shortcuts" example="3">%1$d</xliff:g> shortcuts for <xliff:g id="app_name" example="Messenger">%2$s</xliff:g></string>
+ <!-- Accessibility description when the shortcuts menu has notifications as well as shortcuts. -->
+ <string name="shortcuts_menu_with_notifications_description"><xliff:g id="number_of_shortcuts" example="3">%1$d</xliff:g> shortcuts and <xliff:g id="number_of_notifications" example="3">%2$d</xliff:g> notifications for <xliff:g id="app_name" example="Messenger">%3$s</xliff:g></string>
+
+ <!-- Accessibility action to dismiss a notification in the shortcuts menu for an icon. [CHAR_LIMIT=30] -->
+ <string name="action_dismiss_notification">Dismiss</string>
+
+ <!-- Accessibility confirmation for notification being dismissed. -->
+ <string name="notification_dismissed">Notification dismissed</string>
</resources>
diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml
index 301bef1..8763883 100644
--- a/res/xml/launcher_preferences.xml
+++ b/res/xml/launcher_preferences.xml
@@ -17,13 +17,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
- android:key="pref_allowRotation"
- android:title="@string/allow_rotation_title"
- android:defaultValue="@bool/allow_rotation"
- android:persistent="true"
- />
-
- <SwitchPreference
android:key="pref_add_icon_to_home"
android:title="@string/auto_add_shortcuts_label"
android:summary="@string/auto_add_shortcuts_description"
@@ -40,4 +33,23 @@
android:defaultValue=""
android:persistent="false" />
+ <Preference
+ android:key="pref_icon_badging"
+ android:title="@string/icon_badging_title"
+ android:persistent="false">
+ <intent android:action="android.settings.NOTIFICATION_SETTINGS">
+ <!-- This extra highlights the "Allow icon badges" field in Notification settings -->
+ <extra
+ android:name=":settings:fragment_args_key"
+ android:value="notification_badging" />
+ </intent>
+ </Preference>/>
+
+ <SwitchPreference
+ android:key="pref_allowRotation"
+ android:title="@string/allow_rotation_title"
+ android:defaultValue="@bool/allow_rotation"
+ android:persistent="true"
+ />
+
</PreferenceScreen>
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index 410d590..08cd955 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -39,7 +39,7 @@
public final UserEventDispatcher getUserEventDispatcher() {
if (mUserEventDispatcher == null) {
mUserEventDispatcher = UserEventDispatcher.newInstance(this,
- isInMultiWindowModeCompat());
+ mDeviceProfile.isLandscape, isInMultiWindowModeCompat());
}
return mUserEventDispatcher;
}
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index cb40d3d..94c7e07 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -453,7 +453,7 @@
final int scrollX = getScrollX();
final int scrollY = getScrollY();
canvas.translate(scrollX, scrollY);
- mBadgeRenderer.draw(canvas, mIconPalette, mBadgeInfo, mTempIconBounds, mBadgeScale,
+ mBadgeRenderer.draw(canvas, mBadgeInfo, mTempIconBounds, mBadgeScale,
mTempSpaceForBadgeOffset);
canvas.translate(-scrollX, -scrollY);
}
@@ -660,14 +660,6 @@
}
/**
- * Returns true if the view can show custom shortcuts.
- */
- public boolean hasDeepShortcuts() {
- return !mLauncher.getPopupDataProvider().getShortcutIdsForItem((ItemInfo) getTag())
- .isEmpty();
- }
-
- /**
* Interface to be implemented by the grand parent to allow click shadow effect.
*/
public interface BubbleTextShadowHandler {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index eef578d..2de1003 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -4061,8 +4061,8 @@
shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.custom_actions),
KeyEvent.KEYCODE_O, KeyEvent.META_CTRL_ON));
}
- if (currentFocus instanceof BubbleTextView &&
- ((BubbleTextView) currentFocus).hasDeepShortcuts()) {
+ if (currentFocus.getTag() instanceof ItemInfo
+ && DeepShortcutManager.supportsShortcuts((ItemInfo) currentFocus.getTag())) {
shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.action_deep_shortcut),
KeyEvent.KEYCODE_S, KeyEvent.META_CTRL_ON));
}
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index e68e637..f881b38 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1763,17 +1763,15 @@
}
private void loadDeepShortcuts() {
- if (!mModelLoaded) {
- sBgDataModel.deepShortcutMap.clear();
- DeepShortcutManager shortcutManager = DeepShortcutManager.getInstance(mContext);
- mHasShortcutHostPermission = shortcutManager.hasHostPermission();
- if (mHasShortcutHostPermission) {
- for (UserHandle user : mUserManager.getUserProfiles()) {
- if (mUserManager.isUserUnlocked(user)) {
- List<ShortcutInfoCompat> shortcuts =
- shortcutManager.queryForAllShortcuts(user);
- sBgDataModel.updateDeepShortcutMap(null, user, shortcuts);
- }
+ sBgDataModel.deepShortcutMap.clear();
+ DeepShortcutManager shortcutManager = DeepShortcutManager.getInstance(mContext);
+ mHasShortcutHostPermission = shortcutManager.hasHostPermission();
+ if (mHasShortcutHostPermission) {
+ for (UserHandle user : mUserManager.getUserProfiles()) {
+ if (mUserManager.isUserUnlocked(user)) {
+ List<ShortcutInfoCompat> shortcuts =
+ shortcutManager.queryForAllShortcuts(user);
+ sBgDataModel.updateDeepShortcutMap(null, user, shortcuts);
}
}
}
diff --git a/src/com/android/launcher3/SettingsActivity.java b/src/com/android/launcher3/SettingsActivity.java
index 7ae6b26..0902b20 100644
--- a/src/com/android/launcher3/SettingsActivity.java
+++ b/src/com/android/launcher3/SettingsActivity.java
@@ -34,6 +34,11 @@
* Settings activity for Launcher. Currently implements the following setting: Allow rotation
*/
public class SettingsActivity extends Activity {
+
+ private static final String ICON_BADGING_PREFERENCE_KEY = "pref_icon_badging";
+ // TODO: use Settings.Secure.NOTIFICATION_BADGING
+ private static final String NOTIFICATION_BADGING = "notification_badging";
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -50,6 +55,7 @@
public static class LauncherSettingsFragment extends PreferenceFragment {
private SystemDisplayRotationLockObserver mRotationLockObserver;
+ private IconBadgingObserver mIconBadgingObserver;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -57,13 +63,14 @@
getPreferenceManager().setSharedPreferencesName(LauncherFiles.SHARED_PREFERENCES_KEY);
addPreferencesFromResource(R.xml.launcher_preferences);
+ ContentResolver resolver = getActivity().getContentResolver();
+
// Setup allow rotation preference
Preference rotationPref = findPreference(Utilities.ALLOW_ROTATION_PREFERENCE_KEY);
if (getResources().getBoolean(R.bool.allow_rotation)) {
// Launcher supports rotation by default. No need to show this setting.
getPreferenceScreen().removePreference(rotationPref);
} else {
- ContentResolver resolver = getActivity().getContentResolver();
mRotationLockObserver = new SystemDisplayRotationLockObserver(rotationPref, resolver);
// Register a content observer to listen for system setting changes while
@@ -77,9 +84,18 @@
rotationPref.setDefaultValue(Utilities.getAllowRotationDefaultValue(getActivity()));
}
+ Preference iconBadgingPref = findPreference(ICON_BADGING_PREFERENCE_KEY);
if (!BuildCompat.isAtLeastO()) {
getPreferenceScreen().removePreference(
findPreference(SessionCommitReceiver.ADD_ICON_PREFERENCE_KEY));
+ getPreferenceScreen().removePreference(iconBadgingPref);
+ } else {
+ // Listen to system notification badge settings while this UI is active.
+ mIconBadgingObserver = new IconBadgingObserver(iconBadgingPref, resolver);
+ resolver.registerContentObserver(
+ Settings.Secure.getUriFor(NOTIFICATION_BADGING),
+ false, mIconBadgingObserver);
+ mIconBadgingObserver.onChange(true);
}
Preference iconShapeOverride = findPreference(IconShapeOverride.KEY_PREFERENCE);
@@ -98,6 +114,10 @@
getActivity().getContentResolver().unregisterContentObserver(mRotationLockObserver);
mRotationLockObserver = null;
}
+ if (mIconBadgingObserver != null) {
+ getActivity().getContentResolver().unregisterContentObserver(mIconBadgingObserver);
+ mIconBadgingObserver = null;
+ }
super.onDestroy();
}
}
@@ -127,4 +147,29 @@
? R.string.allow_rotation_desc : R.string.allow_rotation_blocked_desc);
}
}
+
+ /**
+ * Content observer which listens for system badging setting changes,
+ * and updates the launcher badging setting subtext accordingly.
+ */
+ private static class IconBadgingObserver extends ContentObserver {
+
+ private final Preference mBadgingPref;
+ private final ContentResolver mResolver;
+
+ public IconBadgingObserver(Preference badgingPref, ContentResolver resolver) {
+ super(new Handler());
+ mBadgingPref = badgingPref;
+ mResolver = resolver;
+ }
+
+ @Override
+ public void onChange(boolean selfChange) {
+ boolean enabled = Settings.Secure.getInt(mResolver, NOTIFICATION_BADGING, 1) == 1;
+ mBadgingPref.setSummary(enabled
+ ? R.string.icon_badging_desc_on
+ : R.string.icon_badging_desc_off);
+ }
+ }
+
}
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index a476650..70e5781 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -37,6 +37,7 @@
import com.android.launcher3.dragndrop.DragController.DragListener;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.folder.Folder;
+import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.util.Thunk;
import java.util.ArrayList;
@@ -104,8 +105,7 @@
// If the request came from keyboard, do not add custom shortcuts as that is already
// exposed as a direct shortcut
- if (!fromKeyboard && host instanceof BubbleTextView
- && ((BubbleTextView) host).hasDeepShortcuts()) {
+ if (!fromKeyboard && DeepShortcutManager.supportsShortcuts(item)) {
info.addAction(mActions.get(DEEP_SHORTCUTS));
}
diff --git a/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
index b784fe7..8161219 100644
--- a/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
@@ -18,14 +18,15 @@
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.notification.NotificationMainView;
import com.android.launcher3.shortcuts.DeepShortcutView;
import java.util.ArrayList;
@@ -36,14 +37,23 @@
*/
public class ShortcutMenuAccessibilityDelegate extends LauncherAccessibilityDelegate {
+ private static final int DISMISS_NOTIFICATION = R.id.action_dismiss_notification;
+
public ShortcutMenuAccessibilityDelegate(Launcher launcher) {
super(launcher);
+ mActions.put(DISMISS_NOTIFICATION, new AccessibilityAction(DISMISS_NOTIFICATION,
+ launcher.getText(R.string.action_dismiss_notification)));
}
@Override
public void addSupportedActions(View host, AccessibilityNodeInfo info, boolean fromKeyboard) {
if ((host.getParent() instanceof DeepShortcutView)) {
info.addAction(mActions.get(ADD_TO_WORKSPACE));
+ } else if (host instanceof NotificationMainView) {
+ NotificationMainView notificationView = (NotificationMainView) host;
+ if (notificationView.canChildBeDismissed(notificationView)) {
+ info.addAction(mActions.get(DISMISS_NOTIFICATION));
+ }
}
}
@@ -74,6 +84,14 @@
onComplete.run();
}
return true;
+ } else if (action == DISMISS_NOTIFICATION) {
+ if (!(host instanceof NotificationMainView)) {
+ return false;
+ }
+ NotificationMainView notificationView = (NotificationMainView) host;
+ notificationView.onChildDismissed(notificationView);
+ announceConfirmation(R.string.notification_dismissed);
+ return true;
}
return false;
}
diff --git a/src/com/android/launcher3/badge/BadgeRenderer.java b/src/com/android/launcher3/badge/BadgeRenderer.java
index ba1977a..adde4a2 100644
--- a/src/com/android/launcher3/badge/BadgeRenderer.java
+++ b/src/com/android/launcher3/badge/BadgeRenderer.java
@@ -63,6 +63,7 @@
private final Paint mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG
| Paint.FILTER_BITMAP_FLAG);
private final SparseArray<Bitmap> mBackgroundsWithShadow;
+ private final IconPalette mIconPalette;
public BadgeRenderer(Context context, int iconSizePx) {
mContext = context;
@@ -82,24 +83,25 @@
mTextHeight = tempTextHeight.height();
mBackgroundsWithShadow = new SparseArray<>(3);
+
+ mIconPalette = IconPalette.fromDominantColor(context.getColor(R.color.badge_color));
}
/**
* Draw a circle in the top right corner of the given bounds, and draw
* {@link BadgeInfo#getNotificationCount()} on top of the circle.
- * @param palette The colors (based on the icon) to use for the badge.
* @param badgeInfo Contains data to draw on the badge. Could be null if we are animating out.
* @param iconBounds The bounds of the icon being badged.
* @param badgeScale The progress of the animation, from 0 to 1.
* @param spaceForOffset How much space is available to offset the badge up and to the right.
*/
- public void draw(Canvas canvas, IconPalette palette, @Nullable BadgeInfo badgeInfo,
+ public void draw(Canvas canvas, @Nullable BadgeInfo badgeInfo,
Rect iconBounds, float badgeScale, Point spaceForOffset) {
- mTextPaint.setColor(palette.textColor);
+ mTextPaint.setColor(mIconPalette.textColor);
IconDrawer iconDrawer = badgeInfo != null && badgeInfo.isIconLarge()
? mLargeIconDrawer : mSmallIconDrawer;
Shader icon = badgeInfo == null ? null : badgeInfo.getNotificationIconForBadge(
- mContext, palette.backgroundColor, mSize, iconDrawer.mPadding);
+ mContext, mIconPalette.backgroundColor, mSize, iconDrawer.mPadding);
String notificationCount = badgeInfo == null ? "0"
: String.valueOf(badgeInfo.getNotificationCount());
int numChars = notificationCount.length();
@@ -125,7 +127,7 @@
canvas.translate(badgeCenterX + offsetX, badgeCenterY - offsetY);
canvas.scale(badgeScale, badgeScale);
// Prepare the background and shadow and possible stacking effect.
- mBackgroundPaint.setColorFilter(palette.backgroundColorMatrixFilter);
+ mBackgroundPaint.setColorFilter(mIconPalette.backgroundColorMatrixFilter);
int backgroundWithShadowSize = backgroundWithShadow.getHeight(); // Same as width.
boolean shouldStack = !isDot && badgeInfo != null
&& badgeInfo.getNotificationKeys().size() > 1;
@@ -147,7 +149,7 @@
-backgroundWithShadowSize / 2, mBackgroundPaint);
iconDrawer.drawIcon(icon, canvas);
} else if (isDot) {
- mBackgroundPaint.setColorFilter(palette.saturatedBackgroundColorMatrixFilter);
+ mBackgroundPaint.setColorFilter(mIconPalette.saturatedBackgroundColorMatrixFilter);
canvas.drawBitmap(backgroundWithShadow, -backgroundWithShadowSize / 2,
-backgroundWithShadowSize / 2, mBackgroundPaint);
}
diff --git a/src/com/android/launcher3/discovery/AppDiscoveryItemView.java b/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
index 9bb3b10..809d724 100644
--- a/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
+++ b/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
@@ -82,7 +82,7 @@
mPrice.setText(info.priceFormatted != null ? info.priceFormatted : "");
mReviewCount.setVisibility(SHOW_REVIEW_COUNT ? View.VISIBLE : View.GONE);
if (info.rating >= 0) {
- mRatingText.setText(new DecimalFormat("#.#").format(info.rating));
+ mRatingText.setText(new DecimalFormat("#.0").format(info.rating));
mRatingView.setRating(info.rating);
mRatingView.setVisibility(View.VISIBLE);
String reviewCountFormatted = NumberFormat.getInstance().format(info.reviewCount);
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index 25123fb..0b356b5 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -75,7 +75,6 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragView;
-import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.util.Thunk;
import java.util.ArrayList;
@@ -886,7 +885,7 @@
// If we are animating to the accepting state, animate the badge out.
float badgeScale = Math.max(0, mBadgeScale - mBackground.getScaleProgress());
mTempSpaceForBadgeOffset.set(getWidth() - mTempBounds.right, mTempBounds.top);
- mBadgeRenderer.draw(canvas, IconPalette.FOLDER_ICON_PALETTE, mBadgeInfo, mTempBounds,
+ mBadgeRenderer.draw(canvas, mBadgeInfo, mTempBounds,
badgeScale, mTempSpaceForBadgeOffset);
}
}
diff --git a/src/com/android/launcher3/graphics/IconPalette.java b/src/com/android/launcher3/graphics/IconPalette.java
index 0182e53..60ca7b2 100644
--- a/src/com/android/launcher3/graphics/IconPalette.java
+++ b/src/com/android/launcher3/graphics/IconPalette.java
@@ -49,7 +49,7 @@
private IconPalette(int color) {
dominantColor = color;
- backgroundColor = getMutedColor(dominantColor);
+ backgroundColor = dominantColor;
ColorMatrix backgroundColorMatrix = new ColorMatrix();
Themes.setColorScaleOnMatrix(backgroundColor, backgroundColorMatrix);
backgroundColorMatrixFilter = new ColorMatrixColorFilter(backgroundColorMatrix);
@@ -176,10 +176,6 @@
return ColorUtils.LABToColor(low, a, b);
}
- private static int getMutedColor(int color) {
- return getMutedColor(color, 0.87f);
- }
-
private static int getMutedColor(int color, float whiteScrimAlpha) {
int whiteScrim = ColorUtils.setAlphaComponent(Color.WHITE, (int) (255 * whiteScrimAlpha));
return ColorUtils.compositeColors(whiteScrim, color);
diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java
index 07e99c6..258af16 100644
--- a/src/com/android/launcher3/logging/UserEventDispatcher.java
+++ b/src/com/android/launcher3/logging/UserEventDispatcher.java
@@ -62,9 +62,11 @@
private static final boolean IS_VERBOSE =
ProviderConfig.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(LogConfig.USEREVENT);
- public static UserEventDispatcher newInstance(Context context, boolean isInMultiWindowMode) {
+ public static UserEventDispatcher newInstance(Context context, boolean isInLandscapeMode,
+ boolean isInMultiWindowMode) {
UserEventDispatcher ued = Utilities.getOverrideObject(UserEventDispatcher.class,
context.getApplicationContext(), R.string.user_event_dispatcher_class);
+ ued.mIsInLandscapeMode = isInLandscapeMode;
ued.mIsInMultiWindowMode = isInMultiWindowMode;
return ued;
}
@@ -112,6 +114,7 @@
private long mElapsedSessionMillis;
private long mActionDurationMillis;
private boolean mIsInMultiWindowMode;
+ private boolean mIsInLandscapeMode;
// Used for filling in predictedRank on {@link Target}s.
private List<ComponentKey> mPredictedApps;
@@ -296,6 +299,7 @@
}
public void dispatchUserEvent(LauncherEvent ev, Intent intent) {
+ ev.isInLandscapeMode = mIsInLandscapeMode;
ev.isInMultiWindowMode = mIsInMultiWindowMode;
ev.elapsedContainerMillis = SystemClock.uptimeMillis() - mElapsedContainerMillis;
ev.elapsedSessionMillis = SystemClock.uptimeMillis() - mElapsedSessionMillis;
@@ -315,6 +319,7 @@
ev.elapsedContainerMillis,
ev.elapsedSessionMillis,
ev.actionDurationMillis);
+ log += "\n isInLandscapeMode " + ev.isInLandscapeMode;
log += "\n isInMultiWindowMode " + ev.isInMultiWindowMode;
Log.d(TAG, log);
}
diff --git a/src/com/android/launcher3/notification/NotificationFooterLayout.java b/src/com/android/launcher3/notification/NotificationFooterLayout.java
index 1eef743..051c033 100644
--- a/src/com/android/launcher3/notification/NotificationFooterLayout.java
+++ b/src/com/android/launcher3/notification/NotificationFooterLayout.java
@@ -141,6 +141,7 @@
icon.setBackground(info.getIconForBackground(getContext(), mBackgroundColor));
icon.setOnClickListener(info);
icon.setTag(info);
+ icon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
mIconRow.addView(icon, 0, mIconLayoutParams);
return icon;
}
diff --git a/src/com/android/launcher3/notification/NotificationItemView.java b/src/com/android/launcher3/notification/NotificationItemView.java
index dd272b3..997def2 100644
--- a/src/com/android/launcher3/notification/NotificationItemView.java
+++ b/src/com/android/launcher3/notification/NotificationItemView.java
@@ -77,6 +77,10 @@
mSwipeHelper.setDisableHardwareLayers(true);
}
+ public NotificationMainView getMainView() {
+ return mMainView;
+ }
+
public int getHeightMinusFooter() {
int footerHeight = mFooter.getParent() == null ? 0 : mFooter.getHeight();
return getHeight() - footerHeight;
diff --git a/src/com/android/launcher3/notification/NotificationMainView.java b/src/com/android/launcher3/notification/NotificationMainView.java
index d6e0272..0d6da77 100644
--- a/src/com/android/launcher3/notification/NotificationMainView.java
+++ b/src/com/android/launcher3/notification/NotificationMainView.java
@@ -122,7 +122,7 @@
@Override
public boolean canChildBeDismissed(View v) {
- return mNotificationInfo.dismissable;
+ return mNotificationInfo != null && mNotificationInfo.dismissable;
}
@Override
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index d4ee3b8..ccead37 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -114,7 +114,6 @@
mStartDragThreshold = getResources().getDimensionPixelSize(
R.dimen.deep_shortcuts_start_drag_threshold);
- // TODO: make sure the delegate works for all items, not just shortcuts.
mAccessibilityDelegate = new ShortcutMenuAccessibilityDelegate(mLauncher);
mIsRtl = Utilities.isRtl(getResources());
}
@@ -176,7 +175,7 @@
// Add dummy views first, and populate with real info when ready.
PopupPopulator.Item[] itemsToPopulate = PopupPopulator
.getItemsToPopulate(shortcutIds, notificationKeys, systemShortcuts);
- addDummyViews(originalIcon, itemsToPopulate, notificationKeys.size() > 1);
+ addDummyViews(itemsToPopulate, notificationKeys.size() > 1);
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
orientAboutIcon(originalIcon, arrowHeight + arrowVerticalOffset);
@@ -187,7 +186,7 @@
mNotificationItemView = null;
mShortcutsItemView = null;
itemsToPopulate = PopupPopulator.reverseItems(itemsToPopulate);
- addDummyViews(originalIcon, itemsToPopulate, notificationKeys.size() > 1);
+ addDummyViews(itemsToPopulate, notificationKeys.size() > 1);
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
orientAboutIcon(originalIcon, arrowHeight + arrowVerticalOffset);
@@ -204,6 +203,17 @@
updateNotificationHeader();
}
+ int numShortcuts = shortcutViews.size() + systemShortcutViews.size();
+ int numNotifications = notificationKeys.size();
+ if (numNotifications == 0) {
+ setContentDescription(getContext().getString(R.string.shortcuts_menu_description,
+ numShortcuts, originalIcon.getContentDescription().toString()));
+ } else {
+ setContentDescription(getContext().getString(
+ R.string.shortcuts_menu_with_notifications_description, numShortcuts,
+ numNotifications, originalIcon.getContentDescription().toString()));
+ }
+
// Add the arrow.
final int arrowHorizontalOffset = resources.getDimensionPixelSize(isAlignedWithStart() ?
R.dimen.popup_arrow_horizontal_offset_start :
@@ -225,8 +235,8 @@
systemShortcuts, systemShortcutViews));
}
- private void addDummyViews(BubbleTextView originalIcon,
- PopupPopulator.Item[] itemTypesToPopulate, boolean notificationFooterHasIcons) {
+ private void addDummyViews(PopupPopulator.Item[] itemTypesToPopulate,
+ boolean notificationFooterHasIcons) {
final Resources res = getResources();
final int spacing = res.getDimensionPixelSize(R.dimen.popup_items_spacing);
final LayoutInflater inflater = mLauncher.getLayoutInflater();
@@ -243,12 +253,14 @@
int footerHeight = notificationFooterHasIcons ?
res.getDimensionPixelSize(R.dimen.notification_footer_height) : 0;
item.findViewById(R.id.footer).getLayoutParams().height = footerHeight;
+ mNotificationItemView.getMainView().setAccessibilityDelegate(mAccessibilityDelegate);
+ } else if (itemTypeToPopulate == PopupPopulator.Item.SHORTCUT) {
+ item.setAccessibilityDelegate(mAccessibilityDelegate);
}
boolean shouldAddBottomMargin = nextItemTypeToPopulate != null
&& itemTypeToPopulate.isShortcut ^ nextItemTypeToPopulate.isShortcut;
- item.setAccessibilityDelegate(mAccessibilityDelegate);
if (itemTypeToPopulate.isShortcut) {
if (mShortcutsItemView == null) {
mShortcutsItemView = (ShortcutsItemView) inflater.inflate(
@@ -266,9 +278,6 @@
}
}
}
- // TODO: update this, since not all items are shortcuts
- setContentDescription(getContext().getString(R.string.shortcuts_menu_description,
- numItems, originalIcon.getContentDescription().toString()));
}
protected PopupItemView getItemViewAt(int index) {