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

Commit 05d54240 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge changes I21801b63,I017f1d55 into main

* changes:
  App pairs: themed icons
  Fix bug where app pair icons were appearing empty
parents 943843a2 14424e9e
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -25,7 +25,10 @@ import android.util.Log
import android.view.Gravity
import android.widget.FrameLayout
import com.android.launcher3.DeviceProfile
import com.android.launcher3.icons.BitmapInfo
import com.android.launcher3.icons.PlaceHolderIconDrawable
import com.android.launcher3.model.data.WorkspaceItemInfo
import com.android.launcher3.util.Themes

/**
 * A FrameLayout marking the area on an [AppPairIcon] where the visual icon will be drawn. One of
@@ -94,8 +97,17 @@ 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, using themed flag if needed
        val flags = if (Themes.isThemedIconEnabled(context)) BitmapInfo.FLAG_THEMED else 0
        val newIcon1 = parentIcon.info.contents[0].newIcon(context, flags)
        val newIcon2 = parentIcon.info.contents[1].newIcon(context, flags)

        // 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 +138,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.