@@ -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
@@ -1458,7 +1459,9 @@ public int getLauncherLargeIconDensity() {
14581459 case DisplayMetrics .DENSITY_XHIGH :
14591460 return DisplayMetrics .DENSITY_MEDIUM * 2 ;
14601461 default :
1461- return density ;
1462+ // The density is some abnormal value. Return some other
1463+ // abnormal value that is a reasonable scaling of it.
1464+ return (int )(density *1.5f );
14621465 }
14631466 }
14641467
@@ -1471,9 +1474,10 @@ public int getLauncherLargeIconDensity() {
14711474 public int getLauncherLargeIconSize () {
14721475 final Resources res = mContext .getResources ();
14731476 final int size = res .getDimensionPixelSize (android .R .dimen .app_icon_size );
1477+ final int sw = res .getConfiguration ().smallestScreenWidthDp ;
14741478
1475- if (( res . getConfiguration (). screenLayout & Configuration . SCREENLAYOUT_SIZE_MASK )
1476- != Configuration . SCREENLAYOUT_SIZE_XLARGE ) {
1479+ if (sw < 600 ) {
1480+ // Smaller than approx 7" tablets, use the regular icon size.
14771481 return size ;
14781482 }
14791483
@@ -1489,7 +1493,9 @@ public int getLauncherLargeIconSize() {
14891493 case DisplayMetrics .DENSITY_XHIGH :
14901494 return (size * DisplayMetrics .DENSITY_MEDIUM * 2 ) / DisplayMetrics .DENSITY_XHIGH ;
14911495 default :
1492- return size ;
1496+ // The density is some abnormal value. Return some other
1497+ // abnormal value that is a reasonable scaling of it.
1498+ return (int )(size *1.5f );
14931499 }
14941500 }
14951501
0 commit comments