mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
> Calculating extracted color during icon generation and storing it in model and DB > Removing unused logic avoid various types of badge rendering > Icons are badged with extracted colors, while folder is badged with theme color Bug: 35428783 Change-Id: I93e30c52fbded7515c3ae1778422e84672eafb56
114 lines
3.4 KiB
Java
114 lines
3.4 KiB
Java
/*
|
|
* Copyright (C) 2017 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.launcher3;
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
/**
|
|
* Represents an ItemInfo which also holds an icon.
|
|
*/
|
|
public abstract class ItemInfoWithIcon extends ItemInfo {
|
|
|
|
/**
|
|
* A bitmap version of the application icon.
|
|
*/
|
|
public Bitmap iconBitmap;
|
|
|
|
/**
|
|
* Dominant color in the {@link #iconBitmap}.
|
|
*/
|
|
public int iconColor;
|
|
|
|
/**
|
|
* Indicates whether we're using a low res icon
|
|
*/
|
|
public boolean usingLowResIcon;
|
|
|
|
/**
|
|
* Indicates that the icon is disabled due to safe mode restrictions.
|
|
*/
|
|
public static final int FLAG_DISABLED_SAFEMODE = 1 << 0;
|
|
|
|
/**
|
|
* Indicates that the icon is disabled as the app is not available.
|
|
*/
|
|
public static final int FLAG_DISABLED_NOT_AVAILABLE = 1 << 1;
|
|
|
|
/**
|
|
* Indicates that the icon is disabled as the app is suspended
|
|
*/
|
|
public static final int FLAG_DISABLED_SUSPENDED = 1 << 2;
|
|
|
|
/**
|
|
* Indicates that the icon is disabled as the user is in quiet mode.
|
|
*/
|
|
public static final int FLAG_DISABLED_QUIET_USER = 1 << 3;
|
|
|
|
/**
|
|
* Indicates that the icon is disabled as the publisher has disabled the actual shortcut.
|
|
*/
|
|
public static final int FLAG_DISABLED_BY_PUBLISHER = 1 << 4;
|
|
|
|
/**
|
|
* Indicates that the icon is disabled as the user partition is currently locked.
|
|
*/
|
|
public static final int FLAG_DISABLED_LOCKED_USER = 1 << 5;
|
|
|
|
public static final int FLAG_DISABLED_MASK = FLAG_DISABLED_SAFEMODE |
|
|
FLAG_DISABLED_NOT_AVAILABLE | FLAG_DISABLED_SUSPENDED |
|
|
FLAG_DISABLED_QUIET_USER | FLAG_DISABLED_BY_PUBLISHER | FLAG_DISABLED_LOCKED_USER;
|
|
|
|
/**
|
|
* The item points to a system app.
|
|
*/
|
|
public static final int FLAG_SYSTEM_YES = 1 << 6;
|
|
|
|
/**
|
|
* The item points to a non system app.
|
|
*/
|
|
public static final int FLAG_SYSTEM_NO = 1 << 7;
|
|
|
|
public static final int FLAG_SYSTEM_MASK = FLAG_SYSTEM_YES | FLAG_SYSTEM_NO;
|
|
|
|
/**
|
|
* Flag indicating that the icon is an {@link android.graphics.drawable.AdaptiveIconDrawable}
|
|
* that can be optimized in various way.
|
|
*/
|
|
public static final int FLAG_ADAPTIVE_ICON = 1 << 8;
|
|
|
|
/**
|
|
* Status associated with the system state of the underlying item. This is calculated every
|
|
* time a new info is created and not persisted on the disk.
|
|
*/
|
|
public int runtimeStatusFlags = 0;
|
|
|
|
protected ItemInfoWithIcon() { }
|
|
|
|
protected ItemInfoWithIcon(ItemInfoWithIcon info) {
|
|
super(info);
|
|
iconBitmap = info.iconBitmap;
|
|
iconColor = info.iconColor;
|
|
usingLowResIcon = info.usingLowResIcon;
|
|
runtimeStatusFlags = info.runtimeStatusFlags;
|
|
}
|
|
|
|
@Override
|
|
public boolean isDisabled() {
|
|
return (runtimeStatusFlags & FLAG_DISABLED_MASK) != 0;
|
|
}
|
|
}
|