mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Resize preview for correct clipping
Before, the remote view for the widget in launcher is reused to generate a new preview. However, measuring the view without changing the scale would cause strange clippings. This CL sets the scale of the widget views by manually computing the size ratio. Change ag/19572297 is necessary before a complete clean-up. Test: Create a weather widget on first screen -> go to Wallpaper & style -> App grid -> tap on a different grid and verify that the clipping is correct Fix: 228328759 Change-Id: I8242d3bcfcf30ec924552c1320e22f8a3592f1c1
This commit is contained in:
@@ -44,6 +44,7 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
@@ -369,7 +370,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
float scale = 1;
|
||||
if (isWidget) {
|
||||
DeviceProfile profile = mLauncher.getDeviceProfile();
|
||||
scale = Utilities.shrinkRect(r, profile.appWidgetScale.x, profile.appWidgetScale.y);
|
||||
final PointF appWidgetScale = profile.getAppWidgetScale(null);
|
||||
scale = Utilities.shrinkRect(r, appWidgetScale.x, appWidgetScale.y);
|
||||
}
|
||||
size[0] = r.width();
|
||||
size[1] = r.height();
|
||||
@@ -2883,7 +2885,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
r.top -= widgetPadding.top;
|
||||
r.bottom += widgetPadding.bottom;
|
||||
}
|
||||
Utilities.shrinkRect(r, profile.appWidgetScale.x, profile.appWidgetScale.y);
|
||||
PointF appWidgetScale = profile.getAppWidgetScale(null);
|
||||
Utilities.shrinkRect(r, appWidgetScale.x, appWidgetScale.y);
|
||||
}
|
||||
|
||||
mTempFXY[0] = r.left;
|
||||
|
||||
Reference in New Issue
Block a user