summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/all_apps_discovery_item.xml5
-rw-r--r--res/layout/all_apps_discovery_loading_divider.xml4
-rw-r--r--res/values/colors.xml2
-rw-r--r--res/values/config.xml8
-rw-r--r--res/values/strings.xml10
-rw-r--r--res/xml/launcher_preferences.xml26
-rw-r--r--src/com/android/launcher3/BubbleTextView.java2
-rw-r--r--src/com/android/launcher3/LauncherModel.java20
-rw-r--r--src/com/android/launcher3/SettingsActivity.java47
-rw-r--r--src/com/android/launcher3/badge/BadgeRenderer.java14
-rw-r--r--src/com/android/launcher3/discovery/AppDiscoveryItemView.java2
-rw-r--r--src/com/android/launcher3/folder/FolderIcon.java3
-rw-r--r--src/com/android/launcher3/graphics/IconPalette.java6
13 files changed, 104 insertions, 45 deletions
diff --git a/res/layout/all_apps_discovery_item.xml b/res/layout/all_apps_discovery_item.xml
index 1a7eaa72d..3350530af 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 c7b5ad23d..1ad552142 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 58717c273..25893088d 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 19966f61c..e949d4b3b 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" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4bee87d33..f7c482567 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>
diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml
index 301bef104..876388363 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/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index cb40d3d5e..239bd2c30 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -453,7 +453,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
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);
}
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index e68e637c5..f881b380a 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1763,17 +1763,15 @@ public class LauncherModel extends BroadcastReceiver
}
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 7ae6b261d..0902b2029 100644
--- a/src/com/android/launcher3/SettingsActivity.java
+++ b/src/com/android/launcher3/SettingsActivity.java
@@ -34,6 +34,11 @@ import com.android.launcher3.graphics.IconShapeOverride;
* 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 class SettingsActivity extends Activity {
public static class LauncherSettingsFragment extends PreferenceFragment {
private SystemDisplayRotationLockObserver mRotationLockObserver;
+ private IconBadgingObserver mIconBadgingObserver;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -57,13 +63,14 @@ public class SettingsActivity extends Activity {
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 @@ public class SettingsActivity extends Activity {
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 @@ public class SettingsActivity extends Activity {
getActivity().getContentResolver().unregisterContentObserver(mRotationLockObserver);
mRotationLockObserver = null;
}
+ if (mIconBadgingObserver != null) {
+ getActivity().getContentResolver().unregisterContentObserver(mIconBadgingObserver);
+ mIconBadgingObserver = null;
+ }
super.onDestroy();
}
}
@@ -127,4 +147,29 @@ public class SettingsActivity extends Activity {
? 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/badge/BadgeRenderer.java b/src/com/android/launcher3/badge/BadgeRenderer.java
index ba1977af4..adde4a2fc 100644
--- a/src/com/android/launcher3/badge/BadgeRenderer.java
+++ b/src/com/android/launcher3/badge/BadgeRenderer.java
@@ -63,6 +63,7 @@ public class BadgeRenderer {
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 @@ public class BadgeRenderer {
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 @@ public class BadgeRenderer {
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 @@ public class BadgeRenderer {
-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 9bb3b100e..809d7249d 100644
--- a/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
+++ b/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
@@ -82,7 +82,7 @@ public class AppDiscoveryItemView extends RelativeLayout {
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 25123fb1d..0b356b52c 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.badge.FolderBadgeInfo;
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 @@ public class FolderIcon extends FrameLayout implements FolderListener {
// 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 0182e53b9..60ca7b236 100644
--- a/src/com/android/launcher3/graphics/IconPalette.java
+++ b/src/com/android/launcher3/graphics/IconPalette.java
@@ -49,7 +49,7 @@ public class IconPalette {
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 @@ public class IconPalette {
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);