Removing click-feedback shadow generation logic in BubbleTextView

Instead of animating the shadow, animating the icon scale. This avoids
unnecessary bitmap creating at app-launch and also plays nice with the
app-launch transition

Change-Id: I1d3d24bc7212a6d659855ff1002a45388e269e52
This commit is contained in:
Sunny Goyal
2018-03-05 12:54:24 -08:00
parent 85f1eed52d
commit 726bee7d5d
13 changed files with 68 additions and 522 deletions

View File

@@ -16,6 +16,11 @@
package com.android.launcher3.model;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -25,7 +30,6 @@ import android.content.IntentFilter;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.PackageInstaller;
import android.graphics.Bitmap;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.os.Handler;
import android.os.Process;
import android.os.UserHandle;
@@ -36,7 +40,6 @@ import android.util.MutableInt;
import com.android.launcher3.AllAppsList;
import com.android.launcher3.AppInfo;
import com.android.launcher3.ClickShadowView;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.IconCache;
import com.android.launcher3.InstallShortcutReceiver;
@@ -75,11 +78,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CancellationException;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
/**
* Runnable for the thread that loads the contents of the launcher:
* - workspace icons
@@ -146,9 +144,7 @@ public class LoaderTask implements Runnable {
TraceHelper.beginSection(TAG);
try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
TraceHelper.partitionSection(TAG, "step 1.1: loading UI resources");
loadUiResources();
TraceHelper.partitionSection(TAG, "step 1.2: loading workspace");
TraceHelper.partitionSection(TAG, "step 1.1: loading workspace");
loadWorkspace();
verifyNotStopped();
@@ -211,15 +207,6 @@ public class LoaderTask implements Runnable {
this.notify();
}
public void loadUiResources() {
if (Utilities.ATLEAST_OREO) {
LauncherIcons li = LauncherIcons.obtain(mApp.getContext());
ClickShadowView.setAdaptiveIconScaleFactor(li.getNormalizer()
.getScale(new AdaptiveIconDrawable(null, null), null, null, null));
li.recycle();
}
}
private void loadWorkspace() {
final Context context = mApp.getContext();
final ContentResolver contentResolver = context.getContentResolver();