Loading src/com/android/launcher3/BubbleTextView.java +11 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Region; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; Loading Loading @@ -187,6 +189,15 @@ public class BubbleTextView extends TextView verifyHighRes(); } /** * Used for measurement only, sets some dummy values on this view. */ public void applyDummyInfo() { ColorDrawable d = new ColorDrawable(); setIcon(mLauncher.resizeIconDrawable(d), mIconSize); setText(""); } /** * Overrides the default long press timeout. */ Loading src/com/android/launcher3/Launcher.java +2 −13 Original line number Diff line number Diff line Loading @@ -4678,18 +4678,6 @@ public class Launcher extends Activity UserHandleCompat.myUserHandle()); } /** * Generates a dummy AppInfo for us to use to calculate BubbleTextView sizes. */ public AppInfo createDummyAppInfo() { Intent intent = new Intent(); intent.setComponent(new ComponentName(this, Launcher.class)); PackageManager pm = getPackageManager(); ResolveInfo info = pm.resolveActivity(intent, 0); return new AppInfo(this, LauncherActivityInfoCompat.fromResolveInfo(info, this), UserHandleCompat.myUserHandle(), mIconCache); } // TODO: This method should be a part of LauncherSearchCallback public void startDrag(View dragView, ItemInfo dragInfo, DragSource source) { dragView.setTag(dragInfo); Loading Loading @@ -4721,8 +4709,9 @@ public class Launcher extends Activity /** * Resizes an icon drawable to the correct icon size. */ public void resizeIconDrawable(Drawable icon) { public Drawable resizeIconDrawable(Drawable icon) { icon.setBounds(0, 0, mDeviceProfile.iconSizePx, mDeviceProfile.iconSizePx); return icon; } /** Loading src/com/android/launcher3/allapps/AllAppsContainerView.java +8 −5 Original line number Diff line number Diff line Loading @@ -336,15 +336,18 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc // Precalculate the prediction icon and normal icon sizes LayoutInflater layoutInflater = LayoutInflater.from(getContext()); BubbleTextView icon = (BubbleTextView) layoutInflater.inflate(R.layout.all_apps_icon, this, false); icon.applyFromApplicationInfo(mLauncher.createDummyAppInfo()); BubbleTextView icon = (BubbleTextView) layoutInflater.inflate( R.layout.all_apps_icon, this, false); icon.applyDummyInfo(); icon.measure(MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST)); BubbleTextView predIcon = (BubbleTextView) layoutInflater.inflate(R.layout.all_apps_prediction_bar_icon, this, false); predIcon.applyFromApplicationInfo(mLauncher.createDummyAppInfo()); BubbleTextView predIcon = (BubbleTextView) layoutInflater.inflate( R.layout.all_apps_prediction_bar_icon, this, false); predIcon.applyDummyInfo(); predIcon.measure(MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST)); mAppsRecyclerView.setPremeasuredIconHeights(predIcon.getMeasuredHeight(), icon.getMeasuredHeight()); mAppsRecyclerView.setPremeasuredIconHeights(predIcon.getMeasuredHeight(), icon.getMeasuredHeight()); updateBackgroundAndPaddings(); } Loading Loading
src/com/android/launcher3/BubbleTextView.java +11 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Region; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; Loading Loading @@ -187,6 +189,15 @@ public class BubbleTextView extends TextView verifyHighRes(); } /** * Used for measurement only, sets some dummy values on this view. */ public void applyDummyInfo() { ColorDrawable d = new ColorDrawable(); setIcon(mLauncher.resizeIconDrawable(d), mIconSize); setText(""); } /** * Overrides the default long press timeout. */ Loading
src/com/android/launcher3/Launcher.java +2 −13 Original line number Diff line number Diff line Loading @@ -4678,18 +4678,6 @@ public class Launcher extends Activity UserHandleCompat.myUserHandle()); } /** * Generates a dummy AppInfo for us to use to calculate BubbleTextView sizes. */ public AppInfo createDummyAppInfo() { Intent intent = new Intent(); intent.setComponent(new ComponentName(this, Launcher.class)); PackageManager pm = getPackageManager(); ResolveInfo info = pm.resolveActivity(intent, 0); return new AppInfo(this, LauncherActivityInfoCompat.fromResolveInfo(info, this), UserHandleCompat.myUserHandle(), mIconCache); } // TODO: This method should be a part of LauncherSearchCallback public void startDrag(View dragView, ItemInfo dragInfo, DragSource source) { dragView.setTag(dragInfo); Loading Loading @@ -4721,8 +4709,9 @@ public class Launcher extends Activity /** * Resizes an icon drawable to the correct icon size. */ public void resizeIconDrawable(Drawable icon) { public Drawable resizeIconDrawable(Drawable icon) { icon.setBounds(0, 0, mDeviceProfile.iconSizePx, mDeviceProfile.iconSizePx); return icon; } /** Loading
src/com/android/launcher3/allapps/AllAppsContainerView.java +8 −5 Original line number Diff line number Diff line Loading @@ -336,15 +336,18 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc // Precalculate the prediction icon and normal icon sizes LayoutInflater layoutInflater = LayoutInflater.from(getContext()); BubbleTextView icon = (BubbleTextView) layoutInflater.inflate(R.layout.all_apps_icon, this, false); icon.applyFromApplicationInfo(mLauncher.createDummyAppInfo()); BubbleTextView icon = (BubbleTextView) layoutInflater.inflate( R.layout.all_apps_icon, this, false); icon.applyDummyInfo(); icon.measure(MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST)); BubbleTextView predIcon = (BubbleTextView) layoutInflater.inflate(R.layout.all_apps_prediction_bar_icon, this, false); predIcon.applyFromApplicationInfo(mLauncher.createDummyAppInfo()); BubbleTextView predIcon = (BubbleTextView) layoutInflater.inflate( R.layout.all_apps_prediction_bar_icon, this, false); predIcon.applyDummyInfo(); predIcon.measure(MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST)); mAppsRecyclerView.setPremeasuredIconHeights(predIcon.getMeasuredHeight(), icon.getMeasuredHeight()); mAppsRecyclerView.setPremeasuredIconHeights(predIcon.getMeasuredHeight(), icon.getMeasuredHeight()); updateBackgroundAndPaddings(); } Loading