mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Use correct config.smallestScreenWidthDp when creating Resource in DeviceProfile
- This is a regression from ag/17070486 when tested, likely because DeviceProfiles are no longer re-created when changing display sizes, so correct values need to be calculated on the starting state Bug: 221961069 Test: verify smallestWidth specific resource on changing display sizes Change-Id: I1539bad4b35b36f0056d59307ab5fbec23a71f49
This commit is contained in:
@@ -257,7 +257,8 @@ public class DeviceProfile {
|
||||
// Some more constants.
|
||||
context = getContext(context, info, isVerticalBarLayout() || (isTablet && isLandscape)
|
||||
? Configuration.ORIENTATION_LANDSCAPE
|
||||
: Configuration.ORIENTATION_PORTRAIT);
|
||||
: Configuration.ORIENTATION_PORTRAIT,
|
||||
windowBounds);
|
||||
final Resources res = context.getResources();
|
||||
mMetrics = res.getDisplayMetrics();
|
||||
|
||||
@@ -1231,10 +1232,11 @@ public class DeviceProfile {
|
||||
writer.println(prefix + pxToDpStr("overviewGridSideMargin", overviewGridSideMargin));
|
||||
}
|
||||
|
||||
private static Context getContext(Context c, Info info, int orientation) {
|
||||
private static Context getContext(Context c, Info info, int orientation, WindowBounds bounds) {
|
||||
Configuration config = new Configuration(c.getResources().getConfiguration());
|
||||
config.orientation = orientation;
|
||||
config.densityDpi = info.densityDpi;
|
||||
config.smallestScreenWidthDp = (int) info.smallestSizeDp(bounds);
|
||||
return c.createConfigurationContext(config);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user