| | | |
Offset 1, 38 lines modified | Offset 1, 28 lines modified |
| |
1 | package·androidx.core.view; | 1 | package·androidx.core.view; |
| |
2 | import·androidx.core.util.ObjectsCompat; | 2 | import·androidx.core.util.ObjectsCompat; |
3 | import·android.graphics.Rect; | |
4 | import·androidx.core.util.Preconditions; | 3 | import·androidx.core.util.Preconditions; |
5 | import·android.view.View; | |
6 | import·androidx.core.graphics.Insets; | 4 | import·androidx.core.graphics.Insets; |
7 | import·android.view.WindowInsets; | |
8 | import·android.os.Build$VERSION; | 5 | import·android.os.Build$VERSION; |
| 6 | import·android.view.WindowInsets; |
| |
9 | public·class·WindowInsetsCompat | 7 | public·class·WindowInsetsCompat |
10 | { | 8 | { |
11 | ····public·static·final·WindowInsetsCompat·CONSUMED; | 9 | ····public·static·final·WindowInsetsCompat·CONSUMED; |
12 | ····private·final·WindowInsetsCompat$Impl·mImpl; | 10 | ····private·final·WindowInsetsCompat$Impl·mImpl; |
13 | ···· | 11 | ···· |
14 | ····static·{ | 12 | ····static·{ |
15 | ········if·(Build$VERSION.SDK_INT·>=·30)·{ | 13 | ········CONSUMED·=·new·WindowInsetsCompat$Builder().build().consumeDisplayCutout().consumeStableInsets().consumeSystemWindowInsets(); |
16 | ············CONSUMED·=·WindowInsetsCompat$Impl30.CONSUMED; | |
17 | ········} | |
18 | ········else·{ | |
19 | ············CONSUMED·=·WindowInsetsCompat$Impl.CONSUMED; | |
20 | ········} | |
21 | ····} | 14 | ····} |
22 | ···· | 15 | ···· |
23 | ····private·WindowInsetsCompat(final·WindowInsets·windowInsets)·{ | 16 | ····private·WindowInsetsCompat(final·WindowInsets·windowInsets)·{ |
24 | ········final·int·sdk_INT·=·Build$VERSION.SDK_INT; | 17 | ········final·int·sdk_INT·=·Build$VERSION.SDK_INT; |
25 | ········if·(sdk_INT·>=·30)·{ | 18 | ········if·(sdk_INT·>=·29)·{ |
26 | ············this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl30(this,·windowInsets); | |
27 | ········} | |
28 | ········else·if·(sdk_INT·>=·29)·{ | |
29 | ············this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl29(this,·windowInsets); | 19 | ············this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl29(this,·windowInsets); |
30 | ········} | 20 | ········} |
31 | ········else·if·(sdk_INT·>=·28)·{ | 21 | ········else·if·(sdk_INT·>=·28)·{ |
32 | ············this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl28(this,·windowInsets); | 22 | ············this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl28(this,·windowInsets); |
33 | ········} | 23 | ········} |
34 | ········else·if·(sdk_INT·>=·21)·{ | 24 | ········else·if·(sdk_INT·>=·21)·{ |
35 | ············this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl21(this,·windowInsets); | 25 | ············this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl21(this,·windowInsets); |
Offset 45, 33 lines modified | Offset 35, 29 lines modified |
45 | ········} | 35 | ········} |
46 | ····} | 36 | ····} |
47 | ···· | 37 | ···· |
48 | ····public·WindowInsetsCompat(final·WindowInsetsCompat·windowInsetsCompat)·{ | 38 | ····public·WindowInsetsCompat(final·WindowInsetsCompat·windowInsetsCompat)·{ |
49 | ········final·int·sdk_INT·=·Build$VERSION.SDK_INT; | 39 | ········final·int·sdk_INT·=·Build$VERSION.SDK_INT; |
50 | ········if·(windowInsetsCompat·!=·null)·{ | 40 | ········if·(windowInsetsCompat·!=·null)·{ |
51 | ············final·WindowInsetsCompat$Impl·mImpl·=·windowInsetsCompat.mImpl; | 41 | ············final·WindowInsetsCompat$Impl·mImpl·=·windowInsetsCompat.mImpl; |
52 | ············if·(sdk_INT·>=·30·&&·mImpl·instanceof·WindowInsetsCompat$Impl30)·{ | 42 | ············if·(sdk_INT·>=·29·&&·mImpl·instanceof·WindowInsetsCompat$Impl29)·{ |
53 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl30(this,·(WindowInsetsCompat$Impl30)mImpl); | |
54 | ············} | |
55 | ············else·if·(sdk_INT·>=·29·&&·mImpl·instanceof·WindowInsetsCompat$Impl29)·{ | |
56 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl29(this,·(WindowInsetsCompat$Impl29)mImpl); | 43 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl29(this,·(WindowInsetsCompat$Impl29)mImpl); |
57 | ············} | 44 | ············} |
58 | ············else·if·(sdk_INT·>=·28·&&·mImpl·instanceof·WindowInsetsCompat$Impl28)·{ | 45 | ············else·if·(sdk_INT·>=·28·&&·mImpl·instanceof·WindowInsetsCompat$Impl28)·{ |
59 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl28(this,·(WindowInsetsCompat$Impl28)mImpl); | 46 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl28(this,·(WindowInsetsCompat$Impl28)mImpl); |
60 | ············} | 47 | ············} |
61 | ············else·if·(sdk_INT·>=·21·&&·mImpl·instanceof·WindowInsetsCompat$Impl21)·{ | 48 | ············else·if·(sdk_INT·>=·21·&&·mImpl·instanceof·WindowInsetsCompat$Impl21)·{ |
62 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl21(this,·(WindowInsetsCompat$Impl21)mImpl); | 49 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl21(this,·(WindowInsetsCompat$Impl21)mImpl); |
63 | ············} | 50 | ············} |
64 | ············else·if·(sdk_INT·>=·20·&&·mImpl·instanceof·WindowInsetsCompat$Impl20)·{ | 51 | ············else·if·(sdk_INT·>=·20·&&·mImpl·instanceof·WindowInsetsCompat$Impl20)·{ |
65 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl20(this,·(WindowInsetsCompat$Impl20)mImpl); | 52 | ················this.mImpl·=·(WindowInsetsCompat$Impl)new·WindowInsetsCompat$Impl20(this,·(WindowInsetsCompat$Impl20)mImpl); |
66 | ············} | 53 | ············} |
67 | ············else·{ | 54 | ············else·{ |
68 | ················this.mImpl·=·new·WindowInsetsCompat$Impl(this); | 55 | ················this.mImpl·=·new·WindowInsetsCompat$Impl(this); |
69 | ············} | 56 | ············} |
70 | ············((WindowInsetsCompat$Impl)mImpl).copyWindowDataInto(this); | |
71 | ········} | 57 | ········} |
72 | ········else·{ | 58 | ········else·{ |
73 | ············this.mImpl·=·new·WindowInsetsCompat$Impl(this); | 59 | ············this.mImpl·=·new·WindowInsetsCompat$Impl(this); |
74 | ········} | 60 | ········} |
75 | ····} | 61 | ····} |
76 | ···· | 62 | ···· |
77 | ····static·Insets·insetInsets(final·Insets·insets,·final·int·n,·final·int·n2,·final·int·n3,·final·int·n4)·{ | 63 | ····static·Insets·insetInsets(final·Insets·insets,·final·int·n,·final·int·n2,·final·int·n3,·final·int·n4)·{ |
Offset 81, 65 lines modified | Offset 67, 54 lines modified |
81 | ········final·int·max4·=·Math.max(0,·insets.bottom·-·n4); | 67 | ········final·int·max4·=·Math.max(0,·insets.bottom·-·n4); |
82 | ········if·(max·==·n·&&·max2·==·n2·&&·max3·==·n3·&&·max4·==·n4)·{ | 68 | ········if·(max·==·n·&&·max2·==·n2·&&·max3·==·n3·&&·max4·==·n4)·{ |
83 | ············return·insets; | 69 | ············return·insets; |
84 | ········} | 70 | ········} |
85 | ········return·Insets.of(max,·max2,·max3,·max4); | 71 | ········return·Insets.of(max,·max2,·max3,·max4); |
86 | ····} | 72 | ····} |
87 | ···· | 73 | ···· |
88 | ····public·static·WindowInsetsCompat·toWindowInsetsCompat(final·WindowInsets·windowInsets)·{ | 74 | ····public·static·WindowInsetsCompat·toWindowInsetsCompat(WindowInsets·windowInsets)·{ |
89 | ········return·toWindowInsetsCompat(windowInsets,·null); | |
90 | ····} | |
91 | ···· | |
92 | ····public·static·WindowInsetsCompat·toWindowInsetsCompat(WindowInsets·windowInsets,·final·View·view)·{ | |
93 | ········Preconditions.checkNotNull((Object)windowInsets); | 75 | ········Preconditions.checkNotNull((Object)windowInsets); |
94 | ········windowInsets·=·windowInsets; | 76 | ········windowInsets·=·windowInsets; |
95 | ········final·WindowInsetsCompat·windowInsetsCompat·=·new·WindowInsetsCompat(windowInsets); | 77 | ········return·new·WindowInsetsCompat(windowInsets); |
96 | ········if·(view·!=·null·&&·view.isAttachedToWindow())·{ | |
97 | ············windowInsetsCompat.setRootWindowInsets(ViewCompat.getRootWindowInsets(view)); | |
98 | ············windowInsetsCompat.copyRootViewBounds(view.getRootView()); | |
99 | ········} | |
100 | ········return·windowInsetsCompat; | |
101 | ····} | 78 | ····} |
102 | ···· | 79 | ···· |
103 | ····public·WindowInsetsCompat·consumeDisplayCutout()·{ | 80 | ····public·WindowInsetsCompat·consumeDisplayCutout()·{ |
104 | ········return·this.mImpl.consumeDisplayCutout(); | 81 | ········return·this.mImpl.consumeDisplayCutout(); |
105 | ····} | 82 | ····} |
106 | ···· | 83 | ···· |
107 | ····public·WindowInsetsCompat·consumeStableInsets()·{ | 84 | ····public·WindowInsetsCompat·consumeStableInsets()·{ |
108 | ········return·this.mImpl.consumeStableInsets(); | 85 | ········return·this.mImpl.consumeStableInsets(); |
109 | ····} | 86 | ····} |
110 | ···· | 87 | ···· |
111 | ····public·WindowInsetsCompat·consumeSystemWindowInsets()·{ | 88 | ····public·WindowInsetsCompat·consumeSystemWindowInsets()·{ |
112 | ········return·this.mImpl.consumeSystemWindowInsets(); | 89 | ········return·this.mImpl.consumeSystemWindowInsets(); |
113 | ····} | 90 | ····} |
114 | ···· | 91 | ···· |
115 | ····void·copyRootViewBounds(final·View·view)·{ | |
116 | ········final·Rect·rect·=·new·Rect(); | |
117 | ········view.getWindowVisibleDisplayFrame(rect); | |
118 | ········this.setRootViewData(rect,·view.getHeight()); | |
119 | ····} | |
120 | ···· | |
121 | ····public·boolean·equals(final·Object·o)·{ | 92 | ····public·boolean·equals(final·Object·o)·{ |
122 | ········return·this·==·o·||·(o·instanceof·WindowInsetsCompat·&&·ObjectsCompat.equals((Object)this.mImpl,·(Object)((WindowInsetsCompat)o).mImpl)); | 93 | ········return·this·==·o·||·(o·instanceof·WindowInsetsCompat·&&·ObjectsCompat.equals((Object)this.mImpl,·(Object)((WindowInsetsCompat)o).mImpl)); |
123 | ····} | 94 | ····} |
124 | ···· | 95 | ···· |
125 | ····public·int·getSystemWindowInsetBottom()·{ | 96 | ····public·int·getSystemWindowInsetBottom()·{ |
126 | ········return·this.mImpl.getSystemWindowInsets().bottom; | 97 | ········return·this.getSystemWindowInsets().bottom; |
127 | ····} | 98 | ····} |
128 | ···· | 99 | ···· |
129 | ····public·int·getSystemWindowInsetLeft()·{ | 100 | ····public·int·getSystemWindowInsetLeft()·{ |
130 | ········return·this.mImpl.getSystemWindowInsets().left; | 101 | ········return·this.getSystemWindowInsets().left; |
131 | ····} | 102 | ····} |
132 | ···· | 103 | ···· |
133 | ····public·int·getSystemWindowInsetRight()·{ | 104 | ····public·int·getSystemWindowInsetRight()·{ |
134 | ········return·this.mImpl.getSystemWindowInsets().right; | 105 | ········return·this.getSystemWindowInsets().right; |
135 | ····} | 106 | ····} |
136 | ···· | 107 | ···· |
137 | ····public·int·getSystemWindowInsetTop()·{ | 108 | ····public·int·getSystemWindowInsetTop()·{ |
138 | ········return·this.mImpl.getSystemWindowInsets().top; | 109 | ········return·this.getSystemWindowInsets().top; |
| 110 | ····} |
| 111 | ···· |
| 112 | ····public·Insets·getSystemWindowInsets()·{ |
| 113 | ········return·this.mImpl.getSystemWindowInsets(); |
139 | ····} | 114 | ····} |
140 | ···· | 115 | ···· |
141 | ····public·int·hashCode()·{ | 116 | ····public·int·hashCode()·{ |
142 | ········final·WindowInsetsCompat$Impl·mImpl·=·this.mImpl; | 117 | ········final·WindowInsetsCompat$Impl·mImpl·=·this.mImpl; |
143 | ········int·hashCode; | 118 | ········int·hashCode; |
144 | ········if·(mImpl·==·null)·{ | 119 | ········if·(mImpl·==·null)·{ |
145 | ············hashCode·=·0; | 120 | ············hashCode·=·0; |
Offset 156, 22 lines modified | Offset 131, 14 lines modified |
156 | ···· | 131 | ···· |
157 | ····public·WindowInsetsCompat·replaceSystemWindowInsets(final·int·n,·final·int·n2,·final·int·n3,·final·int·n4)·{ | 132 | ····public·WindowInsetsCompat·replaceSystemWindowInsets(final·int·n,·final·int·n2,·final·int·n3,·final·int·n4)·{ |
158 | ········final·WindowInsetsCompat$Builder·windowInsetsCompat$Builder·=·new·WindowInsetsCompat$Builder(this); | 133 | ········final·WindowInsetsCompat$Builder·windowInsetsCompat$Builder·=·new·WindowInsetsCompat$Builder(this); |
159 | ········windowInsetsCompat$Builder.setSystemWindowInsets(Insets.of(n,·n2,·n3,·n4)); | 134 | ········windowInsetsCompat$Builder.setSystemWindowInsets(Insets.of(n,·n2,·n3,·n4)); |
160 | ········return·windowInsetsCompat$Builder.build(); | 135 | ········return·windowInsetsCompat$Builder.build(); |
161 | ····} | 136 | ····} |
162 | ···· | 137 | ···· |
163 | ····void·setRootViewData(final·Rect·rect,·final·int·n)·{ | |
164 | ········this.mImpl.setRootViewData(rect,·n); | |
165 | ····} | |
166 | ···· | |
167 | ····void·setRootWindowInsets(final·WindowInsetsCompat·rootWindowInsets)·{ | |
168 | ········this.mImpl.setRootWindowInsets(rootWindowInsets); | |
169 | ····} | |
170 | ···· | |
171 | ····public·WindowInsets·toWindowInsets()·{ | 138 | ····public·WindowInsets·toWindowInsets()·{ |
172 | ········final·WindowInsetsCompat$Impl·mImpl·=·this.mImpl; | 139 | ········final·WindowInsetsCompat$Impl·mImpl·=·this.mImpl; |
173 | ········WindowInsets·mPlatformInsets; | 140 | ········WindowInsets·mPlatformInsets; |
174 | ········if·(mImpl·instanceof·WindowInsetsCompat$Impl20)·{ | 141 | ········if·(mImpl·instanceof·WindowInsetsCompat$Impl20)·{ |
175 | ············mPlatformInsets·=·((WindowInsetsCompat$Impl20)mImpl).mPlatformInsets; | 142 | ············mPlatformInsets·=·((WindowInsetsCompat$Impl20)mImpl).mPlatformInsets; |
176 | ········} | 143 | ········} |
177 | ········else·{ | 144 | ········else·{ |