@@ -36,9 +36,9 @@ public static void start(Context context) {
3636 @ Override
3737 public void initData (@ Nullable Bundle bundle ) {
3838 if (ScreenUtils .isPortrait ()) {
39- ScreenUtils .adaptScreen4VerticalSlide (this , 540 );
39+ ScreenUtils .adaptScreen4VerticalSlide (this , 360 );
4040 } else {
41- ScreenUtils .adaptScreen4HorizontalSlide (this , 540 );
41+ ScreenUtils .adaptScreen4HorizontalSlide (this , 360 );
4242 }
4343 }
4444
@@ -49,11 +49,7 @@ public int bindLayout() {
4949
5050 @ Override
5151 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+
5753 }
5854
5955 @ Override
@@ -68,34 +64,11 @@ public void onWidgetClick(View view) {
6864
6965 public void toggleFullScreen (View view ) {
7066 ScreenUtils .toggleFullScreen (this );
71- updateLayout ();
7267 }
7368
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 ();
10073 }
10174}
0 commit comments