mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
FastBitmapDrawable can draw an icon badge (notification count)
- Added BadgeInfo to contain data to be shown in a badge (currently just notification count). - Added BadgeRenderer in DeviceProfile to contain things relevant to drawing the badge, such as size and Paint's. - Added IconPalette to compute colors for the badge based on a dominant color (will also be used for notifications) - FastBitmapDrawable uses these classes to draw the badge. Bug: 32410600 Change-Id: I6595a4879943357590f7d20c22594691a573ecaf
This commit is contained in:
@@ -31,7 +31,7 @@ import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.launcher3.CellLayout.ContainerType;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.badge.BadgeRenderer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -136,6 +136,9 @@ public class DeviceProfile {
|
||||
// Listeners
|
||||
private ArrayList<LauncherLayoutChangeListener> mListeners = new ArrayList<>();
|
||||
|
||||
// Icon badges
|
||||
public BadgeRenderer mBadgeRenderer;
|
||||
|
||||
public DeviceProfile(Context context, InvariantDeviceProfile inv,
|
||||
Point minSize, Point maxSize,
|
||||
int width, int height, boolean isLandscape) {
|
||||
@@ -193,6 +196,10 @@ public class DeviceProfile {
|
||||
hotseatBarBottomPaddingPx = 0;
|
||||
hotseatLandGutterPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_gutter_width);
|
||||
|
||||
int badgeSize = res.getDimensionPixelSize(R.dimen.badge_size);
|
||||
int badgeTextSize = res.getDimensionPixelSize(R.dimen.badge_text_size);
|
||||
mBadgeRenderer = new BadgeRenderer(badgeSize, badgeTextSize);
|
||||
|
||||
// Determine sizes.
|
||||
widthPx = width;
|
||||
heightPx = height;
|
||||
|
||||
Reference in New Issue
Block a user