@@ -73,8 +73,8 @@ public SmallView(ClientView clientView) {
73
73
clientView .device .small_l_p_height = shortEdge * 4 / 5 ;
74
74
clientView .device .small_l_l_width = longEdge * 4 / 5 ;
75
75
clientView .device .small_l_l_height = shortEdge * 4 / 5 ;
76
- clientView .device .small_free_width = shortEdge * 4 / 5 ;
77
- clientView .device .small_free_height = longEdge * 4 / 5 ;
76
+ clientView .device .small_free_width = shortEdge * 2 / 5 ;
77
+ clientView .device .small_free_height = shortEdge * 3 / 5 ;
78
78
}
79
79
// 设置监听控制
80
80
setFloatVideoListener ();
@@ -87,12 +87,19 @@ public SmallView(ClientView clientView) {
87
87
if (InitSize < 2 ) return ;
88
88
89
89
if (clientView .mode == 1 && clientView .device .setResolution ) {
90
+ boolean checkPosition = false ;
90
91
if (clientView .device .small_free_x == 0 && clientView .device .small_free_y == 0 ) {
91
92
clientView .updateMaxSize (new Pair <>(clientView .device .small_free_width , clientView .device .small_free_height ));
92
93
ViewGroup .LayoutParams layoutParams = clientView .textureView .getLayoutParams ();
93
- smallViewParams .x = clientView .device .small_free_x = (shortEdge - layoutParams .width ) / 2 ;
94
- smallViewParams .y = clientView .device .small_free_y = (longEdge - layoutParams .height ) / 2 ;
94
+ if (LocalIsPortrait ()) {
95
+ smallViewParams .x = clientView .device .small_free_x = (shortEdge - layoutParams .width ) / 2 ;
96
+ smallViewParams .y = clientView .device .small_free_y = (longEdge - layoutParams .height ) / 2 ;
97
+ } else {
98
+ smallViewParams .x = clientView .device .small_free_x = (longEdge - layoutParams .width ) / 2 ;
99
+ smallViewParams .y = clientView .device .small_free_y = (shortEdge - layoutParams .height ) / 2 ;
100
+ }
95
101
AppData .windowManager .updateViewLayout (smallView .getRoot (), smallViewParams );
102
+ checkPosition = true ;
96
103
InitPos = true ;
97
104
}
98
105
@@ -106,8 +113,35 @@ public SmallView(ClientView clientView) {
106
113
smallViewParams .y = clientView .device .small_free_y ;
107
114
AppData .windowManager .updateViewLayout (smallView .getRoot (), smallViewParams );
108
115
clientView .updateMaxSize (new Pair <>(clientView .device .small_free_width , clientView .device .small_free_height ));
116
+ checkPosition = true ;
109
117
InitPos = true ;
110
118
}
119
+
120
+ boolean LocalIsPortrait = LocalIsPortrait ();
121
+ if (checkPosition || LocalIsPortrait != LastLocalIsPortrait ) {
122
+ LastLocalIsPortrait = LocalIsPortrait ;
123
+ view .postDelayed (() -> {
124
+ int [] location = new int [2 ];
125
+ view .getLocationOnScreen (location );
126
+ int viewRight = location [0 ] + view .getWidth ();
127
+ int viewBottom = location [1 ] + view .getHeight ();
128
+ int width , height ;
129
+ if (LocalIsPortrait ) {
130
+ width = shortEdge ;
131
+ height = longEdge ;
132
+ } else {
133
+ width = longEdge ;
134
+ height = shortEdge ;
135
+ }
136
+ if (location [0 ] < 0 || location [1 ] < 0 || viewRight > width || viewBottom > height ) {
137
+ clientView .device .small_free_x = 0 ;
138
+ clientView .device .small_free_y = 0 ;
139
+ clientView .device .small_free_width = shortEdge * 2 / 5 ;
140
+ clientView .device .small_free_height = shortEdge * 3 / 5 ;
141
+ clientView .updateMaxSize (clientView .getMaxSize ());
142
+ }
143
+ }, 500 );
144
+ }
111
145
return ;
112
146
}
113
147
@@ -395,8 +429,8 @@ private void setButtonListener(ControlPacket controlPacket) {
395
429
clientView .device .small_l_p_height = shortEdge * 4 / 5 ;
396
430
clientView .device .small_l_l_width = longEdge * 4 / 5 ;
397
431
clientView .device .small_l_l_height = shortEdge * 4 / 5 ;
398
- clientView .device .small_free_width = shortEdge * 4 / 5 ;
399
- clientView .device .small_free_height = longEdge * 4 / 5 ;
432
+ clientView .device .small_free_width = shortEdge * 2 / 5 ;
433
+ clientView .device .small_free_height = shortEdge * 3 / 5 ;
400
434
clientView .updateMaxSize (clientView .getMaxSize ());
401
435
barViewTimer ();
402
436
});
0 commit comments