mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +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:
@@ -345,16 +345,21 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
* Returns {@code true} if the bounds represent a tablet.
|
||||
*/
|
||||
public boolean isTablet(WindowBounds bounds) {
|
||||
return dpiFromPx(Math.min(bounds.bounds.width(), bounds.bounds.height()),
|
||||
densityDpi) >= MIN_TABLET_WIDTH;
|
||||
return smallestSizeDp(bounds) >= MIN_TABLET_WIDTH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the bounds represent a large tablet.
|
||||
*/
|
||||
public boolean isLargeTablet(WindowBounds bounds) {
|
||||
return dpiFromPx(Math.min(bounds.bounds.width(), bounds.bounds.height()),
|
||||
densityDpi) >= MIN_LARGE_TABLET_WIDTH;
|
||||
return smallestSizeDp(bounds) >= MIN_LARGE_TABLET_WIDTH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns smallest size in dp for given bounds.
|
||||
*/
|
||||
public float smallestSizeDp(WindowBounds bounds) {
|
||||
return dpiFromPx(Math.min(bounds.bounds.width(), bounds.bounds.height()), densityDpi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user