File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,10 +113,9 @@ type ResTableConfig struct {
113113 MinorVersion uint16
114114
115115 // screen config
116- ScreenLayout uint8
117- UIMode uint8
118- ScreenConfigPad1 uint8
119- ScreenConfigPad2 uint8
116+ ScreenLayout uint8
117+ UIMode uint8
118+ SmallestScreenWidthDp uint16
120119}
121120
122121type TableType struct {
@@ -389,6 +388,18 @@ func (c *ResTableConfig) IsMoreSpecificThan(o *ResTableConfig) bool {
389388 }
390389 }
391390
391+ // smallest screen width dp
392+ if c .SmallestScreenWidthDp != 0 || o .SmallestScreenWidthDp != 0 {
393+ if c .SmallestScreenWidthDp != o .SmallestScreenWidthDp {
394+ if c .SmallestScreenWidthDp != 0 {
395+ return false
396+ }
397+ if o .SmallestScreenWidthDp != 0 {
398+ return true
399+ }
400+ }
401+ }
402+
392403 // screen layout
393404 if c .ScreenLayout != 0 || o .ScreenLayout != 0 {
394405 if ((c .ScreenLayout ^ o .ScreenLayout ) & MASK_SCREENSIZE ) != 0 {
@@ -525,6 +536,13 @@ func (c *ResTableConfig) IsBetterThan(o *ResTableConfig, r *ResTableConfig) bool
525536 }
526537 }
527538
539+ // smallest screen width dp
540+ if c .SmallestScreenWidthDp != 0 || o .SmallestScreenWidthDp != 0 {
541+ if c .SmallestScreenWidthDp != o .SmallestScreenWidthDp {
542+ return c .SmallestScreenWidthDp > o .SmallestScreenWidthDp
543+ }
544+ }
545+
528546 // screen layout
529547 if c .ScreenLayout != 0 || o .ScreenLayout != 0 {
530548 mySL := c .ScreenLayout & MASK_SCREENSIZE
@@ -653,6 +671,12 @@ func (c *ResTableConfig) Match(settings *ResTableConfig) bool {
653671 return false
654672 }
655673
674+ // smallest screen width dp
675+ if c .SmallestScreenWidthDp != 0 &&
676+ c .SmallestScreenWidthDp > settings .SmallestScreenWidthDp {
677+ return false
678+ }
679+
656680 // TODO: input
657681
658682 // screen size
You can’t perform that action at this time.
0 commit comments