1
1
/*
2
+ * Copyright 2020 The Android Open Source Project
2
3
*
3
- * * Copyright 2020 The Android Open Source Project
4
- * *
5
- * * Licensed under the Apache License, Version 2.0 (the "License");
6
- * * you may not use this file except in compliance with the License.
7
- * * You may obtain a copy of the License at
8
- * *
9
- * * http://www.apache.org/licenses/LICENSE-2.0
10
- * *
11
- * * Unless required by applicable law or agreed to in writing, software
12
- * * distributed under the License is distributed on an "AS IS" BASIS,
13
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * * See the License for the specific language governing permissions and
15
- * * limitations under the License.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
16
7
*
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
17
15
*/
18
16
19
17
package com.example.windowmanagersample
@@ -55,7 +53,7 @@ fun getFeatureBoundsInWindow(
55
53
val featureRectInView = Rect (displayFeature.bounds)
56
54
val intersects = featureRectInView.intersect(viewRect)
57
55
58
- // Checks to see if the display feature overlaps with our view at all
56
+ // Checks to see if the display feature overlaps with our view at all
59
57
if ((featureRectInView.width() == 0 && featureRectInView.height() == 0 ) ||
60
58
! intersects
61
59
) {
@@ -73,20 +71,20 @@ fun getFeatureBoundsInWindow(
73
71
* [FrameLayout].
74
72
*/
75
73
fun getLayoutParamsForFeature (displayFeature : DisplayFeature , viewGroup : ViewGroup ):
76
- MarginLayoutParams ? {
77
- val featureRectInView = getFeatureBoundsInWindow(displayFeature, viewGroup) ? : return null
74
+ MarginLayoutParams ? {
75
+ val featureRectInView = getFeatureBoundsInWindow(displayFeature, viewGroup) ? : return null
78
76
79
- val lp = MarginLayoutParams (featureRectInView.width(), featureRectInView.height())
80
- lp.leftMargin = featureRectInView.left
81
- lp.topMargin = featureRectInView.top
77
+ val lp = MarginLayoutParams (featureRectInView.width(), featureRectInView.height())
78
+ lp.leftMargin = featureRectInView.left
79
+ lp.topMargin = featureRectInView.top
82
80
83
- // Make sure that zero-wide and zero-high features are still shown
84
- if (featureRectInView.left == featureRectInView.right) {
85
- lp.width = 1
86
- }
87
- if (featureRectInView.top == featureRectInView.bottom) {
88
- lp.height = 1
89
- }
81
+ // Make sure that zero-wide and zero-high features are still shown
82
+ if (featureRectInView.left == featureRectInView.right) {
83
+ lp.width = 1
84
+ }
85
+ if (featureRectInView.top == featureRectInView.bottom) {
86
+ lp.height = 1
87
+ }
90
88
91
- return lp
92
- }
89
+ return lp
90
+ }
0 commit comments