@@ -36,9 +36,9 @@ public static void start(Context context) {
36
36
@ Override
37
37
public void initData (@ Nullable Bundle bundle ) {
38
38
if (ScreenUtils .isPortrait ()) {
39
- ScreenUtils .adaptScreen4VerticalSlide (this , 540 );
39
+ ScreenUtils .adaptScreen4VerticalSlide (this , 360 );
40
40
} else {
41
- ScreenUtils .adaptScreen4HorizontalSlide (this , 540 );
41
+ ScreenUtils .adaptScreen4HorizontalSlide (this , 360 );
42
42
}
43
43
}
44
44
@@ -49,11 +49,7 @@ public int bindLayout() {
49
49
50
50
@ Override
51
51
public void initView (Bundle savedInstanceState , View contentView ) {
52
- tvUp = findViewById (R .id .tv_up );
53
- tvDown = findViewById (R .id .tv_down );
54
- if (!ScreenUtils .isPortrait ()) {
55
- updateLayout ();
56
- }
52
+
57
53
}
58
54
59
55
@ Override
@@ -68,34 +64,11 @@ public void onWidgetClick(View view) {
68
64
69
65
public void toggleFullScreen (View view ) {
70
66
ScreenUtils .toggleFullScreen (this );
71
- updateLayout ();
72
67
}
73
68
74
- private void updateLayout () {
75
- int statusBarHeight = BarUtils .getStatusBarHeight ();
76
- int statusBarHeightInDp = SizeUtils .px2dp (this , statusBarHeight );
77
- ViewGroup .LayoutParams upLayoutParams = tvUp .getLayoutParams ();
78
- ViewGroup .LayoutParams downLayoutParams = tvDown .getLayoutParams ();
79
- if (ScreenUtils .isFullScreen (this )) {
80
- int height = 360 / 2 ;
81
- String s = height + "dp" ;
82
- upLayoutParams .height = SizeUtils .dp2px (this , height );
83
- tvUp .setLayoutParams (upLayoutParams );
84
- tvUp .setText (s );
85
-
86
- downLayoutParams .height = SizeUtils .dp2px (this , height );
87
- tvDown .setLayoutParams (downLayoutParams );
88
- tvDown .setText (s );
89
- } else {
90
- int height = 360 / 2 - statusBarHeightInDp / 2 ;
91
- String s = height + "dp" ;
92
- upLayoutParams .height = SizeUtils .dp2px (this , height );
93
- tvUp .setLayoutParams (upLayoutParams );
94
- tvUp .setText (s );
95
-
96
- downLayoutParams .height = SizeUtils .dp2px (this , height );
97
- tvDown .setLayoutParams (downLayoutParams );
98
- tvDown .setText (s );
99
- }
69
+ @ Override
70
+ protected void onDestroy () {
71
+ ScreenUtils .cancelAdaptScreen (this );
72
+ super .onDestroy ();
100
73
}
101
74
}
0 commit comments