Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d36d4f3f authored by Jeremy Sim's avatar Jeremy Sim Committed by Vinit Nayak
Browse files

Fix bug where app pair icons were appearing empty

Using similar logic as other BubbleTextViews, checks for PlaceholderIconDrawables and redraws the icons if needed.

Fixes: 316041983
Test: Manual and presubmit tested
Flag: ACONFIG com.android.wm.shell.enable_app_pairs TEAMFOOD
Change-Id: I017f1d5597fd28d37ca9a8a5758f33468e46f384
parent a85fa488
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.util.Log
import android.view.Gravity
import android.widget.FrameLayout
import com.android.launcher3.DeviceProfile
import com.android.launcher3.icons.PlaceHolderIconDrawable
import com.android.launcher3.model.data.WorkspaceItemInfo

/**
@@ -94,8 +95,16 @@ class AppPairIconGraphic @JvmOverloads constructor(context: Context, attrs: Attr
            return
        }

        appIcon1 = parentIcon.info.contents[0].newIcon(context)
        appIcon2 = parentIcon.info.contents[1].newIcon(context)
        // Generate new icons
        val newIcon1 = parentIcon.info.contents[0].newIcon(context)
        val newIcon2 = parentIcon.info.contents[1].newIcon(context)

        // If app icons did not draw fully last time, animate to full icon
        (appIcon1 as? PlaceHolderIconDrawable)?.animateIconUpdate(newIcon1)
        (appIcon2 as? PlaceHolderIconDrawable)?.animateIconUpdate(newIcon2)

        appIcon1 = newIcon1
        appIcon2 = newIcon2
        appIcon1?.setBounds(0, 0, memberIconSize.toInt(), memberIconSize.toInt())
        appIcon2?.setBounds(0, 0, memberIconSize.toInt(), memberIconSize.toInt())
    }
@@ -126,6 +135,16 @@ class AppPairIconGraphic @JvmOverloads constructor(context: Context, attrs: Attr
        // Draw background
        appPairBackground.draw(canvas)

        // Make sure icons are loaded
        if (
            appIcon1 == null ||
                appIcon2 == null ||
                appIcon1 is PlaceHolderIconDrawable ||
                appIcon2 is PlaceHolderIconDrawable
        ) {
            applyIcons(parentIcon.info.contents)
        }

        // Draw first icon
        canvas.save()
        // The app icons are placed differently depending on device orientation.