mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Add NotificationListener to launcher.
- NotificationListener extends NotificationListenerService, and is added to the manifest. - Added PopupDataProvider, which contains logic for storing and interacting with data that goes into the long-press popup menu (shortcuts and notifications). A follow-up CL will rename DeepShortcutsContainer to a generic PopupContainerWithArrow. - If Launcher has notification access, NotificationListener will get callbacks when notifications are posted and removed; upon receiving these callbacks, NotificationListener passes them to PopupDataProvider via a NotificationsChangedListener interface. - Upon receiving the changed notifications, PopupDataProvider maps them to the corresponding package/user and tells launcher to update relevant icons on the workspace and all apps. This is guarded by FeatureFlags.BADGE_ICONS. Bug: 32410600 Change-Id: I59aeb31a7f92399c9c4b831ab551e51e13f44f5c
This commit is contained in:
@@ -39,14 +39,16 @@ import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.IconCache.IconLoadRequest;
|
||||
import com.android.launcher3.IconCache.ItemInfoUpdateReceiver;
|
||||
import com.android.launcher3.badge.BadgeRenderer;
|
||||
import com.android.launcher3.badge.BadgeInfo;
|
||||
import com.android.launcher3.badge.BadgeRenderer;
|
||||
import com.android.launcher3.badging.NotificationInfo;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.graphics.DrawableFactory;
|
||||
import com.android.launcher3.graphics.HolographicOutlineHelper;
|
||||
import com.android.launcher3.model.PackageItemInfo;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TextView that draws a bubble behind the text. We cannot use a LineBackgroundSpan
|
||||
@@ -168,6 +170,8 @@ public class BubbleTextView extends TextView
|
||||
if (promiseStateChanged || info.isPromise()) {
|
||||
applyPromiseState(promiseStateChanged);
|
||||
}
|
||||
|
||||
applyBadgeState(info);
|
||||
}
|
||||
|
||||
public void applyFromApplicationInfo(AppInfo info) {
|
||||
@@ -178,6 +182,8 @@ public class BubbleTextView extends TextView
|
||||
|
||||
// Verify high res immediately
|
||||
verifyHighRes();
|
||||
|
||||
applyBadgeState(info);
|
||||
}
|
||||
|
||||
public void applyFromPackageItemInfo(PackageItemInfo info) {
|
||||
@@ -502,8 +508,9 @@ public class BubbleTextView extends TextView
|
||||
}
|
||||
}
|
||||
|
||||
public void applyBadgeState(BadgeInfo badgeInfo) {
|
||||
public void applyBadgeState(ItemInfo itemInfo) {
|
||||
if (mIcon instanceof FastBitmapDrawable) {
|
||||
BadgeInfo badgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo);
|
||||
BadgeRenderer badgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer;
|
||||
((FastBitmapDrawable) mIcon).applyIconBadge(badgeInfo, badgeRenderer);
|
||||
}
|
||||
@@ -634,7 +641,8 @@ public class BubbleTextView extends TextView
|
||||
* Returns true if the view can show custom shortcuts.
|
||||
*/
|
||||
public boolean hasDeepShortcuts() {
|
||||
return !mLauncher.getShortcutIdsForItem((ItemInfo) getTag()).isEmpty();
|
||||
return !mLauncher.getPopupDataProvider().getShortcutIdsForItem((ItemInfo) getTag())
|
||||
.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user