Notification count support for Notification Dots (#2587)

* Add notification dot counter to preferences

Co-authored-by: Daria Hamrah Paytakht <info@dariarnd.ir>

* Add counter support to notification dots

Co-authored-by: Daria Hamrah Paytakht <info@dariarnd.ir>

Co-authored-by: Daria Hamrah Paytakht <info@dariarnd.ir>
This commit is contained in:
YASAN
2022-05-16 20:47:02 +04:30
committed by GitHub
parent 37c4bf7544
commit 074a102ded
9 changed files with 39 additions and 9 deletions

View File

@@ -31,8 +31,10 @@ import android.graphics.Path;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.util.DisplayMetrics;
import android.view.Surface;
import androidx.core.content.res.ResourcesCompat;
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.DevicePaddings.DevicePadding;
@@ -487,11 +489,20 @@ public class DeviceProfile {
flingToDeleteThresholdVelocity = res.getDimensionPixelSize(
R.dimen.drag_flingToDeleteMinVelocity);
// Check if notification dots should show the notification count
boolean showNotificationCount = PreferenceExtensionsKt.firstBlocking(preferenceManager2.getShowNotificationCount());
// Load the default font to use on notification dots
Typeface typeface = null;
if (showNotificationCount) {
typeface = ResourcesCompat.getFont(context, R.font.inter_regular);
}
// This is done last, after iconSizePx is calculated above.
Path dotPath = GraphicsUtils.getShapePath(DEFAULT_DOT_SIZE);
mDotRendererWorkSpace = new DotRenderer(iconSizePx, dotPath, DEFAULT_DOT_SIZE);
mDotRendererWorkSpace = new DotRenderer(iconSizePx, dotPath, DEFAULT_DOT_SIZE, showNotificationCount, typeface);
mDotRendererAllApps = iconSizePx == allAppsIconSizePx ? mDotRendererWorkSpace :
new DotRenderer(allAppsIconSizePx, dotPath, DEFAULT_DOT_SIZE);
new DotRenderer(allAppsIconSizePx, dotPath, DEFAULT_DOT_SIZE, showNotificationCount, typeface);
}
private int getHorizontalMarginPx(InvariantDeviceProfile idp, Resources res) {