|
10 | 10 | import android.os.Bundle;
|
11 | 11 | import android.os.CountDownTimer;
|
12 | 12 | import android.text.Html;
|
| 13 | +import android.util.Log; |
13 | 14 | import android.util.TypedValue;
|
14 | 15 | import android.view.LayoutInflater;
|
15 | 16 | import android.view.View;
|
@@ -104,26 +105,27 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
104 | 105 | toolbar.setBackgroundResource(showBarColor);
|
105 | 106 | bottombar.setBackgroundResource(showBarColor);
|
106 | 107 |
|
107 |
| - UiModeManager uiModeManager = (UiModeManager) getSystemService(Context.UI_MODE_SERVICE); |
| 108 | + //getSystemService导致的内存泄漏问题 https://blog.csdn.net/xiabing082/article/details/53993298 |
| 109 | + UiModeManager uiModeManager = (UiModeManager) getApplicationContext().getSystemService(Context.UI_MODE_SERVICE); |
108 | 110 | if (uiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES) {
|
109 | 111 | isNigntMode = true;
|
110 | 112 | } else {
|
111 | 113 | isNigntMode = false;
|
112 | 114 | }
|
113 | 115 |
|
| 116 | + setBackgroundAndTextColor();//初始化背景颜色的字符串,以便hideBar()调用 |
| 117 | + |
114 | 118 | bottomSheetDialog = new BottomSheetDialog(this);
|
115 | 119 | bottomSheetView = LayoutInflater.from(this).inflate(R.layout.view_bottom_sheet_act_new_reader, null, false);
|
116 | 120 | bottomSheetDialog.setContentView(bottomSheetView);
|
117 | 121 | bottomSheetDialog.setDismissWithAnimation(true);
|
118 | 122 | //保存设置
|
119 | 123 | bottomSheetDialog.setOnDismissListener(dialog -> {
|
120 |
| - hideBar(); |
121 |
| - |
122 |
| - GlobalConfig.newReaderFontSize = fontSize.getValue() + 20f; |
123 |
| - GlobalConfig.newReaderLineSpacing = lineSpacing.getValue(); |
124 |
| - GlobalConfig.readerBottomTextSize = bottomTextSize.getValue(); |
125 |
| - |
126 |
| - DatabaseHelper.SaveReaderSetting(); |
| 124 | + hideBar(); |
| 125 | + GlobalConfig.newReaderFontSize = fontSize.getValue() + 20f; |
| 126 | + GlobalConfig.newReaderLineSpacing = lineSpacing.getValue(); |
| 127 | + GlobalConfig.readerBottomTextSize = bottomTextSize.getValue(); |
| 128 | + DatabaseHelper.SaveReaderSetting(); |
127 | 129 | });
|
128 | 130 |
|
129 | 131 |
|
@@ -381,6 +383,7 @@ public void showBar() {
|
381 | 383 | toolbar.animate().translationY(0).setListener(new Animator.AnimatorListener() {
|
382 | 384 | @Override
|
383 | 385 | public void onAnimationStart(@NonNull Animator animation) {
|
| 386 | + Log.d("tag","readeractivity hide:"+hideBarColor); |
384 | 387 | ImmersionBar.with(ReaderActivity.this)
|
385 | 388 | .statusBarColor(showBarColor)
|
386 | 389 | .navigationBarColor(showBarColor)
|
|
0 commit comments