@@ -1442,9 +1442,10 @@ public ConfigurationInfo getDeviceConfigurationInfo() {
14421442 public int getLauncherLargeIconDensity () {
14431443 final Resources res = mContext .getResources ();
14441444 final int density = res .getDisplayMetrics ().densityDpi ;
1445+ final int sw = res .getConfiguration ().smallestScreenWidthDp ;
14451446
1446- if (( res . getConfiguration (). screenLayout & Configuration . SCREENLAYOUT_SIZE_MASK )
1447- != Configuration . SCREENLAYOUT_SIZE_XLARGE ) {
1447+ if (sw < 600 ) {
1448+ // Smaller than approx 7" tablets, use the regular icon size.
14481449 return density ;
14491450 }
14501451
@@ -1456,9 +1457,13 @@ public int getLauncherLargeIconDensity() {
14561457 case DisplayMetrics .DENSITY_HIGH :
14571458 return DisplayMetrics .DENSITY_XHIGH ;
14581459 case DisplayMetrics .DENSITY_XHIGH :
1459- return DisplayMetrics .DENSITY_MEDIUM * 2 ;
1460+ return DisplayMetrics .DENSITY_XXHIGH ;
1461+ case DisplayMetrics .DENSITY_XXHIGH :
1462+ return DisplayMetrics .DENSITY_XHIGH * 2 ;
14601463 default :
1461- return density ;
1464+ // The density is some abnormal value. Return some other
1465+ // abnormal value that is a reasonable scaling of it.
1466+ return (int )(density *1.5f );
14621467 }
14631468 }
14641469
@@ -1471,9 +1476,10 @@ public int getLauncherLargeIconDensity() {
14711476 public int getLauncherLargeIconSize () {
14721477 final Resources res = mContext .getResources ();
14731478 final int size = res .getDimensionPixelSize (android .R .dimen .app_icon_size );
1479+ final int sw = res .getConfiguration ().smallestScreenWidthDp ;
14741480
1475- if (( res . getConfiguration (). screenLayout & Configuration . SCREENLAYOUT_SIZE_MASK )
1476- != Configuration . SCREENLAYOUT_SIZE_XLARGE ) {
1481+ if (sw < 600 ) {
1482+ // Smaller than approx 7" tablets, use the regular icon size.
14771483 return size ;
14781484 }
14791485
@@ -1487,9 +1493,13 @@ public int getLauncherLargeIconSize() {
14871493 case DisplayMetrics .DENSITY_HIGH :
14881494 return (size * DisplayMetrics .DENSITY_XHIGH ) / DisplayMetrics .DENSITY_HIGH ;
14891495 case DisplayMetrics .DENSITY_XHIGH :
1490- return (size * DisplayMetrics .DENSITY_MEDIUM * 2 ) / DisplayMetrics .DENSITY_XHIGH ;
1496+ return (size * DisplayMetrics .DENSITY_XXHIGH ) / DisplayMetrics .DENSITY_XHIGH ;
1497+ case DisplayMetrics .DENSITY_XXHIGH :
1498+ return (size * DisplayMetrics .DENSITY_XHIGH *2 ) / DisplayMetrics .DENSITY_XXHIGH ;
14911499 default :
1492- return size ;
1500+ // The density is some abnormal value. Return some other
1501+ // abnormal value that is a reasonable scaling of it.
1502+ return (int )(size *1.5f );
14931503 }
14941504 }
14951505
0 commit comments