File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -632,7 +632,41 @@ func (c *ResTableConfig) IsBetterThan(o *ResTableConfig, r *ResTableConfig) bool
632632 }
633633 }
634634
635- // TODO: screen type
635+ // screen type
636+ if c .Density != o .Density {
637+ h := int (c .Density )
638+ if h == 0 {
639+ h = 160
640+ }
641+ l := int (o .Density )
642+ if l == 0 {
643+ l = 160
644+ }
645+ blmBigger := true
646+ if l > h {
647+ h , l = l , h
648+ blmBigger = false
649+ }
650+
651+ reqValue := int (r .Density )
652+ if reqValue == 0 {
653+ reqValue = 160
654+ }
655+ if reqValue >= h {
656+ return blmBigger
657+ }
658+ if l >= reqValue {
659+ return ! blmBigger
660+ }
661+ if (2 * l - reqValue )* h > reqValue * reqValue {
662+ return ! blmBigger
663+ } else {
664+ return blmBigger
665+ }
666+ }
667+ if c .Touchscreen != o .Touchscreen && r .Touchscreen != 0 {
668+ return c .Touchscreen != 0
669+ }
636670
637671 // TODO: input
638672
@@ -745,6 +779,14 @@ func (c *ResTableConfig) Match(settings *ResTableConfig) bool {
745779 return false
746780 }
747781
782+ // screen type
783+ if c .Orientation != 0 && c .Orientation != settings .Orientation {
784+ return false
785+ }
786+ if c .Touchscreen != 0 && c .Touchscreen != settings .Touchscreen {
787+ return false
788+ }
789+
748790 // TODO: input
749791
750792 // screen size
You can’t perform that action at this time.
0 commit comments