mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Manual revert due to conflict:
Revert "Load label in bg thread to prevent ANR b/27238970"
This reverts commit b62fd09576.
Change-Id: Ia751e3414fb24a18bb8bb9ca09dcd93d0e4249f6
This commit is contained in:
@@ -136,23 +136,32 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the widget provider info or the resolve info to the view.
|
||||
* Apply the widget provider info to the view.
|
||||
*/
|
||||
public void applyFromInfo(Object info, CharSequence label,
|
||||
WidgetPreviewLoader loader) {
|
||||
public void applyFromAppWidgetProviderInfo(LauncherAppWidgetProviderInfo info,
|
||||
WidgetPreviewLoader loader) {
|
||||
|
||||
InvariantDeviceProfile profile =
|
||||
LauncherAppState.getInstance().getInvariantDeviceProfile();
|
||||
mInfo = info;
|
||||
mWidgetName.setText(label);
|
||||
// TODO(hyunyoungs): setup a cache for these labels.
|
||||
mWidgetName.setText(AppWidgetManagerCompat.getInstance(getContext()).loadLabel(info));
|
||||
int hSpan = Math.min(info.spanX, profile.numColumns);
|
||||
int vSpan = Math.min(info.spanY, profile.numRows);
|
||||
mWidgetDims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
|
||||
mWidgetPreviewLoader = loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the resolve info to the view.
|
||||
*/
|
||||
public void applyFromResolveInfo(
|
||||
PackageManager pm, ResolveInfo info, WidgetPreviewLoader loader) {
|
||||
mInfo = info;
|
||||
CharSequence label = info.loadLabel(pm);
|
||||
mWidgetName.setText(label);
|
||||
mWidgetDims.setText(String.format(mDimensionsFormatString, 1, 1));
|
||||
mWidgetPreviewLoader = loader;
|
||||
if (info instanceof LauncherAppWidgetProviderInfo) {
|
||||
InvariantDeviceProfile profile =
|
||||
LauncherAppState.getInstance().getInvariantDeviceProfile();
|
||||
int hSpan = Math.min(((LauncherAppWidgetProviderInfo)info).spanX, profile.numColumns);
|
||||
int vSpan = Math.min(((LauncherAppWidgetProviderInfo)info).spanY, profile.numRows);
|
||||
mWidgetDims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
|
||||
}
|
||||
if (info instanceof ResolveInfo) {
|
||||
mWidgetDims.setText(String.format(mDimensionsFormatString, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getPreviewSize() {
|
||||
|
||||
Reference in New Issue
Block a user