diff --git a/app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java b/app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java index 168e63d42..15acf7a91 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java @@ -187,6 +187,8 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan private int mSavingPage = -1; + private static int defaultNightMode = DayNightDelegate.MODE_NIGHT_UNSPECIFIED; + ActivityResultLauncher requestStoragePermissionLauncher = registerForActivityResult( new ActivityResultContracts.RequestPermission(), result -> { @@ -303,9 +305,10 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan @Override protected void attachBaseContext(@NonNull Context newBase) { + if (defaultNightMode == DayNightDelegate.MODE_NIGHT_UNSPECIFIED) defaultNightMode = DayNightDelegate.getDefaultNightMode(); switch (Settings.getReadTheme()) { case 0: - DayNightDelegate.setDefaultNightMode(Settings.getTheme()); + DayNightDelegate.setDefaultNightMode(defaultNightMode); break; case 1: DayNightDelegate.setDefaultNightMode(DayNightDelegate.MODE_NIGHT_YES); @@ -319,7 +322,8 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan @Override public void finish() { - DayNightDelegate.setDefaultNightMode(Settings.getTheme()); + DayNightDelegate.setDefaultNightMode(defaultNightMode); + defaultNightMode = DayNightDelegate.MODE_NIGHT_UNSPECIFIED; super.finish(); } @@ -393,23 +397,15 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan mShowSystemUi = false; } else { Window window = getWindow(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - View decorView = window.getDecorView(); - int flags = decorView.getSystemUiVisibility(); - if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_YES) <= 0) { - flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; - } else { - flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; - } - decorView.setSystemUiVisibility(flags); - window.setStatusBarColor(AttrResources.getAttrColor(this, android.R.attr.colorBackground)); + View decorView = window.getDecorView(); + int flags = decorView.getSystemUiVisibility(); + if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_YES) <= 0) { + flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } else { - if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_YES) <= 0) { - window.setStatusBarColor(AttrResources.getAttrColor(this, R.attr.colorPrimaryDark)); - } else { - window.setStatusBarColor(AttrResources.getAttrColor(this, android.R.attr.colorBackground)); - } + flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } + decorView.setSystemUiVisibility(flags); + window.setStatusBarColor(AttrResources.getAttrColor(this, android.R.attr.colorBackground)); } mMaskView = (ColorView) ViewUtils.$$(this, R.id.mask); diff --git a/app/src/main/res/layout/dialog_add_filter.xml b/app/src/main/res/layout/dialog_add_filter.xml index cdc022a05..792400a09 100644 --- a/app/src/main/res/layout/dialog_add_filter.xml +++ b/app/src/main/res/layout/dialog_add_filter.xml @@ -18,9 +18,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingLeft="?attr/dialogPreferredPadding" android:paddingTop="@dimen/abc_dialog_padding_top_material" - android:paddingRight="?attr/dialogPreferredPadding"> + android:paddingHorizontal="?attr/dialogPreferredPadding"> - + android:showDividers="middle"> + android:orientation="horizontal"> - + android:layout_gravity="center_vertical" + android:layout_weight="1" + android:text="@string/settings_read_screen_rotation" + android:textColor="?android:attr/textColorPrimary" /> - - - - - - - + android:layout_gravity="center_vertical" + android:layout_weight="2" + android:entries="@array/screen_rotation_entries" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:orientation="horizontal"> - - - - - - - - - - - - - - - - + android:layout_gravity="center_vertical" + android:layout_weight="2" + android:entries="@array/reading_direction_entries" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/app/src/main/res/layout/dialog_go_to.xml b/app/src/main/res/layout/dialog_go_to.xml index f135375fb..263e7b597 100644 --- a/app/src/main/res/layout/dialog_go_to.xml +++ b/app/src/main/res/layout/dialog_go_to.xml @@ -18,9 +18,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" - android:paddingLeft="16dp" - android:paddingTop="16dp" - android:paddingRight="16dp"> + android:paddingTop="@dimen/abc_dialog_padding_top_material" + android:paddingHorizontal="?attr/dialogPreferredPadding"> @color/colorPrimary @color/colorPrimary - @color/grey_850 @color/grey_850 - @color/grey_850 @color/grey_500 @color/divider @@ -112,12 +110,10 @@