From 74655c0cd0ba72c80ac6c48df55bc3d2f5280ad2 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 25 May 2020 16:39:53 -0700 Subject: [PATCH] Switch to the new Day/Night theme. https://redmine.stoutner.com/issues/522 --- .idea/dictionaries/soren.xml | 1 + .../dialogs/AdConsentDialog.java | 37 +- .../drawable/privacy_browser_foreground.xml | 135 +-- app/src/main/AndroidManifest.xml | 2 +- .../main/assets/de/about_licenses_dark.html | 3 +- .../main/assets/de/about_licenses_light.html | 3 +- .../main/assets/en/about_licenses_dark.html | 3 +- .../main/assets/en/about_licenses_light.html | 3 +- .../main/assets/es/about_licenses_dark.html | 3 +- .../main/assets/es/about_licenses_light.html | 3 +- .../main/assets/fr/about_licenses_dark.html | 3 +- .../main/assets/fr/about_licenses_light.html | 3 +- .../main/assets/it/about_licenses_dark.html | 3 +- .../main/assets/it/about_licenses_light.html | 3 +- .../main/assets/ru/about_licenses_dark.html | 3 +- .../main/assets/ru/about_licenses_light.html | 3 +- .../main/assets/tr/about_licenses_dark.html | 7 +- .../main/assets/tr/about_licenses_light.html | 7 +- .../activities/AboutActivity.java | 11 +- .../activities/BookmarksActivity.java | 35 +- .../BookmarksDatabaseViewActivity.java | 39 +- .../activities/DomainsActivity.java | 72 +- .../activities/GuideActivity.java | 9 +- .../activities/ImportExportActivity.java | 11 +- .../activities/LogcatActivity.java | 37 +- .../activities/MainWebViewActivity.java | 445 ++++---- .../activities/RequestsActivity.java | 13 +- .../activities/SettingsActivity.java | 11 +- .../activities/ViewSourceActivity.java | 33 +- .../adapters/RequestsArrayAdapter.java | 22 +- .../privacybrowser/asynctasks/GetUrlSize.java | 6 +- .../dialogs/AboutViewSourceDialog.kt | 33 +- .../privacybrowser/dialogs/AddDomainDialog.kt | 35 +- .../dialogs/CreateBookmarkDialog.kt | 28 +- .../dialogs/CreateBookmarkFolderDialog.kt | 27 +- .../dialogs/CreateHomeScreenShortcutDialog.kt | 21 +- .../dialogs/EditBookmarkDatabaseViewDialog.kt | 39 +- .../dialogs/EditBookmarkDialog.java | 40 +- .../EditBookmarkFolderDatabaseViewDialog.java | 41 +- .../dialogs/EditBookmarkFolderDialog.java | 33 +- .../dialogs/FontSizeDialog.java | 36 +- .../dialogs/HttpAuthenticationDialog.java | 51 +- .../dialogs/MoveToFolderDialog.java | 35 +- .../privacybrowser/dialogs/OpenDialog.java | 49 +- .../dialogs/PinnedMismatchDialog.java | 73 +- .../dialogs/ProxyNotInstalledDialog.java | 47 +- .../privacybrowser/dialogs/SaveDialog.java | 59 +- .../dialogs/SaveLogcatDialog.java | 53 +- .../dialogs/SslCertificateErrorDialog.java | 96 +- .../dialogs/StoragePermissionDialog.java | 31 +- .../dialogs/UrlHistoryDialog.java | 34 +- .../dialogs/ViewRequestDialog.java | 51 +- .../dialogs/ViewSslCertificateDialog.java | 62 +- .../dialogs/WaitingForProxyDialog.java | 36 +- .../fragments/AboutTabFragment.java | 27 +- .../fragments/DomainSettingsFragment.java | 567 +++++------ .../fragments/DomainsListFragment.java | 27 +- .../fragments/GuideTabFragment.java | 16 +- .../fragments/SettingsFragment.java | 957 +++++++++--------- .../helpers/ImportExportDatabaseHelper.java | 38 +- .../appbar_spinner_color_selector_dark.xml | 25 - ... button_background_color_selector_day.xml} | 3 +- ...utton_background_color_selector_night.xml} | 3 +- ...xml => button_text_color_selector_day.xml} | 3 +- ...l => button_text_color_selector_night.xml} | 8 +- ...rk.xml => checked_text_color_selector.xml} | 5 +- .../{about_light.xml => about_day.xml} | 2 +- .../{about_dark.xml => about_night.xml} | 2 +- .../drawable/{add_light.xml => add_day.xml} | 2 +- .../drawable/{add_dark.xml => add_night.xml} | 2 +- ...xml => allow_screenshots_disabled_day.xml} | 4 +- ...l => allow_screenshots_disabled_night.xml} | 4 +- ....xml => allow_screenshots_enabled_day.xml} | 4 +- ...ml => allow_screenshots_enabled_night.xml} | 4 +- ...led_light.xml => app_bar_disabled_day.xml} | 4 +- ...ed_dark.xml => app_bar_disabled_night.xml} | 4 +- ...bled_light.xml => app_bar_enabled_day.xml} | 10 +- ...led_dark.xml => app_bar_enabled_night.xml} | 10 +- ...sted_light.xml => app_bar_ghosted_day.xml} | 4 +- ...ted_dark.xml => app_bar_ghosted_night.xml} | 4 +- app/src/main/res/drawable/back.xml | 4 +- ...d_light.xml => block_ads_disabled_day.xml} | 4 +- ..._dark.xml => block_ads_disabled_night.xml} | 4 +- ...ed_light.xml => block_ads_enabled_day.xml} | 4 +- ...d_dark.xml => block_ads_enabled_night.xml} | 4 +- ...all_third_party_requests_disabled_day.xml} | 4 +- ...l_third_party_requests_disabled_night.xml} | 4 +- ..._all_third_party_requests_enabled_day.xml} | 4 +- ...ll_third_party_requests_enabled_night.xml} | 4 +- ...ht.xml => block_tracking_disabled_day.xml} | 4 +- ....xml => block_tracking_disabled_night.xml} | 4 +- ...ght.xml => block_tracking_enabled_day.xml} | 4 +- ...k.xml => block_tracking_enabled_night.xml} | 4 +- ...{bookmarks_light.xml => bookmarks_day.xml} | 4 +- ...bookmarks_dark.xml => bookmarks_night.xml} | 4 +- app/src/main/res/drawable/bug.xml | 4 +- ...leared_light.xml => cache_cleared_day.xml} | 4 +- ...eared_dark.xml => cache_cleared_night.xml} | 4 +- app/src/main/res/drawable/cache_warning.xml | 4 +- app/src/main/res/drawable/clear_and_exit.xml | 4 +- .../{clear_light.xml => clear_day.xml} | 6 +- .../drawable/clear_everything_disabled.xml | 4 +- ...t.xml => clear_everything_enabled_day.xml} | 4 +- ...xml => clear_everything_enabled_night.xml} | 4 +- .../{clear_dark.xml => clear_night.xml} | 4 +- .../{close_light.xml => close_day.xml} | 4 +- .../{close_dark.xml => close_night.xml} | 4 +- ...ared_light.xml => cookies_cleared_day.xml} | 4 +- ...red_dark.xml => cookies_cleared_night.xml} | 4 +- ...led_light.xml => cookies_disabled_day.xml} | 4 +- ...ed_dark.xml => cookies_disabled_night.xml} | 4 +- app/src/main/res/drawable/cookies_enabled.xml | 4 +- ...sted_light.xml => cookies_ghosted_day.xml} | 4 +- ...ted_dark.xml => cookies_ghosted_night.xml} | 4 +- app/src/main/res/drawable/cookies_warning.xml | 4 +- .../drawable/{copy_light.xml => copy_day.xml} | 4 +- ...enabled_light.xml => copy_enabled_day.xml} | 2 +- ...nabled_dark.xml => copy_enabled_night.xml} | 2 +- .../{copy_dark.xml => copy_night.xml} | 2 +- ...mark_light.xml => create_bookmark_day.xml} | 4 +- ...ark_dark.xml => create_bookmark_night.xml} | 4 +- ...folder_light.xml => create_folder_day.xml} | 4 +- ...older_dark.xml => create_folder_night.xml} | 4 +- ....xml => custom_user_agent_enabled_day.xml} | 2 +- ...ml => custom_user_agent_enabled_night.xml} | 2 +- ....xml => custom_user_agent_ghosted_day.xml} | 2 +- ...ml => custom_user_agent_ghosted_night.xml} | 2 +- app/src/main/res/drawable/delete_blue.xml | 13 - app/src/main/res/drawable/delete_day.xml | 13 + app/src/main/res/drawable/delete_disabled.xml | 13 + app/src/main/res/drawable/delete_light.xml | 13 - .../{delete_dark.xml => delete_night.xml} | 4 +- ..._light.xml => dom_storage_cleared_day.xml} | 2 +- ...dark.xml => dom_storage_cleared_night.xml} | 2 +- ...light.xml => dom_storage_disabled_day.xml} | 2 +- ...ark.xml => dom_storage_disabled_night.xml} | 2 +- .../main/res/drawable/dom_storage_enabled.xml | 2 +- ..._light.xml => dom_storage_ghosted_day.xml} | 2 +- ...dark.xml => dom_storage_ghosted_night.xml} | 2 +- .../main/res/drawable/dom_storage_warning.xml | 2 +- app/src/main/res/drawable/domains_light.xml | 2 +- .../{domains_dark.xml => domains_night.xml} | 2 +- ...ed_light.xml => downloads_enabled_day.xml} | 2 +- ...d_dark.xml => downloads_enabled_night.xml} | 2 +- ...ed_light.xml => downloads_ghosted_day.xml} | 2 +- ...d_dark.xml => downloads_ghosted_night.xml} | 2 +- .../drawable/{edit_light.xml => edit_day.xml} | 6 +- .../{edit_dark.xml => edit_night.xml} | 4 +- .../main/res/drawable/folder_dark_blue.xml | 4 +- app/src/main/res/drawable/folder_gray.xml | 4 +- ...{font_size_light.xml => font_size_day.xml} | 4 +- ...font_size_dark.xml => font_size_night.xml} | 4 +- ...ed_light.xml => form_data_cleared_day.xml} | 4 +- ...d_dark.xml => form_data_cleared_night.xml} | 4 +- ...d_light.xml => form_data_disabled_day.xml} | 4 +- ..._dark.xml => form_data_disabled_night.xml} | 4 +- .../main/res/drawable/form_data_enabled.xml | 4 +- .../main/res/drawable/form_data_warning.xml | 4 +- app/src/main/res/drawable/forward.xml | 4 +- ...light.xml => full_screen_disabled_day.xml} | 2 +- ...ark.xml => full_screen_disabled_night.xml} | 2 +- ..._light.xml => full_screen_enabled_day.xml} | 2 +- ...dark.xml => full_screen_enabled_night.xml} | 2 +- app/src/main/res/drawable/guide.xml | 4 +- app/src/main/res/drawable/history.xml | 4 +- ...enabled_light.xml => home_enabled_day.xml} | 2 +- ...nabled_dark.xml => home_enabled_night.xml} | 2 +- ...bled_light.xml => images_disabled_day.xml} | 4 +- ...led_dark.xml => images_disabled_night.xml} | 4 +- ...abled_light.xml => images_enabled_day.xml} | 4 +- ...bled_dark.xml => images_enabled_night.xml} | 4 +- ...export_light.xml => import_export_day.xml} | 4 +- ...xport_dark.xml => import_export_night.xml} | 4 +- ...ht.xml => incognito_mode_disabled_day.xml} | 4 +- ....xml => incognito_mode_disabled_night.xml} | 4 +- ...ght.xml => incognito_mode_enabled_day.xml} | 4 +- ...k.xml => incognito_mode_enabled_night.xml} | 4 +- .../main/res/drawable/javascript_enabled.xml | 6 +- ...lector_light.xml => list_selector_day.xml} | 4 +- ...ector_dark.xml => list_selector_night.xml} | 4 +- .../drawable/{lock_light.xml => lock_day.xml} | 4 +- .../{lock_dark.xml => lock_night.xml} | 4 +- ..._light.xml => modify_url_disabled_day.xml} | 4 +- ...dark.xml => modify_url_disabled_night.xml} | 4 +- ...d_light.xml => modify_url_enabled_day.xml} | 4 +- ..._dark.xml => modify_url_enabled_night.xml} | 4 +- ...sabled_light.xml => more_disabled_day.xml} | 4 +- ...abled_dark.xml => more_disabled_night.xml} | 4 +- ...enabled_light.xml => more_enabled_day.xml} | 4 +- ...nabled_dark.xml => more_enabled_night.xml} | 4 +- .../main/res/drawable/move_down_disabled.xml | 6 +- .../res/drawable/move_down_enabled_dark.xml | 13 - .../res/drawable/move_down_enabled_day.xml | 13 + .../res/drawable/move_down_enabled_light.xml | 13 - .../res/drawable/move_down_enabled_night.xml | 13 + ...older_light.xml => move_to_folder_day.xml} | 6 +- ...lder_dark.xml => move_to_folder_night.xml} | 4 +- .../main/res/drawable/move_up_disabled.xml | 6 +- .../res/drawable/move_up_enabled_dark.xml | 13 - .../main/res/drawable/move_up_enabled_day.xml | 13 + .../res/drawable/move_up_enabled_light.xml | 13 - .../res/drawable/move_up_enabled_night.xml | 13 + app/src/main/res/drawable/next.xml | 4 +- ..._light.xml => night_mode_disabled_day.xml} | 4 +- ...dark.xml => night_mode_disabled_night.xml} | 4 +- ...d_light.xml => night_mode_enabled_day.xml} | 4 +- ..._dark.xml => night_mode_enabled_night.xml} | 4 +- app/src/main/res/drawable/previous.xml | 4 +- .../drawable/privacy_browser_foreground.xml | 49 +- app/src/main/res/drawable/privacy_mode.xml | 8 +- ...abled_light.xml => proxy_disabled_day.xml} | 0 ...bled_dark.xml => proxy_disabled_night.xml} | 4 +- ...nabled_light.xml => proxy_enabled_day.xml} | 4 +- ...abled_dark.xml => proxy_enabled_night.xml} | 4 +- ...hosted_light.xml => proxy_ghosted_day.xml} | 4 +- ...osted_dark.xml => proxy_ghosted_night.xml} | 4 +- ...led_light.xml => refresh_disabled_day.xml} | 4 +- ...ed_dark.xml => refresh_disabled_night.xml} | 4 +- ...bled_light.xml => refresh_enabled_day.xml} | 4 +- ...led_dark.xml => refresh_enabled_night.xml} | 6 +- .../drawable/{save_light.xml => save_day.xml} | 6 +- ...e_dialog_light.xml => save_dialog_day.xml} | 4 +- ..._dialog_dark.xml => save_dialog_night.xml} | 4 +- .../{save_dark.xml => save_night.xml} | 4 +- ....xml => search_custom_url_enabled_day.xml} | 4 +- ...ml => search_custom_url_enabled_night.xml} | 4 +- ....xml => search_custom_url_ghosted_day.xml} | 4 +- ...ml => search_custom_url_ghosted_night.xml} | 4 +- ...abled_light.xml => search_enabled_day.xml} | 4 +- ...bled_dark.xml => search_enabled_night.xml} | 4 +- ...elect_all_light.xml => select_all_day.xml} | 6 +- ...lect_all_dark.xml => select_all_night.xml} | 4 +- app/src/main/res/drawable/settings.xml | 4 +- ...ight.xml => social_media_disabled_day.xml} | 6 +- ...rk.xml => social_media_disabled_night.xml} | 6 +- ...light.xml => social_media_enabled_day.xml} | 6 +- ...ark.xml => social_media_enabled_night.xml} | 6 +- ...light.xml => social_media_ghosted_day.xml} | 6 +- ...ark.xml => social_media_ghosted_night.xml} | 6 +- .../drawable/{sort_light.xml => sort_day.xml} | 6 +- .../{sort_dark.xml => sort_night.xml} | 4 +- ...elected_dark.xml => sort_selected_day.xml} | 12 +- ...cted_light.xml => sort_selected_night.xml} | 12 +- ...t.xml => ssl_certificate_disabled_day.xml} | 4 +- ...xml => ssl_certificate_disabled_night.xml} | 4 +- ...ht.xml => ssl_certificate_enabled_day.xml} | 4 +- ....xml => ssl_certificate_enabled_night.xml} | 4 +- .../main/res/drawable/tab_disabled_dark.xml | 2 +- .../main/res/drawable/tab_disabled_light.xml | 2 +- .../main/res/drawable/tab_enabled_dark.xml | 2 +- .../main/res/drawable/tab_enabled_light.xml | 2 +- .../{theme_light.xml => theme_day.xml} | 4 +- .../{theme_dark.xml => theme_night.xml} | 6 +- ...ser_agent_light.xml => user_agent_day.xml} | 4 +- ...er_agent_dark.xml => user_agent_night.xml} | 4 +- app/src/main/res/drawable/warning.xml | 8 +- ...ght.xml => wide_viewport_disabled_day.xml} | 4 +- ...k.xml => wide_viewport_disabled_night.xml} | 4 +- ...ight.xml => wide_viewport_enabled_day.xml} | 4 +- ...rk.xml => wide_viewport_enabled_night.xml} | 4 +- .../res/layout-w900dp/bookmarks_drawer.xml | 18 +- .../res/layout/about_coordinatorlayout.xml | 22 +- app/src/main/res/layout/about_tab_version.xml | 25 +- .../layout/appbar_spinner_dropdown_item.xml | 7 +- .../main/res/layout/appbar_spinner_item.xml | 4 +- .../bookmarks_activity_item_linearlayout.xml | 4 +- .../layout/bookmarks_coordinatorlayout.xml | 24 +- ...okmarks_databaseview_coordinatorlayout.xml | 17 +- app/src/main/res/layout/bookmarks_drawer.xml | 18 +- .../bookmarks_drawer_item_linearlayout.xml | 4 +- .../create_home_screen_shortcut_dialog.xml | 6 +- .../res/layout/domain_name_linearlayout.xml | 4 +- .../res/layout/domain_settings_fragment.xml | 10 +- .../res/layout/domains_coordinatorlayout.xml | 13 +- .../res/layout/guide_coordinatorlayout.xml | 22 +- .../import_export_coordinatorlayout.xml | 19 +- .../res/layout/logcat_coordinatorlayout.xml | 16 +- app/src/main/res/layout/main_framelayout.xml | 34 +- app/src/main/res/layout/navigation_header.xml | 30 - app/src/main/res/layout/open_dialog.xml | 1 - .../layout/pinned_mismatch_linearlayout.xml | 5 +- .../requests_appbar_spinner_dropdown_item.xml | 5 +- .../layout/requests_appbar_spinner_item.xml | 4 +- .../res/layout/requests_coordinatorlayout.xml | 20 +- .../res/layout/requests_item_linearlayout.xml | 4 +- app/src/main/res/layout/save_dialog.xml | 1 - .../main/res/layout/save_logcat_dialog.xml | 1 - .../main/res/layout/ssl_certificate_error.xml | 4 +- app/src/main/res/layout/tab_custom_view.xml | 2 +- .../res/layout/unencrypted_website_dialog.xml | 2 +- .../layout/url_history_item_linearlayout.xml | 4 +- .../main/res/layout/view_source_app_bar.xml | 4 +- .../layout/view_source_coordinatorlayout.xml | 7 +- .../main/res/layout/webview_framelayout.xml | 3 +- .../main/res/menu/webview_navigation_menu.xml | 14 +- .../main/res/menu/webview_options_menu.xml | 4 +- app/src/main/res/values-de/strings.xml | 2 - app/src/main/res/values-es/strings.xml | 2 - app/src/main/res/values-fr/strings.xml | 2 - app/src/main/res/values-it/strings.xml | 2 - app/src/main/res/values-night-v23/styles.xml | 86 ++ app/src/main/res/values-night-v27/styles.xml | 90 ++ app/src/main/res/values-night/styles.xml | 80 ++ app/src/main/res/values-ru/strings.xml | 2 - app/src/main/res/values-tr/strings.xml | 2 - app/src/main/res/values-v23/styles.xml | 86 ++ app/src/main/res/values-v27/styles.xml | 90 ++ app/src/main/res/values/attrs.xml | 58 +- app/src/main/res/values/strings.xml | 14 +- app/src/main/res/values/styles.xml | 232 +---- .../main/res/xml/network_security_config.xml | 7 +- app/src/main/res/xml/preferences.xml | 13 +- 312 files changed, 2925 insertions(+), 2808 deletions(-) delete mode 100644 app/src/main/res/color/appbar_spinner_color_selector_dark.xml rename app/src/main/res/color/{button_background_color_selector_light.xml => button_background_color_selector_day.xml} (88%) rename app/src/main/res/color/{button_background_color_selector_dark.xml => button_background_color_selector_night.xml} (88%) rename app/src/main/res/color/{button_text_color_selector_light.xml => button_text_color_selector_day.xml} (88%) rename app/src/main/res/color/{appbar_spinner_color_selector_light.xml => button_text_color_selector_night.xml} (76%) rename app/src/main/res/color/{button_text_color_selector_dark.xml => checked_text_color_selector.xml} (80%) rename app/src/main/res/drawable/{about_light.xml => about_day.xml} (92%) rename app/src/main/res/drawable/{about_dark.xml => about_night.xml} (92%) rename app/src/main/res/drawable/{add_light.xml => add_day.xml} (90%) rename app/src/main/res/drawable/{add_dark.xml => add_night.xml} (90%) rename app/src/main/res/drawable/{allow_screenshots_disabled_light.xml => allow_screenshots_disabled_day.xml} (74%) rename app/src/main/res/drawable/{allow_screenshots_disabled_dark.xml => allow_screenshots_disabled_night.xml} (74%) rename app/src/main/res/drawable/{allow_screenshots_enabled_light.xml => allow_screenshots_enabled_day.xml} (74%) rename app/src/main/res/drawable/{allow_screenshots_enabled_dark.xml => allow_screenshots_enabled_night.xml} (74%) rename app/src/main/res/drawable/{app_bar_disabled_light.xml => app_bar_disabled_day.xml} (73%) rename app/src/main/res/drawable/{app_bar_disabled_dark.xml => app_bar_disabled_night.xml} (72%) rename app/src/main/res/drawable/{app_bar_enabled_light.xml => app_bar_enabled_day.xml} (62%) rename app/src/main/res/drawable/{app_bar_enabled_dark.xml => app_bar_enabled_night.xml} (62%) rename app/src/main/res/drawable/{app_bar_ghosted_light.xml => app_bar_ghosted_day.xml} (72%) rename app/src/main/res/drawable/{app_bar_ghosted_dark.xml => app_bar_ghosted_night.xml} (72%) rename app/src/main/res/drawable/{block_ads_disabled_light.xml => block_ads_disabled_day.xml} (76%) rename app/src/main/res/drawable/{block_ads_disabled_dark.xml => block_ads_disabled_night.xml} (76%) rename app/src/main/res/drawable/{block_ads_enabled_light.xml => block_ads_enabled_day.xml} (76%) rename app/src/main/res/drawable/{block_ads_enabled_dark.xml => block_ads_enabled_night.xml} (76%) rename app/src/main/res/drawable/{block_all_third_party_requests_disabled_light.xml => block_all_third_party_requests_disabled_day.xml} (73%) rename app/src/main/res/drawable/{block_all_third_party_requests_disabled_dark.xml => block_all_third_party_requests_disabled_night.xml} (73%) rename app/src/main/res/drawable/{block_all_third_party_requests_enabled_light.xml => block_all_third_party_requests_enabled_day.xml} (73%) rename app/src/main/res/drawable/{block_all_third_party_requests_enabled_dark.xml => block_all_third_party_requests_enabled_night.xml} (73%) rename app/src/main/res/drawable/{block_tracking_disabled_light.xml => block_tracking_disabled_day.xml} (76%) rename app/src/main/res/drawable/{block_tracking_disabled_dark.xml => block_tracking_disabled_night.xml} (76%) rename app/src/main/res/drawable/{block_tracking_enabled_light.xml => block_tracking_enabled_day.xml} (76%) rename app/src/main/res/drawable/{block_tracking_enabled_dark.xml => block_tracking_enabled_night.xml} (76%) rename app/src/main/res/drawable/{bookmarks_light.xml => bookmarks_day.xml} (78%) rename app/src/main/res/drawable/{bookmarks_dark.xml => bookmarks_night.xml} (78%) rename app/src/main/res/drawable/{cache_cleared_light.xml => cache_cleared_day.xml} (80%) rename app/src/main/res/drawable/{cache_cleared_dark.xml => cache_cleared_night.xml} (80%) rename app/src/main/res/drawable/{clear_light.xml => clear_day.xml} (53%) rename app/src/main/res/drawable/{clear_everything_enabled_light.xml => clear_everything_enabled_day.xml} (65%) rename app/src/main/res/drawable/{clear_everything_enabled_dark.xml => clear_everything_enabled_night.xml} (65%) rename app/src/main/res/drawable/{clear_dark.xml => clear_night.xml} (59%) rename app/src/main/res/drawable/{close_light.xml => close_day.xml} (69%) rename app/src/main/res/drawable/{close_dark.xml => close_night.xml} (69%) rename app/src/main/res/drawable/{cookies_cleared_light.xml => cookies_cleared_day.xml} (80%) rename app/src/main/res/drawable/{cookies_cleared_dark.xml => cookies_cleared_night.xml} (80%) rename app/src/main/res/drawable/{cookies_disabled_light.xml => cookies_disabled_day.xml} (80%) rename app/src/main/res/drawable/{cookies_disabled_dark.xml => cookies_disabled_night.xml} (80%) rename app/src/main/res/drawable/{cookies_ghosted_light.xml => cookies_ghosted_day.xml} (80%) rename app/src/main/res/drawable/{cookies_ghosted_dark.xml => cookies_ghosted_night.xml} (80%) rename app/src/main/res/drawable/{copy_light.xml => copy_day.xml} (83%) rename app/src/main/res/drawable/{copy_enabled_light.xml => copy_enabled_day.xml} (87%) rename app/src/main/res/drawable/{copy_enabled_dark.xml => copy_enabled_night.xml} (87%) rename app/src/main/res/drawable/{copy_dark.xml => copy_night.xml} (87%) rename app/src/main/res/drawable/{create_bookmark_light.xml => create_bookmark_day.xml} (72%) rename app/src/main/res/drawable/{create_bookmark_dark.xml => create_bookmark_night.xml} (72%) rename app/src/main/res/drawable/{create_folder_light.xml => create_folder_day.xml} (79%) rename app/src/main/res/drawable/{create_folder_dark.xml => create_folder_night.xml} (79%) rename app/src/main/res/drawable/{custom_user_agent_enabled_light.xml => custom_user_agent_enabled_day.xml} (88%) rename app/src/main/res/drawable/{custom_user_agent_enabled_dark.xml => custom_user_agent_enabled_night.xml} (88%) rename app/src/main/res/drawable/{custom_user_agent_ghosted_light.xml => custom_user_agent_ghosted_day.xml} (88%) rename app/src/main/res/drawable/{custom_user_agent_ghosted_dark.xml => custom_user_agent_ghosted_night.xml} (88%) delete mode 100644 app/src/main/res/drawable/delete_blue.xml create mode 100644 app/src/main/res/drawable/delete_day.xml create mode 100644 app/src/main/res/drawable/delete_disabled.xml delete mode 100644 app/src/main/res/drawable/delete_light.xml rename app/src/main/res/drawable/{delete_dark.xml => delete_night.xml} (58%) rename app/src/main/res/drawable/{dom_storage_cleared_light.xml => dom_storage_cleared_day.xml} (86%) rename app/src/main/res/drawable/{dom_storage_cleared_dark.xml => dom_storage_cleared_night.xml} (86%) rename app/src/main/res/drawable/{dom_storage_disabled_light.xml => dom_storage_disabled_day.xml} (86%) rename app/src/main/res/drawable/{dom_storage_disabled_dark.xml => dom_storage_disabled_night.xml} (86%) rename app/src/main/res/drawable/{dom_storage_ghosted_light.xml => dom_storage_ghosted_day.xml} (86%) rename app/src/main/res/drawable/{dom_storage_ghosted_dark.xml => dom_storage_ghosted_night.xml} (86%) rename app/src/main/res/drawable/{domains_dark.xml => domains_night.xml} (88%) rename app/src/main/res/drawable/{downloads_enabled_light.xml => downloads_enabled_day.xml} (79%) rename app/src/main/res/drawable/{downloads_enabled_dark.xml => downloads_enabled_night.xml} (79%) rename app/src/main/res/drawable/{downloads_ghosted_light.xml => downloads_ghosted_day.xml} (79%) rename app/src/main/res/drawable/{downloads_ghosted_dark.xml => downloads_ghosted_night.xml} (79%) rename app/src/main/res/drawable/{edit_light.xml => edit_day.xml} (75%) rename app/src/main/res/drawable/{edit_dark.xml => edit_night.xml} (79%) rename app/src/main/res/drawable/{font_size_light.xml => font_size_day.xml} (68%) rename app/src/main/res/drawable/{font_size_dark.xml => font_size_night.xml} (68%) rename app/src/main/res/drawable/{form_data_cleared_light.xml => form_data_cleared_day.xml} (72%) rename app/src/main/res/drawable/{form_data_cleared_dark.xml => form_data_cleared_night.xml} (72%) rename app/src/main/res/drawable/{form_data_disabled_light.xml => form_data_disabled_day.xml} (72%) rename app/src/main/res/drawable/{form_data_disabled_dark.xml => form_data_disabled_night.xml} (72%) rename app/src/main/res/drawable/{full_screen_disabled_light.xml => full_screen_disabled_day.xml} (80%) rename app/src/main/res/drawable/{full_screen_disabled_dark.xml => full_screen_disabled_night.xml} (80%) rename app/src/main/res/drawable/{full_screen_enabled_light.xml => full_screen_enabled_day.xml} (80%) rename app/src/main/res/drawable/{full_screen_enabled_dark.xml => full_screen_enabled_night.xml} (80%) rename app/src/main/res/drawable/{home_enabled_light.xml => home_enabled_day.xml} (88%) rename app/src/main/res/drawable/{home_enabled_dark.xml => home_enabled_night.xml} (88%) rename app/src/main/res/drawable/{images_disabled_light.xml => images_disabled_day.xml} (78%) rename app/src/main/res/drawable/{images_disabled_dark.xml => images_disabled_night.xml} (78%) rename app/src/main/res/drawable/{images_enabled_light.xml => images_enabled_day.xml} (78%) rename app/src/main/res/drawable/{images_enabled_dark.xml => images_enabled_night.xml} (78%) rename app/src/main/res/drawable/{import_export_light.xml => import_export_day.xml} (76%) rename app/src/main/res/drawable/{import_export_dark.xml => import_export_night.xml} (76%) rename app/src/main/res/drawable/{incognito_mode_disabled_light.xml => incognito_mode_disabled_day.xml} (80%) rename app/src/main/res/drawable/{incognito_mode_disabled_dark.xml => incognito_mode_disabled_night.xml} (80%) rename app/src/main/res/drawable/{incognito_mode_enabled_light.xml => incognito_mode_enabled_day.xml} (80%) rename app/src/main/res/drawable/{incognito_mode_enabled_dark.xml => incognito_mode_enabled_night.xml} (80%) rename app/src/main/res/drawable/{list_selector_light.xml => list_selector_day.xml} (92%) rename app/src/main/res/drawable/{list_selector_dark.xml => list_selector_night.xml} (92%) rename app/src/main/res/drawable/{lock_light.xml => lock_day.xml} (75%) rename app/src/main/res/drawable/{lock_dark.xml => lock_night.xml} (75%) rename app/src/main/res/drawable/{modify_url_disabled_light.xml => modify_url_disabled_day.xml} (76%) rename app/src/main/res/drawable/{modify_url_disabled_dark.xml => modify_url_disabled_night.xml} (76%) rename app/src/main/res/drawable/{modify_url_enabled_light.xml => modify_url_enabled_day.xml} (76%) rename app/src/main/res/drawable/{modify_url_enabled_dark.xml => modify_url_enabled_night.xml} (76%) rename app/src/main/res/drawable/{more_disabled_light.xml => more_disabled_day.xml} (78%) rename app/src/main/res/drawable/{more_disabled_dark.xml => more_disabled_night.xml} (78%) rename app/src/main/res/drawable/{more_enabled_light.xml => more_enabled_day.xml} (78%) rename app/src/main/res/drawable/{more_enabled_dark.xml => more_enabled_night.xml} (78%) delete mode 100644 app/src/main/res/drawable/move_down_enabled_dark.xml create mode 100644 app/src/main/res/drawable/move_down_enabled_day.xml delete mode 100644 app/src/main/res/drawable/move_down_enabled_light.xml create mode 100644 app/src/main/res/drawable/move_down_enabled_night.xml rename app/src/main/res/drawable/{move_to_folder_light.xml => move_to_folder_day.xml} (77%) rename app/src/main/res/drawable/{move_to_folder_dark.xml => move_to_folder_night.xml} (80%) delete mode 100644 app/src/main/res/drawable/move_up_enabled_dark.xml create mode 100644 app/src/main/res/drawable/move_up_enabled_day.xml delete mode 100644 app/src/main/res/drawable/move_up_enabled_light.xml create mode 100644 app/src/main/res/drawable/move_up_enabled_night.xml rename app/src/main/res/drawable/{night_mode_disabled_light.xml => night_mode_disabled_day.xml} (81%) rename app/src/main/res/drawable/{night_mode_disabled_dark.xml => night_mode_disabled_night.xml} (81%) rename app/src/main/res/drawable/{night_mode_enabled_light.xml => night_mode_enabled_day.xml} (81%) rename app/src/main/res/drawable/{night_mode_enabled_dark.xml => night_mode_enabled_night.xml} (81%) rename app/src/main/res/drawable/{proxy_disabled_light.xml => proxy_disabled_day.xml} (100%) rename app/src/main/res/drawable/{proxy_disabled_dark.xml => proxy_disabled_night.xml} (72%) rename app/src/main/res/drawable/{proxy_enabled_light.xml => proxy_enabled_day.xml} (72%) rename app/src/main/res/drawable/{proxy_enabled_dark.xml => proxy_enabled_night.xml} (72%) rename app/src/main/res/drawable/{proxy_ghosted_light.xml => proxy_ghosted_day.xml} (72%) rename app/src/main/res/drawable/{proxy_ghosted_dark.xml => proxy_ghosted_night.xml} (72%) rename app/src/main/res/drawable/{refresh_disabled_light.xml => refresh_disabled_day.xml} (80%) rename app/src/main/res/drawable/{refresh_disabled_dark.xml => refresh_disabled_night.xml} (80%) rename app/src/main/res/drawable/{refresh_enabled_light.xml => refresh_enabled_day.xml} (80%) rename app/src/main/res/drawable/{refresh_enabled_dark.xml => refresh_enabled_night.xml} (80%) rename app/src/main/res/drawable/{save_light.xml => save_day.xml} (69%) rename app/src/main/res/drawable/{save_dialog_light.xml => save_dialog_day.xml} (73%) rename app/src/main/res/drawable/{save_dialog_dark.xml => save_dialog_night.xml} (73%) rename app/src/main/res/drawable/{save_dark.xml => save_night.xml} (73%) rename app/src/main/res/drawable/{search_custom_url_enabled_light.xml => search_custom_url_enabled_day.xml} (88%) rename app/src/main/res/drawable/{search_custom_url_enabled_dark.xml => search_custom_url_enabled_night.xml} (88%) rename app/src/main/res/drawable/{search_custom_url_ghosted_light.xml => search_custom_url_ghosted_day.xml} (88%) rename app/src/main/res/drawable/{search_custom_url_ghosted_dark.xml => search_custom_url_ghosted_night.xml} (88%) rename app/src/main/res/drawable/{search_enabled_light.xml => search_enabled_day.xml} (93%) rename app/src/main/res/drawable/{search_enabled_dark.xml => search_enabled_night.xml} (93%) rename app/src/main/res/drawable/{select_all_light.xml => select_all_day.xml} (67%) rename app/src/main/res/drawable/{select_all_dark.xml => select_all_night.xml} (71%) rename app/src/main/res/drawable/{social_media_disabled_light.xml => social_media_disabled_day.xml} (83%) rename app/src/main/res/drawable/{social_media_disabled_dark.xml => social_media_disabled_night.xml} (83%) rename app/src/main/res/drawable/{social_media_enabled_light.xml => social_media_enabled_day.xml} (83%) rename app/src/main/res/drawable/{social_media_enabled_dark.xml => social_media_enabled_night.xml} (83%) rename app/src/main/res/drawable/{social_media_ghosted_light.xml => social_media_ghosted_day.xml} (83%) rename app/src/main/res/drawable/{social_media_ghosted_dark.xml => social_media_ghosted_night.xml} (83%) rename app/src/main/res/drawable/{sort_light.xml => sort_day.xml} (72%) rename app/src/main/res/drawable/{sort_dark.xml => sort_night.xml} (77%) rename app/src/main/res/drawable/{sort_selected_dark.xml => sort_selected_day.xml} (74%) rename app/src/main/res/drawable/{sort_selected_light.xml => sort_selected_night.xml} (74%) rename app/src/main/res/drawable/{ssl_certificate_disabled_light.xml => ssl_certificate_disabled_day.xml} (85%) rename app/src/main/res/drawable/{ssl_certificate_disabled_dark.xml => ssl_certificate_disabled_night.xml} (85%) rename app/src/main/res/drawable/{ssl_certificate_enabled_light.xml => ssl_certificate_enabled_day.xml} (81%) rename app/src/main/res/drawable/{ssl_certificate_enabled_dark.xml => ssl_certificate_enabled_night.xml} (81%) rename app/src/main/res/drawable/{theme_light.xml => theme_day.xml} (79%) rename app/src/main/res/drawable/{theme_dark.xml => theme_night.xml} (76%) rename app/src/main/res/drawable/{user_agent_light.xml => user_agent_day.xml} (82%) rename app/src/main/res/drawable/{user_agent_dark.xml => user_agent_night.xml} (82%) rename app/src/main/res/drawable/{wide_viewport_disabled_light.xml => wide_viewport_disabled_day.xml} (65%) rename app/src/main/res/drawable/{wide_viewport_disabled_dark.xml => wide_viewport_disabled_night.xml} (65%) rename app/src/main/res/drawable/{wide_viewport_enabled_light.xml => wide_viewport_enabled_day.xml} (65%) rename app/src/main/res/drawable/{wide_viewport_enabled_dark.xml => wide_viewport_enabled_night.xml} (65%) delete mode 100644 app/src/main/res/layout/navigation_header.xml create mode 100644 app/src/main/res/values-night-v23/styles.xml create mode 100644 app/src/main/res/values-night-v27/styles.xml create mode 100644 app/src/main/res/values-night/styles.xml create mode 100644 app/src/main/res/values-v23/styles.xml create mode 100644 app/src/main/res/values-v27/styles.xml diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml index c71e3926..1cefe928 100644 --- a/.idea/dictionaries/soren.xml +++ b/.idea/dictionaries/soren.xml @@ -83,6 +83,7 @@ glitchy googleplay homescreen + hsts huawei imageview inet diff --git a/app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java b/app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java index bce865f2..60d507b0 100644 --- a/app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java +++ b/app/src/free/java/com/stoutner/privacybrowser/dialogs/AdConsentDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2018-2019 Soren Stoutner . + * Copyright © 2018-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -19,16 +19,17 @@ package com.stoutner.privacybrowser.dialogs; -import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.WindowManager; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; import com.stoutner.privacybrowser.R; @@ -39,23 +40,17 @@ public class AdConsentDialog extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - // Use a builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); + + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the style and the icon according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - dialogBuilder.setIcon(R.drawable.block_ads_enabled_dark); + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.block_ads_enabled_night); } else { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - dialogBuilder.setIcon(R.drawable.block_ads_enabled_light); + dialogBuilder.setIcon(R.drawable.block_ads_enabled_day); } // Remove the incorrect lint warning below that `getApplicationContext()` might be null. @@ -99,6 +94,12 @@ public class AdConsentDialog extends DialogFragment { // Create an alert dialog from the alert dialog builder. AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindow()` might be null. @@ -114,7 +115,7 @@ public class AdConsentDialog extends DialogFragment { // Close Privacy Browser Free if the dialog is cancelled without selecting a button (by tapping on the background). @Override - public void onCancel(DialogInterface dialogInterface) { + public void onCancel(@NonNull DialogInterface dialogInterface) { // Remove the incorrect lint warning below that `getApplicationContext()` might be null. assert getActivity() != null; @@ -125,7 +126,7 @@ public class AdConsentDialog extends DialogFragment { // Update the ad consent database. adConsentDatabaseHelper.updateAdConsent(false); - // Close the browser. `finishAndRemoveTask` also removes Privacy Browser from the recent app list. + // Close the browser. `finishAndRemoveTask()` also removes Privacy Browser from the recent app list. if (Build.VERSION.SDK_INT >= 21) { getActivity().finishAndRemoveTask(); } else { diff --git a/app/src/free/res/drawable/privacy_browser_foreground.xml b/app/src/free/res/drawable/privacy_browser_foreground.xml index d723a60f..cb1baa1d 100644 --- a/app/src/free/res/drawable/privacy_browser_foreground.xml +++ b/app/src/free/res/drawable/privacy_browser_foreground.xml @@ -1,78 +1,87 @@ - + android:width="108dp" + android:viewportHeight="523.63635" + android:viewportWidth="523.63635" > - + - + + - + + - + + - + + - + + - + + - + + - + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dedd5b1a..b4998dd3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -99,7 +99,7 @@ More information about the blocklists can be found on the EasyList website.

Libraries

-

Privacy Browser is built with the AndroidX Libraries +

Privacy Browser is built with the AndroidX Libraries, + the Kotlin libraries, and code from the Google Material Maven repository, which are released under the Apache License 2.0.

diff --git a/app/src/main/assets/de/about_licenses_light.html b/app/src/main/assets/de/about_licenses_light.html index b7334fb9..2aaa701a 100644 --- a/app/src/main/assets/de/about_licenses_light.html +++ b/app/src/main/assets/de/about_licenses_light.html @@ -45,7 +45,8 @@

More information about the blocklists can be found on the EasyList website.

Libraries

-

Privacy Browser is built with the AndroidX Libraries +

Privacy Browser is built with the AndroidX Libraries, + the Kotlin libraries, and code from the Google Material Maven repository, which are released under the Apache License 2.0.

diff --git a/app/src/main/assets/en/about_licenses_dark.html b/app/src/main/assets/en/about_licenses_dark.html index d35e8926..3591332e 100644 --- a/app/src/main/assets/en/about_licenses_dark.html +++ b/app/src/main/assets/en/about_licenses_dark.html @@ -44,7 +44,8 @@

More information about the blocklists can be found on the EasyList website.

Libraries

-

Privacy Browser is built with the AndroidX Libraries +

Privacy Browser is built with the AndroidX Libraries, + the Kotlin libraries, and code from the Google Material Maven repository, which are released under the Apache License 2.0.

diff --git a/app/src/main/assets/en/about_licenses_light.html b/app/src/main/assets/en/about_licenses_light.html index 94fc96b7..0ca5a629 100644 --- a/app/src/main/assets/en/about_licenses_light.html +++ b/app/src/main/assets/en/about_licenses_light.html @@ -44,7 +44,8 @@

More information about the blocklists can be found on the EasyList website.

Libraries

-

Privacy Browser is built with the AndroidX Libraries +

Privacy Browser is built with the AndroidX Libraries, + the Kotlin libraries, and code from the Google Material Maven repository, which are released under the Apache License 2.0.

diff --git a/app/src/main/assets/es/about_licenses_dark.html b/app/src/main/assets/es/about_licenses_dark.html index 1efd9fab..3fdf16b1 100644 --- a/app/src/main/assets/es/about_licenses_dark.html +++ b/app/src/main/assets/es/about_licenses_dark.html @@ -46,7 +46,8 @@

Más información sobre las listas de bloqueo puede encontrarse en la página web de EasyList.

Librerías

-

Navegador Privado está construido con las librerías de AndroidX +

Navegador Privado está construido con las librerías de AndroidX, + the Kotlin libraries, y código del repositorio de Google Material Maven, que se publican bajo la Licencia Apache 2.0.

diff --git a/app/src/main/assets/es/about_licenses_light.html b/app/src/main/assets/es/about_licenses_light.html index c365df02..8a9525e2 100644 --- a/app/src/main/assets/es/about_licenses_light.html +++ b/app/src/main/assets/es/about_licenses_light.html @@ -46,7 +46,8 @@

Más información sobre las listas de bloqueo puede encontrarse en la página web de EasyList.

Librerías

-

Navegador Privado está construido con las librerías de AndroidX +

Navegador Privado está construido con las librerías de AndroidX, + the Kotlin libraries, y código del repositorio de Google Material Maven, que se publican bajo la Licencia Apache 2.0.

diff --git a/app/src/main/assets/fr/about_licenses_dark.html b/app/src/main/assets/fr/about_licenses_dark.html index 9fd954e1..46d16e1a 100644 --- a/app/src/main/assets/fr/about_licenses_dark.html +++ b/app/src/main/assets/fr/about_licenses_dark.html @@ -46,7 +46,8 @@

Pour plus d'informations sur les listes de blocage, consultez le site web EasyList.

Librairies

-

Privacy Browser est construit avec les librairies AndroidX +

Privacy Browser est construit avec les librairies AndroidX, + the Kotlin libraries, et le code du référentiel Google Material Maven, publiées sous la Licence Apache 2.0.

diff --git a/app/src/main/assets/fr/about_licenses_light.html b/app/src/main/assets/fr/about_licenses_light.html index c70af653..3c23d5df 100644 --- a/app/src/main/assets/fr/about_licenses_light.html +++ b/app/src/main/assets/fr/about_licenses_light.html @@ -46,7 +46,8 @@

Pour plus d'informations sur les listes de blocage, consultez le site web EasyList.

Librairies

-

Privacy Browser est construit avec les librairies AndroidX +

Privacy Browser est construit avec les librairies AndroidX, + the Kotlin libraries, et le code du référentiel Google Material Maven, publiées sous la Licence Apache 2.0.

diff --git a/app/src/main/assets/it/about_licenses_dark.html b/app/src/main/assets/it/about_licenses_dark.html index c117f94c..e752e95e 100644 --- a/app/src/main/assets/it/about_licenses_dark.html +++ b/app/src/main/assets/it/about_licenses_dark.html @@ -49,7 +49,8 @@

E' possibile reperire maggiori informazioni sulle block list sul sito web EasyList.

Librerie

-

Privacy Browser è compilato utilizzando le Librerie AndroidX +

Privacy Browser è compilato utilizzando le Librerie AndroidX, + the Kotlin libraries, e il codice disponibile nella Google Material Maven repository, entrambi rilasciati con Licenza Apache 2.0.

diff --git a/app/src/main/assets/it/about_licenses_light.html b/app/src/main/assets/it/about_licenses_light.html index bb3f7d6e..58ed90db 100644 --- a/app/src/main/assets/it/about_licenses_light.html +++ b/app/src/main/assets/it/about_licenses_light.html @@ -49,7 +49,8 @@

E' possibile reperire maggiori informazioni sulle block list sul sito web EasyList.

Librerie

-

Privacy Browser è compilato utilizzando le Librerie AndroidX +

Privacy Browser è compilato utilizzando le Librerie AndroidX, + the Kotlin libraries, e il codice disponibile nella Google Material Maven repository, entrambi rilasciati con Licenza Apache 2.0.

diff --git a/app/src/main/assets/ru/about_licenses_dark.html b/app/src/main/assets/ru/about_licenses_dark.html index 8a6a0532..7e79ef52 100644 --- a/app/src/main/assets/ru/about_licenses_dark.html +++ b/app/src/main/assets/ru/about_licenses_dark.html @@ -44,7 +44,8 @@

Более подробную информацию о списках блокировки можно найти на веб-сайте EasyList.

Библиотеки

-

Privacy Browser создан на базе библиотек AndroidX +

Privacy Browser создан на базе библиотек AndroidX, + the Kotlin libraries, и кодовой базы из репозитория Google Material Maven, которые выпущены под лицензией Apache 2.0.

diff --git a/app/src/main/assets/ru/about_licenses_light.html b/app/src/main/assets/ru/about_licenses_light.html index a9d95e89..c71850bb 100644 --- a/app/src/main/assets/ru/about_licenses_light.html +++ b/app/src/main/assets/ru/about_licenses_light.html @@ -44,7 +44,8 @@

Более подробную информацию о списках блокировки можно найти на веб-сайте EasyList.

Библиотеки

-

Privacy Browser создан на базе библиотек AndroidX +

Privacy Browser создан на базе библиотек AndroidX, + the Kotlin libraries, и кодовой базы из репозитория Google Material Maven, которые выпущены под лицензией Apache 2.0.

diff --git a/app/src/main/assets/tr/about_licenses_dark.html b/app/src/main/assets/tr/about_licenses_dark.html index f5918010..453ebde1 100644 --- a/app/src/main/assets/tr/about_licenses_dark.html +++ b/app/src/main/assets/tr/about_licenses_dark.html @@ -44,9 +44,10 @@

Engel listeleri hakkında daha fazla bilgiyi EasyList adresinde bulabilirsiniz.

Kütüphaneler

-

Privacy Browser AndroidX Kütüphaneleri ile ve - Apache License 2.0 altında yayınlanan - Google Material Maven veri havuzundaki kodlardan oluşturulmuştur.

+

Privacy Browser is built with the AndroidX Libraries, + the Kotlin libraries, + and code from the Google Material Maven repository, + which are released under the Apache License 2.0.

Privacy Browser ücretsiz versiyonu Android Software Development Kit lisansı altında yayınlanan Firebase Ads ile oluşturulmuştur.

diff --git a/app/src/main/assets/tr/about_licenses_light.html b/app/src/main/assets/tr/about_licenses_light.html index 4fe9764a..d8031280 100644 --- a/app/src/main/assets/tr/about_licenses_light.html +++ b/app/src/main/assets/tr/about_licenses_light.html @@ -44,9 +44,10 @@

Engel listeleri hakkında daha fazla bilgiyi EasyList adresinde bulabilirsiniz.

Kütüphaneler

-

Privacy Browser AndroidX Kütüphaneleri ile ve - Apache License 2.0 altında yayınlanan - Google Material Maven veri havuzundaki kodlardan oluşturulmuştur.

+

Privacy Browser is built with the AndroidX Libraries, + the Kotlin libraries, + and code from the Google Material Maven repository, + which are released under the Apache License 2.0.

Privacy Browser ücretsiz versiyonu Android Software Development Kit lisansı altında yayınlanan Firebase Ads ile oluşturulmuştur.

diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java index 6ce5b431..3d5170df 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -41,8 +41,7 @@ public class AboutActivity extends AppCompatActivity { // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); // Disable screenshots if not allowed. @@ -51,11 +50,7 @@ public class AboutActivity extends AppCompatActivity { } // Set the theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); - } else { - setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); - } + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java index 67cff69d..3a96929f 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java @@ -25,6 +25,7 @@ import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -128,8 +129,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); // Disable screenshots if not allowed. @@ -137,12 +137,8 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } - // Set the activity theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); - } else { - setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); - } + // Set the theme. + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); @@ -991,12 +987,6 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma } private void updateMoveIcons() { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Get a long array of the selected bookmarks. long[] selectedBookmarksLongArray = bookmarksListView.getCheckedItemIds(); @@ -1006,6 +996,9 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma // bookmarksListView is 0 indexed. int lastBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(bookmarksListView.getCount() - 1); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Update the move bookmark up `MenuItem`. if (selectedBookmarkDatabaseId == firstBookmarkDatabaseId) { // The selected bookmark is in the first position. // Disable the move bookmark up `MenuItem`. @@ -1014,14 +1007,14 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma // Set the move bookmark up icon to be ghosted. moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_disabled); } else { // The selected bookmark is not in the first position. - // Enable the move bookmark up `MenuItem`. + // Enable the move bookmark up menu item. moveBookmarkUpMenuItem.setEnabled(true); // Set the icon according to the theme. - if (darkTheme) { - moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_night); } else { - moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_light); + moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_day); } } @@ -1037,10 +1030,10 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma moveBookmarkDownMenuItem.setEnabled(true); // Set the icon according to the theme. - if (darkTheme) { - moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_night); } else { - moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_light); + moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_day); } } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java index 9844f184..c4b97517 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java @@ -24,6 +24,7 @@ import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.database.Cursor; import android.database.MatrixCursor; import android.database.MergeCursor; @@ -107,8 +108,7 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); // Disable screenshots if not allowed. @@ -117,11 +117,7 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements } // Set the activity theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); - } else { - setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); - } + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); @@ -334,8 +330,12 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements parentFolderImageView.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.folder_dark_blue)); bookmarkParentFolderTextView.setText(bookmarkParentFolder); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Set the text color according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + // This color is a little darker than the default night mode text. But the effect is rather nice. bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.gray_300)); } else { bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.black)); @@ -590,12 +590,6 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements @Override public boolean onOptionsItemSelected(MenuItem menuItem) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - - // Get the theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Get the ID of the menu item that was selected. int menuItemId = menuItem.getItemId(); @@ -610,26 +604,29 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements // Update the sort by display order tracker. sortByDisplayOrder = !sortByDisplayOrder; - // Get a handle for the bookmarks `ListView`. + // Get a handle for the bookmarks list view. ListView bookmarksListView = findViewById(R.id.bookmarks_databaseview_listview); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Update the icon and display a snackbar. if (sortByDisplayOrder) { // Sort by display order. // Update the icon according to the theme. - if (darkTheme) { - menuItem.setIcon(R.drawable.sort_selected_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + menuItem.setIcon(R.drawable.sort_selected_night); } else { - menuItem.setIcon(R.drawable.sort_selected_light); + menuItem.setIcon(R.drawable.sort_selected_day); } // Display a Snackbar indicating the current sort type. Snackbar.make(bookmarksListView, R.string.sorted_by_display_order, Snackbar.LENGTH_SHORT).show(); } else { // Sort by database id. // Update the icon according to the theme. - if (darkTheme) { - menuItem.setIcon(R.drawable.sort_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + menuItem.setIcon(R.drawable.sort_night); } else { - menuItem.setIcon(R.drawable.sort_light); + menuItem.setIcon(R.drawable.sort_day); } // Display a Snackbar indicating the current sort type. diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java index 708e622b..6c07a121 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java @@ -23,6 +23,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.os.Bundle; @@ -129,8 +130,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); // Disable screenshots if not allowed. @@ -138,12 +138,8 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } - // Set the activity theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); - } else { - setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); - } + // Set the theme. + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); @@ -396,7 +392,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // Disable the options `MenuItems`. deleteMenuItem.setEnabled(false); - deleteMenuItem.setIcon(R.drawable.delete_blue); + deleteMenuItem.setIcon(R.drawable.delete_disabled); // Remove the domain settings fragment. fragmentManager.beginTransaction().remove(Objects.requireNonNull(fragmentManager.findFragmentById(R.id.domain_settings_fragment_container))).commit(); @@ -442,7 +438,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // Get a handle for the activity. Activity activity = this; - // Display a `Snackbar`. + // Display a snackbar. undoDeleteSnackbar = Snackbar.make(domainsListView, R.string.domain_deleted, Snackbar.LENGTH_LONG) .setAction(R.string.undo, (View v) -> { // Do nothing because everything will be handled by `onDismissed()` below. @@ -482,17 +478,27 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo } }; - // Update the `ListView`. + // Update the domains list view. domainsListView.setAdapter(undoDeleteDomainsCursorAdapter); - // Select the previously deleted domain in `domainsListView`. + + // Select the previously deleted domain in the list view. domainsListView.setItemChecked(deletedDomainPosition, true); - // Display `domainSettingsFragment`. + // Display the domain settings fragment. fragmentManager.beginTransaction().replace(R.id.domain_settings_fragment_container, domainSettingsFragment).commit(); - // Enable the options `MenuItems`. + // Enable the options delete menu item. deleteMenuItem.setEnabled(true); - deleteMenuItem.setIcon(R.drawable.delete_light); + + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + // Set the delete menu item icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + deleteMenuItem.setIcon(R.drawable.delete_night); + } else { + deleteMenuItem.setIcon(R.drawable.delete_day); + } } else { // The device in in one-paned mode. // Display `domainSettingsFragment`. fragmentManager.beginTransaction().replace(R.id.domains_listview_fragment_container, domainSettingsFragment).commit(); @@ -514,29 +520,26 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo if (dismissingSnackbar) { // Create a `Runnable` to enable the delete menu item. Runnable enableDeleteMenuItemRunnable = () -> { - // Enable `deleteMenuItem` according to the display mode. + // Enable the delete menu item according to the display mode. if (twoPanedMode) { // Two-paned mode. // Enable the delete menu item. deleteMenuItem.setEnabled(true); - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - - // Get the theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the delete icon according to the theme. - if (darkTheme) { - deleteMenuItem.setIcon(R.drawable.delete_dark); + // Set the delete menu item icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + deleteMenuItem.setIcon(R.drawable.delete_night); } else { - deleteMenuItem.setIcon(R.drawable.delete_light); + deleteMenuItem.setIcon(R.drawable.delete_day); } } else { // Single-paned mode. - // Show `deleteMenuItem`. + // Show the delete menu item. deleteMenuItem.setVisible(true); } - // Reset `dismissingSnackbar`. + // Reset the dismissing snackbar tracker. dismissingSnackbar = false; }; @@ -853,22 +856,19 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // Enable the delete options menu items. deleteMenuItem.setEnabled(true); - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; // Set the delete icon according to the theme. - if (darkTheme) { - deleteMenuItem.setIcon(R.drawable.delete_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + deleteMenuItem.setIcon(R.drawable.delete_night); } else { - deleteMenuItem.setIcon(R.drawable.delete_light); + deleteMenuItem.setIcon(R.drawable.delete_day); } } else if (twoPanedMode) { // Two-paned mode is enabled but there are no domains. // Disable the options `MenuItems`. deleteMenuItem.setEnabled(false); - deleteMenuItem.setIcon(R.drawable.delete_blue); + deleteMenuItem.setIcon(R.drawable.delete_disabled); } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/GuideActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/GuideActivity.java index d6809e57..7fcf2d3c 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/GuideActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/GuideActivity.java @@ -40,8 +40,7 @@ public class GuideActivity extends AppCompatActivity { // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); // Disable screenshots if not allowed. @@ -50,11 +49,7 @@ public class GuideActivity extends AppCompatActivity { } // Set the theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); - } else { - setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); - } + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.java index 3481f312..cc9363f9 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.java @@ -96,8 +96,7 @@ public class ImportExportActivity extends AppCompatActivity implements StoragePe // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); // Disable screenshots if not allowed. @@ -105,12 +104,8 @@ public class ImportExportActivity extends AppCompatActivity implements StoragePe getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } - // Set the activity theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); - } else { - setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); - } + // Set the theme. + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java index 9f433632..de0b873d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java @@ -27,11 +27,13 @@ import android.content.ClipboardManager; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.Configuration; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; +import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -75,8 +77,7 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); // Disable screenshots if not allowed. @@ -84,12 +85,8 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } - // Set the activity theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); - } else { - setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); - } + // Set the theme. + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); @@ -97,7 +94,7 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo // Set the content view. setContentView(R.layout.logcat_coordinatorlayout); - // The AndroidX toolbar must be used until the minimum API is >= 21. + // Set the toolbar as the action bar. Toolbar toolbar = findViewById(R.id.logcat_toolbar); setSupportActionBar(toolbar); @@ -117,14 +114,28 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo new GetLogcat(this).execute(); }); - // Set the swipe to refresh color according to the theme. - if (darkTheme) { - swipeRefreshLayout.setColorSchemeResources(R.color.blue_600); - swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.gray_800); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + // Set the refresh color scheme according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeRefreshLayout.setColorSchemeResources(R.color.blue_500); } else { swipeRefreshLayout.setColorSchemeResources(R.color.blue_700); } + // Initialize a color background typed value. + TypedValue colorBackgroundTypedValue = new TypedValue(); + + // Get the color background from the theme. + getTheme().resolveAttribute(android.R.attr.colorBackground, colorBackgroundTypedValue, true); + + // Get the color background int from the typed value. + int colorBackgroundInt = colorBackgroundTypedValue.data; + + // Set the swipe refresh background color. + swipeRefreshLayout.setProgressBackgroundColorSchemeColor(colorBackgroundInt); + // Get the logcat. new GetLogcat(this).execute(); } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 267e59bf..becbd5ac 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -58,6 +58,7 @@ import android.text.Spanned; import android.text.TextWatcher; import android.text.style.ForegroundColorSpan; import android.util.Patterns; +import android.util.TypedValue; import android.view.ContextMenu; import android.view.GestureDetector; import android.view.KeyEvent; @@ -96,6 +97,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.app.ActivityCompat; @@ -124,7 +126,6 @@ import com.stoutner.privacybrowser.dialogs.AdConsentDialog; import com.stoutner.privacybrowser.dialogs.CreateBookmarkDialog; import com.stoutner.privacybrowser.dialogs.CreateBookmarkFolderDialog; import com.stoutner.privacybrowser.dialogs.CreateHomeScreenShortcutDialog; -import com.stoutner.privacybrowser.dialogs.EditBookmarkDialog; import com.stoutner.privacybrowser.dialogs.EditBookmarkFolderDialog; import com.stoutner.privacybrowser.dialogs.FontSizeDialog; import com.stoutner.privacybrowser.dialogs.HttpAuthenticationDialog; @@ -167,9 +168,9 @@ import java.util.Objects; import java.util.Set; public class MainWebViewActivity extends AppCompatActivity implements CreateBookmarkDialog.CreateBookmarkListener, CreateBookmarkFolderDialog.CreateBookmarkFolderListener, - EditBookmarkDialog.EditBookmarkListener, EditBookmarkFolderDialog.EditBookmarkFolderListener, FontSizeDialog.UpdateFontSizeListener, NavigationView.OnNavigationItemSelectedListener, - OpenDialog.OpenListener, PinnedMismatchDialog.PinnedMismatchListener, PopulateBlocklists.PopulateBlocklistsListener, SaveDialog.SaveWebpageListener, - StoragePermissionDialog.StoragePermissionDialogListener, UrlHistoryDialog.NavigateHistoryListener, WebViewTabFragment.NewTabListener { + EditBookmarkFolderDialog.EditBookmarkFolderListener, FontSizeDialog.UpdateFontSizeListener, NavigationView.OnNavigationItemSelectedListener, OpenDialog.OpenListener, + PinnedMismatchDialog.PinnedMismatchListener, PopulateBlocklists.PopulateBlocklistsListener, SaveDialog.SaveWebpageListener, StoragePermissionDialog.StoragePermissionDialogListener, + UrlHistoryDialog.NavigateHistoryListener, WebViewTabFragment.NewTabListener { // `orbotStatus` is public static so it can be accessed from `OrbotProxyHelper`. It is also used in `onCreate()`, `onResume()`, and `applyProxy()`. public static String orbotStatus = "unknown"; @@ -276,11 +277,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook private ForegroundColorSpan initialGrayColorSpan; private ForegroundColorSpan finalGrayColorSpan; - // The drawer header padding variables are used in `onCreate()` and `onConfigurationChanged()`. - private int drawerHeaderPaddingLeftAndRight; - private int drawerHeaderPaddingTop; - private int drawerHeaderPaddingBottom; - // `bookmarksDatabaseHelper` is used in `onCreate()`, `onDestroy`, `onOptionsItemSelected()`, `onCreateBookmark()`, `onCreateBookmarkFolder()`, `onSaveEditBookmark()`, `onSaveEditBookmarkFolder()`, // and `loadBookmarksFolder()`. private BookmarksDatabaseHelper bookmarksDatabaseHelper; @@ -298,12 +294,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook private ValueCallback fileChooserCallback; // The default progress view offsets are set in `onCreate()` and used in `initializeWebView()`. + private int appBarHeight; private int defaultProgressViewStartOffset; private int defaultProgressViewEndOffset; - // The swipe refresh layout top padding is used when exiting full screen browsing mode. It is used in an inner class in `initializeWebView()`. - private int swipeRefreshLayoutPaddingTop; - // The URL sanitizers are set in `applyAppSettings()` and used in `sanitizeUrl()`. private boolean sanitizeGoogleAnalytics; private boolean sanitizeFacebookClickIds; @@ -318,10 +312,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Remove the warning about needing to override `performClick()` when using an `OnTouchListener` with `WebView`. @SuppressLint("ClickableViewAccessibility") protected void onCreate(Bundle savedInstanceState) { - // Enable the drawing of the entire webpage. This makes it possible to save a website image. This must be done before anything else happens with the WebView. - if (Build.VERSION.SDK_INT >= 21) { - WebView.enableSlowWholeDocumentDraw(); - } + // Run the default commands. + super.onCreate(savedInstanceState); // Initialize the default preference values the first time the program is run. `false` keeps this command from resetting any current preferences back to default. PreferenceManager.setDefaultValues(this, R.xml.preferences, false); @@ -329,24 +321,42 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the screenshot preference. + String appTheme = sharedPreferences.getString("app_theme", getString(R.string.app_theme_default_value)); boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Get the theme entry values string array. + String[] appThemeEntryValuesStringArray = getResources().getStringArray(R.array.app_theme_entry_values); + + // Set the app theme according to the preference. A switch statement cannot be used because the theme entry values string array is not a compile time constant. + if (appTheme.equals(appThemeEntryValuesStringArray[1])) { // The light theme is selected. + // Apply the light theme. + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + } else if (appTheme.equals(appThemeEntryValuesStringArray[2])) { // The dark theme is selected. + // Apply the dark theme. + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + } else { // The system default theme is selected. + if (Build.VERSION.SDK_INT >= 28) { // The system default theme is supported. + // Follow the system default theme. + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); + } else { // The system default theme is not supported. + // Follow the battery saver mode. + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY); + } + } + // Disable screenshots if not allowed. if (!allowScreenshots) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } - // Set the activity theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark); - } else { - setTheme(R.style.PrivacyBrowserLight); + // Enable the drawing of the entire webpage. This makes it possible to save a website image. This must be done before anything else happens with the WebView. + if (Build.VERSION.SDK_INT >= 21) { + WebView.enableSlowWholeDocumentDraw(); } - // Run the default commands. - super.onCreate(savedInstanceState); + // Set the theme. + setTheme(R.style.PrivacyBrowser); // Set the content view. setContentView(R.layout.main_framelayout); @@ -356,11 +366,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook Toolbar toolbar = findViewById(R.id.toolbar); ViewPager webViewPager = findViewById(R.id.webviewpager); - // Set the action bar. `SupportActionBar` must be used until the minimum API is >= 21. - setSupportActionBar(toolbar); + // Get a handle for the app compat delegate. + AppCompatDelegate appCompatDelegate = getDelegate(); + + // Set the support action bar. + appCompatDelegate.setSupportActionBar(toolbar); // Get a handle for the action bar. - ActionBar actionBar = getSupportActionBar(); + ActionBar actionBar = appCompatDelegate.getSupportActionBar(); // This is needed to get rid of the Android Studio warning that the action bar might be null. assert actionBar != null; @@ -369,12 +382,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook actionBar.setCustomView(R.layout.url_app_bar); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); - // Initially disable the sliding drawers. They will be enabled once the blocklists are loaded. - drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); - // Create the hamburger icon at the start of the AppBar. actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open_navigation_drawer, R.string.close_navigation_drawer); + // Initially disable the sliding drawers. They will be enabled once the blocklists are loaded. + drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); + // Initialize the web view pager adapter. webViewPagerAdapter = new WebViewPagerAdapter(getSupportFragmentManager()); @@ -568,9 +581,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Get a handle for the root frame layouts. FrameLayout rootFrameLayout = findViewById(R.id.root_framelayout); - // Remove the translucent status flag. This is necessary so the root frame layout can fill the entire screen. - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - /* Hide the system bars. * SYSTEM_UI_FLAG_FULLSCREEN hides the status bar at the top of the screen. * SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN makes the root frame layout fill the area that is normally reserved for the status bar. @@ -619,12 +629,20 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @Override public void onDestroy() { - // Unregister the orbot status broadcast receiver. - this.unregisterReceiver(orbotStatusBroadcastReceiver); + // Unregister the orbot status broadcast receiver if it exists. + if (orbotStatusBroadcastReceiver != null) { + this.unregisterReceiver(orbotStatusBroadcastReceiver); + } - // Close the bookmarks cursor and database. - bookmarksCursor.close(); - bookmarksDatabaseHelper.close(); + // Close the bookmarks cursor if it exists. + if (bookmarksCursor != null) { + bookmarksCursor.close(); + } + + // Close the bookmarks database if it exists. + if (bookmarksDatabaseHelper != null) { + bookmarksDatabaseHelper.close(); + } // Run the default commands. super.onDestroy(); @@ -668,7 +686,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Get the dark theme and app bar preferences.. boolean displayAdditionalAppBarIcons = sharedPreferences.getBoolean("display_additional_app_bar_icons", false); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); // Set the status of the additional app bar icons. Setting the refresh menu item to `SHOW_AS_ACTION_ALWAYS` makes it appear even on small devices like phones. if (displayAdditionalAppBarIcons) { @@ -686,12 +703,18 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Set the title. refreshMenuItem.setTitle(R.string.stop); - // If the icon is displayed in the AppBar, set it according to the theme. + // Set the icon if it is displayed in the app bar. if (displayAdditionalAppBarIcons) { - if (darkTheme) { - refreshMenuItem.setIcon(R.drawable.close_dark); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + // Set the icon according to the current theme status. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + // Set the dark stop icon. + refreshMenuItem.setIcon(R.drawable.close_night); } else { - refreshMenuItem.setIcon(R.drawable.close_light); + // Set the light stop icon. + refreshMenuItem.setIcon(R.drawable.close_day); } } } @@ -2017,18 +2040,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Run the default commands. super.onConfigurationChanged(newConfig); - // Get the status bar pixel size. - int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); - int statusBarPixelSize = getResources().getDimensionPixelSize(statusBarResourceId); - - // Get the resource density. - float screenDensity = getResources().getDisplayMetrics().density; - - // Recalculate the drawer header padding. - drawerHeaderPaddingLeftAndRight = (int) (15 * screenDensity); - drawerHeaderPaddingTop = statusBarPixelSize + (int) (4 * screenDensity); - drawerHeaderPaddingBottom = (int) (8 * screenDensity); - // Reload the ad for the free flavor if not in full screen mode. if (BuildConfig.FLAVOR.contentEquals("free") && !inFullScreenBrowsingMode) { // Reload the ad. The AdView is destroyed and recreated, which changes the ID, every time it is reloaded to handle possible rotations. @@ -2457,47 +2468,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook bookmarksListView.setSelection(0); } - @Override - public void onSaveBookmark(DialogFragment dialogFragment, int selectedBookmarkDatabaseId, Bitmap favoriteIconBitmap) { - // Get the dialog. - Dialog dialog = dialogFragment.getDialog(); - - // Remove the incorrect lint warning below that the dialog might be null. - assert dialog != null; - - // Get handles for the views from the dialog. - EditText editBookmarkNameEditText = dialog.findViewById(R.id.edit_bookmark_name_edittext); - EditText editBookmarkUrlEditText = dialog.findViewById(R.id.edit_bookmark_url_edittext); - RadioButton currentBookmarkIconRadioButton = dialog.findViewById(R.id.edit_bookmark_current_icon_radiobutton); - - // Store the bookmark strings. - String bookmarkNameString = editBookmarkNameEditText.getText().toString(); - String bookmarkUrlString = editBookmarkUrlEditText.getText().toString(); - - // Update the bookmark. - if (currentBookmarkIconRadioButton.isChecked()) { // Update the bookmark without changing the favorite icon. - bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString); - } else { // Update the bookmark using the `WebView` favorite icon. - // Create a favorite icon byte array output stream. - ByteArrayOutputStream newFavoriteIconByteArrayOutputStream = new ByteArrayOutputStream(); - - // Convert the favorite icon bitmap to a byte array. `0` is for lossless compression (the only option for a PNG). - favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, newFavoriteIconByteArrayOutputStream); - - // Convert the favorite icon byte array stream to a byte array. - byte[] newFavoriteIconByteArray = newFavoriteIconByteArrayOutputStream.toByteArray(); - - // Update the bookmark and the favorite icon. - bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString, newFavoriteIconByteArray); - } - - // Update the bookmarks cursor with the current contents of this folder. - bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrder(currentBookmarksFolder); - - // Update the list view. - bookmarksCursorAdapter.changeCursor(bookmarksCursor); - } - @Override public void onSaveBookmarkFolder(DialogFragment dialogFragment, int selectedFolderDatabaseId, Bitmap favoriteIconBitmap) { // Get the dialog. @@ -2633,30 +2603,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Apply the appropriate full screen mode flags. if (fullScreenBrowsingModeEnabled && inFullScreenBrowsingMode) { // Privacy Browser is currently in full screen browsing mode. - // Hide the app bar if specified. - if (hideAppBar) { - // Get handles for the views. - LinearLayout tabsLinearLayout = findViewById(R.id.tabs_linearlayout); - ActionBar actionBar = getSupportActionBar(); - - // Remove the incorrect lint warning below that the action bar might be null. - assert actionBar != null; - - // Hide the tab linear layout. - tabsLinearLayout.setVisibility(View.GONE); - - // Hide the action bar. - actionBar.hide(); - } - // Hide the banner ad in the free flavor. if (BuildConfig.FLAVOR.contentEquals("free")) { AdHelper.hideAd(findViewById(R.id.adview)); } - // Remove the translucent status flag. This is necessary so the root frame layout can fill the entire screen. - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - /* Hide the system bars. * SYSTEM_UI_FLAG_FULLSCREEN hides the status bar at the top of the screen. * SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN makes the root frame layout fill the area that is normally reserved for the status bar. @@ -2665,12 +2616,15 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook */ rootFrameLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + + // Reload the website if the app bar is hidden. Otherwise, there is some bug in Android that causes the WebView to be entirely black. + if (hideAppBar) { + // Reload the WebView. + currentWebView.reload(); + } } else { // Switch to normal viewing mode. // Remove the `SYSTEM_UI` flags from the root frame layout. rootFrameLayout.setSystemUiVisibility(0); - - // Add the translucent status flag. - getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } // Reload the ad for the free flavor if not in full screen mode. @@ -3205,10 +3159,13 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook searchURL = searchString; } + // Get a handle for the app compat delegate. + AppCompatDelegate appCompatDelegate = getDelegate(); + // Get handles for the views that need to be modified. FrameLayout rootFrameLayout = findViewById(R.id.root_framelayout); AppBarLayout appBarLayout = findViewById(R.id.appbar_layout); - ActionBar actionBar = getSupportActionBar(); + ActionBar actionBar = appCompatDelegate.getSupportActionBar(); Toolbar toolbar = findViewById(R.id.toolbar); LinearLayout findOnPageLinearLayout = findViewById(R.id.find_on_page_linearlayout); LinearLayout tabsLinearLayout = findViewById(R.id.tabs_linearlayout); @@ -3297,9 +3254,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook AdHelper.hideAd(findViewById(R.id.adview)); } - // Remove the translucent status flag. This is necessary so the root frame layout can fill the entire screen. - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - /* Hide the system bars. * SYSTEM_UI_FLAG_FULLSCREEN hides the status bar at the top of the screen. * SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN makes the root frame layout fill the area that is normally reserved for the status bar. @@ -3326,19 +3280,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Remove the `SYSTEM_UI` flags from the root frame layout. rootFrameLayout.setSystemUiVisibility(0); - - // Add the translucent status flag. - getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } } private void initializeApp() { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - - // Get the theme preference. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Get a handle for the input method. InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); @@ -3528,20 +3473,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } }); - // Set the bookmarks drawer resources according to the theme. This can't be done in the layout due to compatibility issues with the `DrawerLayout` support widget. - // The deprecated `getResources().getDrawable()` must be used until the minimum API >= 21 and and `getResources().getColor()` must be used until the minimum API >= 23. - if (darkTheme) { - launchBookmarksActivityFab.setImageDrawable(getResources().getDrawable(R.drawable.bookmarks_dark)); - createBookmarkFolderFab.setImageDrawable(getResources().getDrawable(R.drawable.create_folder_dark)); - createBookmarkFab.setImageDrawable(getResources().getDrawable(R.drawable.create_bookmark_dark)); - bookmarksListView.setBackgroundColor(getResources().getColor(R.color.gray_850)); - } else { - launchBookmarksActivityFab.setImageDrawable(getResources().getDrawable(R.drawable.bookmarks_light)); - createBookmarkFolderFab.setImageDrawable(getResources().getDrawable(R.drawable.create_folder_light)); - createBookmarkFab.setImageDrawable(getResources().getDrawable(R.drawable.create_bookmark_light)); - bookmarksListView.setBackgroundColor(getResources().getColor(R.color.white)); - } - // Set the launch bookmarks activity FAB to launch the bookmarks activity. launchBookmarksActivityFab.setOnClickListener(v -> { // Get a copy of the favorite icon bitmap. @@ -3629,15 +3560,29 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook defaultProgressViewStartOffset = swipeRefreshLayout.getProgressViewStartOffset(); defaultProgressViewEndOffset = swipeRefreshLayout.getProgressViewEndOffset(); - // Set the swipe to refresh color according to the theme. - if (darkTheme) { - swipeRefreshLayout.setColorSchemeResources(R.color.blue_800); - swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.gray_850); - } else { + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + // Set the refresh color scheme according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { swipeRefreshLayout.setColorSchemeResources(R.color.blue_500); + } else { + swipeRefreshLayout.setColorSchemeResources(R.color.blue_700); } - // `DrawerTitle` identifies the `DrawerLayouts` in accessibility mode. + // Initialize a color background typed value. + TypedValue colorBackgroundTypedValue = new TypedValue(); + + // Get the color background from the theme. + getTheme().resolveAttribute(android.R.attr.colorBackground, colorBackgroundTypedValue, true); + + // Get the color background int from the typed value. + int colorBackgroundInt = colorBackgroundTypedValue.data; + + // Set the swipe refresh background color. + swipeRefreshLayout.setProgressBackgroundColorSchemeColor(colorBackgroundInt); + + // The drawer titles identify the drawer layouts in accessibility mode. drawerLayout.setDrawerTitle(GravityCompat.START, getString(R.string.navigation_drawer)); drawerLayout.setDrawerTitle(GravityCompat.END, getString(R.string.bookmarks)); @@ -3710,18 +3655,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook return true; }); - // Get the status bar pixel size. - int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); - int statusBarPixelSize = getResources().getDimensionPixelSize(statusBarResourceId); - - // Get the resource density. - float screenDensity = getResources().getDisplayMetrics().density; - - // Calculate the drawer header padding. This is used to move the text in the drawer headers below any cutouts. - drawerHeaderPaddingLeftAndRight = (int) (15 * screenDensity); - drawerHeaderPaddingTop = statusBarPixelSize + (int) (4 * screenDensity); - drawerHeaderPaddingBottom = (int) (8 * screenDensity); - // The drawer listener is used to update the navigation menu. drawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() { @Override @@ -3739,20 +3672,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @Override public void onDrawerStateChanged(int newState) { if ((newState == DrawerLayout.STATE_SETTLING) || (newState == DrawerLayout.STATE_DRAGGING)) { // A drawer is opening or closing. - // Get handles for the drawer headers. - TextView navigationHeaderTextView = findViewById(R.id.navigationText); - TextView bookmarksHeaderTextView = findViewById(R.id.bookmarks_title_textview); - - // Apply the navigation header paddings if the view is not null (sometimes it is null if another activity has already started). This moves the text in the header below any cutouts. - if (navigationHeaderTextView != null) { - navigationHeaderTextView.setPadding(drawerHeaderPaddingLeftAndRight, drawerHeaderPaddingTop, drawerHeaderPaddingLeftAndRight, drawerHeaderPaddingBottom); - } - - // Apply the bookmarks header paddings if the view is not null (sometimes it is null if another activity has already started). This moves the text in the header below any cutouts. - if (bookmarksHeaderTextView != null) { - bookmarksHeaderTextView.setPadding(drawerHeaderPaddingLeftAndRight, drawerHeaderPaddingTop, drawerHeaderPaddingLeftAndRight, drawerHeaderPaddingBottom); - } - // Update the navigation menu items if the WebView is not null. if (currentWebView != null) { navigationBackMenuItem.setEnabled(currentWebView.canGoBack()); @@ -3938,7 +3857,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook String defaultFontSizeString = sharedPreferences.getString("font_size", getString(R.string.font_size_default_value)); String defaultUserAgentName = sharedPreferences.getString("user_agent", getString(R.string.user_agent_default_value)); boolean defaultSwipeToRefresh = sharedPreferences.getBoolean("swipe_to_refresh", true); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); boolean wideViewport = sharedPreferences.getBoolean("wide_viewport", true); boolean displayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true); @@ -4182,8 +4100,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook break; } - // Set a green background on the URL relative layout to indicate that custom domain settings are being used. The deprecated `.getDrawable()` must be used until the minimum API >= 21. - if (darkTheme) { + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + // Set a background on the URL relative layout to indicate that custom domain settings are being used. The deprecated `.getDrawable()` must be used until the minimum API >= 21. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { urlRelativeLayout.setBackground(getResources().getDrawable(R.drawable.url_bar_background_dark_blue)); } else { urlRelativeLayout.setBackground(getResources().getDrawable(R.drawable.url_bar_background_light_green)); @@ -4296,12 +4217,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } private void applyProxy(boolean reloadWebViews) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - - // Get the theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Get a handle for the app bar layout. AppBarLayout appBarLayout = findViewById(R.id.appbar_layout); @@ -4311,20 +4226,28 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Reset the waiting for proxy tracker. waitingForProxy = false; + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Update the user interface and reload the WebViews if requested. switch (proxyMode) { case ProxyHelper.NONE: + // Initialize a color background typed value. + TypedValue colorBackgroundTypedValue = new TypedValue(); + + // Get the color background from the theme. + getTheme().resolveAttribute(android.R.attr.colorBackground, colorBackgroundTypedValue, true); + + // Get the color background int from the typed value. + int colorBackgroundInt = colorBackgroundTypedValue.data; + // Set the default app bar layout background. - if (darkTheme) { - appBarLayout.setBackgroundResource(R.color.gray_900); - } else { - appBarLayout.setBackgroundResource(R.color.gray_100); - } + appBarLayout.setBackgroundColor(colorBackgroundInt); break; case ProxyHelper.TOR: // Set the app bar background to indicate proxying through Orbot is enabled. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { appBarLayout.setBackgroundResource(R.color.dark_blue_30); } else { appBarLayout.setBackgroundResource(R.color.blue_50); @@ -4366,7 +4289,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook case ProxyHelper.I2P: // Set the app bar background to indicate proxying through Orbot is enabled. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { appBarLayout.setBackgroundResource(R.color.dark_blue_30); } else { appBarLayout.setBackgroundResource(R.color.blue_50); @@ -4393,7 +4316,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook case ProxyHelper.CUSTOM: // Set the app bar background to indicate proxying through Orbot is enabled. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { appBarLayout.setBackgroundResource(R.color.dark_blue_30); } else { appBarLayout.setBackgroundResource(R.color.blue_50); @@ -4426,12 +4349,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook private void updatePrivacyIcons(boolean runInvalidateOptionsMenu) { // Only update the privacy icons if the options menu and the current WebView have already been populated. if ((optionsMenu != null) && (currentWebView != null)) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Get handles for the menu items. MenuItem privacyMenuItem = optionsMenu.findItem(R.id.toggle_javascript); MenuItem firstPartyCookiesMenuItem = optionsMenu.findItem(R.id.toggle_first_party_cookies); @@ -4447,14 +4364,17 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook privacyMenuItem.setIcon(R.drawable.privacy_mode); } + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Update the first-party cookies icon. if (currentWebView.getAcceptFirstPartyCookies()) { // First-party cookies are enabled. firstPartyCookiesMenuItem.setIcon(R.drawable.cookies_enabled); } else { // First-party cookies are disabled. - if (darkTheme) { - firstPartyCookiesMenuItem.setIcon(R.drawable.cookies_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + firstPartyCookiesMenuItem.setIcon(R.drawable.cookies_disabled_night); } else { - firstPartyCookiesMenuItem.setIcon(R.drawable.cookies_disabled_light); + firstPartyCookiesMenuItem.setIcon(R.drawable.cookies_disabled_day); } } @@ -4462,27 +4382,27 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook if (currentWebView.getSettings().getJavaScriptEnabled() && currentWebView.getSettings().getDomStorageEnabled()) { // Both JavaScript and DOM storage are enabled. domStorageMenuItem.setIcon(R.drawable.dom_storage_enabled); } else if (currentWebView.getSettings().getJavaScriptEnabled()) { // JavaScript is enabled but DOM storage is disabled. - if (darkTheme) { - domStorageMenuItem.setIcon(R.drawable.dom_storage_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageMenuItem.setIcon(R.drawable.dom_storage_disabled_night); } else { - domStorageMenuItem.setIcon(R.drawable.dom_storage_disabled_light); + domStorageMenuItem.setIcon(R.drawable.dom_storage_disabled_day); } } else { // JavaScript is disabled, so DOM storage is ghosted. - if (darkTheme) { - domStorageMenuItem.setIcon(R.drawable.dom_storage_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageMenuItem.setIcon(R.drawable.dom_storage_ghosted_night); } else { - domStorageMenuItem.setIcon(R.drawable.dom_storage_ghosted_light); + domStorageMenuItem.setIcon(R.drawable.dom_storage_ghosted_day); } } // Update the refresh icon. - if (darkTheme) { - refreshMenuItem.setIcon(R.drawable.refresh_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + refreshMenuItem.setIcon(R.drawable.refresh_enabled_night); } else { - refreshMenuItem.setIcon(R.drawable.refresh_enabled_light); + refreshMenuItem.setIcon(R.drawable.refresh_enabled_day); } - // `invalidateOptionsMenu` calls `onPrepareOptionsMenu()` and redraws the icons in the `AppBar`. + // `invalidateOptionsMenu()` calls `onPrepareOptionsMenu()` and redraws the icons in the app bar. if (runInvalidateOptionsMenu) { invalidateOptionsMenu(); } @@ -4953,12 +4873,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } private void setCurrentWebView(int pageNumber) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - - // Get the theme preference. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Get handles for the URL views. RelativeLayout urlRelativeLayout = findViewById(R.id.url_relativelayout); EditText urlEditText = findViewById(R.id.url_edittext); @@ -5036,8 +4950,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Set the background to indicate the domain settings status. if (currentWebView.getDomainSettingsApplied()) { + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Set a green background on the URL relative layout to indicate that custom domain settings are being used. The deprecated `.getDrawable()` must be used until the minimum API >= 21. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { urlRelativeLayout.setBackground(getResources().getDrawable(R.drawable.url_bar_background_dark_blue)); } else { urlRelativeLayout.setBackground(getResources().getDrawable(R.drawable.url_bar_background_light_green)); @@ -5062,11 +4979,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @Override public void initializeWebView(NestedScrollWebView nestedScrollWebView, int pageNumber, ProgressBar progressBar, String url) { + // Get a handle for the app compat delegate. + AppCompatDelegate appCompatDelegate = getDelegate(); + // Get handles for the activity views. FrameLayout rootFrameLayout = findViewById(R.id.root_framelayout); DrawerLayout drawerLayout = findViewById(R.id.drawerlayout); RelativeLayout mainContentRelativeLayout = findViewById(R.id.main_content_relativelayout); - ActionBar actionBar = getSupportActionBar(); + ActionBar actionBar = appCompatDelegate.getSupportActionBar(); LinearLayout tabsLinearLayout = findViewById(R.id.tabs_linearlayout); EditText urlEditText = findViewById(R.id.url_edittext); TabLayout tabLayout = findViewById(R.id.tablayout); @@ -5124,9 +5044,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Toggle the full screen browsing mode. if (inFullScreenBrowsingMode) { // Switch to full screen mode. - // Store the swipe refresh layout top padding. - swipeRefreshLayoutPaddingTop = swipeRefreshLayout.getPaddingTop(); - // Hide the app bar if specified. if (hideAppBar) { // Close the find on page bar if it is visible. @@ -5138,10 +5055,13 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Hide the action bar. actionBar.hide(); - // Check to see if app bar scrolling is disabled. + // If the app bar is not being scrolled, the swipe refresh layout needs to be adjusted. if (!scrollAppBar) { // Remove the padding from the top of the swipe refresh layout. swipeRefreshLayout.setPadding(0, 0, 0, 0); + + // The swipe refresh circle must be moved above the now removed status bar location. + swipeRefreshLayout.setProgressViewOffset(false, -200, defaultProgressViewEndOffset); } } @@ -5150,9 +5070,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook AdHelper.hideAd(findViewById(R.id.adview)); } - // Remove the translucent status flag. This is necessary so the root frame layout can fill the entire screen. - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - /* Hide the system bars. * SYSTEM_UI_FLAG_FULLSCREEN hides the status bar at the top of the screen. * SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN makes the root frame layout fill the area that is normally reserved for the status bar. @@ -5162,16 +5079,22 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook rootFrameLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } else { // Switch to normal viewing mode. - // Show the tab linear layout. - tabsLinearLayout.setVisibility(View.VISIBLE); + // Show the app bar if it was hidden. + if (hideAppBar) { + // Show the tab linear layout. + tabsLinearLayout.setVisibility(View.VISIBLE); - // Show the action bar. - actionBar.show(); + // Show the action bar. + actionBar.show(); + + // If the app bar is not being scrolled, the swipe refresh layout needs to be adjusted. + if (!scrollAppBar) { + // The swipe refresh layout must be manually moved below the app bar layout. + swipeRefreshLayout.setPadding(0, appBarHeight, 0, 0); - // Check to see if app bar scrolling is disabled. - if (!scrollAppBar) { - // Add the padding from the top of the swipe refresh layout. - swipeRefreshLayout.setPadding(0, swipeRefreshLayoutPaddingTop, 0, 0); + // The swipe to refresh circle doesn't always hide itself completely unless it is moved up 10 pixels. + swipeRefreshLayout.setProgressViewOffset(false, defaultProgressViewStartOffset - 10 + appBarHeight, defaultProgressViewEndOffset + appBarHeight); + } } // Show the banner ad in the free flavor. @@ -5182,9 +5105,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Remove the `SYSTEM_UI` flags from the root frame layout. rootFrameLayout.setSystemUiVisibility(0); - - // Add the translucent status flag. - getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } // Consume the double-tap. @@ -5411,12 +5331,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Hide the main content relative layout. mainContentRelativeLayout.setVisibility(View.GONE); - // Remove the translucent status bar overlay on the `Drawer Layout`, which is special and needs its own command. - drawerLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); - - // Remove the translucent status flag. This is necessary so the root frame layout can fill the entire screen. - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - /* Hide the system bars. * SYSTEM_UI_FLAG_FULLSCREEN hides the status bar at the top of the screen. * SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN makes the root frame layout fill the area that is normally reserved for the status bar. @@ -5479,9 +5393,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook AdHelper.hideAd(findViewById(R.id.adview)); } - // Remove the translucent status flag. This is necessary so the root frame layout can fill the entire screen. - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - /* Hide the system bars. * SYSTEM_UI_FLAG_FULLSCREEN hides the status bar at the top of the screen. * SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN makes the root frame layout fill the area that is normally reserved for the status bar. @@ -5493,9 +5404,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } else { // Switch to normal viewing mode. // Remove the `SYSTEM_UI` flags from the root frame layout. rootFrameLayout.setSystemUiVisibility(0); - - // Add the translucent status flag. - getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } // Reload the ad for the free flavor if not in full screen mode. @@ -5992,21 +5900,20 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook public void onPageStarted(WebView view, String url, Bitmap favicon) { // Get the preferences. boolean scrollAppBar = sharedPreferences.getBoolean("scroll_app_bar", true); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); // Get a handler for the app bar layout. AppBarLayout appBarLayout = findViewById(R.id.appbar_layout); - // Set the top padding of the swipe refresh layout according to the app bar scrolling preference. - if (scrollAppBar) { + // Set the top padding of the swipe refresh layout according to the app bar scrolling preference. This can't be done in `appAppSettings()` because the app bar is not yet populated there. + if (scrollAppBar || (inFullScreenBrowsingMode && hideAppBar)) { // No padding is needed because it will automatically be placed below the app bar layout due to the scrolling layout behavior. swipeRefreshLayout.setPadding(0, 0, 0, 0); // The swipe to refresh circle doesn't always hide itself completely unless it is moved up 10 pixels. swipeRefreshLayout.setProgressViewOffset(false, defaultProgressViewStartOffset - 10, defaultProgressViewEndOffset); } else { - // Get the app bar layout height. This can't be done in `applyAppSettings()` because the app bar is not yet populated. - int appBarHeight = appBarLayout.getHeight(); + // Get the app bar layout height. This can't be done in `applyAppSettings()` because the app bar is not yet populated there. + appBarHeight = appBarLayout.getHeight(); // The swipe refresh layout must be manually moved below the app bar layout. swipeRefreshLayout.setPadding(0, appBarHeight, 0, 0); @@ -6021,6 +5928,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Reset the requests counters. nestedScrollWebView.resetRequestsCounters(); + // TODO. Make the background of a new tab match the theme. // If night mode is enabled, hide `mainWebView` until after the night mode CSS is applied. if (nestedScrollWebView.getNightMode()) { nestedScrollWebView.setVisibility(View.INVISIBLE); @@ -6068,10 +5976,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // If the icon is displayed in the AppBar, set it according to the theme. if (displayAdditionalAppBarIcons) { - if (darkTheme) { - refreshMenuItem.setIcon(R.drawable.close_dark); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + // Set the stop icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + refreshMenuItem.setIcon(R.drawable.close_night); } else { - refreshMenuItem.setIcon(R.drawable.close_light); + refreshMenuItem.setIcon(R.drawable.close_day); } } } @@ -6094,14 +6006,17 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Get the app bar and theme preferences. boolean displayAdditionalAppBarIcons = sharedPreferences.getBoolean("display_additional_app_bar_icons", false); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // If the icon is displayed in the AppBar, reset it according to the theme. + // If the icon is displayed in the app bar, reset it according to the theme. if (displayAdditionalAppBarIcons) { - if (darkTheme) { - refreshMenuItem.setIcon(R.drawable.refresh_enabled_dark); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + refreshMenuItem.setIcon(R.drawable.refresh_enabled_night); } else { - refreshMenuItem.setIcon(R.drawable.refresh_enabled_light); + refreshMenuItem.setIcon(R.drawable.refresh_enabled_day); } } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.java index c7be71c5..2adeb318 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.java @@ -1,5 +1,5 @@ /* - * Copyright © 2018-2019 Soren Stoutner . + * Copyright © 2018-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -60,21 +60,16 @@ public class RequestsActivity extends AppCompatActivity implements ViewRequestDi // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - // Get the screenshot and theme preferences. + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); // Disable screenshots if not allowed. if (!allowScreenshots) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } - // Set the activity theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); - } else { - setTheme(R.style.PrivacyBrowserLight_SecondaryActivity); - } + // Set the theme. + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java index 7119b0f7..b306cc12 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -37,19 +37,14 @@ public class SettingsActivity extends AppCompatActivity { // Get the screenshot and theme preferences. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); // Disable screenshots if not allowed. if (!allowScreenshots) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } - // Set the activity theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserSettingsDark); - } else { - setTheme(R.style.PrivacyBrowserSettingsLight); - } + // Set the theme. + setTheme(R.style.PrivacyBrowserSettings); // Run the default commands. super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java index a0f51d14..51036fbc 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java @@ -23,10 +23,12 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.Spanned; import android.text.style.ForegroundColorSpan; +import android.util.TypedValue; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; @@ -61,9 +63,8 @@ public class ViewSourceActivity extends AppCompatActivity { // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - // Get the screenshot and theme preferences. + // Get the screenshot preference. boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); // Disable screenshots if not allowed. if (!allowScreenshots) { @@ -71,11 +72,7 @@ public class ViewSourceActivity extends AppCompatActivity { } // Set the theme. - if (darkTheme) { - setTheme(R.style.PrivacyBrowserDark); - } else { - setTheme(R.style.PrivacyBrowserLight); - } + setTheme(R.style.PrivacyBrowser); // Run the default commands. super.onCreate(savedInstanceState); @@ -189,14 +186,28 @@ public class ViewSourceActivity extends AppCompatActivity { } }); - // Set the swipe to refresh color according to the theme. - if (darkTheme) { - swipeRefreshLayout.setColorSchemeResources(R.color.blue_600); - swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.gray_800); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + // Set the refresh color scheme according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeRefreshLayout.setColorSchemeResources(R.color.blue_500); } else { swipeRefreshLayout.setColorSchemeResources(R.color.blue_700); } + // Initialize a color background typed value. + TypedValue colorBackgroundTypedValue = new TypedValue(); + + // Get the color background from the theme. + getTheme().resolveAttribute(android.R.attr.colorBackground, colorBackgroundTypedValue, true); + + // Get the color background int from the typed value. + int colorBackgroundInt = colorBackgroundTypedValue.data; + + // Set the swipe refresh background color. + swipeRefreshLayout.setProgressBackgroundColorSchemeColor(colorBackgroundInt); + // Get the source using an AsyncTask if the URL begins with `http`. if ((currentUrl != null) && currentUrl.startsWith("http")) { new GetSource(this, this, userAgent).execute(currentUrl); diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.java b/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.java index edc64f81..fcccba48 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.java +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/RequestsArrayAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright © 2018-2019 Soren Stoutner . + * Copyright © 2018-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,8 +20,7 @@ package com.stoutner.privacybrowser.adapters; import android.content.Context; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; +import android.content.res.Configuration; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -45,12 +44,6 @@ public class RequestsArrayAdapter extends ArrayAdapter { @Override @NonNull public View getView(int position, View view, @NonNull ViewGroup parent) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Get a handle for the context. Context context = getContext(); @@ -73,6 +66,9 @@ public class RequestsArrayAdapter extends ArrayAdapter { // The ID is one greater than the position because it is 0 based. int id = position + 1; + // Get the current theme status. + int currentThemeStatus = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Set the action text and the background color. switch (entryStringArray[0]) { case BlocklistHelper.REQUEST_DEFAULT: @@ -94,7 +90,7 @@ public class RequestsArrayAdapter extends ArrayAdapter { dispositionTextView.setText(requestAllowed); // Set the background color. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { linearLayout.setBackgroundColor(context.getResources().getColor(R.color.blue_700_50)); } else { linearLayout.setBackgroundColor(context.getResources().getColor(R.color.blue_100)); @@ -109,7 +105,7 @@ public class RequestsArrayAdapter extends ArrayAdapter { dispositionTextView.setText(requestThirdParty); // Set the background color. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { linearLayout.setBackgroundColor(context.getResources().getColor(R.color.yellow_700_50)); } else { linearLayout.setBackgroundColor(context.getResources().getColor(R.color.yellow_100)); @@ -125,7 +121,7 @@ public class RequestsArrayAdapter extends ArrayAdapter { dispositionTextView.setText(requestBlocked); // Set the background color. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { linearLayout.setBackgroundColor(context.getResources().getColor(R.color.red_700_40)); } else { linearLayout.setBackgroundColor(context.getResources().getColor(R.color.red_100)); @@ -137,7 +133,7 @@ public class RequestsArrayAdapter extends ArrayAdapter { urlTextView.setText(entryStringArray[1]); // Set the text color. For some unexplained reason, `android:textColor="?android:textColorPrimary"` doesn't work in the layout file. Probably some bug relating to array adapters. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { dispositionTextView.setTextColor(context.getResources().getColor(R.color.gray_200)); urlTextView.setTextColor(context.getResources().getColor(R.color.gray_200)); } else { diff --git a/app/src/main/java/com/stoutner/privacybrowser/asynctasks/GetUrlSize.java b/app/src/main/java/com/stoutner/privacybrowser/asynctasks/GetUrlSize.java index 5f0020d0..46c3a039 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/asynctasks/GetUrlSize.java +++ b/app/src/main/java/com/stoutner/privacybrowser/asynctasks/GetUrlSize.java @@ -19,12 +19,13 @@ package com.stoutner.privacybrowser.asynctasks; -import android.app.AlertDialog; import android.content.Context; import android.os.AsyncTask; import android.webkit.CookieManager; import android.widget.TextView; +import androidx.appcompat.app.AlertDialog; + import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.helpers.ProxyHelper; @@ -164,6 +165,9 @@ public class GetUrlSize extends AsyncTask { // Get a handle for the file size text view. TextView fileSizeTextView = alertDialog.findViewById(R.id.file_size_textview); + // Remove the incorrect warning below that the file size text view might be null. + assert fileSizeTextView != null; + // Update the file size. fileSizeTextView.setText(fileSize); } diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AboutViewSourceDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AboutViewSourceDialog.kt index 30bcf8d0..70247f05 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AboutViewSourceDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AboutViewSourceDialog.kt @@ -19,11 +19,12 @@ package com.stoutner.privacybrowser.dialogs -import android.app.AlertDialog import android.app.Dialog +import android.content.res.Configuration import android.os.Bundle import android.view.WindowManager +import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment import androidx.preference.PreferenceManager @@ -31,29 +32,19 @@ import com.stoutner.privacybrowser.R class AboutViewSourceDialog: DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - // Get a handle for the shared preferences. - val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) - - // Get the screenshot and theme preferences. - val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) - val darkTheme = sharedPreferences.getBoolean("dark_theme", false) - // Use a builder to create the alert dialog. - val dialogBuilder: AlertDialog.Builder + val dialogBuilder: AlertDialog.Builder = AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog) - // Set the style and the icon according to the theme. - if (darkTheme) { - // Use a dark style. - dialogBuilder = AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogDark) + // Get the current theme status. + val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK + // Set the style and the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Set a dark icon. - dialogBuilder.setIcon(R.drawable.about_dark) + dialogBuilder.setIcon(R.drawable.about_night) } else { - // Use a light style. - dialogBuilder = AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogLight) - // Set a light icon. - dialogBuilder.setIcon(R.drawable.about_light) + dialogBuilder.setIcon(R.drawable.about_day) } // Set the title. @@ -68,6 +59,12 @@ class AboutViewSourceDialog: DialogFragment() { // Create an alert dialog from the alert dialog builder. val alertDialog = dialogBuilder.create() + // Get a handle for the shared preferences. + val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) + + // Get the screenshot preference. + val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.window!!.addFlags(WindowManager.LayoutParams.FLAG_SECURE) diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.kt index 8b56f2d4..527e0d7d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.kt @@ -20,10 +20,10 @@ package com.stoutner.privacybrowser.dialogs import android.annotation.SuppressLint -import android.app.AlertDialog import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.content.res.Configuration import android.net.Uri import android.os.Bundle import android.text.Editable @@ -34,6 +34,7 @@ import android.view.WindowManager import android.widget.EditText import android.widget.TextView +import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment import androidx.preference.PreferenceManager @@ -87,27 +88,17 @@ class AddDomainDialog: DialogFragment() { // Get the URL from the bundle. val urlString = arguments.getString("url_string") - // Get a handle for the shared preferences. - val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) - - // Get the screenshot and theme preferences. - val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) - val darkTheme = sharedPreferences.getBoolean("dark_theme", false) - // Use an alert dialog builder to create the alert dialog. - val dialogBuilder: AlertDialog.Builder + val dialogBuilder: AlertDialog.Builder = AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog) - // USet the style and the icon according to the theme. - if (darkTheme) { - // Set the dark style. - dialogBuilder = AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogDark) + // Get the current theme status. + val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Set the dark icon. - dialogBuilder.setIcon(R.drawable.domains_dark) + dialogBuilder.setIcon(R.drawable.domains_night) } else { - // Set the light style. - dialogBuilder = AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogLight) - // Set the light icon. dialogBuilder.setIcon(R.drawable.domains_light) } @@ -130,6 +121,12 @@ class AddDomainDialog: DialogFragment() { // Create an alert dialog from the builder. val alertDialog = dialogBuilder.create() + // Get a handle for the shared preferences. + val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) + + // Get the screenshot preference. + val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.window!!.addFlags(WindowManager.LayoutParams.FLAG_SECURE) @@ -142,8 +139,8 @@ class AddDomainDialog: DialogFragment() { val domainsDatabaseHelper = DomainsDatabaseHelper(context, null, null, 0) // Get handles for the views in the alert dialog. - val addDomainEditText = alertDialog.findViewById(R.id.domain_name_edittext) - val domainNameAlreadyExistsTextView = alertDialog.findViewById(R.id.domain_name_already_exists_textview) + val addDomainEditText = alertDialog.findViewById(R.id.domain_name_edittext)!! + val domainNameAlreadyExistsTextView = alertDialog.findViewById(R.id.domain_name_already_exists_textview)!! val addButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) // Update the status of the warning text and the add button when the domain name changes. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.kt index 0b1dea00..a10e574a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.kt @@ -20,7 +20,6 @@ package com.stoutner.privacybrowser.dialogs import android.annotation.SuppressLint -import android.app.AlertDialog import android.app.Dialog import android.content.Context import android.content.DialogInterface @@ -34,6 +33,7 @@ import android.view.View import android.view.WindowManager import android.widget.EditText +import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment import androidx.preference.PreferenceManager @@ -104,19 +104,8 @@ class CreateBookmarkDialog: DialogFragment() { // Convert the favorite icon byte array to a bitmap. val favoriteIconBitmap = BitmapFactory.decodeByteArray(favoriteIconByteArray, 0, favoriteIconByteArray.size) - // Get a handle for the shared preferences. - val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) - - // Get the screenshot and theme preferences. - val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) - val darkTheme = sharedPreferences.getBoolean("dark_theme", false) - - // Use an alert dialog builder to create the dialog and set the style according to the theme. - val dialogBuilder = if (darkTheme) { - AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogDark) - } else { - AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogLight) - } + // Use an alert dialog builder to create the dialog. + val dialogBuilder = AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog) // Set the title. dialogBuilder.setTitle(R.string.create_bookmark) @@ -142,6 +131,13 @@ class CreateBookmarkDialog: DialogFragment() { // Create an alert dialog from the builder. val alertDialog = dialogBuilder.create() + + // Get a handle for the shared preferences. + val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) + + // Get the screenshot preference. + val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.window!!.addFlags(WindowManager.LayoutParams.FLAG_SECURE) @@ -151,8 +147,8 @@ class CreateBookmarkDialog: DialogFragment() { alertDialog.show() // Get a handle for the edit texts. - val createBookmarkNameEditText = alertDialog.findViewById(R.id.create_bookmark_name_edittext) - val createBookmarkUrlEditText = alertDialog.findViewById(R.id.create_bookmark_url_edittext) + val createBookmarkNameEditText = alertDialog.findViewById(R.id.create_bookmark_name_edittext)!! + val createBookmarkUrlEditText = alertDialog.findViewById(R.id.create_bookmark_url_edittext)!! // Set the initial texts for the edit texts. createBookmarkNameEditText.setText(titleString) diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.kt index d4f12193..83670bc8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.kt @@ -19,7 +19,6 @@ package com.stoutner.privacybrowser.dialogs import android.annotation.SuppressLint -import android.app.AlertDialog import android.app.Dialog import android.content.Context import android.content.DialogInterface @@ -33,6 +32,7 @@ import android.view.View import android.view.WindowManager import android.widget.EditText import android.widget.ImageView +import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment import androidx.preference.PreferenceManager @@ -101,19 +101,8 @@ class CreateBookmarkFolderDialog: DialogFragment() { // Convert the favorite icon byte array to a bitmap. val favoriteIconBitmap = BitmapFactory.decodeByteArray(favoriteIconByteArray, 0, favoriteIconByteArray.size) - // Get a handle for the shared preferences. - val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) - - // Get the screenshot and theme preferences. - val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) - val darkTheme = sharedPreferences.getBoolean("dark_theme", false) - - // Use an alert dialog builder to create the dialog and set the style according to the theme. - val dialogBuilder = if (darkTheme) { - AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogDark) - } else { - AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogLight) - } + // Use an alert dialog builder to create the dialog. + val dialogBuilder = AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog) // Set the title. dialogBuilder.setTitle(R.string.create_folder) @@ -133,6 +122,12 @@ class CreateBookmarkFolderDialog: DialogFragment() { // Create an alert dialog from the builder. val alertDialog = dialogBuilder.create() + // Get a handle for the shared preferences. + val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) + + // Get the screenshot preference. + val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.window!!.addFlags(WindowManager.LayoutParams.FLAG_SECURE) @@ -145,8 +140,8 @@ class CreateBookmarkFolderDialog: DialogFragment() { alertDialog.show() // Get handles for the views in the dialog. - val webPageIconImageView = alertDialog.findViewById(R.id.create_folder_web_page_icon) - val folderNameEditText = alertDialog.findViewById(R.id.create_folder_name_edittext) + val webPageIconImageView = alertDialog.findViewById(R.id.create_folder_web_page_icon)!! + val folderNameEditText = alertDialog.findViewById(R.id.create_folder_name_edittext)!! val createButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) // Display the current favorite icon. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.kt index ddcc72cc..69be19d2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.kt @@ -104,19 +104,8 @@ class CreateHomeScreenShortcutDialog: DialogFragment() { // Convert the favorite icon byte array to a bitmap. val favoriteIconBitmap = BitmapFactory.decodeByteArray(favoriteIconByteArray, 0, favoriteIconByteArray.size) - // Get a handle for the shared preferences. - val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) - - // Get the theme and screenshot preferences. - val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) - val darkTheme = sharedPreferences.getBoolean("dark_theme", false) - - // Use an alert dialog builder to create the dialog and set the style according to the theme. - val dialogBuilder = if (darkTheme) { - AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialogDark) - } else { - AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialogLight) - } + // Use an alert dialog builder to create the dialog. + val dialogBuilder = AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog) // Create a drawable version of the favorite icon. val favoriteIconDrawable: Drawable = BitmapDrawable(resources, favoriteIconBitmap) @@ -140,6 +129,12 @@ class CreateHomeScreenShortcutDialog: DialogFragment() { // Create an alert dialog from the alert dialog builder. val alertDialog = dialogBuilder.create() + // Get a handle for the shared preferences. + val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) + + // Get the screenshot preference. + val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.window!!.addFlags(WindowManager.LayoutParams.FLAG_SECURE) diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.kt index 57f764be..4de35431 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.kt @@ -19,7 +19,6 @@ package com.stoutner.privacybrowser.dialogs import android.annotation.SuppressLint -import android.app.AlertDialog import android.app.Dialog import android.content.Context import android.content.DialogInterface @@ -37,6 +36,7 @@ import android.view.WindowManager import android.widget.* import android.widget.AdapterView.OnItemSelectedListener +import androidx.appcompat.app.AlertDialog import androidx.core.content.ContextCompat import androidx.fragment.app.DialogFragment import androidx.preference.PreferenceManager @@ -127,19 +127,8 @@ class EditBookmarkDatabaseViewDialog: DialogFragment() { // Move the cursor to the first position. bookmarkCursor.moveToFirst() - // Get a handle for the shared preferences. - val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) - - // Get the screenshot and theme preferences. - val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) - val darkTheme = sharedPreferences.getBoolean("dark_theme", false) - // Use an alert dialog builder to create the dialog and set the style according to the theme. - val dialogBuilder = if (darkTheme) { - AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogDark) - } else { - AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialogLight) - } + val dialogBuilder = AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog) // Set the title. dialogBuilder.setTitle(R.string.edit_bookmark) @@ -159,6 +148,12 @@ class EditBookmarkDatabaseViewDialog: DialogFragment() { // Create an alert dialog from the alert dialog builder. val alertDialog = dialogBuilder.create() + // Get a handle for the shared preferences. + val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) + + // Get the screenshot preference. + val allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false) + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.window!!.addFlags(WindowManager.LayoutParams.FLAG_SECURE) @@ -168,15 +163,15 @@ class EditBookmarkDatabaseViewDialog: DialogFragment() { alertDialog.show() // Get handles for the layout items. - val databaseIdTextView = alertDialog.findViewById(R.id.edit_bookmark_database_id_textview) - val iconRadioGroup = alertDialog.findViewById(R.id.edit_bookmark_icon_radiogroup) - val currentIconImageView = alertDialog.findViewById(R.id.edit_bookmark_current_icon) - val newFavoriteIconImageView = alertDialog.findViewById(R.id.edit_bookmark_webpage_favorite_icon) - newIconRadioButton = alertDialog.findViewById(R.id.edit_bookmark_webpage_favorite_icon_radiobutton) - nameEditText = alertDialog.findViewById(R.id.edit_bookmark_name_edittext) - urlEditText = alertDialog.findViewById(R.id.edit_bookmark_url_edittext) - folderSpinner = alertDialog.findViewById(R.id.edit_bookmark_folder_spinner) - displayOrderEditText = alertDialog.findViewById(R.id.edit_bookmark_display_order_edittext) + val databaseIdTextView = alertDialog.findViewById(R.id.edit_bookmark_database_id_textview)!! + val iconRadioGroup = alertDialog.findViewById(R.id.edit_bookmark_icon_radiogroup)!! + val currentIconImageView = alertDialog.findViewById(R.id.edit_bookmark_current_icon)!! + val newFavoriteIconImageView = alertDialog.findViewById(R.id.edit_bookmark_webpage_favorite_icon)!! + newIconRadioButton = alertDialog.findViewById(R.id.edit_bookmark_webpage_favorite_icon_radiobutton)!! + nameEditText = alertDialog.findViewById(R.id.edit_bookmark_name_edittext)!! + urlEditText = alertDialog.findViewById(R.id.edit_bookmark_url_edittext)!! + folderSpinner = alertDialog.findViewById(R.id.edit_bookmark_folder_spinner)!! + displayOrderEditText = alertDialog.findViewById(R.id.edit_bookmark_display_order_edittext)!! editButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) // Store the current bookmark values. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java index adf6d44e..df4a1a14 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,7 +20,6 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; @@ -42,7 +41,8 @@ import android.widget.RadioButton; import android.widget.RadioGroup; import androidx.annotation.NonNull; -import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; @@ -125,21 +125,7 @@ public class EditBookmarkDialog extends DialogFragment { bookmarkCursor.moveToFirst(); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Set the style according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - } else { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); // Set the title. dialogBuilder.setTitle(R.string.edit_bookmark); @@ -167,6 +153,12 @@ public class EditBookmarkDialog extends DialogFragment { // remove the incorrect lint warning below that `getWindow().addFlags()` might be null. assert alertDialog.getWindow() != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); @@ -183,6 +175,13 @@ public class EditBookmarkDialog extends DialogFragment { EditText urlEditText = alertDialog.findViewById(R.id.edit_bookmark_url_edittext); Button editButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); + // Remove the incorrect lint warnings below that the views might be null. + assert iconRadioGroup != null; + assert currentIconImageView != null; + assert newFavoriteIconImageView != null; + assert nameEditText != null; + assert urlEditText != null; + // Get the current favorite icon byte array from the cursor. byte[] currentIconByteArray = bookmarkCursor.getBlob(bookmarkCursor.getColumnIndex(BookmarksDatabaseHelper.FAVORITE_ICON)); @@ -295,6 +294,11 @@ public class EditBookmarkDialog extends DialogFragment { RadioButton newIconRadioButton = alertdialog.findViewById(R.id.edit_bookmark_webpage_favorite_icon_radiobutton); Button editButton = alertdialog.getButton(AlertDialog.BUTTON_POSITIVE); + // Remove the incorrect lint warnings below that the views might be null. + assert nameEditText != null; + assert urlEditText != null; + assert newIconRadioButton != null; + // Get the text from the edit texts. String newName = nameEditText.getText().toString(); String newUrl = urlEditText.getText().toString(); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java index 0f7eff1a..7960c68a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,7 +20,6 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; @@ -50,6 +49,7 @@ import android.widget.Spinner; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. @@ -136,21 +136,7 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment { folderCursor.moveToFirst(); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Set the style according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - } else { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); // Set the title. dialogBuilder.setTitle(R.string.edit_folder); @@ -178,6 +164,12 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment { // Remove the warning below that `getWindow()` might be null. assert alertDialog.getWindow() != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); @@ -196,6 +188,15 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment { EditText displayOrderEditText = alertDialog.findViewById(R.id.edit_folder_display_order_edittext); Button editButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); + // Remove the incorrect lint warnings below that the views might be null. + assert databaseIdTextView != null; + assert iconRadioGroup != null; + assert currentIconImageView != null; + assert newFavoriteIconImageView != null; + assert nameEditText != null; + assert folderSpinner != null; + assert displayOrderEditText != null; + // Store the current folder values. String currentFolderName = folderCursor.getString(folderCursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_NAME)); int currentDisplayOrder = folderCursor.getInt(folderCursor.getColumnIndex(BookmarksDatabaseHelper.DISPLAY_ORDER)); @@ -410,6 +411,12 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment { RadioButton currentIconRadioButton = alertDialog.findViewById(R.id.edit_folder_current_icon_radiobutton); Button editButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); + // Remove the incorrect lint warning below that the views might be null. + assert nameEditText != null; + assert folderSpinner != null; + assert displayOrderEditText != null; + assert currentIconRadioButton != null; + // Get the values from the dialog. String newFolderName = nameEditText.getText().toString(); int newParentFolderDatabaseId = (int) folderSpinner.getSelectedItemId(); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java index 230abd34..216f0d38 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,7 +20,6 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; @@ -42,6 +41,7 @@ import android.widget.RadioButton; import android.widget.RadioGroup; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. import com.stoutner.privacybrowser.R; @@ -125,21 +125,7 @@ public class EditBookmarkFolderDialog extends DialogFragment { folderCursor.moveToFirst(); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Set the style according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - } else { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); // Set the title. dialogBuilder.setTitle(R.string.edit_folder); @@ -167,6 +153,12 @@ public class EditBookmarkFolderDialog extends DialogFragment { // Remove the warning below that `getWindow()` might be null. assert alertDialog.getWindow() != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); @@ -183,6 +175,13 @@ public class EditBookmarkFolderDialog extends DialogFragment { EditText folderNameEditText = alertDialog.findViewById(R.id.edit_folder_name_edittext); Button editButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); + // Remove the incorrect lint warnings below that the views might be null. + assert iconRadioGroup != null; + assert currentIconRadioButton != null; + assert currentIconImageView != null; + assert webPageFavoriteIconImageView != null; + assert folderNameEditText != null; + // Initially disable the edit button. editButton.setEnabled(false); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/FontSizeDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/FontSizeDialog.java index 2349189c..7a0e07eb 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/FontSizeDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/FontSizeDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2019 Soren Stoutner . + * Copyright © 2019-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -21,11 +21,11 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; @@ -34,6 +34,7 @@ import android.view.WindowManager; import android.widget.EditText; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; import androidx.preference.PreferenceManager; @@ -87,9 +88,6 @@ public class FontSizeDialog extends DialogFragment { assert activity != null; assert context != null; - // Use a builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - // Get the arguments. Bundle arguments = getArguments(); @@ -99,20 +97,17 @@ public class FontSizeDialog extends DialogFragment { // Get the current font size. int currentFontSize = arguments.getInt("font_size"); - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); + // Use a builder to create the alert dialog. + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialog); - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the style and icon according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark); - dialogBuilder.setIcon(R.drawable.font_size_dark); + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.font_size_night); } else { - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight); - dialogBuilder.setIcon(R.drawable.font_size_light); + dialogBuilder.setIcon(R.drawable.font_size_day); } // Set the title. @@ -139,6 +134,12 @@ public class FontSizeDialog extends DialogFragment { // Remove the incorrect lint warning below that the dialog window might be null. assert dialogWindow != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); + + // Get the screenshot preferences. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { dialogWindow.addFlags(WindowManager.LayoutParams.FLAG_SECURE); @@ -153,6 +154,9 @@ public class FontSizeDialog extends DialogFragment { // Get a handle for the font size edit text. EditText fontSizeEditText = alertDialog.findViewById(R.id.font_size_edittext); + // Remove the incorrect lint warning below that the edit text might be null. + assert fontSizeEditText != null; + // Display the current font size. fontSizeEditText.setText(String.valueOf(currentFontSize)); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java index 4b681089..20e04a4b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017-2019 Soren Stoutner . + * Copyright © 2017-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,10 +20,10 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.SpannableStringBuilder; @@ -39,7 +39,8 @@ import android.widget.EditText; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.activities.MainWebViewActivity; @@ -111,28 +112,16 @@ public class HttpAuthenticationDialog extends DialogFragment{ LayoutInflater layoutInflater = getActivity().getLayoutInflater(); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialog); - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Set the style according to the theme. - if (darkTheme) { - // Set the dialog theme. - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the icon. - dialogBuilder.setIcon(R.drawable.lock_dark); + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.lock_night); } else { - // Set the dialog theme. - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - - // Set the icon. - dialogBuilder.setIcon(R.drawable.lock_light); + dialogBuilder.setIcon(R.drawable.lock_day); } // Set the title. @@ -168,6 +157,12 @@ public class HttpAuthenticationDialog extends DialogFragment{ // Remove the incorrect lint warning below that the dialog window might be null. assert dialogWindow != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); @@ -185,11 +180,15 @@ public class HttpAuthenticationDialog extends DialogFragment{ usernameEditText = alertDialog.findViewById(R.id.http_authentication_username); passwordEditText = alertDialog.findViewById(R.id.http_authentication_password); + // Remove the incorrect lint warnings below that the views might be null. + assert realmTextView != null; + assert hostTextView != null; + // Set the realm text. realmTextView.setText(httpAuthRealm); - // Set the realm text color according to the theme. The deprecated `.getColor()` must be used until API >= 23. - if (darkTheme) { + // Set the realm text color according to the theme. The deprecated `getResources()` must be used until API >= 23. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { realmTextView.setTextColor(getResources().getColor(R.color.gray_300)); } else { realmTextView.setTextColor(getResources().getColor(R.color.black)); @@ -202,8 +201,8 @@ public class HttpAuthenticationDialog extends DialogFragment{ // Create a blue `ForegroundColorSpan`. ForegroundColorSpan blueColorSpan; - // Set `blueColorSpan` according to the theme. The deprecated `getColor()` must be used until API >= 23. - if (darkTheme) { + // Set `blueColorSpan` according to the theme. The deprecated `getResources()` must be used until API >= 23. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400)); } else { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700)); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java index cf944c04..2406e95a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,7 +20,6 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; @@ -46,8 +45,9 @@ import android.widget.ListView; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; -import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <= 22. +import androidx.fragment.app.DialogFragment; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.activities.BookmarksActivity; @@ -83,21 +83,7 @@ public class MoveToFolderDialog extends DialogFragment { bookmarksDatabaseHelper = new BookmarksDatabaseHelper(getContext(), null, null, 0); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Set the style according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - } else { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); // Set the title. dialogBuilder.setTitle(R.string.move_to_folder); @@ -122,6 +108,12 @@ public class MoveToFolderDialog extends DialogFragment { // Create an alert dialog from the alert dialog builder. final AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindow()` might be null. @@ -278,8 +270,13 @@ public class MoveToFolderDialog extends DialogFragment { }; } - // Display the ListView + // Get a handle for the folders list view. ListView foldersListView = alertDialog.findViewById(R.id.move_to_folder_listview); + + // Remove the incorrect lint warning below that the view might be null. + assert foldersListView != null; + + // Set the folder list view adapter. foldersListView.setAdapter(foldersCursorAdapter); // Enable the move button when a folder is selected. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/OpenDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/OpenDialog.java index 59aa177b..43594860 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/OpenDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/OpenDialog.java @@ -22,13 +22,13 @@ package com.stoutner.privacybrowser.dialogs; import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.os.Environment; @@ -42,6 +42,7 @@ import android.widget.EditText; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; import androidx.preference.PreferenceManager; @@ -76,36 +77,20 @@ public class OpenDialog extends DialogFragment { @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { // Get a handle for the activity and the context. - Activity activity = getActivity(); - Context context = getContext(); - - // Remove the incorrect lint warnings below that the activity and the context might be null. - assert activity != null; - assert context != null; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + Activity activity = requireActivity(); + Context context = requireContext(); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialog); - // Set the style and icon according to the theme. - if (darkTheme) { - // Set the style. - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the icon. - dialogBuilder.setIcon(R.drawable.proxy_enabled_dark); + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.proxy_enabled_night); } else { - // Set the style. - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight); - - // Set the icon. - dialogBuilder.setIcon(R.drawable.proxy_enabled_light); + dialogBuilder.setIcon(R.drawable.proxy_enabled_day); } // Set the title. @@ -129,6 +114,12 @@ public class OpenDialog extends DialogFragment { // Remove the incorrect lint warning below that the window might be null. assert alertDialog.getWindow() != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); @@ -144,6 +135,12 @@ public class OpenDialog extends DialogFragment { TextView storagePermissionTextView = alertDialog.findViewById(R.id.storage_permission_textview); Button openButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); + // Remove the incorrect lint warnings below that the views might be null. + assert fileNameEditText != null; + assert browseButton != null; + assert fileDoesNotExistTextView != null; + assert storagePermissionTextView != null; + // Update the status of the open button when the file name changes. fileNameEditText.addTextChangedListener(new TextWatcher() { @Override diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java index 675f1e8a..0ab49b4c 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017-2019 Soren Stoutner . + * Copyright © 2017-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,11 +20,11 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; @@ -54,6 +54,7 @@ import java.util.ArrayList; import java.util.Date; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. import androidx.viewpager.widget.PagerAdapter; @@ -129,23 +130,7 @@ public class PinnedMismatchDialog extends DialogFragment { nestedScrollWebView = fragmentView.findViewById(R.id.nestedscroll_webview); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Set the style according to the theme. - if (darkTheme) { - // Set the dialog theme. - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - } else { - // Set the dialog theme. - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); // Get the context. Context context = getContext(); @@ -170,11 +155,14 @@ public class PinnedMismatchDialog extends DialogFragment { // Set the favorite icon as the dialog icon if it exists. if (favoriteIconBitmap.sameAs(defaultFavoriteIconBitmap)) { // There is no website favorite icon. + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Set the icon according to the theme. - if (darkTheme) { - dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_night); } else { - dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_light); + dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_day); } } else { // There is a favorite icon. // Create a drawable version of the favorite icon. @@ -253,6 +241,12 @@ public class PinnedMismatchDialog extends DialogFragment { // Create an alert dialog from the alert dialog builder. final AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindow()` might be null. @@ -265,15 +259,21 @@ public class PinnedMismatchDialog extends DialogFragment { // Show the alert dialog so the items in the layout can be modified. alertDialog.show(); - // Setup the view pager. + // Get a handle for the views. WrapVerticalContentViewPager wrapVerticalContentViewPager = alertDialog.findViewById(R.id.pinned_ssl_certificate_mismatch_viewpager); + TabLayout tabLayout = alertDialog.findViewById(R.id.pinned_ssl_certificate_mismatch_tablayout); + + // Remove the incorrect lint warning below that the views might be null. + assert wrapVerticalContentViewPager != null; + assert tabLayout != null; + + // Set the view pager adapter. wrapVerticalContentViewPager.setAdapter(new pagerAdapter()); - // Setup the tab layout and connect it to the view pager. - TabLayout tabLayout = alertDialog.findViewById(R.id.pinned_ssl_certificate_mismatch_tablayout); + // Connect the tab layout to the view pager. tabLayout.setupWithViewPager(wrapVerticalContentViewPager); - // `onCreateDialog()` requires the return of an `AlertDialog`. + // Return the alert dialog. return alertDialog; } @@ -424,23 +424,20 @@ public class PinnedMismatchDialog extends DialogFragment { } } - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - - // Create a red foreground color span. The deprecated `getResources().getColor` must be used until the minimum API >= 23. - ForegroundColorSpan redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700)); - - // Create a blue foreground color span. + // Define the color spans. ForegroundColorSpan blueColorSpan; + ForegroundColorSpan redColorSpan; + + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the blue color span according to the theme. The deprecated `getResources().getColor` must be used until the minimum API >= 23. - if (darkTheme) { + // Set the color spans according to the theme. The deprecated `getResources()` must be used until the minimum API >= 23. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400)); + redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_900)); } else { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700)); + redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700)); } // Set the domain name to be blue. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ProxyNotInstalledDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ProxyNotInstalledDialog.java index fa17c439..9b70e0d2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ProxyNotInstalledDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ProxyNotInstalledDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2019 Soren Stoutner . + * Copyright © 2019-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -19,11 +19,11 @@ package com.stoutner.privacybrowser.dialogs; -import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; import android.view.WindowManager; @@ -57,13 +57,8 @@ public class ProxyNotInstalledDialog extends DialogFragment { @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { - // Get the context and the activity. - Context context = getContext(); - Activity activity = getActivity(); - - // Remove the incorrect lint warnings below that the context or the activity might be null. - assert context != null; - assert activity != null; + // Get the context. + Context context = requireContext(); // Get the arguments. Bundle arguments = getArguments(); @@ -74,32 +69,20 @@ public class ProxyNotInstalledDialog extends DialogFragment { // Get the proxy mode from the arguments. String proxyMode = arguments.getString("proxy_mode"); - // Remove the incorrect lint warning below tha tth eproxy mode migth be null. + // Remove the incorrect lint warning below that the proxy mode might be null. assert proxyMode != null; - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); - - // Get the screenshot and the theme preferences. - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Use a builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialog); - // Set the style and the icon according to the theme. - if (darkTheme) { - // Set the style. - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the icon. - dialogBuilder.setIcon(R.drawable.proxy_enabled_dark); + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.proxy_enabled_night); } else { - // Set the style. - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight); - - // Set the icon. - dialogBuilder.setIcon(R.drawable.proxy_enabled_light); + dialogBuilder.setIcon(R.drawable.proxy_enabled_day); } // Set the title and the message according to the proxy mode. @@ -129,6 +112,12 @@ public class ProxyNotInstalledDialog extends DialogFragment { // Create an alert dialog from the alert dialog builder. AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindows()` might be null. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.java index 71eecb15..0730717c 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveDialog.java @@ -22,13 +22,13 @@ package com.stoutner.privacybrowser.dialogs; import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.Configuration; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; @@ -43,6 +43,7 @@ import android.widget.EditText; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; import androidx.preference.PreferenceManager; @@ -117,58 +118,44 @@ public class SaveDialog extends DialogFragment { boolean cookiesEnabled = arguments.getBoolean("cookies_enabled"); // Get a handle for the activity and the context. - Activity activity = getActivity(); - Context context = getContext(); - - // Remove the incorrect lint warnings below that the activity and context might be null. - assert activity != null; - assert context != null; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + Activity activity = requireActivity(); + Context context = requireContext(); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialog); - // Set the style and icon according to the theme. - if (darkTheme) { - // Set the style. - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // The night theme is enabled. // Set the icon according to the save type. switch (saveType) { case StoragePermissionDialog.SAVE_URL: - dialogBuilder.setIcon(R.drawable.copy_enabled_dark); + dialogBuilder.setIcon(R.drawable.copy_enabled_night); break; case StoragePermissionDialog.SAVE_AS_ARCHIVE: - dialogBuilder.setIcon(R.drawable.dom_storage_cleared_dark); + dialogBuilder.setIcon(R.drawable.dom_storage_cleared_night); break; case StoragePermissionDialog.SAVE_AS_IMAGE: - dialogBuilder.setIcon(R.drawable.images_enabled_dark); + dialogBuilder.setIcon(R.drawable.images_enabled_night); break; } - } else { - // Set the style. - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight); - + } else { // The day theme is enabled. // Set the icon according to the save type. switch (saveType) { case StoragePermissionDialog.SAVE_URL: - dialogBuilder.setIcon(R.drawable.copy_enabled_light); + dialogBuilder.setIcon(R.drawable.copy_enabled_day); break; case StoragePermissionDialog.SAVE_AS_ARCHIVE: - dialogBuilder.setIcon(R.drawable.dom_storage_cleared_light); + dialogBuilder.setIcon(R.drawable.dom_storage_cleared_day); break; case StoragePermissionDialog.SAVE_AS_IMAGE: - dialogBuilder.setIcon(R.drawable.images_enabled_light); + dialogBuilder.setIcon(R.drawable.images_enabled_day); break; } } @@ -206,6 +193,12 @@ public class SaveDialog extends DialogFragment { // Remove the incorrect lint warning below that the window might be null. assert alertDialog.getWindow() != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); @@ -223,6 +216,14 @@ public class SaveDialog extends DialogFragment { TextView storagePermissionTextView = alertDialog.findViewById(R.id.storage_permission_textview); Button saveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); + // Remove the incorrect warnings that the views might be null. + assert urlEditText != null; + assert fileNameEditText != null; + assert browseButton != null; + assert fileSizeTextView != null; + assert fileExistsWarningTextView != null; + assert storagePermissionTextView != null; + // Set the file size text view. fileSizeTextView.setText(fileSizeString); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java index 624e4553..c73cfdc6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java @@ -22,13 +22,13 @@ package com.stoutner.privacybrowser.dialogs; import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.os.Environment; @@ -43,8 +43,9 @@ import android.widget.EditText; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; -import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment is required or an error is produced on API <=22. It is also required for the browse button to work correctly. +import androidx.fragment.app.DialogFragment; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.helpers.DownloadLocationHelper; @@ -74,39 +75,23 @@ public class SaveLogcatDialog extends DialogFragment { @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - // Get a handle for the activity and the context. - Activity activity = getActivity(); - Context context = getContext(); - - // Remove the incorrect lint warnings. - assert activity != null; - assert context != null; - - // Set the style according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark); - } else { - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight); - } + Activity activity = requireActivity(); + Context context = requireContext(); + // Use an alert dialog builder to create the alert dialog. + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialog); // Set the title. dialogBuilder.setTitle(R.string.save_logcat); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Set the icon according to the theme. - if (darkTheme) { - dialogBuilder.setIcon(R.drawable.save_dialog_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.save_dialog_night); } else { - dialogBuilder.setIcon(R.drawable.save_dialog_light); + dialogBuilder.setIcon(R.drawable.save_dialog_day); } // Set the view. The parent view is null because it will be assigned by the alert dialog. @@ -129,6 +114,12 @@ public class SaveLogcatDialog extends DialogFragment { // Remove the incorrect lint warning below that `getWindow()` might be null. assert alertDialog.getWindow() != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); @@ -144,6 +135,12 @@ public class SaveLogcatDialog extends DialogFragment { TextView storagePermissionTextView = alertDialog.findViewById(R.id.storage_permission_textview); Button saveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); + // Remove the incorrect lint warnings below that the views might be null. + assert fileNameEditText != null; + assert browseButton != null; + assert fileExistsWarningTextView != null; + assert storagePermissionTextView != null; + // Update the status of the save button when the file name changes. fileNameEditText.addTextChangedListener(new TextWatcher() { @Override diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java index 7d8e0b63..9e329434 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -21,10 +21,10 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.net.Uri; import android.net.http.SslCertificate; import android.net.http.SslError; @@ -41,7 +41,8 @@ import android.webkit.SslErrorHandler; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.activities.MainWebViewActivity; @@ -137,35 +138,20 @@ public class SslCertificateErrorDialog extends DialogFragment { // Get a handle for the SSL error handler. SslErrorHandler sslErrorHandler = nestedScrollWebView.getSslErrorHandler(); - // Remove the incorrect lint warning that `getActivity()` might be null. - assert getActivity() != null; - // Get the activity's layout inflater. - LayoutInflater layoutInflater = getActivity().getLayoutInflater(); + LayoutInflater layoutInflater = requireActivity().getLayoutInflater(); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); - // Set the style and icon according to the theme. - if (darkTheme) { - // Set the style. - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the icon. - dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_dark); + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_night); } else { - // Set the style. - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - - // Set the icon. - dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_light); + dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_day); } // Set the title. @@ -202,6 +188,12 @@ public class SslCertificateErrorDialog extends DialogFragment { // Create an alert dialog from the alert dialog builder. AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindow()` might be null. @@ -234,6 +226,20 @@ public class SslCertificateErrorDialog extends DialogFragment { TextView startDateTextView = alertDialog.findViewById(R.id.start_date); TextView endDateTextView = alertDialog.findViewById(R.id.end_date); + // Remove the incorrect lint warnings below that the views might be null. + assert primaryErrorTextView != null; + assert urlTextView != null; + assert issuedToCNameTextView != null; + assert issuedToONameTextView != null; + assert issuedToUNameTextView != null; + assert issuedByTextView != null; + assert issuedByCNameTextView != null; + assert issuedByONameTextView != null; + assert issuedByUNameTextView != null; + assert validDatesTextView != null; + assert startDateTextView != null; + assert endDateTextView != null; + // Setup the common strings. String urlLabel = getString(R.string.url_label) + " "; String cNameLabel = getString(R.string.common_name) + " "; @@ -253,17 +259,17 @@ public class SslCertificateErrorDialog extends DialogFragment { SpannableStringBuilder startDateStringBuilder = new SpannableStringBuilder(startDateLabel + startDate); SpannableStringBuilder endDateStringBuilder = new SpannableStringBuilder((endDateLabel + endDate)); - // Create a red foreground color span. The deprecated `getResources().getColor` must be used until the minimum API >= 23. - ForegroundColorSpan redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700)); - - // Create a blue `ForegroundColorSpan`. + // Define the color spans. ForegroundColorSpan blueColorSpan; + ForegroundColorSpan redColorSpan; - // Set a blue color span according to the theme. The deprecated `getResources().getColor` must be used until the minimum API >= 23. - if (darkTheme) { + // Set the color spans according to the theme. The deprecated `getResources()` must be used until the minimum API >= 23. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400)); + redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_900)); } else { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700)); + redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700)); } // Setup the spans to display the certificate information in blue. `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction. @@ -293,7 +299,11 @@ public class SslCertificateErrorDialog extends DialogFragment { case SslError.SSL_UNTRUSTED: // Change the issued by text view text to red. The deprecated `getResources().getColor` must be used until the minimum API >= 23. - issuedByTextView.setTextColor(getResources().getColor(R.color.red_a700)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + issuedByTextView.setTextColor(getResources().getColor(R.color.red_900)); + } else { + issuedByTextView.setTextColor(getResources().getColor(R.color.red_a700)); + } // Change the issued by span color to red. issuedByCNameStringBuilder.setSpan(redColorSpan, cNameLabel.length(), issuedByCNameStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); @@ -306,7 +316,11 @@ public class SslCertificateErrorDialog extends DialogFragment { case SslError.SSL_DATE_INVALID: // Change the valid dates text view text to red. The deprecated `getResources().getColor` must be used until the minimum API >= 23. - validDatesTextView.setTextColor(getResources().getColor(R.color.red_a700)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + validDatesTextView.setTextColor(getResources().getColor(R.color.red_900)); + } else { + validDatesTextView.setTextColor(getResources().getColor(R.color.red_a700)); + } // Change the date span colors to red. startDateStringBuilder.setSpan(redColorSpan, startDateLabel.length(), startDateStringBuilder.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); @@ -410,17 +424,14 @@ public class SslCertificateErrorDialog extends DialogFragment { // Create a spannable string builder. SpannableStringBuilder ipAddressesStringBuilder = new SpannableStringBuilder(ipAddressesLabel + ipAddresses); - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Create a blue foreground color span. ForegroundColorSpan blueColorSpan; + // Get the current theme status. + int currentThemeStatus = activity.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Set the blue color span according to the theme. The deprecated `getColor()` must be used until the minimum API >= 23. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { blueColorSpan = new ForegroundColorSpan(activity.getResources().getColor(R.color.blue_400)); } else { blueColorSpan = new ForegroundColorSpan(activity.getResources().getColor(R.color.blue_700)); @@ -448,6 +459,9 @@ public class SslCertificateErrorDialog extends DialogFragment { // Get a handle for the IP addresses text view. TextView ipAddressesTextView = alertDialog.findViewById(R.id.ip_addresses); + // Remove the incorrect lint warning below that the view might be null. + assert ipAddressesTextView != null; + // Populate the IP addresses text view. ipAddressesTextView.setText(ipAddresses); } diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java index 4743f9be..472a5184 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java @@ -19,16 +19,17 @@ package com.stoutner.privacybrowser.dialogs; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.WindowManager; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; import com.stoutner.privacybrowser.R; @@ -86,23 +87,17 @@ public class StoragePermissionDialog extends DialogFragment { // Get the save type. int requestType = arguments.getInt("request_type"); - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - // Use a builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); + + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the style and the icon according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - dialogBuilder.setIcon(R.drawable.import_export_dark); + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.import_export_night); } else { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - dialogBuilder.setIcon(R.drawable.import_export_light); + dialogBuilder.setIcon(R.drawable.import_export_day); } // Set the title. @@ -120,6 +115,12 @@ public class StoragePermissionDialog extends DialogFragment { // Create an alert dialog from the builder. final AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindow()` might be null. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java index 298da3b9..661df9a2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,7 +20,6 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; @@ -39,6 +38,7 @@ import android.widget.ListView; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. @@ -91,11 +91,8 @@ public class UrlHistoryDialog extends DialogFragment{ // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. @SuppressLint("InflateParams") public Dialog onCreateDialog(Bundle savedInstanceState) { - // Remove the incorrect lint warning that `getActivity()` might be null. - assert getActivity() != null; - // Get the activity's layout inflater. - LayoutInflater layoutInflater = getActivity().getLayoutInflater(); + LayoutInflater layoutInflater = requireActivity().getLayoutInflater(); // Get the arguments. Bundle arguments = getArguments(); @@ -169,21 +166,7 @@ public class UrlHistoryDialog extends DialogFragment{ int currentPageId = webBackForwardList.getSize() - 1 - currentPageIndex; // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Set the style according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - } else { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); // Set the title. dialogBuilder.setTitle(R.string.history); @@ -205,6 +188,12 @@ public class UrlHistoryDialog extends DialogFragment{ // Create an alert dialog from the alert dialog builder. final AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindow()` might be null. @@ -223,6 +212,9 @@ public class UrlHistoryDialog extends DialogFragment{ // Get a handle for the list view. ListView listView = alertDialog.findViewById(R.id.history_listview); + // Remove the incorrect lint warning below that the view might be null. + assert listView != null; + // Set the list view adapter. listView.setAdapter(historyArrayAdapter); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java index 5b7566f6..0ff75520 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2018-2019 Soren Stoutner . + * Copyright © 2018-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,11 +20,11 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.View; @@ -33,6 +33,7 @@ import android.widget.Button; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; import com.stoutner.privacybrowser.R; @@ -79,13 +80,6 @@ public class ViewRequestDialog extends DialogFragment { // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. @SuppressLint("InflateParams") public Dialog onCreateDialog(Bundle savedInstanceState) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the theme and screenshot preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - // Remove the incorrect lint warning that `getInt()` might be null. assert getArguments() != null; @@ -95,15 +89,16 @@ public class ViewRequestDialog extends DialogFragment { String[] requestDetails = getArguments().getStringArray("request_details"); // Use an alert dialog builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog); + + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the style and icon according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); - dialogBuilder.setIcon(R.drawable.block_ads_enabled_dark); + // Set the icon according to the theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + dialogBuilder.setIcon(R.drawable.block_ads_enabled_night); } else { - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); - dialogBuilder.setIcon(R.drawable.block_ads_enabled_light); + dialogBuilder.setIcon(R.drawable.block_ads_enabled_day); } // Create the dialog title. @@ -139,6 +134,12 @@ public class ViewRequestDialog extends DialogFragment { // Create an alert dialog from the alert dialog builder. final AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindow()` might be null. @@ -165,6 +166,18 @@ public class ViewRequestDialog extends DialogFragment { Button previousButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE); Button nextButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); + // Remove the incorrect lint warnings below that the views might be null. + assert requestDisposition != null; + assert requestUrl != null; + assert requestBlockListLabel != null; + assert requestBlockList != null; + assert requestSubListLabel != null; + assert requestSubList != null; + assert requestBlockListEntriesLabel != null; + assert requestBlockListEntries != null; + assert requestBlockListOriginalEntryLabel != null; + assert requestBlockListOriginalEntry != null; + // Disable the previous button if the first resource request is displayed. previousButton.setEnabled(!(id == 1)); @@ -186,7 +199,7 @@ public class ViewRequestDialog extends DialogFragment { requestDisposition.setText(R.string.allowed); // Set the background color. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { requestDisposition.setBackgroundColor(getResources().getColor(R.color.blue_700_50)); } else { requestDisposition.setBackgroundColor(getResources().getColor(R.color.blue_100)); @@ -198,7 +211,7 @@ public class ViewRequestDialog extends DialogFragment { requestDisposition.setText(R.string.third_party_blocked); // Set the background color. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { requestDisposition.setBackgroundColor(getResources().getColor(R.color.yellow_700_50)); } else { requestDisposition.setBackgroundColor(getResources().getColor(R.color.yellow_100)); @@ -210,7 +223,7 @@ public class ViewRequestDialog extends DialogFragment { requestDisposition.setText(R.string.blocked); // Set the background color. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { requestDisposition.setBackgroundColor(getResources().getColor(R.color.red_700_40)); } else { requestDisposition.setBackgroundColor(getResources().getColor(R.color.red_100)); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java index b7f0b487..90ea8320 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java @@ -21,10 +21,10 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; @@ -39,7 +39,8 @@ import android.view.WindowManager; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; import androidx.preference.PreferenceManager; import com.stoutner.privacybrowser.activities.MainWebViewActivity; @@ -75,12 +76,8 @@ public class ViewSslCertificateDialog extends DialogFragment { @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { // Get a handle for the activity and the context. - Activity activity = getActivity(); - Context context = getContext(); - - // Remove the incorrect lint warnings below that the activity and context might be null. - assert activity != null; - assert context != null; + Activity activity = requireActivity(); + Context context = requireContext(); // Get the activity's layout inflater. LayoutInflater layoutInflater = activity.getLayoutInflater(); @@ -108,21 +105,7 @@ public class ViewSslCertificateDialog extends DialogFragment { // Use a builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); - - // Get the screenshot and theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Set the style according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark); - } else { - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight); - } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialog); // Create a drawable version of the favorite icon. Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), nestedScrollWebView.getFavoriteOrDefaultIcon()); @@ -136,6 +119,12 @@ public class ViewSslCertificateDialog extends DialogFragment { // Get the SSL certificate. SslCertificate sslCertificate = nestedScrollWebView.getCertificate(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Check to see if the website is encrypted. if (sslCertificate == null) { // The website is not encrypted. // Set the title. @@ -192,6 +181,18 @@ public class ViewSslCertificateDialog extends DialogFragment { TextView startDateTextView = alertDialog.findViewById(R.id.start_date); TextView endDateTextView = alertDialog.findViewById(R.id.end_date); + // Remove the incorrect warning that the views might be null. + assert domainTextView != null; + assert ipAddressesTextView != null; + assert issuedToCNameTextView != null; + assert issuedToONameTextView != null; + assert issuedToUNameTextView != null; + assert issuedByCNameTextView != null; + assert issuedByONameTextView != null; + assert issuedByUNameTextView != null; + assert startDateTextView != null; + assert endDateTextView != null; + // Setup the labels. String domainLabel = getString(R.string.domain_label) + " "; String ipAddressesLabel = getString(R.string.ip_addresses) + " "; @@ -229,17 +230,20 @@ public class ViewSslCertificateDialog extends DialogFragment { SpannableStringBuilder startDateStringBuilder = new SpannableStringBuilder(startDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(startDate)); SpannableStringBuilder endDateStringBuilder = new SpannableStringBuilder(endDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(endDate)); - // Create a red foreground color span. The deprecated `getColor` must be used until the minimum API >= 23. - ForegroundColorSpan redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700)); - - // Create a blue foreground color span. + // Define the color spans. ForegroundColorSpan blueColorSpan; + ForegroundColorSpan redColorSpan; + + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - // Set the blue color span according to the theme. The deprecated `getColor()` must be used until the minimum API >= 23. - if (darkTheme) { + // Set the color spans according to the theme. The deprecated `getResources()` must be used until the minimum API >= 23. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400)); + redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_900)); } else { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700)); + redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700)); } // Remove the incorrect lint error that `.equals` might produce a NullPointerException. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/WaitingForProxyDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/WaitingForProxyDialog.java index 08e39212..b413584e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/WaitingForProxyDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/WaitingForProxyDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2019 Soren Stoutner . + * Copyright © 2019-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,7 +20,6 @@ package com.stoutner.privacybrowser.dialogs; import android.annotation.SuppressLint; -import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.SharedPreferences; @@ -41,33 +40,14 @@ public class WaitingForProxyDialog extends DialogFragment { @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { - // Get the context and the activity. - Context context = getContext(); - Activity activity = getActivity(); - - // Remove the incorrect lint warnings below that the context or the activity might be null. - assert context != null; - assert activity != null; + // Get a handle for the context. + Context context = requireContext(); // Get the activity's layout inflater. - LayoutInflater layoutInflater = activity.getLayoutInflater(); - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); - - // Get the screenshot and theme preferences. - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + LayoutInflater layoutInflater = requireActivity().getLayoutInflater(); // Use a builder to create the alert dialog. - AlertDialog.Builder dialogBuilder; - - // Set the style according to the theme. - if (darkTheme) { - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogDark); - } else { - dialogBuilder = new AlertDialog.Builder(activity, R.style.PrivacyBrowserAlertDialogLight); - } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialog); // Set the layout. The parent view is `null` because it will be assigned by the alert dialog. dialogBuilder.setView(layoutInflater.inflate(R.layout.waiting_for_proxy_dialog, null)); @@ -75,6 +55,12 @@ public class WaitingForProxyDialog extends DialogFragment { // Create an alert dialog from the alert dialog builder. AlertDialog alertDialog = dialogBuilder.create(); + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); + + // Get the screenshot preference. + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Disable screenshots if not allowed. if (!allowScreenshots) { // Remove the warning below that `getWindow()` might be null. diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java index 486f593c..8f148a4b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -21,13 +21,12 @@ package com.stoutner.privacybrowser.fragments; import android.annotation.SuppressLint; import android.content.Context; -import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.Signature; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; -import android.preference.PreferenceManager; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.style.ForegroundColorSpan; @@ -39,6 +38,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; +import androidx.webkit.WebViewCompat; import com.stoutner.privacybrowser.BuildConfig; import com.stoutner.privacybrowser.R; @@ -101,11 +101,8 @@ public class AboutTabFragment extends Fragment { Context context = getContext(); assert context != null; - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); - - // Get the theme preference. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; // Load the tabs. Tab numbers start at 0. if (tabNumber == 0) { // Load the about tab. @@ -230,8 +227,8 @@ public class AboutTabFragment extends Fragment { // Create the `blueColorSpan` variable. ForegroundColorSpan blueColorSpan; - // Set `blueColorSpan` according to the theme. We have to use the deprecated `getColor()` until API >= 23. - if (darkTheme) { + // Set the blue color span according to the theme. The deprecated `getResources()` must be used until the minimum API >= 23. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400)); } else { blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700)); @@ -292,13 +289,13 @@ public class AboutTabFragment extends Fragment { securityPatchTextView.setVisibility(View.GONE); } - // Only populate the WebView provider if the SDK >= 26. - if (Build.VERSION.SDK_INT >= 26) { + // Only populate the WebView provider if the SDK >= 21. + if (Build.VERSION.SDK_INT >= 21) { // Create the WebView provider label. String webViewProviderLabel = getString(R.string.webview_provider) + " "; // Get the current WebView package info. - PackageInfo webViewPackageInfo = WebView.getCurrentWebViewPackage(); + PackageInfo webViewPackageInfo = WebViewCompat.getCurrentWebViewPackage(context); // Remove the warning below that the package info might be null. assert webViewPackageInfo != null; @@ -314,7 +311,7 @@ public class AboutTabFragment extends Fragment { // Display the WebView provider. webViewProviderTextView.setText(webViewProviderStringBuilder); - } else { // The API < 26. + } else { // The API < 21. // Hide the WebView provider text view. webViewProviderTextView.setVisibility(View.GONE); } @@ -415,7 +412,7 @@ public class AboutTabFragment extends Fragment { WebView tabWebView = (WebView) tabLayout; // Load the tabs according to the theme. - if (darkTheme) { // The dark theme is applied. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // The dark theme is applied. // Set the background color. The deprecated `.getColor()` must be used until the minimum API >= 23. tabWebView.setBackgroundColor(getResources().getColor(R.color.gray_850)); diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java index 8517b6f6..1af803a5 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017-2019 Soren Stoutner . + * Copyright © 2017-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -22,6 +22,7 @@ package com.stoutner.privacybrowser.fragments; import android.annotation.SuppressLint; import android.content.Context; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.os.Build; @@ -92,6 +93,9 @@ public class DomainSettingsFragment extends Fragment { // Remove the error below that the context might be null. assert context != null; + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Get a handle for the shared preference. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); @@ -100,7 +104,6 @@ public class DomainSettingsFragment extends Fragment { String defaultCustomUserAgentString = sharedPreferences.getString("custom_user_agent", getString(R.string.custom_user_agent_default_value)); String defaultFontSizeString = sharedPreferences.getString("font_size", getString(R.string.font_size_default_value)); boolean defaultSwipeToRefresh = sharedPreferences.getBoolean("swipe_to_refresh", true); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); boolean defaultNightMode = sharedPreferences.getBoolean("night_mode", false); boolean defaultWideViewport = sharedPreferences.getBoolean("wide_viewport", true); boolean defaultDisplayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true); @@ -298,8 +301,8 @@ public class DomainSettingsFragment extends Fragment { // Create a blue foreground color span. final ForegroundColorSpan blueColorSpan; - // Set the blue color span according to the theme. The deprecated `resources.getColor` must be used until the minimum API >= 23. - if (darkTheme) { + // Set the blue color span according to the theme. The deprecated `resources` must be used until the minimum API >= 23. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { blueColorSpan = new ForegroundColorSpan(resources.getColor(R.color.blue_400)); } else { blueColorSpan = new ForegroundColorSpan(resources.getColor(R.color.blue_700)); @@ -394,10 +397,10 @@ public class DomainSettingsFragment extends Fragment { firstPartyCookiesSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_night)); } else { - firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light)); + firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_day)); } } @@ -413,10 +416,10 @@ public class DomainSettingsFragment extends Fragment { thirdPartyCookiesSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_night)); } else { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light)); + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_day)); } } } else { // First-party cookies are disabled. @@ -431,10 +434,10 @@ public class DomainSettingsFragment extends Fragment { thirdPartyCookiesSwitch.setEnabled(false); // Set the icon according to the theme. - if (darkTheme) { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_night)); } else { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_light)); + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_day)); } } } else { // Third-party cookies cannot be configured for API <= 21. @@ -456,10 +459,10 @@ public class DomainSettingsFragment extends Fragment { domStorageSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_night)); } else { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light)); + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_day)); } } } else { // JavaScript is disabled. @@ -474,10 +477,10 @@ public class DomainSettingsFragment extends Fragment { } // Set the icon according to the theme. - if (darkTheme) { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_night)); } else { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light)); + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_day)); } } @@ -494,10 +497,10 @@ public class DomainSettingsFragment extends Fragment { formDataSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_night)); } else { - formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light)); + formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_day)); } } } @@ -508,20 +511,20 @@ public class DomainSettingsFragment extends Fragment { easyListSwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_night)); } else { - easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light)); + easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_day)); } } else { // EasyList is off. // Turn the switch off. easyListSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_night)); } else { - easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light)); + easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_day)); } } @@ -531,20 +534,20 @@ public class DomainSettingsFragment extends Fragment { easyPrivacySwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_night)); } else { - easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light)); + easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_day)); } } else { // EasyPrivacy is off. // Turn the switch off. easyPrivacySwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_night)); } else { - easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light)); + easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_day)); } } @@ -554,20 +557,20 @@ public class DomainSettingsFragment extends Fragment { fanboysAnnoyanceListSwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_night)); } else { - fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light)); + fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_day)); } } else { // Fanboy's Annoyance List is off. // Turn the switch off. fanboysAnnoyanceListSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_night)); } else { - fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light)); + fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_day)); } } @@ -580,10 +583,10 @@ public class DomainSettingsFragment extends Fragment { fanboysSocialBlockingListSwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_night)); } else { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light)); + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_day)); } } else { // Fanboy's Social Blocking List is off. // Enable the switch but turn it off. @@ -591,10 +594,10 @@ public class DomainSettingsFragment extends Fragment { fanboysSocialBlockingListSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_night)); } else { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light)); + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_day)); } } } else { // Fanboy's Annoyance List is on. @@ -610,10 +613,10 @@ public class DomainSettingsFragment extends Fragment { } // Set the icon according to the theme. - if (darkTheme) { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_night)); } else { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_light)); + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_day)); } } @@ -623,20 +626,20 @@ public class DomainSettingsFragment extends Fragment { ultraListSwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_night)); } else { - ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light)); + ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_day)); } } else { // UltraList is off. // Turn the switch off. ultraListSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_night)); } else { - ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light)); + ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_day)); } } @@ -646,20 +649,20 @@ public class DomainSettingsFragment extends Fragment { ultraPrivacySwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_night)); } else { - ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light)); + ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_day)); } } else { // EasyPrivacy is off. // Turn the switch off. ultraPrivacySwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_night)); } else { - ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light)); + ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_day)); } } @@ -669,20 +672,20 @@ public class DomainSettingsFragment extends Fragment { blockAllThirdPartyRequestsSwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_night)); } else { - blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_light)); + blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_day)); } } else { // Blocking all third-party requests is off. // Turn the switch off. blockAllThirdPartyRequestsSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_night)); } else { - blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_light)); + blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_day)); } } @@ -815,17 +818,17 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultSwipeToRefresh) { // Swipe to refresh is enabled by default. // Set the icon according to the theme. - if (darkTheme) { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_night)); } else { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light)); + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_day)); } } else { // Swipe to refresh is disabled by default // Set the icon according to the theme. - if (darkTheme) { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_night)); } else { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light)); + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_day)); } } @@ -835,10 +838,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. - if (darkTheme) { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_night)); } else { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light)); + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_day)); } // Hide the swipe to refresh TextView.` @@ -847,10 +850,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. - if (darkTheme) { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_night)); } else { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light)); + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_day)); } // Hide the swipe to refresh TextView. @@ -878,17 +881,17 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultNightMode) { // Night mode enabled by default. // Set the icon according to the theme. - if (darkTheme) { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night)); } else { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light)); + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day)); } } else { // Night mode disabled by default. // Set the icon according to the theme. - if (darkTheme) { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night)); } else { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light)); + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day)); } } @@ -898,10 +901,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. - if (darkTheme) { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night)); } else { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light)); + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day)); } // Hide the night mode TextView. @@ -910,10 +913,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. - if (darkTheme) { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night)); } else { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light)); + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day)); } // Hide the night mode TextView. @@ -942,16 +945,16 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultWideViewport) { // Wide viewport enabled by default. // Set the icon according to the theme. - if (darkTheme) { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_night)); } else { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_light)); + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_day)); } } else { // Wide viewport disabled by default. - if (darkTheme) { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_night)); } else { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_light)); + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_day)); } } @@ -961,10 +964,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. - if (darkTheme) { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_night)); } else { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_light)); + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_day)); } // Hide the wide viewport text view. @@ -973,10 +976,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. - if (darkTheme) { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_night)); } else { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_light)); + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_day)); } // Hide the wide viewport text view. @@ -1005,17 +1008,17 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultDisplayWebpageImages) { // Display webpage images enabled by default. // Set the icon according to the theme. - if (darkTheme) { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_night)); } else { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light)); + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_day)); } } else { // Display webpage images disabled by default. // Set the icon according to the theme. - if (darkTheme) { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_night)); } else { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light)); + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_day)); } } @@ -1025,10 +1028,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. - if (darkTheme) { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_night)); } else { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light)); + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_day)); } // Hide the display images text view. @@ -1037,10 +1040,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. - if (darkTheme) { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_night)); } else { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light)); + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_day)); } // Hide the display images text view. @@ -1060,20 +1063,20 @@ public class DomainSettingsFragment extends Fragment { pinnedSslCertificateSwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_night)); } else { - pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light)); + pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_day)); } } else { // Pinned SSL certificate is disabled. // Uncheck the switch. pinnedSslCertificateSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_night)); } else { - pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light)); + pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_day)); } } @@ -1214,7 +1217,7 @@ public class DomainSettingsFragment extends Fragment { currentWebsiteCertificateRadioButton.setChecked(false); // Darken the background of the current website SSL certificate linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -1247,20 +1250,20 @@ public class DomainSettingsFragment extends Fragment { pinnedIpAddressesSwitch.setChecked(true); // Set the icon according to the theme. - if (darkTheme) { - pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_night)); } else { - pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light)); + pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_day)); } } else { // Pinned IP Addresses is disabled. // Uncheck the switch. pinnedIpAddressesSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_night)); } else { - pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light)); + pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_day)); } } @@ -1289,7 +1292,7 @@ public class DomainSettingsFragment extends Fragment { currentIpAddressesRadioButton.setChecked(false); // Darken the background of the current IP addresses linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -1326,10 +1329,10 @@ public class DomainSettingsFragment extends Fragment { domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_enabled)); } else { // DOM storage is disabled. // Set the icon according to the theme. - if (darkTheme) { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_night)); } else { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light)); + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_day)); } } } else { // JavaScript is disabled. @@ -1340,10 +1343,10 @@ public class DomainSettingsFragment extends Fragment { domStorageSwitch.setEnabled(false); // Set the DOM storage icon according to the theme. - if (darkTheme) { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_night)); } else { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light)); + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_day)); } } }); @@ -1362,28 +1365,28 @@ public class DomainSettingsFragment extends Fragment { thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning)); } else { // Third-party cookies are disabled. // Set the third-party cookies icon according to the theme. - if (darkTheme) { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_night)); } else { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light)); + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_day)); } } } else { // First-party cookies are disabled. // Update the first-party cookies icon according to the theme. - if (darkTheme) { - firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_night)); } else { - firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light)); + firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_day)); } // Disable the third-party cookies switch. thirdPartyCookiesSwitch.setEnabled(false); // Set the third-party cookies icon according to the theme. - if (darkTheme) { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_night)); } else { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_light)); + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_day)); } } }); @@ -1395,10 +1398,10 @@ public class DomainSettingsFragment extends Fragment { thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning)); } else { // Update the third-party cookies icon according to the theme. - if (darkTheme) { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_night)); } else { - thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light)); + thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_day)); } } }); @@ -1410,10 +1413,10 @@ public class DomainSettingsFragment extends Fragment { domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_enabled)); } else { // Set the icon according to the theme. - if (darkTheme) { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_night)); } else { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light)); + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_day)); } } }); @@ -1426,10 +1429,10 @@ public class DomainSettingsFragment extends Fragment { formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled)); } else { // Set the icon according to the theme. - if (darkTheme) { - formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_night)); } else { - formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light)); + formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_day)); } } }); @@ -1440,17 +1443,17 @@ public class DomainSettingsFragment extends Fragment { // Update the icon. if (isChecked) { // EasyList is on. // Set the icon according to the theme. - if (darkTheme) { - easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_night)); } else { - easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light)); + easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_day)); } } else { // EasyList is off. // Set the icon according to the theme. - if (darkTheme) { - easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_night)); } else { - easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light)); + easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_day)); } } }); @@ -1460,17 +1463,17 @@ public class DomainSettingsFragment extends Fragment { // Update the icon. if (isChecked) { // EasyPrivacy is on. // Set the icon according to the theme. - if (darkTheme) { - easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_night)); } else { - easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light)); + easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_day)); } } else { // EasyPrivacy is off. // Set the icon according to the theme. - if (darkTheme) { - easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_night)); } else { - easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light)); + easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_day)); } } }); @@ -1480,27 +1483,27 @@ public class DomainSettingsFragment extends Fragment { // Update the icon and Fanboy's Social Blocking List. if (isChecked) { // Fanboy's Annoyance List is on. // Set the icon according to the theme. - if (darkTheme) { - fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_night)); } else { - fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light)); + fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_day)); } // Disable the Fanboy's Social Blocking List switch. fanboysSocialBlockingListSwitch.setEnabled(false); // Update the Fanboy's Social Blocking List icon according to the theme. - if (darkTheme) { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_night)); } else { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_light)); + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_day)); } } else { // Fanboy's Annoyance List is off. // Set the icon according to the theme. - if (darkTheme) { - fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_night)); } else { - fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light)); + fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_day)); } // Enable the Fanboy's Social Blocking List switch. @@ -1509,17 +1512,17 @@ public class DomainSettingsFragment extends Fragment { // Update the Fanboy's Social Blocking List icon. if (fanboysSocialBlockingListSwitch.isChecked()) { // Fanboy's Social Blocking List is on. // Update the icon according to the theme. - if (darkTheme) { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_night)); } else { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light)); + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_day)); } } else { // Fanboy's Social Blocking List is off. // Update the icon according to the theme. - if (darkTheme) { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_night)); } else { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light)); + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_day)); } } } @@ -1531,17 +1534,17 @@ public class DomainSettingsFragment extends Fragment { // Update the icon. if (isChecked) { // Fanboy's Social Blocking List is on. // Set the icon according to the theme. - if (darkTheme) { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_night)); } else { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light)); + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_day)); } } else { // Fanboy's Social Blocking List is off. // Set the icon according to the theme. - if (darkTheme) { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_night)); } else { - fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light)); + fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_day)); } } }); @@ -1551,17 +1554,17 @@ public class DomainSettingsFragment extends Fragment { // Update the icon. if (isChecked) { // UltraList is on. // Set the icon according to the theme. - if (darkTheme) { - ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_night)); } else { - ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light)); + ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_day)); } } else { // UltraList is off. // Set the icon according to the theme. - if (darkTheme) { - ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_night)); } else { - ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light)); + ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_day)); } } }); @@ -1571,17 +1574,17 @@ public class DomainSettingsFragment extends Fragment { // Update the icon. if (isChecked) { // UltraPrivacy is on. // Set the icon according to the theme. - if (darkTheme) { - ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_night)); } else { - ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light)); + ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_day)); } } else { // UltraPrivacy is off. // Set the icon according to the theme. - if (darkTheme) { - ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_night)); } else { - ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light)); + ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_day)); } } }); @@ -1591,17 +1594,17 @@ public class DomainSettingsFragment extends Fragment { // Update the icon. if (isChecked) { // Blocking all third-party requests is on. // Set the icon according to the theme. - if (darkTheme) { - blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_night)); } else { - blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_light)); + blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_day)); } } else { // Blocking all third-party requests is off. // Set the icon according to the theme. - if (darkTheme) { - blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_night)); } else { - blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_light)); + blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_day)); } } }); @@ -1711,17 +1714,17 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultSwipeToRefresh) { // Swipe to refresh enabled by default. // Set the icon according to the theme. - if (darkTheme) { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_night)); } else { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light)); + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_day)); } } else { // Swipe to refresh disabled by default. // Set the icon according to the theme. - if (darkTheme) { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_night)); } else { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light)); + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_day)); } } @@ -1731,10 +1734,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. - if (darkTheme) { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_night)); } else { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light)); + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_day)); } // Hide the swipe to refresh TextView. @@ -1743,10 +1746,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. - if (darkTheme) { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_night)); } else { - swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light)); + swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_day)); } // Hide the swipe to refresh TextView. @@ -1769,17 +1772,17 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultNightMode) { // Night mode enabled by default. // Set the icon according to the theme. - if (darkTheme) { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night)); } else { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light)); + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day)); } } else { // Night mode disabled by default. // Set the icon according to the theme. - if (darkTheme) { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night)); } else { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light)); + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day)); } } @@ -1789,10 +1792,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. - if (darkTheme) { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night)); } else { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light)); + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day)); } // Hide `nightModeTextView`. @@ -1801,10 +1804,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. - if (darkTheme) { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night)); } else { - nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light)); + nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day)); } // Hide `nightModeTextView`. @@ -1843,10 +1846,10 @@ public class DomainSettingsFragment extends Fragment { domStorageSwitch.setChecked(false); // Set the icon according to the theme. - if (darkTheme) { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_night)); } else { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light)); + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_day)); } } } else { // JavaScript is disabled. @@ -1861,10 +1864,10 @@ public class DomainSettingsFragment extends Fragment { } // Set the icon according to the theme. - if (darkTheme) { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_night)); } else { - domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light)); + domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_day)); } } } @@ -1884,16 +1887,16 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultWideViewport) { // Wide viewport is enabled by default. // Set the icon according to the theme. - if (darkTheme) { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_night)); } else { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_light)); + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_day)); } } else { // Wide viewport is disabled by default. - if (darkTheme) { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_night)); } else { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_light)); + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_day)); } } @@ -1903,10 +1906,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. - if (darkTheme) { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_night)); } else { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_light)); + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_day)); } // Hide the wide viewport text view. @@ -1915,10 +1918,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. - if (darkTheme) { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_night)); } else { - wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_light)); + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_day)); } // Hid ethe wide viewport text view. @@ -1942,17 +1945,17 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultDisplayWebpageImages) { // Display webpage images is enabled by default. // Set the icon according to the theme. - if (darkTheme) { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_night)); } else { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light)); + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_day)); } } else { // Display webpage images is disabled by default. // Set the icon according to the theme. - if (darkTheme) { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_night)); } else { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light)); + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_day)); } } @@ -1962,10 +1965,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. - if (darkTheme) { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_night)); } else { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light)); + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_day)); } // Hide the display images text view. @@ -1974,10 +1977,10 @@ public class DomainSettingsFragment extends Fragment { case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. - if (darkTheme) { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_night)); } else { - displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light)); + displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_day)); } // Hide the display images text view. @@ -1997,10 +2000,10 @@ public class DomainSettingsFragment extends Fragment { // Update the icon. if (isChecked) { // SSL certificate pinning is enabled. // Set the icon according to the theme. - if (darkTheme) { - pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_night)); } else { - pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light)); + pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_day)); } // Update the visibility of the saved SSL certificate. @@ -2037,7 +2040,7 @@ public class DomainSettingsFragment extends Fragment { savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the current website SSL certificate linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2056,7 +2059,7 @@ public class DomainSettingsFragment extends Fragment { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the saved SSL certificate linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2074,10 +2077,10 @@ public class DomainSettingsFragment extends Fragment { } } else { // SSL certificate pinning is disabled. // Set the icon according to the theme. - if (darkTheme) { - pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_night)); } else { - pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light)); + pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_day)); } // Hide the SSl certificates and instructions. @@ -2102,7 +2105,7 @@ public class DomainSettingsFragment extends Fragment { savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the current website SSL certificate linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2120,7 +2123,7 @@ public class DomainSettingsFragment extends Fragment { savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the current website SSL certificate linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2138,7 +2141,7 @@ public class DomainSettingsFragment extends Fragment { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the saved SSL certificate linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2156,7 +2159,7 @@ public class DomainSettingsFragment extends Fragment { currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the saved SSL certificate linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2168,10 +2171,10 @@ public class DomainSettingsFragment extends Fragment { // Update the icon. if (isChecked) { // IP addresses pinning is enabled. // Set the icon according to the theme. - if (darkTheme) { - pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_night)); } else { - pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light)); + pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_day)); } // Update the visibility of the saved IP addresses card view. @@ -2196,7 +2199,7 @@ public class DomainSettingsFragment extends Fragment { savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the current IP addresses linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2212,7 +2215,7 @@ public class DomainSettingsFragment extends Fragment { currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the saved IP addresses linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2223,10 +2226,10 @@ public class DomainSettingsFragment extends Fragment { currentIpAddressesCardView.getParent().requestChildFocus(currentIpAddressesCardView, currentIpAddressesCardView); } else { // IP addresses pinning is disabled. // Set the icon according to the theme. - if (darkTheme) { - pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark)); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_night)); } else { - pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light)); + pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_day)); } // Hide the IP addresses card views. @@ -2250,7 +2253,7 @@ public class DomainSettingsFragment extends Fragment { savedIpAddressesLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the current IP addresses linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2268,7 +2271,7 @@ public class DomainSettingsFragment extends Fragment { savedIpAddressesLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the current IP addresses linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2286,7 +2289,7 @@ public class DomainSettingsFragment extends Fragment { currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the saved IP addresses linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11); @@ -2304,7 +2307,7 @@ public class DomainSettingsFragment extends Fragment { currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent); // Darken the background of the saved IP addresses linear layout according to the theme. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33); } else { savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11); diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java index 2bf499e4..2aa974b9 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017-2019 Soren Stoutner . + * Copyright © 2017-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,9 +20,8 @@ package com.stoutner.privacybrowser.fragments; import android.content.Context; -import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; -import android.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -30,7 +29,7 @@ import android.widget.AdapterView; import android.widget.ListView; import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; // The AndroidX fragment must be used until minimum API >= 23. Otherwise `getContext()` does not work. +import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import com.google.android.material.floatingactionbutton.FloatingActionButton; @@ -47,7 +46,7 @@ public class DomainsListFragment extends Fragment { void dismissSnackbar(); } - public void onAttach(Context context) { + public void onAttach(@NonNull Context context) { // Run the default commands. super.onAttach(context); @@ -77,12 +76,15 @@ public class DomainsListFragment extends Fragment { // Get a handle for the domain settings fragment. Fragment domainSettingsFragment = supportFragmentManager.findFragmentById(R.id.domain_settings_fragment_container); - // Remove the incorrect lint error below that the domain settings fragment might be null. + // Remove the incorrect lint warning below that the domain settings fragment might be null. assert domainSettingsFragment != null; // Get a handle for the domain settings fragment view. View domainSettingsFragmentView = domainSettingsFragment.getView(); + // Remove the incorrect lint warning below that the domain settings fragment view might be null. + assert domainSettingsFragmentView != null; + // Get a handle for the domains activity. DomainsActivity domainsActivity = new DomainsActivity(); @@ -108,17 +110,14 @@ public class DomainsListFragment extends Fragment { // Enable the delete menu item. DomainsActivity.deleteMenuItem.setEnabled(true); - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the theme preferences. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; // Set the delete icon according to the theme. - if (darkTheme) { - DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_night); } else { - DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_light); + DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_day); } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTabFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTabFragment.java index e40f0661..6a2e82f1 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTabFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTabFragment.java @@ -20,9 +20,8 @@ package com.stoutner.privacybrowser.fragments; import android.annotation.SuppressLint; -import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; -import android.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -68,20 +67,17 @@ public class GuideTabFragment extends Fragment { @SuppressLint("SetJavaScriptEnabled") @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); - - // Get the theme preference. - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); - // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container. The fragment will take care of attaching the root automatically. View tabLayout = inflater.inflate(R.layout.bare_webview, container, false); - // Get a handle for `tabWebView`. + // Get a handle for the tab WebView. WebView tabWebView = (WebView) tabLayout; + // Get the current theme status. + int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Load the tabs according to the theme. - if (darkTheme) { // The dark theme is applied. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // The dark theme is applied. tabWebView.setBackgroundColor(getResources().getColor(R.color.gray_850)); // Tab numbers start at 0. diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java index 8e533363..0c8d39b9 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java @@ -24,6 +24,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.content.res.Resources; import android.os.Build; import android.os.Bundle; @@ -33,6 +34,7 @@ import android.view.View; import android.webkit.WebView; import android.widget.ArrayAdapter; +import androidx.appcompat.app.AppCompatDelegate; import androidx.preference.Preference; import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceFragmentCompat; @@ -46,6 +48,7 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Define the class variables. private SharedPreferences.OnSharedPreferenceChangeListener preferencesListener; private SharedPreferences savedPreferences; + private int currentThemeStatus; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { @@ -62,6 +65,9 @@ public class SettingsFragment extends PreferenceFragmentCompat { Context context = activity.getApplicationContext(); Resources resources = getResources(); + // Get the current theme status. + currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + // Initialize savedPreferences. savedPreferences = getPreferenceScreen().getSharedPreferences(); @@ -105,7 +111,7 @@ public class SettingsFragment extends PreferenceFragmentCompat { Preference swipeToRefreshPreference = findPreference("swipe_to_refresh"); Preference scrollAppBarPreference = findPreference("scroll_app_bar"); Preference displayAdditionalAppBarIconsPreference = findPreference("display_additional_app_bar_icons"); - Preference darkThemePreference = findPreference("dark_theme"); + Preference appThemePreference = findPreference("app_theme"); Preference nightModePreference = findPreference("night_mode"); Preference wideViewportPreference = findPreference("wide_viewport"); Preference displayWebpageImagesPreference = findPreference("display_webpage_images"); @@ -150,7 +156,7 @@ public class SettingsFragment extends PreferenceFragmentCompat { assert swipeToRefreshPreference != null; assert scrollAppBarPreference != null; assert displayAdditionalAppBarIconsPreference != null; - assert darkThemePreference != null; + assert appThemePreference != null; assert nightModePreference != null; assert wideViewportPreference != null; assert displayWebpageImagesPreference != null; @@ -172,7 +178,6 @@ public class SettingsFragment extends PreferenceFragmentCompat { boolean fanboySocialBlockingEnabled = savedPreferences.getBoolean("fanboys_social_blocking_list", true); boolean fullScreenBrowsingMode = savedPreferences.getBoolean("full_screen_browsing_mode", false); boolean clearEverything = savedPreferences.getBoolean("clear_everything", true); - boolean darkTheme = savedPreferences.getBoolean("dark_theme", false); boolean nightMode = savedPreferences.getBoolean("night_mode", false); // Only enable the third-party cookies preference if first-party cookies are enabled and API >= 21. @@ -330,6 +335,29 @@ public class SettingsFragment extends PreferenceFragmentCompat { fontSizePreference.setSummary(savedPreferences.getString("font_size", getString(R.string.font_size_default_value)) + "%"); + // Get the theme string arrays. + String[] appThemeEntriesStringArray = resources.getStringArray(R.array.app_theme_entries); + String[] appThemeEntryValuesStringArray = resources.getStringArray(R.array.app_theme_entry_values); + + // Get the current theme. + String currentAppTheme = savedPreferences.getString("app_theme", getString(R.string.app_theme_default_value)); + + // Define a theme entry number. + int appThemeEntryNumber; + + // Get the theme entry number that matches the current theme. A switch statement cannot be used because the theme entry values string array is not a compile time constant. + if (currentAppTheme.equals(appThemeEntryValuesStringArray[1])) { // The light theme is selected. + appThemeEntryNumber = 1; + } else if (currentAppTheme.equals(appThemeEntryValuesStringArray[2])) { // The dark theme is selected. + appThemeEntryNumber = 2; + } else { // The system default theme is selected. + appThemeEntryNumber = 0; + } + + // Set the current theme as the summary text for the preference. + appThemePreference.setSummary(appThemeEntriesStringArray[appThemeEntryNumber]); + + // Disable the JavaScript preference if Night Mode is enabled. JavaScript will be enabled for all web pages. javaScriptPreference.setEnabled(!nightMode); @@ -344,10 +372,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (firstPartyCookiesEnabled) { firstPartyCookiesPreference.setIcon(R.drawable.cookies_enabled); } else { - if (darkTheme) { - firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_night); } else { - firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light); + firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_day); } } @@ -356,17 +384,17 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (thirdPartyCookiesEnabled) { thirdPartyCookiesPreference.setIcon(R.drawable.cookies_warning); } else { - if (darkTheme) { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_night); } else { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light); + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_day); } } } else { - if (darkTheme) { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_night); } else { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_light); + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_day); } } @@ -375,17 +403,17 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (savedPreferences.getBoolean("dom_storage", false)) { // DOM storage is enabled. domStoragePreference.setIcon(R.drawable.dom_storage_enabled); } else { // DOM storage is disabled. - if (darkTheme) { - domStoragePreference.setIcon(R.drawable.dom_storage_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStoragePreference.setIcon(R.drawable.dom_storage_disabled_night); } else { - domStoragePreference.setIcon(R.drawable.dom_storage_disabled_light); + domStoragePreference.setIcon(R.drawable.dom_storage_disabled_day); } } } else { // The preference is disabled. The icon should be ghosted. - if (darkTheme) { - domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_night); } else { - domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_light); + domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_day); } } @@ -394,283 +422,283 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (savedPreferences.getBoolean("save_form_data", false)) { formDataPreference.setIcon(R.drawable.form_data_enabled); } else { - if (darkTheme) { - formDataPreference.setIcon(R.drawable.form_data_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + formDataPreference.setIcon(R.drawable.form_data_disabled_night); } else { - formDataPreference.setIcon(R.drawable.form_data_disabled_light); + formDataPreference.setIcon(R.drawable.form_data_disabled_day); } } } // Set the custom user agent icon. if (customUserAgentPreference.isEnabled()) { - if (darkTheme) { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_night); } else { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_light); + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_day); } } else { - if (darkTheme) { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_night); } else { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_light); + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_day); } } // Set the incognito mode icon. if (savedPreferences.getBoolean("incognito_mode", false)) { - if (darkTheme) { - incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_night); } else { - incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_light); + incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_day); } } else { - if (darkTheme) { - incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_night); } else { - incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_light); + incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_day); } } // Set the Do Not Track icon. if (savedPreferences.getBoolean("do_not_track", false)) { - if (darkTheme) { - doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_night); } else { - doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_light); + doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_day); } } else { - if (darkTheme) { - doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_night); } else { - doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_light); + doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_day); } } // Set the allow screenshots icon. if (savedPreferences.getBoolean("allow_screenshots", false)) { - if (darkTheme) { - allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_night); } else { - allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_light); + allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_day); } } else { - if (darkTheme) { - allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_night); } else { - allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_light); + allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_day); } } // Set the EasyList icon. if (savedPreferences.getBoolean("easylist", true)) { - if (darkTheme) { - easyListPreference.setIcon(R.drawable.block_ads_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyListPreference.setIcon(R.drawable.block_ads_enabled_night); } else { - easyListPreference.setIcon(R.drawable.block_ads_enabled_light); + easyListPreference.setIcon(R.drawable.block_ads_enabled_day); } } else { - if (darkTheme) { - easyListPreference.setIcon(R.drawable.block_ads_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyListPreference.setIcon(R.drawable.block_ads_disabled_night); } else { - easyListPreference.setIcon(R.drawable.block_ads_disabled_light); + easyListPreference.setIcon(R.drawable.block_ads_disabled_day); } } // Set the EasyPrivacy icon. if (savedPreferences.getBoolean("easyprivacy", true)) { - if (darkTheme) { - easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_night); } else { - easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light); + easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_day); } } else { - if (darkTheme) { - easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_night); } else { - easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light); + easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_day); } } // Set the Fanboy lists icons. if (fanboyAnnoyanceListEnabled) { - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Set the Fanboy annoyance list icon. - fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_dark); + fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_night); // Set the Fanboy social blocking list icon. - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_dark); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_night); } else { // Set the Fanboy annoyance list icon. - fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_light); + fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_day); // Set the Fanboy social blocking list icon. - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_light); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_day); } } else { - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Set the Fanboy annoyance list icon. - fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_dark); + fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_night); // Set the Fanboy social blocking list icon. if (fanboySocialBlockingEnabled) { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_dark); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_night); } else { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_dark); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_night); } } else { // Set the Fanboy annoyance list icon. - fanboyAnnoyanceListPreference.setIcon(R.drawable.block_ads_disabled_light); + fanboyAnnoyanceListPreference.setIcon(R.drawable.block_ads_disabled_day); // Set the Fanboy social blocking list icon. if (fanboySocialBlockingEnabled) { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_light); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_day); } else { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_light); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_day); } } } // Set the UltraList icon. if (savedPreferences.getBoolean("ultralist", true)){ - if (darkTheme) { - ultraListPreference.setIcon(R.drawable.block_ads_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraListPreference.setIcon(R.drawable.block_ads_enabled_night); } else { - ultraListPreference.setIcon(R.drawable.block_ads_enabled_light); + ultraListPreference.setIcon(R.drawable.block_ads_enabled_day); } } else { - if (darkTheme) { - ultraListPreference.setIcon(R.drawable.block_ads_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraListPreference.setIcon(R.drawable.block_ads_disabled_night); } else { - ultraListPreference.setIcon(R.drawable.block_ads_disabled_light); + ultraListPreference.setIcon(R.drawable.block_ads_disabled_day); } } // Set the UltraPrivacy icon. if (savedPreferences.getBoolean("ultraprivacy", true)) { - if (darkTheme) { - ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_night); } else { - ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light); + ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_day); } } else { - if (darkTheme) { - ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_night); } else { - ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light); + ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_day); } } // Set the block all third-party requests icon. if (savedPreferences.getBoolean("block_all_third_party_requests", false)) { - if (darkTheme) { - blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_night); } else { - blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_light); + blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_day); } } else { - if (darkTheme) { - blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_night); } else { - blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_light); + blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_day); } } // Set the Google Analytics icon according to the theme. if (savedPreferences.getBoolean("google_analytics", true)) { - if (darkTheme) { - googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_night); } else { - googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_light); + googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_day); } } else { - if (darkTheme) { - googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_night); } else { - googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_light); + googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_day); } } // Set the Facebook Click IDs icon according to the theme. if (savedPreferences.getBoolean("facebook_click_ids", true)) { - if (darkTheme) { - facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_night); } else { - facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_light); + facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_day); } } else { - if (darkTheme) { - facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_night); } else { - facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_light); + facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_day); } } // Set the Twitter AMP redirects icon according to the theme. if (savedPreferences.getBoolean("twitter_amp_redirects", true)) { - if (darkTheme) { - twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_night); } else { - twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_light); + twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_day); } } else { - if (darkTheme) { - twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_night); } else { - twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_light); + twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_day); } } // Set the search custom URL icon. if (searchCustomURLPreference.isEnabled()) { - if (darkTheme) { - searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_night); } else { - searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_light); + searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_day); } } else { - if (darkTheme) { - searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_night); } else { - searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_light); + searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_day); } } // Set the Proxy icons according to the theme and status. if (proxyString.equals("None")) { // Proxying is disabled. - if (darkTheme) { // Dark theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Dark theme. // Set the main proxy icon to be disabled. - proxyPreference.setIcon(R.drawable.proxy_disabled_dark); + proxyPreference.setIcon(R.drawable.proxy_disabled_night); // Set the custom proxy URL icon to be ghosted. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_dark); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_night); } else { // Light theme. // Set the main proxy icon to be disabled. - proxyPreference.setIcon(R.drawable.proxy_disabled_light); + proxyPreference.setIcon(R.drawable.proxy_disabled_day); // Set the custom proxy URL icon to be ghosted. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_light); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_day); } } else { // Proxying is enabled. - if (darkTheme) { // Dark theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Dark theme. // Set the main proxy icon to be enabled. - proxyPreference.setIcon(R.drawable.proxy_enabled_dark); + proxyPreference.setIcon(R.drawable.proxy_enabled_night); // Set the custom proxy URL icon according to its status. if (proxyCustomUrlPreference.isEnabled()) { // Custom proxy is enabled. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_dark); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_night); } else { // Custom proxy is disabled. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_dark); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_night); } } else { // Light theme. // Set the main proxy icon to be enabled. - proxyPreference.setIcon(R.drawable.proxy_enabled_light); + proxyPreference.setIcon(R.drawable.proxy_enabled_day); // Set the custom proxy URL icon according to its status. if (proxyCustomUrlPreference.isEnabled()) { // Custom proxy is enabled. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_light); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_day); } else { // Custom proxy is disabled. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_light); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_day); } } } @@ -678,45 +706,45 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Set the full screen browsing mode icons. if (fullScreenBrowsingMode) { // Full screen browsing mode is enabled. // Set the `fullScreenBrowsingModePreference` icon according to the theme. - if (darkTheme) { - fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_night); } else { - fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_light); + fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_day); } // Set the hide app bar icon. if (savedPreferences.getBoolean("hide_app_bar", true)) { // Hide app bar is enabled. // Set the icon according to the theme. - if (darkTheme) { - hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_night); } else { - hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_light); + hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_day); } } else { // Hide app bar is disabled. // Set the icon according to the theme. - if (darkTheme) { - hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_night); } else { - hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_light); + hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_day); } } } else { // Full screen browsing mode is disabled. // Set the icons according to the theme. - if (darkTheme) { - fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_dark); - hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_night); + hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_night); } else { - fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_light); - hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_light); + fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_day); + hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_day); } } // Set the clear everything preference icon. if (clearEverything) { - if (darkTheme) { - clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_night); } else { - clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_light); + clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_day); } } else { clearEverythingPreference.setIcon(R.drawable.clear_everything_disabled); @@ -724,10 +752,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Set the clear cookies preference icon. if (clearEverything || savedPreferences.getBoolean("clear_cookies", true)) { - if (darkTheme) { - clearCookiesPreference.setIcon(R.drawable.cookies_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearCookiesPreference.setIcon(R.drawable.cookies_cleared_night); } else { - clearCookiesPreference.setIcon(R.drawable.cookies_cleared_light); + clearCookiesPreference.setIcon(R.drawable.cookies_cleared_day); } } else { clearCookiesPreference.setIcon(R.drawable.cookies_warning); @@ -735,10 +763,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Set the clear DOM storage preference icon. if (clearEverything || savedPreferences.getBoolean("clear_dom_storage", true)) { - if (darkTheme) { - clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_night); } else { - clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_light); + clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_day); } } else { clearDomStoragePreference.setIcon(R.drawable.dom_storage_warning); @@ -747,10 +775,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Set the clear form data preference icon if the API < 26. It has no effect on newer versions of Android. if (Build.VERSION.SDK_INT < 26) { if (clearEverything || savedPreferences.getBoolean("clear_form_data", true)) { - if (darkTheme) { - clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearFormDataPreference.setIcon(R.drawable.form_data_cleared_night); } else { - clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light); + clearFormDataPreference.setIcon(R.drawable.form_data_cleared_day); } } else { clearFormDataPreference.setIcon(R.drawable.form_data_warning); @@ -759,10 +787,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Set the clear cache preference icon. if (clearEverything || savedPreferences.getBoolean("clear_cache", true)) { - if (darkTheme) { - clearCachePreference.setIcon(R.drawable.cache_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearCachePreference.setIcon(R.drawable.cache_cleared_night); } else { - clearCachePreference.setIcon(R.drawable.cache_cleared_light); + clearCachePreference.setIcon(R.drawable.cache_cleared_day); } } else { clearCachePreference.setIcon(R.drawable.cache_warning); @@ -770,28 +798,28 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Set the download custom location icon. if (downloadCustomLocationPreference.isEnabled()) { - if (darkTheme) { - downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_night); } else { - downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_light); + downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_day); } } else { - if (darkTheme) { - downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_night); } else { - downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_light); + downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_day); } } // Set the open intents in new tab preference icon. if (savedPreferences.getBoolean("open_intents_in_new_tab", true)) { - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_dark); } else { openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_light); } } else { - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_dark); } else { openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_light); @@ -800,98 +828,91 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Set the swipe to refresh preference icon. if (savedPreferences.getBoolean("swipe_to_refresh", true)) { - if (darkTheme) { - swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_night); } else { - swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_light); + swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_day); } } else { - if (darkTheme) { - swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_night); } else { - swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_light); + swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_day); } } // Set the scroll app bar preference icon. if (savedPreferences.getBoolean("scroll_app_bar", true)) { - if (darkTheme) { - scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_night); } else { - scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_light); + scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_day); } } else { - if (darkTheme) { - scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_night); } else { - scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_light); + scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_day); } } // Set the display additional app bar icons preference icon. if (savedPreferences.getBoolean("display_additional_app_bar_icons", false)) { - if (darkTheme) { - displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_night); } else { - displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_light); + displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_day); } } else { - if (darkTheme) { - displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_night); } else { - displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_light); + displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_day); } } - // Set the dark theme preference icon. - if (savedPreferences.getBoolean("dark_theme", false)) { - darkThemePreference.setIcon(R.drawable.theme_dark); - } else { - darkThemePreference.setIcon(R.drawable.theme_light); - } - // Set the night mode preference icon. if (nightMode) { - if (darkTheme) { - nightModePreference.setIcon(R.drawable.night_mode_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModePreference.setIcon(R.drawable.night_mode_enabled_night); } else { - nightModePreference.setIcon(R.drawable.night_mode_enabled_light); + nightModePreference.setIcon(R.drawable.night_mode_enabled_day); } } else { - if (darkTheme) { - nightModePreference.setIcon(R.drawable.night_mode_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModePreference.setIcon(R.drawable.night_mode_disabled_night); } else { - nightModePreference.setIcon(R.drawable.night_mode_disabled_light); + nightModePreference.setIcon(R.drawable.night_mode_disabled_day); } } // Set the wide viewport preference icon. if (savedPreferences.getBoolean("wide_viewport", true)) { - if (darkTheme) { - wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_night); } else { - wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_light); + wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_day); } } else { - if (darkTheme) { - wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_night); } else { - wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_light); + wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_day); } } // Set the display webpage images preference icon. if (savedPreferences.getBoolean("display_webpage_images", true)) { - if (darkTheme) { - displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_night); } else { - displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_light); + displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_day); } } else { - if (darkTheme) { - displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_night); } else { - displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_light); + displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_day); } } @@ -912,10 +933,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (sharedPreferences.getBoolean("dom_storage", false)) { domStoragePreference.setIcon(R.drawable.dom_storage_enabled); } else { - if (darkTheme) { - domStoragePreference.setIcon(R.drawable.dom_storage_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStoragePreference.setIcon(R.drawable.dom_storage_disabled_night); } else { - domStoragePreference.setIcon(R.drawable.dom_storage_disabled_light); + domStoragePreference.setIcon(R.drawable.dom_storage_disabled_day); } } } else { // The JavaScript preference is disabled. @@ -926,10 +947,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { domStoragePreference.setEnabled(false); // Set the icon for DOM storage preference to be ghosted. - if (darkTheme) { - domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_night); } else { - domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_light); + domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_day); } } break; @@ -945,32 +966,32 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (sharedPreferences.getBoolean("third_party_cookies", false)) { thirdPartyCookiesPreference.setIcon(R.drawable.cookies_warning); } else { - if (darkTheme) { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_night); } else { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light); + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_day); } } } else { - if (darkTheme) { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_night); } else { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_light); + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_day); } } } else { // `first_party_cookies` is `false`. // Update the icon for `first_party_cookies`. - if (darkTheme) { - firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_night); } else { - firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light); + firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_day); } // Set the icon for `third_party_cookies` to be ghosted. - if (darkTheme) { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_night); } else { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_light); + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_day); } } @@ -983,10 +1004,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (sharedPreferences.getBoolean("third_party_cookies", false)) { thirdPartyCookiesPreference.setIcon(R.drawable.cookies_warning); } else { - if (darkTheme) { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_night); } else { - thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light); + thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_day); } } break; @@ -996,10 +1017,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (sharedPreferences.getBoolean("dom_storage", false)) { domStoragePreference.setIcon(R.drawable.dom_storage_enabled); } else { - if (darkTheme) { - domStoragePreference.setIcon(R.drawable.dom_storage_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStoragePreference.setIcon(R.drawable.dom_storage_disabled_night); } else { - domStoragePreference.setIcon(R.drawable.dom_storage_disabled_light); + domStoragePreference.setIcon(R.drawable.dom_storage_disabled_day); } } break; @@ -1010,10 +1031,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (sharedPreferences.getBoolean("save_form_data", false)) { formDataPreference.setIcon(R.drawable.form_data_enabled); } else { - if (darkTheme) { - formDataPreference.setIcon(R.drawable.form_data_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + formDataPreference.setIcon(R.drawable.form_data_disabled_night); } else { - formDataPreference.setIcon(R.drawable.form_data_disabled_light); + formDataPreference.setIcon(R.drawable.form_data_disabled_day); } } break; @@ -1038,10 +1059,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { customUserAgentPreference.setEnabled(false); // Set the custom user agent preference icon according to the theme. - if (darkTheme) { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_night); } else { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_light); + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_day); } break; @@ -1053,10 +1074,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { customUserAgentPreference.setEnabled(true); // Set the custom user agent preference icon according to the theme. - if (darkTheme) { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_night); } else { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_light); + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_day); } break; @@ -1068,10 +1089,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { customUserAgentPreference.setEnabled(false); // Set the custom user agent preference icon according to the theme. - if (darkTheme) { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_night); } else { - customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_light); + customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_day); } } break; @@ -1084,16 +1105,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "incognito_mode": // Update the icon. if (sharedPreferences.getBoolean("incognito_mode", false)) { - if (darkTheme) { - incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_night); } else { - incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_light); + incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_day); } } else { - if (darkTheme) { - incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_night); } else { - incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_light); + incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_day); } } break; @@ -1101,16 +1122,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "do_not_track": // Update the icon. if (sharedPreferences.getBoolean("do_not_track", false)) { - if (darkTheme) { - doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_night); } else { - doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_light); + doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_day); } } else { - if (darkTheme) { - doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_night); } else { - doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_light); + doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_day); } } @@ -1119,16 +1140,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "allow_screenshots": // Update the icon. if (sharedPreferences.getBoolean("allow_screenshots", false)) { - if (darkTheme) { - allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_night); } else { - allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_light); + allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_day); } } else { - if (darkTheme) { - allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_night); } else { - allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_light); + allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_day); } } @@ -1160,16 +1181,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "easylist": // Update the icon. if (sharedPreferences.getBoolean("easylist", true)) { - if (darkTheme) { - easyListPreference.setIcon(R.drawable.block_ads_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyListPreference.setIcon(R.drawable.block_ads_enabled_night); } else { - easyListPreference.setIcon(R.drawable.block_ads_enabled_light); + easyListPreference.setIcon(R.drawable.block_ads_enabled_day); } } else { - if (darkTheme) { - easyListPreference.setIcon(R.drawable.block_ads_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyListPreference.setIcon(R.drawable.block_ads_disabled_night); } else { - easyListPreference.setIcon(R.drawable.block_ads_disabled_light); + easyListPreference.setIcon(R.drawable.block_ads_disabled_day); } } break; @@ -1177,16 +1198,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "easyprivacy": // Update the icon. if (sharedPreferences.getBoolean("easyprivacy", true)) { - if (darkTheme) { - easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_night); } else { - easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light); + easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_day); } } else { - if (darkTheme) { - easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_night); } else { - easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light); + easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_day); } } break; @@ -1197,39 +1218,39 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the Fanboy icons. if (currentFanboyAnnoyanceList) { // Fanboy's annoyance list is enabled. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Update the Fanboy's annoyance list icon. - fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_dark); + fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_night); // Update the Fanboy's social blocking list icon. - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_dark); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_night); } else { // Update the Fanboy's annoyance list icon. - fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_light); + fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_day); // Update the Fanboy's social blocking list icon. - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_light); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_day); } } else { // Fanboy's annoyance list is disabled. - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Update the Fanboy's annoyance list icon. - fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_dark); + fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_night); // Update the Fanboy's social blocking list icon. if (currentFanboySocialBlockingList) { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_dark); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_night); } else { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_dark); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_night); } } else { // Update the Fanboy's annoyance list icon. - fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_light); + fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_day); // Update the Fanboy's social blocking list icon. if (currentFanboySocialBlockingList) { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_light); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_day); } else { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_light); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_day); } } } @@ -1241,16 +1262,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "fanboys_social_blocking_list": // Update the icon. if (sharedPreferences.getBoolean("fanboys_social_blocking_list", true)) { - if (darkTheme) { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_night); } else { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_light); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_day); } } else { - if (darkTheme) { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_night); } else { - fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_light); + fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_day); } } break; @@ -1258,16 +1279,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "ultralist": // Update the icon. if (sharedPreferences.getBoolean("ultralist", true)) { - if (darkTheme) { - ultraListPreference.setIcon(R.drawable.block_ads_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraListPreference.setIcon(R.drawable.block_ads_enabled_night); } else { - ultraListPreference.setIcon(R.drawable.block_ads_enabled_light); + ultraListPreference.setIcon(R.drawable.block_ads_enabled_day); } } else { - if (darkTheme) { - ultraListPreference.setIcon(R.drawable.block_ads_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraListPreference.setIcon(R.drawable.block_ads_disabled_night); } else { - ultraListPreference.setIcon(R.drawable.block_ads_disabled_light); + ultraListPreference.setIcon(R.drawable.block_ads_disabled_day); } } break; @@ -1275,16 +1296,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "ultraprivacy": // Update the icon. if (sharedPreferences.getBoolean("ultraprivacy", true)) { - if (darkTheme) { - ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_night); } else { - ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light); + ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_day); } } else { - if (darkTheme) { - ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_night); } else { - ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light); + ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_day); } } break; @@ -1292,16 +1313,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "block_all_third_party_requests": // Update the icon. if (sharedPreferences.getBoolean("block_all_third_party_requests", false)) { - if (darkTheme) { - blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_night); } else { - blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_light); + blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_day); } } else { - if (darkTheme) { - blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_night); } else { - blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_light); + blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_day); } } break; @@ -1309,16 +1330,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "google_analytics": // Update the icon. if (sharedPreferences.getBoolean("google_analytics", true)) { - if (darkTheme) { - googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_night); } else { - googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_light); + googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_day); } } else { - if (darkTheme) { - googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_night); } else { - googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_light); + googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_day); } } break; @@ -1326,16 +1347,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "facebook_click_ids": // Update the icon. if (sharedPreferences.getBoolean("facebook_click_ids", true)) { - if (darkTheme) { - facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_night); } else { - facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_light); + facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_day); } } else { - if (darkTheme) { - facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_night); } else { - facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_light); + facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_day); } } break; @@ -1343,16 +1364,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "twitter_amp_redirects": // Update the icon. if (sharedPreferences.getBoolean("twitter_amp_redirects", true)) { - if (darkTheme) { - twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_night); } else { - twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_light); + twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_day); } } else { - if (darkTheme) { - twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_night); } else { - twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_light); + twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_day); } } break; @@ -1370,10 +1391,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { searchCustomURLPreference.setEnabled(true); // Set the `searchCustomURLPreference` according to the theme. - if (darkTheme) { - searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_night); } else { - searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_light); + searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_day); } } else { // `Custom URL` is not selected. // Set the summary text to `newSearchString`. @@ -1383,10 +1404,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { searchCustomURLPreference.setEnabled(false); // Set the `searchCustomURLPreference` according to the theme. - if (darkTheme) { - searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_night); } else { - searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_light); + searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_day); } } break; @@ -1428,39 +1449,39 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the icons. if (currentProxyString.equals("None")) { // Proxying is disabled. - if (darkTheme) { // Dark theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Dark theme. // Set the main proxy icon to be disabled - proxyPreference.setIcon(R.drawable.proxy_disabled_dark); + proxyPreference.setIcon(R.drawable.proxy_disabled_night); // Set the custom proxy URL icon to be ghosted. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_dark); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_night); } else { // Light theme. // Set the main proxy icon to be disabled. - proxyPreference.setIcon(R.drawable.proxy_disabled_light); + proxyPreference.setIcon(R.drawable.proxy_disabled_day); // Set the custom proxy URL icon to be ghosted. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_light); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_day); } } else { // Proxying is enabled. - if (darkTheme) { // Dark theme. + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Dark theme. // Set the main proxy icon to be enabled. - proxyPreference.setIcon(R.drawable.proxy_enabled_dark); + proxyPreference.setIcon(R.drawable.proxy_enabled_night); /// Set the custom proxy URL icon according to its status. if (proxyCustomUrlPreference.isEnabled()) { // Custom proxy is enabled. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_dark); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_night); } else { // Custom proxy is disabled. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_dark); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_night); } } else { // Light theme. // Set the main proxy icon to be enabled. - proxyPreference.setIcon(R.drawable.proxy_enabled_light); + proxyPreference.setIcon(R.drawable.proxy_enabled_day); // Set the custom proxy URL icon according to its status. if (proxyCustomUrlPreference.isEnabled()) { // Custom proxy is enabled. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_light); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_day); } else { // Custom proxy is disabled. - proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_light); + proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_day); } } } @@ -1474,36 +1495,36 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "full_screen_browsing_mode": if (sharedPreferences.getBoolean("full_screen_browsing_mode", false)) { // Full screen browsing is enabled. // Set the full screen browsing mode preference icon according to the theme. - if (darkTheme) { - fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_night); } else { - fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_light); + fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_day); } // Set the hide app bar preference icon. if (sharedPreferences.getBoolean("hide_app_bar", true)) { // Hide app bar is enabled. // Set the icon according to the theme. - if (darkTheme) { - hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_night); } else { - hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_light); + hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_day); } } else { // Hide app bar is disabled. // Set the icon according to the theme. - if (darkTheme) { - hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_night); } else { - hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_light); + hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_day); } } } else { // Full screen browsing is disabled. // Update the icons according to the theme. - if (darkTheme) { - fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_dark); - hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_night); + hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_night); } else { - fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_light); - hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_light); + fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_day); + hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_day); } } break; @@ -1512,17 +1533,17 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the icon. if (sharedPreferences.getBoolean("hide_app_bar", true)) { // Hide app bar is enabled. // Set the icon according to the theme. - if (darkTheme) { - hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_night); } else { - hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_light); + hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_day); } } else { // Hide app bar is disabled. // Set the icon according to the theme. - if (darkTheme) { - hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_night); } else { - hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_light); + hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_day); } } break; @@ -1539,10 +1560,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the `clearEverythingPreference` icon. if (newClearEverythingBoolean) { - if (darkTheme) { - clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_night); } else { - clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_light); + clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_day); } } else { clearEverythingPreference.setIcon(R.drawable.clear_everything_disabled); @@ -1550,10 +1571,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the `clearCookiesPreference` icon. if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_cookies", true)) { - if (darkTheme) { - clearCookiesPreference.setIcon(R.drawable.cookies_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearCookiesPreference.setIcon(R.drawable.cookies_cleared_night); } else { - clearCookiesPreference.setIcon(R.drawable.cookies_cleared_light); + clearCookiesPreference.setIcon(R.drawable.cookies_cleared_day); } } else { clearCookiesPreference.setIcon(R.drawable.cookies_warning); @@ -1561,10 +1582,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the `clearDomStoragePreference` icon. if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_dom_storage", true)) { - if (darkTheme) { - clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_night); } else { - clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_light); + clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_day); } } else { clearDomStoragePreference.setIcon(R.drawable.dom_storage_warning); @@ -1573,10 +1594,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the clear form data preference icon if the API < 26. if (Build.VERSION.SDK_INT < 26) { if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_form_data", true)) { - if (darkTheme) { - clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearFormDataPreference.setIcon(R.drawable.form_data_cleared_night); } else { - clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light); + clearFormDataPreference.setIcon(R.drawable.form_data_cleared_day); } } else { clearFormDataPreference.setIcon(R.drawable.form_data_warning); @@ -1585,10 +1606,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the `clearCachePreference` icon. if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_cache", true)) { - if (darkTheme) { - clearCachePreference.setIcon(R.drawable.cache_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearCachePreference.setIcon(R.drawable.cache_cleared_night); } else { - clearCachePreference.setIcon(R.drawable.cache_cleared_light); + clearCachePreference.setIcon(R.drawable.cache_cleared_day); } } else { clearCachePreference.setIcon(R.drawable.cache_warning); @@ -1598,10 +1619,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "clear_cookies": // Update the icon. if (sharedPreferences.getBoolean("clear_cookies", true)) { - if (darkTheme) { - clearCookiesPreference.setIcon(R.drawable.cookies_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearCookiesPreference.setIcon(R.drawable.cookies_cleared_night); } else { - clearCookiesPreference.setIcon(R.drawable.cookies_cleared_light); + clearCookiesPreference.setIcon(R.drawable.cookies_cleared_day); } } else { clearCookiesPreference.setIcon(R.drawable.cookies_warning); @@ -1611,10 +1632,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "clear_dom_storage": // Update the icon. if (sharedPreferences.getBoolean("clear_dom_storage", true)) { - if (darkTheme) { - clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_night); } else { - clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_light); + clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_day); } } else { clearDomStoragePreference.setIcon(R.drawable.dom_storage_warning); @@ -1625,10 +1646,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "clear_form_data": // Update the icon. if (sharedPreferences.getBoolean("clear_form_data", true)) { - if (darkTheme) { - clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearFormDataPreference.setIcon(R.drawable.form_data_cleared_night); } else { - clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light); + clearFormDataPreference.setIcon(R.drawable.form_data_cleared_day); } } else { clearFormDataPreference.setIcon(R.drawable.form_data_warning); @@ -1638,10 +1659,10 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "clear_cache": // Update the icon. if (sharedPreferences.getBoolean("clear_cache", true)) { - if (darkTheme) { - clearCachePreference.setIcon(R.drawable.cache_cleared_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + clearCachePreference.setIcon(R.drawable.cache_cleared_night); } else { - clearCachePreference.setIcon(R.drawable.cache_cleared_light); + clearCachePreference.setIcon(R.drawable.cache_cleared_day); } } else { clearCachePreference.setIcon(R.drawable.cache_warning); @@ -1674,16 +1695,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the download custom location icon. if (downloadCustomLocationPreference.isEnabled()) { - if (darkTheme) { - downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_night); } else { - downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_light); + downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_day); } } else { - if (darkTheme) { - downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_night); } else { - downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_light); + downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_day); } } break; @@ -1701,13 +1722,13 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "open_intents_in_new_tab": // Update the icon. if (sharedPreferences.getBoolean("open_intents_in_new_tab", true)) { - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_dark); } else { openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_light); } } else { - if (darkTheme) { + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_dark); } else { openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_light); @@ -1718,16 +1739,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "swipe_to_refresh": // Update the icon. if (sharedPreferences.getBoolean("swipe_to_refresh", true)) { - if (darkTheme) { - swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_night); } else { - swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_light); + swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_day); } } else { - if (darkTheme) { - swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_night); } else { - swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_light); + swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_day); } } break; @@ -1735,16 +1756,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "scroll_app_bar": // Update the icon. if (sharedPreferences.getBoolean("scroll_app_bar", true)) { - if (darkTheme) { - scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_night); } else { - scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_light); + scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_day); } } else { - if (darkTheme) { - scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_night); } else { - scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_light); + scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_day); } } break; @@ -1752,51 +1773,53 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "display_additional_app_bar_icons": // Update the icon. if (sharedPreferences.getBoolean("display_additional_app_bar_icons", false)) { - if (darkTheme) { - displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_night); } else { - displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_light); + displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_day); } } else { - if (darkTheme) { - displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_night); } else { - displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_light); + displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_day); } } break; - case "dark_theme": - // Update the icon. - if (sharedPreferences.getBoolean("dark_theme", false)) { - darkThemePreference.setIcon(R.drawable.theme_dark); - } else { - darkThemePreference.setIcon(R.drawable.theme_light); + case "app_theme": + // Get the new theme. + String newAppTheme = sharedPreferences.getString("app_theme", getString(R.string.app_theme_default_value)); + + // Update the system according to the new theme. A switch statement cannot be used because the theme entry values string array is not a compile time constant. + if (newAppTheme.equals(appThemeEntryValuesStringArray[1])) { // The light theme is selected. + // Update the theme preference summary text. + appThemePreference.setSummary(appThemeEntriesStringArray[1]); + + // Apply the new theme. + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + } else if (newAppTheme.equals(appThemeEntryValuesStringArray[2])) { // The dark theme is selected. + // Update the theme preference summary text. + appThemePreference.setSummary(appThemeEntriesStringArray[2]); + + // Apply the new theme. + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + } else { // The system default theme is selected. + // Update the theme preference summary text. + appThemePreference.setSummary(appThemeEntriesStringArray[0]); + + // Apply the new theme. + if (Build.VERSION.SDK_INT >= 28) { // The system default theme is supported. + // Follow the system default theme. + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); + } else {// The system default theme is not supported. + // Follow the battery saver mode. + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY); + } } - // Create an intent to restart Privacy Browser. - Intent changeThemeRestartIntent = getActivity().getParentActivityIntent(); - - // Assert that the intent is not null to remove the lint error below. - assert changeThemeRestartIntent != null; - - // `Intent.FLAG_ACTIVITY_CLEAR_TASK` removes all activities from the stack. It requires `Intent.FLAG_ACTIVITY_NEW_TASK`. - changeThemeRestartIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); - - // Create a handler to restart the activity. - Handler changeThemeRestartHandler = new Handler(); - - // Create a runnable to restart the activity. - Runnable changeThemeRestartRunnable = () -> { - // Restart the activity. - startActivity(changeThemeRestartIntent); - - // Kill this instance of Privacy Browser. Otherwise, the app exhibits sporadic behavior after the restart. - System.exit(0); - }; - - // Restart the activity after 150 milliseconds, so that the app has enough time to save the change to the preference. - changeThemeRestartHandler.postDelayed(changeThemeRestartRunnable, 150); + // Update the current theme status. + currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; break; case "night_mode": @@ -1806,16 +1829,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { // Update the icon. if (currentNightModeBoolean) { - if (darkTheme) { - nightModePreference.setIcon(R.drawable.night_mode_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModePreference.setIcon(R.drawable.night_mode_enabled_night); } else { - nightModePreference.setIcon(R.drawable.night_mode_enabled_light); + nightModePreference.setIcon(R.drawable.night_mode_enabled_day); } } else { - if (darkTheme) { - nightModePreference.setIcon(R.drawable.night_mode_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + nightModePreference.setIcon(R.drawable.night_mode_disabled_night); } else { - nightModePreference.setIcon(R.drawable.night_mode_disabled_light); + nightModePreference.setIcon(R.drawable.night_mode_disabled_day); } } @@ -1835,17 +1858,17 @@ public class SettingsFragment extends PreferenceFragmentCompat { if (sharedPreferences.getBoolean("dom_storage", false)) { // DOM storage is enabled. domStoragePreference.setIcon(R.drawable.dom_storage_enabled); } else { // DOM storage is disabled. - if (darkTheme) { - domStoragePreference.setIcon(R.drawable.dom_storage_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStoragePreference.setIcon(R.drawable.dom_storage_disabled_night); } else { - domStoragePreference.setIcon(R.drawable.dom_storage_disabled_light); + domStoragePreference.setIcon(R.drawable.dom_storage_disabled_day); } } } else { // The preference is disabled. The icon should be ghosted. - if (darkTheme) { - domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_night); } else { - domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_light); + domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_day); } } break; @@ -1853,16 +1876,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "wide_viewport": // Update the icon. if (sharedPreferences.getBoolean("wide_viewport", true)) { - if (darkTheme) { - wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_night); } else { - wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_light); + wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_day); } } else { - if (darkTheme) { - wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_night); } else { - wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_light); + wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_day); } } break; @@ -1870,16 +1893,16 @@ public class SettingsFragment extends PreferenceFragmentCompat { case "display_webpage_images": // Update the icon. if (sharedPreferences.getBoolean("display_webpage_images", true)) { - if (darkTheme) { - displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_night); } else { - displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_light); + displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_day); } } else { - if (darkTheme) { - displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_dark); + if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { + displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_night); } else { - displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_light); + displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_day); } } break; diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java index 74b4e510..6815258a 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java @@ -39,7 +39,7 @@ public class ImportExportDatabaseHelper { public static final String EXPORT_SUCCESSFUL = "Export Successful"; public static final String IMPORT_SUCCESSFUL = "Import Successful"; - private static final int SCHEMA_VERSION = 10; + private static final int SCHEMA_VERSION = 11; private static final String PREFERENCES_TABLE = "preferences"; // The preferences constants. @@ -83,7 +83,7 @@ public class ImportExportDatabaseHelper { private static final String SWIPE_TO_REFRESH = "swipe_to_refresh"; private static final String SCROLL_APP_BAR = "scroll_app_bar"; private static final String DISPLAY_ADDITIONAL_APP_BAR_ICONS = "display_additional_app_bar_icons"; - private static final String DARK_THEME = "dark_theme"; + private static final String APP_THEME = "app_theme"; private static final String NIGHT_MODE = "night_mode"; private static final String WIDE_VIEWPORT = "wide_viewport"; private static final String DISPLAY_WEBPAGE_IMAGES = "display_webpage_images"; @@ -238,7 +238,7 @@ public class ImportExportDatabaseHelper { SWIPE_TO_REFRESH + " BOOLEAN, " + SCROLL_APP_BAR + " BOOLEAN, " + DISPLAY_ADDITIONAL_APP_BAR_ICONS + " BOOLEAN, " + - DARK_THEME + " BOOLEAN, " + + APP_THEME + " TEXT, " + NIGHT_MODE + " BOOLEAN, " + WIDE_VIEWPORT + " BOOLEAN, " + DISPLAY_WEBPAGE_IMAGES + " BOOLEAN)"; @@ -290,7 +290,7 @@ public class ImportExportDatabaseHelper { preferencesContentValues.put(SWIPE_TO_REFRESH, sharedPreferences.getBoolean(SWIPE_TO_REFRESH, true)); preferencesContentValues.put(SCROLL_APP_BAR, sharedPreferences.getBoolean(SCROLL_APP_BAR, true)); preferencesContentValues.put(DISPLAY_ADDITIONAL_APP_BAR_ICONS, sharedPreferences.getBoolean(DISPLAY_ADDITIONAL_APP_BAR_ICONS, false)); - preferencesContentValues.put(DARK_THEME, sharedPreferences.getBoolean(DARK_THEME, false)); + preferencesContentValues.put(APP_THEME, sharedPreferences.getString(APP_THEME, context.getString(R.string.app_theme_default_value))); preferencesContentValues.put(NIGHT_MODE, sharedPreferences.getBoolean(NIGHT_MODE, false)); preferencesContentValues.put(WIDE_VIEWPORT, sharedPreferences.getBoolean(WIDE_VIEWPORT, true)); preferencesContentValues.put(DISPLAY_WEBPAGE_IMAGES, sharedPreferences.getBoolean(DISPLAY_WEBPAGE_IMAGES, true)); @@ -540,6 +540,32 @@ public class ImportExportDatabaseHelper { // Populate the preferences table with the current download location values. importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + DOWNLOAD_LOCATION + " = '" + downloadLocation + "'"); importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + DOWNLOAD_CUSTOM_LOCATION + " = '" + downloadCustomLocation + "'"); + + // Upgrade from schema version 10. + case 10: + // Add the app theme column to the preferences table. + importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + APP_THEME + " TEXT"); + + // Get a cursor for the dark theme preference. + Cursor darkThemePreferencesCursor = importDatabase.rawQuery("SELECT dark_theme FROM " + PREFERENCES_TABLE, null); + + // Move to the first preference. + darkThemePreferencesCursor.moveToFirst(); + + // Get the old dark theme value, which is in column 0. + int darkTheme = darkThemePreferencesCursor.getInt(0); + + // Close the dark theme preference cursor. + darkThemePreferencesCursor.close(); + + // Populate the app theme according to the old dark theme preference. + if (darkTheme == 0) { // A light theme was selected. + // Set the app theme to be the system default. + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + APP_THEME + " = 'System default'"); + } else { // A dark theme was selected. + // Set the app theme to be dark. + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + APP_THEME + " = 'Dark'"); + } } } @@ -646,7 +672,7 @@ public class ImportExportDatabaseHelper { bookmarksDatabaseHelper.close(); - // Get a cursor for the bookmarks table. + // Get a cursor for the preferences table. Cursor importPreferencesCursor = importDatabase.rawQuery("SELECT * FROM " + PREFERENCES_TABLE, null); // Move to the first preference. @@ -695,7 +721,7 @@ public class ImportExportDatabaseHelper { .putBoolean(SWIPE_TO_REFRESH, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(SWIPE_TO_REFRESH)) == 1) .putBoolean(SCROLL_APP_BAR, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(SCROLL_APP_BAR)) == 1) .putBoolean(DISPLAY_ADDITIONAL_APP_BAR_ICONS, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(DISPLAY_ADDITIONAL_APP_BAR_ICONS)) == 1) - .putBoolean(DARK_THEME, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(DARK_THEME)) == 1) + .putString(APP_THEME, importPreferencesCursor.getString(importPreferencesCursor.getColumnIndex(APP_THEME))) .putBoolean(NIGHT_MODE, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(NIGHT_MODE)) == 1) .putBoolean(WIDE_VIEWPORT, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(WIDE_VIEWPORT)) == 1) .putBoolean(DISPLAY_WEBPAGE_IMAGES, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(DISPLAY_WEBPAGE_IMAGES)) == 1) diff --git a/app/src/main/res/color/appbar_spinner_color_selector_dark.xml b/app/src/main/res/color/appbar_spinner_color_selector_dark.xml deleted file mode 100644 index f58c7830..00000000 --- a/app/src/main/res/color/appbar_spinner_color_selector_dark.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/color/button_background_color_selector_light.xml b/app/src/main/res/color/button_background_color_selector_day.xml similarity index 88% rename from app/src/main/res/color/button_background_color_selector_light.xml rename to app/src/main/res/color/button_background_color_selector_day.xml index 8049c091..b75a2e01 100644 --- a/app/src/main/res/color/button_background_color_selector_light.xml +++ b/app/src/main/res/color/button_background_color_selector_day.xml @@ -1,7 +1,7 @@ + diff --git a/app/src/main/res/color/button_background_color_selector_dark.xml b/app/src/main/res/color/button_background_color_selector_night.xml similarity index 88% rename from app/src/main/res/color/button_background_color_selector_dark.xml rename to app/src/main/res/color/button_background_color_selector_night.xml index 85b04231..b32fab70 100644 --- a/app/src/main/res/color/button_background_color_selector_dark.xml +++ b/app/src/main/res/color/button_background_color_selector_night.xml @@ -1,7 +1,7 @@ + diff --git a/app/src/main/res/color/button_text_color_selector_light.xml b/app/src/main/res/color/button_text_color_selector_day.xml similarity index 88% rename from app/src/main/res/color/button_text_color_selector_light.xml rename to app/src/main/res/color/button_text_color_selector_day.xml index 74c6c5bf..d71ae2d5 100644 --- a/app/src/main/res/color/button_text_color_selector_light.xml +++ b/app/src/main/res/color/button_text_color_selector_day.xml @@ -1,7 +1,7 @@ + diff --git a/app/src/main/res/color/appbar_spinner_color_selector_light.xml b/app/src/main/res/color/button_text_color_selector_night.xml similarity index 76% rename from app/src/main/res/color/appbar_spinner_color_selector_light.xml rename to app/src/main/res/color/button_text_color_selector_night.xml index 03ac9ea0..a0a4a27c 100644 --- a/app/src/main/res/color/appbar_spinner_color_selector_light.xml +++ b/app/src/main/res/color/button_text_color_selector_night.xml @@ -1,7 +1,7 @@ - + - - + + \ No newline at end of file diff --git a/app/src/main/res/color/button_text_color_selector_dark.xml b/app/src/main/res/color/checked_text_color_selector.xml similarity index 80% rename from app/src/main/res/color/button_text_color_selector_dark.xml rename to app/src/main/res/color/checked_text_color_selector.xml index 090ae067..52bbd83e 100644 --- a/app/src/main/res/color/button_text_color_selector_dark.xml +++ b/app/src/main/res/color/checked_text_color_selector.xml @@ -1,7 +1,7 @@ + - + \ No newline at end of file diff --git a/app/src/main/res/drawable/about_light.xml b/app/src/main/res/drawable/about_day.xml similarity index 92% rename from app/src/main/res/drawable/about_light.xml rename to app/src/main/res/drawable/about_day.xml index 401cdcb6..7a629334 100644 --- a/app/src/main/res/drawable/about_light.xml +++ b/app/src/main/res/drawable/about_day.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/about_dark.xml b/app/src/main/res/drawable/about_night.xml similarity index 92% rename from app/src/main/res/drawable/about_dark.xml rename to app/src/main/res/drawable/about_night.xml index acc4180d..cdba373c 100644 --- a/app/src/main/res/drawable/about_dark.xml +++ b/app/src/main/res/drawable/about_night.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/add_light.xml b/app/src/main/res/drawable/add_day.xml similarity index 90% rename from app/src/main/res/drawable/add_light.xml rename to app/src/main/res/drawable/add_day.xml index 5ecf8d39..87921013 100644 --- a/app/src/main/res/drawable/add_light.xml +++ b/app/src/main/res/drawable/add_day.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/add_dark.xml b/app/src/main/res/drawable/add_night.xml similarity index 90% rename from app/src/main/res/drawable/add_dark.xml rename to app/src/main/res/drawable/add_night.xml index 15485cbc..38b6ddae 100644 --- a/app/src/main/res/drawable/add_dark.xml +++ b/app/src/main/res/drawable/add_night.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/allow_screenshots_disabled_light.xml b/app/src/main/res/drawable/allow_screenshots_disabled_day.xml similarity index 74% rename from app/src/main/res/drawable/allow_screenshots_disabled_light.xml rename to app/src/main/res/drawable/allow_screenshots_disabled_day.xml index 67ff615f..838e4cef 100644 --- a/app/src/main/res/drawable/allow_screenshots_disabled_light.xml +++ b/app/src/main/res/drawable/allow_screenshots_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/allow_screenshots_disabled_dark.xml b/app/src/main/res/drawable/allow_screenshots_disabled_night.xml similarity index 74% rename from app/src/main/res/drawable/allow_screenshots_disabled_dark.xml rename to app/src/main/res/drawable/allow_screenshots_disabled_night.xml index b320afb2..fd4d9f1e 100644 --- a/app/src/main/res/drawable/allow_screenshots_disabled_dark.xml +++ b/app/src/main/res/drawable/allow_screenshots_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/allow_screenshots_enabled_light.xml b/app/src/main/res/drawable/allow_screenshots_enabled_day.xml similarity index 74% rename from app/src/main/res/drawable/allow_screenshots_enabled_light.xml rename to app/src/main/res/drawable/allow_screenshots_enabled_day.xml index 4e481be3..9840bb82 100644 --- a/app/src/main/res/drawable/allow_screenshots_enabled_light.xml +++ b/app/src/main/res/drawable/allow_screenshots_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/allow_screenshots_enabled_dark.xml b/app/src/main/res/drawable/allow_screenshots_enabled_night.xml similarity index 74% rename from app/src/main/res/drawable/allow_screenshots_enabled_dark.xml rename to app/src/main/res/drawable/allow_screenshots_enabled_night.xml index d4310c66..de024260 100644 --- a/app/src/main/res/drawable/allow_screenshots_enabled_dark.xml +++ b/app/src/main/res/drawable/allow_screenshots_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/app_bar_disabled_light.xml b/app/src/main/res/drawable/app_bar_disabled_day.xml similarity index 73% rename from app/src/main/res/drawable/app_bar_disabled_light.xml rename to app/src/main/res/drawable/app_bar_disabled_day.xml index aefbca92..3de4608f 100644 --- a/app/src/main/res/drawable/app_bar_disabled_light.xml +++ b/app/src/main/res/drawable/app_bar_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/app_bar_disabled_dark.xml b/app/src/main/res/drawable/app_bar_disabled_night.xml similarity index 72% rename from app/src/main/res/drawable/app_bar_disabled_dark.xml rename to app/src/main/res/drawable/app_bar_disabled_night.xml index 33a6f072..cfd29e1d 100644 --- a/app/src/main/res/drawable/app_bar_disabled_dark.xml +++ b/app/src/main/res/drawable/app_bar_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/app_bar_enabled_light.xml b/app/src/main/res/drawable/app_bar_enabled_day.xml similarity index 62% rename from app/src/main/res/drawable/app_bar_enabled_light.xml rename to app/src/main/res/drawable/app_bar_enabled_day.xml index 88b81f82..ae11037d 100644 --- a/app/src/main/res/drawable/app_bar_enabled_light.xml +++ b/app/src/main/res/drawable/app_bar_enabled_day.xml @@ -1,12 +1,12 @@ - + + android:width="24dp" + android:viewportHeight="24.0" + android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/app_bar_enabled_dark.xml b/app/src/main/res/drawable/app_bar_enabled_night.xml similarity index 62% rename from app/src/main/res/drawable/app_bar_enabled_dark.xml rename to app/src/main/res/drawable/app_bar_enabled_night.xml index 6d037b41..00b14af7 100644 --- a/app/src/main/res/drawable/app_bar_enabled_dark.xml +++ b/app/src/main/res/drawable/app_bar_enabled_night.xml @@ -1,12 +1,12 @@ - + + android:width="24dp" + android:viewportHeight="24.0" + android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/app_bar_ghosted_light.xml b/app/src/main/res/drawable/app_bar_ghosted_day.xml similarity index 72% rename from app/src/main/res/drawable/app_bar_ghosted_light.xml rename to app/src/main/res/drawable/app_bar_ghosted_day.xml index 163c9e1f..83a9ec70 100644 --- a/app/src/main/res/drawable/app_bar_ghosted_light.xml +++ b/app/src/main/res/drawable/app_bar_ghosted_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/app_bar_ghosted_dark.xml b/app/src/main/res/drawable/app_bar_ghosted_night.xml similarity index 72% rename from app/src/main/res/drawable/app_bar_ghosted_dark.xml rename to app/src/main/res/drawable/app_bar_ghosted_night.xml index dce17b04..578362a5 100644 --- a/app/src/main/res/drawable/app_bar_ghosted_dark.xml +++ b/app/src/main/res/drawable/app_bar_ghosted_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/back.xml b/app/src/main/res/drawable/back.xml index 85c235aa..c4f0873f 100644 --- a/app/src/main/res/drawable/back.xml +++ b/app/src/main/res/drawable/back.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/block_ads_disabled_light.xml b/app/src/main/res/drawable/block_ads_disabled_day.xml similarity index 76% rename from app/src/main/res/drawable/block_ads_disabled_light.xml rename to app/src/main/res/drawable/block_ads_disabled_day.xml index 3d9f61eb..106faa45 100644 --- a/app/src/main/res/drawable/block_ads_disabled_light.xml +++ b/app/src/main/res/drawable/block_ads_disabled_day.xml @@ -1,11 +1,11 @@ - + - + diff --git a/app/src/main/res/drawable/block_ads_disabled_dark.xml b/app/src/main/res/drawable/block_ads_disabled_night.xml similarity index 76% rename from app/src/main/res/drawable/block_ads_disabled_dark.xml rename to app/src/main/res/drawable/block_ads_disabled_night.xml index df5a95bc..76e679b0 100644 --- a/app/src/main/res/drawable/block_ads_disabled_dark.xml +++ b/app/src/main/res/drawable/block_ads_disabled_night.xml @@ -1,11 +1,11 @@ - + - + diff --git a/app/src/main/res/drawable/block_ads_enabled_light.xml b/app/src/main/res/drawable/block_ads_enabled_day.xml similarity index 76% rename from app/src/main/res/drawable/block_ads_enabled_light.xml rename to app/src/main/res/drawable/block_ads_enabled_day.xml index 81816b9e..4229305d 100644 --- a/app/src/main/res/drawable/block_ads_enabled_light.xml +++ b/app/src/main/res/drawable/block_ads_enabled_day.xml @@ -1,11 +1,11 @@ - + - + diff --git a/app/src/main/res/drawable/block_ads_enabled_dark.xml b/app/src/main/res/drawable/block_ads_enabled_night.xml similarity index 76% rename from app/src/main/res/drawable/block_ads_enabled_dark.xml rename to app/src/main/res/drawable/block_ads_enabled_night.xml index e9307371..7fcaca2e 100644 --- a/app/src/main/res/drawable/block_ads_enabled_dark.xml +++ b/app/src/main/res/drawable/block_ads_enabled_night.xml @@ -1,11 +1,11 @@ - + - + diff --git a/app/src/main/res/drawable/block_all_third_party_requests_disabled_light.xml b/app/src/main/res/drawable/block_all_third_party_requests_disabled_day.xml similarity index 73% rename from app/src/main/res/drawable/block_all_third_party_requests_disabled_light.xml rename to app/src/main/res/drawable/block_all_third_party_requests_disabled_day.xml index 21db2f97..4c681e53 100644 --- a/app/src/main/res/drawable/block_all_third_party_requests_disabled_light.xml +++ b/app/src/main/res/drawable/block_all_third_party_requests_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/block_all_third_party_requests_disabled_dark.xml b/app/src/main/res/drawable/block_all_third_party_requests_disabled_night.xml similarity index 73% rename from app/src/main/res/drawable/block_all_third_party_requests_disabled_dark.xml rename to app/src/main/res/drawable/block_all_third_party_requests_disabled_night.xml index 7112e75c..e9974959 100644 --- a/app/src/main/res/drawable/block_all_third_party_requests_disabled_dark.xml +++ b/app/src/main/res/drawable/block_all_third_party_requests_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/block_all_third_party_requests_enabled_light.xml b/app/src/main/res/drawable/block_all_third_party_requests_enabled_day.xml similarity index 73% rename from app/src/main/res/drawable/block_all_third_party_requests_enabled_light.xml rename to app/src/main/res/drawable/block_all_third_party_requests_enabled_day.xml index 2dda9112..11db0600 100644 --- a/app/src/main/res/drawable/block_all_third_party_requests_enabled_light.xml +++ b/app/src/main/res/drawable/block_all_third_party_requests_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/block_all_third_party_requests_enabled_dark.xml b/app/src/main/res/drawable/block_all_third_party_requests_enabled_night.xml similarity index 73% rename from app/src/main/res/drawable/block_all_third_party_requests_enabled_dark.xml rename to app/src/main/res/drawable/block_all_third_party_requests_enabled_night.xml index c5b66784..a2f836f8 100644 --- a/app/src/main/res/drawable/block_all_third_party_requests_enabled_dark.xml +++ b/app/src/main/res/drawable/block_all_third_party_requests_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/block_tracking_disabled_light.xml b/app/src/main/res/drawable/block_tracking_disabled_day.xml similarity index 76% rename from app/src/main/res/drawable/block_tracking_disabled_light.xml rename to app/src/main/res/drawable/block_tracking_disabled_day.xml index 3a363b37..dcaaac4f 100644 --- a/app/src/main/res/drawable/block_tracking_disabled_light.xml +++ b/app/src/main/res/drawable/block_tracking_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/block_tracking_disabled_dark.xml b/app/src/main/res/drawable/block_tracking_disabled_night.xml similarity index 76% rename from app/src/main/res/drawable/block_tracking_disabled_dark.xml rename to app/src/main/res/drawable/block_tracking_disabled_night.xml index eca2e06a..7cbe7390 100644 --- a/app/src/main/res/drawable/block_tracking_disabled_dark.xml +++ b/app/src/main/res/drawable/block_tracking_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/block_tracking_enabled_light.xml b/app/src/main/res/drawable/block_tracking_enabled_day.xml similarity index 76% rename from app/src/main/res/drawable/block_tracking_enabled_light.xml rename to app/src/main/res/drawable/block_tracking_enabled_day.xml index 84681045..26969ba0 100644 --- a/app/src/main/res/drawable/block_tracking_enabled_light.xml +++ b/app/src/main/res/drawable/block_tracking_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/block_tracking_enabled_dark.xml b/app/src/main/res/drawable/block_tracking_enabled_night.xml similarity index 76% rename from app/src/main/res/drawable/block_tracking_enabled_dark.xml rename to app/src/main/res/drawable/block_tracking_enabled_night.xml index 7079243e..ed8d7104 100644 --- a/app/src/main/res/drawable/block_tracking_enabled_dark.xml +++ b/app/src/main/res/drawable/block_tracking_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/bookmarks_light.xml b/app/src/main/res/drawable/bookmarks_day.xml similarity index 78% rename from app/src/main/res/drawable/bookmarks_light.xml rename to app/src/main/res/drawable/bookmarks_day.xml index 732df254..000555df 100644 --- a/app/src/main/res/drawable/bookmarks_light.xml +++ b/app/src/main/res/drawable/bookmarks_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/bookmarks_dark.xml b/app/src/main/res/drawable/bookmarks_night.xml similarity index 78% rename from app/src/main/res/drawable/bookmarks_dark.xml rename to app/src/main/res/drawable/bookmarks_night.xml index 8b191185..3608e8d5 100644 --- a/app/src/main/res/drawable/bookmarks_dark.xml +++ b/app/src/main/res/drawable/bookmarks_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/bug.xml b/app/src/main/res/drawable/bug.xml index c21c2eb6..c2270aa2 100644 --- a/app/src/main/res/drawable/bug.xml +++ b/app/src/main/res/drawable/bug.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cache_cleared_light.xml b/app/src/main/res/drawable/cache_cleared_day.xml similarity index 80% rename from app/src/main/res/drawable/cache_cleared_light.xml rename to app/src/main/res/drawable/cache_cleared_day.xml index 570c57ce..3b8c9a78 100644 --- a/app/src/main/res/drawable/cache_cleared_light.xml +++ b/app/src/main/res/drawable/cache_cleared_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cache_cleared_dark.xml b/app/src/main/res/drawable/cache_cleared_night.xml similarity index 80% rename from app/src/main/res/drawable/cache_cleared_dark.xml rename to app/src/main/res/drawable/cache_cleared_night.xml index 5bf67061..113973e1 100644 --- a/app/src/main/res/drawable/cache_cleared_dark.xml +++ b/app/src/main/res/drawable/cache_cleared_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cache_warning.xml b/app/src/main/res/drawable/cache_warning.xml index 3e237dc3..df3a5c2c 100644 --- a/app/src/main/res/drawable/cache_warning.xml +++ b/app/src/main/res/drawable/cache_warning.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/clear_and_exit.xml b/app/src/main/res/drawable/clear_and_exit.xml index 2894a265..1c64ee9d 100644 --- a/app/src/main/res/drawable/clear_and_exit.xml +++ b/app/src/main/res/drawable/clear_and_exit.xml @@ -12,13 +12,13 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + - + + - + \ No newline at end of file diff --git a/app/src/main/res/drawable/clear_everything_disabled.xml b/app/src/main/res/drawable/clear_everything_disabled.xml index 29acff29..05870616 100644 --- a/app/src/main/res/drawable/clear_everything_disabled.xml +++ b/app/src/main/res/drawable/clear_everything_disabled.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/clear_everything_enabled_light.xml b/app/src/main/res/drawable/clear_everything_enabled_day.xml similarity index 65% rename from app/src/main/res/drawable/clear_everything_enabled_light.xml rename to app/src/main/res/drawable/clear_everything_enabled_day.xml index d4a3af08..e8514cf6 100644 --- a/app/src/main/res/drawable/clear_everything_enabled_light.xml +++ b/app/src/main/res/drawable/clear_everything_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/clear_everything_enabled_dark.xml b/app/src/main/res/drawable/clear_everything_enabled_night.xml similarity index 65% rename from app/src/main/res/drawable/clear_everything_enabled_dark.xml rename to app/src/main/res/drawable/clear_everything_enabled_night.xml index 0153bb81..8858897a 100644 --- a/app/src/main/res/drawable/clear_everything_enabled_dark.xml +++ b/app/src/main/res/drawable/clear_everything_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/clear_dark.xml b/app/src/main/res/drawable/clear_night.xml similarity index 59% rename from app/src/main/res/drawable/clear_dark.xml rename to app/src/main/res/drawable/clear_night.xml index 738b53fd..8912a993 100644 --- a/app/src/main/res/drawable/clear_dark.xml +++ b/app/src/main/res/drawable/clear_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/close_light.xml b/app/src/main/res/drawable/close_day.xml similarity index 69% rename from app/src/main/res/drawable/close_light.xml rename to app/src/main/res/drawable/close_day.xml index a7e07956..50d196f5 100644 --- a/app/src/main/res/drawable/close_light.xml +++ b/app/src/main/res/drawable/close_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/close_dark.xml b/app/src/main/res/drawable/close_night.xml similarity index 69% rename from app/src/main/res/drawable/close_dark.xml rename to app/src/main/res/drawable/close_night.xml index 38a05299..47e515cf 100644 --- a/app/src/main/res/drawable/close_dark.xml +++ b/app/src/main/res/drawable/close_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cookies_cleared_light.xml b/app/src/main/res/drawable/cookies_cleared_day.xml similarity index 80% rename from app/src/main/res/drawable/cookies_cleared_light.xml rename to app/src/main/res/drawable/cookies_cleared_day.xml index 1a14271b..1b400bca 100644 --- a/app/src/main/res/drawable/cookies_cleared_light.xml +++ b/app/src/main/res/drawable/cookies_cleared_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cookies_cleared_dark.xml b/app/src/main/res/drawable/cookies_cleared_night.xml similarity index 80% rename from app/src/main/res/drawable/cookies_cleared_dark.xml rename to app/src/main/res/drawable/cookies_cleared_night.xml index 1d718d4a..1ebbc479 100644 --- a/app/src/main/res/drawable/cookies_cleared_dark.xml +++ b/app/src/main/res/drawable/cookies_cleared_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cookies_disabled_light.xml b/app/src/main/res/drawable/cookies_disabled_day.xml similarity index 80% rename from app/src/main/res/drawable/cookies_disabled_light.xml rename to app/src/main/res/drawable/cookies_disabled_day.xml index 21c326f5..b2c60f2b 100644 --- a/app/src/main/res/drawable/cookies_disabled_light.xml +++ b/app/src/main/res/drawable/cookies_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cookies_disabled_dark.xml b/app/src/main/res/drawable/cookies_disabled_night.xml similarity index 80% rename from app/src/main/res/drawable/cookies_disabled_dark.xml rename to app/src/main/res/drawable/cookies_disabled_night.xml index 850341a3..49eca2f0 100644 --- a/app/src/main/res/drawable/cookies_disabled_dark.xml +++ b/app/src/main/res/drawable/cookies_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cookies_enabled.xml b/app/src/main/res/drawable/cookies_enabled.xml index df39e058..84492441 100644 --- a/app/src/main/res/drawable/cookies_enabled.xml +++ b/app/src/main/res/drawable/cookies_enabled.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cookies_ghosted_light.xml b/app/src/main/res/drawable/cookies_ghosted_day.xml similarity index 80% rename from app/src/main/res/drawable/cookies_ghosted_light.xml rename to app/src/main/res/drawable/cookies_ghosted_day.xml index 0550b697..d427e059 100644 --- a/app/src/main/res/drawable/cookies_ghosted_light.xml +++ b/app/src/main/res/drawable/cookies_ghosted_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cookies_ghosted_dark.xml b/app/src/main/res/drawable/cookies_ghosted_night.xml similarity index 80% rename from app/src/main/res/drawable/cookies_ghosted_dark.xml rename to app/src/main/res/drawable/cookies_ghosted_night.xml index e6c08c11..14c30acc 100644 --- a/app/src/main/res/drawable/cookies_ghosted_dark.xml +++ b/app/src/main/res/drawable/cookies_ghosted_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/cookies_warning.xml b/app/src/main/res/drawable/cookies_warning.xml index 6f497590..4404b3d2 100644 --- a/app/src/main/res/drawable/cookies_warning.xml +++ b/app/src/main/res/drawable/cookies_warning.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/copy_light.xml b/app/src/main/res/drawable/copy_day.xml similarity index 83% rename from app/src/main/res/drawable/copy_light.xml rename to app/src/main/res/drawable/copy_day.xml index 0c33ca1b..22751522 100644 --- a/app/src/main/res/drawable/copy_light.xml +++ b/app/src/main/res/drawable/copy_day.xml @@ -11,8 +11,8 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + \ No newline at end of file diff --git a/app/src/main/res/drawable/copy_enabled_light.xml b/app/src/main/res/drawable/copy_enabled_day.xml similarity index 87% rename from app/src/main/res/drawable/copy_enabled_light.xml rename to app/src/main/res/drawable/copy_enabled_day.xml index 0149278e..32d7b9d4 100644 --- a/app/src/main/res/drawable/copy_enabled_light.xml +++ b/app/src/main/res/drawable/copy_enabled_day.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/copy_enabled_dark.xml b/app/src/main/res/drawable/copy_enabled_night.xml similarity index 87% rename from app/src/main/res/drawable/copy_enabled_dark.xml rename to app/src/main/res/drawable/copy_enabled_night.xml index bd40a055..7a84453d 100644 --- a/app/src/main/res/drawable/copy_enabled_dark.xml +++ b/app/src/main/res/drawable/copy_enabled_night.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/copy_dark.xml b/app/src/main/res/drawable/copy_night.xml similarity index 87% rename from app/src/main/res/drawable/copy_dark.xml rename to app/src/main/res/drawable/copy_night.xml index 50c9da76..f1e7a828 100644 --- a/app/src/main/res/drawable/copy_dark.xml +++ b/app/src/main/res/drawable/copy_night.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/create_bookmark_light.xml b/app/src/main/res/drawable/create_bookmark_day.xml similarity index 72% rename from app/src/main/res/drawable/create_bookmark_light.xml rename to app/src/main/res/drawable/create_bookmark_day.xml index 9038a775..1c40cce2 100644 --- a/app/src/main/res/drawable/create_bookmark_light.xml +++ b/app/src/main/res/drawable/create_bookmark_day.xml @@ -1,4 +1,4 @@ - - + diff --git a/app/src/main/res/drawable/create_bookmark_dark.xml b/app/src/main/res/drawable/create_bookmark_night.xml similarity index 72% rename from app/src/main/res/drawable/create_bookmark_dark.xml rename to app/src/main/res/drawable/create_bookmark_night.xml index 5578e728..64a898e8 100644 --- a/app/src/main/res/drawable/create_bookmark_dark.xml +++ b/app/src/main/res/drawable/create_bookmark_night.xml @@ -1,4 +1,4 @@ - - + diff --git a/app/src/main/res/drawable/create_folder_light.xml b/app/src/main/res/drawable/create_folder_day.xml similarity index 79% rename from app/src/main/res/drawable/create_folder_light.xml rename to app/src/main/res/drawable/create_folder_day.xml index d5a4411c..3512e61c 100644 --- a/app/src/main/res/drawable/create_folder_light.xml +++ b/app/src/main/res/drawable/create_folder_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/create_folder_dark.xml b/app/src/main/res/drawable/create_folder_night.xml similarity index 79% rename from app/src/main/res/drawable/create_folder_dark.xml rename to app/src/main/res/drawable/create_folder_night.xml index b9dbc2de..7b3c91cb 100644 --- a/app/src/main/res/drawable/create_folder_dark.xml +++ b/app/src/main/res/drawable/create_folder_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/custom_user_agent_enabled_light.xml b/app/src/main/res/drawable/custom_user_agent_enabled_day.xml similarity index 88% rename from app/src/main/res/drawable/custom_user_agent_enabled_light.xml rename to app/src/main/res/drawable/custom_user_agent_enabled_day.xml index 9a39a93f..3463bcb3 100644 --- a/app/src/main/res/drawable/custom_user_agent_enabled_light.xml +++ b/app/src/main/res/drawable/custom_user_agent_enabled_day.xml @@ -11,7 +11,7 @@ android:viewportWidth="24.0" tools:ignore="VectorRaster"> - + diff --git a/app/src/main/res/drawable/custom_user_agent_enabled_dark.xml b/app/src/main/res/drawable/custom_user_agent_enabled_night.xml similarity index 88% rename from app/src/main/res/drawable/custom_user_agent_enabled_dark.xml rename to app/src/main/res/drawable/custom_user_agent_enabled_night.xml index c4c04f14..e4076e43 100644 --- a/app/src/main/res/drawable/custom_user_agent_enabled_dark.xml +++ b/app/src/main/res/drawable/custom_user_agent_enabled_night.xml @@ -11,7 +11,7 @@ android:viewportWidth="24.0" tools:ignore="VectorRaster"> - + diff --git a/app/src/main/res/drawable/custom_user_agent_ghosted_light.xml b/app/src/main/res/drawable/custom_user_agent_ghosted_day.xml similarity index 88% rename from app/src/main/res/drawable/custom_user_agent_ghosted_light.xml rename to app/src/main/res/drawable/custom_user_agent_ghosted_day.xml index 808d7f61..6bda8913 100644 --- a/app/src/main/res/drawable/custom_user_agent_ghosted_light.xml +++ b/app/src/main/res/drawable/custom_user_agent_ghosted_day.xml @@ -11,7 +11,7 @@ android:viewportWidth="24.0" tools:ignore="VectorRaster"> - + diff --git a/app/src/main/res/drawable/custom_user_agent_ghosted_dark.xml b/app/src/main/res/drawable/custom_user_agent_ghosted_night.xml similarity index 88% rename from app/src/main/res/drawable/custom_user_agent_ghosted_dark.xml rename to app/src/main/res/drawable/custom_user_agent_ghosted_night.xml index 2e16df62..fe6918cc 100644 --- a/app/src/main/res/drawable/custom_user_agent_ghosted_dark.xml +++ b/app/src/main/res/drawable/custom_user_agent_ghosted_night.xml @@ -11,7 +11,7 @@ android:viewportWidth="24.0" tools:ignore="VectorRaster"> - + diff --git a/app/src/main/res/drawable/delete_blue.xml b/app/src/main/res/drawable/delete_blue.xml deleted file mode 100644 index ff829e86..00000000 --- a/app/src/main/res/drawable/delete_blue.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/delete_day.xml b/app/src/main/res/drawable/delete_day.xml new file mode 100644 index 00000000..6fbf33a5 --- /dev/null +++ b/app/src/main/res/drawable/delete_day.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/app/src/main/res/drawable/delete_disabled.xml b/app/src/main/res/drawable/delete_disabled.xml new file mode 100644 index 00000000..76a9ca24 --- /dev/null +++ b/app/src/main/res/drawable/delete_disabled.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/delete_light.xml b/app/src/main/res/drawable/delete_light.xml deleted file mode 100644 index bd6140e3..00000000 --- a/app/src/main/res/drawable/delete_light.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/app/src/main/res/drawable/delete_dark.xml b/app/src/main/res/drawable/delete_night.xml similarity index 58% rename from app/src/main/res/drawable/delete_dark.xml rename to app/src/main/res/drawable/delete_night.xml index 0953c461..46df6f55 100644 --- a/app/src/main/res/drawable/delete_dark.xml +++ b/app/src/main/res/drawable/delete_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/dom_storage_cleared_light.xml b/app/src/main/res/drawable/dom_storage_cleared_day.xml similarity index 86% rename from app/src/main/res/drawable/dom_storage_cleared_light.xml rename to app/src/main/res/drawable/dom_storage_cleared_day.xml index 117304b9..62db94d0 100644 --- a/app/src/main/res/drawable/dom_storage_cleared_light.xml +++ b/app/src/main/res/drawable/dom_storage_cleared_day.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/dom_storage_cleared_dark.xml b/app/src/main/res/drawable/dom_storage_cleared_night.xml similarity index 86% rename from app/src/main/res/drawable/dom_storage_cleared_dark.xml rename to app/src/main/res/drawable/dom_storage_cleared_night.xml index 1fb6e498..149fcc5b 100644 --- a/app/src/main/res/drawable/dom_storage_cleared_dark.xml +++ b/app/src/main/res/drawable/dom_storage_cleared_night.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/dom_storage_disabled_light.xml b/app/src/main/res/drawable/dom_storage_disabled_day.xml similarity index 86% rename from app/src/main/res/drawable/dom_storage_disabled_light.xml rename to app/src/main/res/drawable/dom_storage_disabled_day.xml index e49b639c..fb26f261 100644 --- a/app/src/main/res/drawable/dom_storage_disabled_light.xml +++ b/app/src/main/res/drawable/dom_storage_disabled_day.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/dom_storage_disabled_dark.xml b/app/src/main/res/drawable/dom_storage_disabled_night.xml similarity index 86% rename from app/src/main/res/drawable/dom_storage_disabled_dark.xml rename to app/src/main/res/drawable/dom_storage_disabled_night.xml index 0e2b0034..f99dba1e 100644 --- a/app/src/main/res/drawable/dom_storage_disabled_dark.xml +++ b/app/src/main/res/drawable/dom_storage_disabled_night.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/dom_storage_enabled.xml b/app/src/main/res/drawable/dom_storage_enabled.xml index bc59cd95..b3d86fbc 100644 --- a/app/src/main/res/drawable/dom_storage_enabled.xml +++ b/app/src/main/res/drawable/dom_storage_enabled.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/dom_storage_ghosted_light.xml b/app/src/main/res/drawable/dom_storage_ghosted_day.xml similarity index 86% rename from app/src/main/res/drawable/dom_storage_ghosted_light.xml rename to app/src/main/res/drawable/dom_storage_ghosted_day.xml index c680a7f1..4bf96175 100644 --- a/app/src/main/res/drawable/dom_storage_ghosted_light.xml +++ b/app/src/main/res/drawable/dom_storage_ghosted_day.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster"> - + diff --git a/app/src/main/res/drawable/dom_storage_ghosted_dark.xml b/app/src/main/res/drawable/dom_storage_ghosted_night.xml similarity index 86% rename from app/src/main/res/drawable/dom_storage_ghosted_dark.xml rename to app/src/main/res/drawable/dom_storage_ghosted_night.xml index 9f2419f9..bf4ee919 100644 --- a/app/src/main/res/drawable/dom_storage_ghosted_dark.xml +++ b/app/src/main/res/drawable/dom_storage_ghosted_night.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster"> - + diff --git a/app/src/main/res/drawable/dom_storage_warning.xml b/app/src/main/res/drawable/dom_storage_warning.xml index eb42e0fa..0abbe9f5 100644 --- a/app/src/main/res/drawable/dom_storage_warning.xml +++ b/app/src/main/res/drawable/dom_storage_warning.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/domains_light.xml b/app/src/main/res/drawable/domains_light.xml index 4e41917d..7c2b9953 100644 --- a/app/src/main/res/drawable/domains_light.xml +++ b/app/src/main/res/drawable/domains_light.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/domains_dark.xml b/app/src/main/res/drawable/domains_night.xml similarity index 88% rename from app/src/main/res/drawable/domains_dark.xml rename to app/src/main/res/drawable/domains_night.xml index 4f9557e5..5ea08689 100644 --- a/app/src/main/res/drawable/domains_dark.xml +++ b/app/src/main/res/drawable/domains_night.xml @@ -11,7 +11,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/downloads_enabled_light.xml b/app/src/main/res/drawable/downloads_enabled_day.xml similarity index 79% rename from app/src/main/res/drawable/downloads_enabled_light.xml rename to app/src/main/res/drawable/downloads_enabled_day.xml index 34e0fc7e..0315a5a7 100644 --- a/app/src/main/res/drawable/downloads_enabled_light.xml +++ b/app/src/main/res/drawable/downloads_enabled_day.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/downloads_enabled_dark.xml b/app/src/main/res/drawable/downloads_enabled_night.xml similarity index 79% rename from app/src/main/res/drawable/downloads_enabled_dark.xml rename to app/src/main/res/drawable/downloads_enabled_night.xml index f3622528..12e3b2fa 100644 --- a/app/src/main/res/drawable/downloads_enabled_dark.xml +++ b/app/src/main/res/drawable/downloads_enabled_night.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/downloads_ghosted_light.xml b/app/src/main/res/drawable/downloads_ghosted_day.xml similarity index 79% rename from app/src/main/res/drawable/downloads_ghosted_light.xml rename to app/src/main/res/drawable/downloads_ghosted_day.xml index bfcd415d..654c1930 100644 --- a/app/src/main/res/drawable/downloads_ghosted_light.xml +++ b/app/src/main/res/drawable/downloads_ghosted_day.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/downloads_ghosted_dark.xml b/app/src/main/res/drawable/downloads_ghosted_night.xml similarity index 79% rename from app/src/main/res/drawable/downloads_ghosted_dark.xml rename to app/src/main/res/drawable/downloads_ghosted_night.xml index c857a820..0adb67af 100644 --- a/app/src/main/res/drawable/downloads_ghosted_dark.xml +++ b/app/src/main/res/drawable/downloads_ghosted_night.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/edit_light.xml b/app/src/main/res/drawable/edit_day.xml similarity index 75% rename from app/src/main/res/drawable/edit_light.xml rename to app/src/main/res/drawable/edit_day.xml index 35473a10..7d6ded03 100644 --- a/app/src/main/res/drawable/edit_light.xml +++ b/app/src/main/res/drawable/edit_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/edit_dark.xml b/app/src/main/res/drawable/edit_night.xml similarity index 79% rename from app/src/main/res/drawable/edit_dark.xml rename to app/src/main/res/drawable/edit_night.xml index 8845672a..2bd724ca 100644 --- a/app/src/main/res/drawable/edit_dark.xml +++ b/app/src/main/res/drawable/edit_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/folder_dark_blue.xml b/app/src/main/res/drawable/folder_dark_blue.xml index 43f1a2f5..00bb4efa 100644 --- a/app/src/main/res/drawable/folder_dark_blue.xml +++ b/app/src/main/res/drawable/folder_dark_blue.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/folder_gray.xml b/app/src/main/res/drawable/folder_gray.xml index e9259b9f..a5b27aae 100644 --- a/app/src/main/res/drawable/folder_gray.xml +++ b/app/src/main/res/drawable/folder_gray.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/font_size_light.xml b/app/src/main/res/drawable/font_size_day.xml similarity index 68% rename from app/src/main/res/drawable/font_size_light.xml rename to app/src/main/res/drawable/font_size_day.xml index befb9955..99609b6d 100644 --- a/app/src/main/res/drawable/font_size_light.xml +++ b/app/src/main/res/drawable/font_size_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/font_size_dark.xml b/app/src/main/res/drawable/font_size_night.xml similarity index 68% rename from app/src/main/res/drawable/font_size_dark.xml rename to app/src/main/res/drawable/font_size_night.xml index c230bd29..8b2a77c7 100644 --- a/app/src/main/res/drawable/font_size_dark.xml +++ b/app/src/main/res/drawable/font_size_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/form_data_cleared_light.xml b/app/src/main/res/drawable/form_data_cleared_day.xml similarity index 72% rename from app/src/main/res/drawable/form_data_cleared_light.xml rename to app/src/main/res/drawable/form_data_cleared_day.xml index 244a95b5..99ecf439 100644 --- a/app/src/main/res/drawable/form_data_cleared_light.xml +++ b/app/src/main/res/drawable/form_data_cleared_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/form_data_cleared_dark.xml b/app/src/main/res/drawable/form_data_cleared_night.xml similarity index 72% rename from app/src/main/res/drawable/form_data_cleared_dark.xml rename to app/src/main/res/drawable/form_data_cleared_night.xml index e51d86f1..f9c4922a 100644 --- a/app/src/main/res/drawable/form_data_cleared_dark.xml +++ b/app/src/main/res/drawable/form_data_cleared_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/form_data_disabled_light.xml b/app/src/main/res/drawable/form_data_disabled_day.xml similarity index 72% rename from app/src/main/res/drawable/form_data_disabled_light.xml rename to app/src/main/res/drawable/form_data_disabled_day.xml index ba16dcff..fab8b382 100644 --- a/app/src/main/res/drawable/form_data_disabled_light.xml +++ b/app/src/main/res/drawable/form_data_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/form_data_disabled_dark.xml b/app/src/main/res/drawable/form_data_disabled_night.xml similarity index 72% rename from app/src/main/res/drawable/form_data_disabled_dark.xml rename to app/src/main/res/drawable/form_data_disabled_night.xml index e4838e6b..f6626c6d 100644 --- a/app/src/main/res/drawable/form_data_disabled_dark.xml +++ b/app/src/main/res/drawable/form_data_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/form_data_enabled.xml b/app/src/main/res/drawable/form_data_enabled.xml index d2f8b182..5737b8f7 100644 --- a/app/src/main/res/drawable/form_data_enabled.xml +++ b/app/src/main/res/drawable/form_data_enabled.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/form_data_warning.xml b/app/src/main/res/drawable/form_data_warning.xml index 77845c32..a555261b 100644 --- a/app/src/main/res/drawable/form_data_warning.xml +++ b/app/src/main/res/drawable/form_data_warning.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/forward.xml b/app/src/main/res/drawable/forward.xml index 04097253..bea8b20f 100644 --- a/app/src/main/res/drawable/forward.xml +++ b/app/src/main/res/drawable/forward.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/full_screen_disabled_light.xml b/app/src/main/res/drawable/full_screen_disabled_day.xml similarity index 80% rename from app/src/main/res/drawable/full_screen_disabled_light.xml rename to app/src/main/res/drawable/full_screen_disabled_day.xml index e4f440d7..ca8a5784 100644 --- a/app/src/main/res/drawable/full_screen_disabled_light.xml +++ b/app/src/main/res/drawable/full_screen_disabled_day.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/full_screen_disabled_dark.xml b/app/src/main/res/drawable/full_screen_disabled_night.xml similarity index 80% rename from app/src/main/res/drawable/full_screen_disabled_dark.xml rename to app/src/main/res/drawable/full_screen_disabled_night.xml index f01cb256..af0b9915 100644 --- a/app/src/main/res/drawable/full_screen_disabled_dark.xml +++ b/app/src/main/res/drawable/full_screen_disabled_night.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/full_screen_enabled_light.xml b/app/src/main/res/drawable/full_screen_enabled_day.xml similarity index 80% rename from app/src/main/res/drawable/full_screen_enabled_light.xml rename to app/src/main/res/drawable/full_screen_enabled_day.xml index 9e81e0a6..f5709b97 100644 --- a/app/src/main/res/drawable/full_screen_enabled_light.xml +++ b/app/src/main/res/drawable/full_screen_enabled_day.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/full_screen_enabled_dark.xml b/app/src/main/res/drawable/full_screen_enabled_night.xml similarity index 80% rename from app/src/main/res/drawable/full_screen_enabled_dark.xml rename to app/src/main/res/drawable/full_screen_enabled_night.xml index b1085adb..4c2a6506 100644 --- a/app/src/main/res/drawable/full_screen_enabled_dark.xml +++ b/app/src/main/res/drawable/full_screen_enabled_night.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/guide.xml b/app/src/main/res/drawable/guide.xml index c456e702..503f81bf 100644 --- a/app/src/main/res/drawable/guide.xml +++ b/app/src/main/res/drawable/guide.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/history.xml b/app/src/main/res/drawable/history.xml index ce03bafb..91cd43f4 100644 --- a/app/src/main/res/drawable/history.xml +++ b/app/src/main/res/drawable/history.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/home_enabled_light.xml b/app/src/main/res/drawable/home_enabled_day.xml similarity index 88% rename from app/src/main/res/drawable/home_enabled_light.xml rename to app/src/main/res/drawable/home_enabled_day.xml index 9ea9ca84..b233b73f 100644 --- a/app/src/main/res/drawable/home_enabled_light.xml +++ b/app/src/main/res/drawable/home_enabled_day.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/home_enabled_dark.xml b/app/src/main/res/drawable/home_enabled_night.xml similarity index 88% rename from app/src/main/res/drawable/home_enabled_dark.xml rename to app/src/main/res/drawable/home_enabled_night.xml index 86bf0683..5b8d8f75 100644 --- a/app/src/main/res/drawable/home_enabled_dark.xml +++ b/app/src/main/res/drawable/home_enabled_night.xml @@ -6,7 +6,7 @@ android:viewportHeight="24.0" android:viewportWidth="24.0" > - + diff --git a/app/src/main/res/drawable/images_disabled_light.xml b/app/src/main/res/drawable/images_disabled_day.xml similarity index 78% rename from app/src/main/res/drawable/images_disabled_light.xml rename to app/src/main/res/drawable/images_disabled_day.xml index 95f5b1a6..3b361dd5 100644 --- a/app/src/main/res/drawable/images_disabled_light.xml +++ b/app/src/main/res/drawable/images_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/images_disabled_dark.xml b/app/src/main/res/drawable/images_disabled_night.xml similarity index 78% rename from app/src/main/res/drawable/images_disabled_dark.xml rename to app/src/main/res/drawable/images_disabled_night.xml index d7947b1e..aa358d4f 100644 --- a/app/src/main/res/drawable/images_disabled_dark.xml +++ b/app/src/main/res/drawable/images_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/images_enabled_light.xml b/app/src/main/res/drawable/images_enabled_day.xml similarity index 78% rename from app/src/main/res/drawable/images_enabled_light.xml rename to app/src/main/res/drawable/images_enabled_day.xml index a118988a..07865428 100644 --- a/app/src/main/res/drawable/images_enabled_light.xml +++ b/app/src/main/res/drawable/images_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/images_enabled_dark.xml b/app/src/main/res/drawable/images_enabled_night.xml similarity index 78% rename from app/src/main/res/drawable/images_enabled_dark.xml rename to app/src/main/res/drawable/images_enabled_night.xml index 41874845..cb3cb4af 100644 --- a/app/src/main/res/drawable/images_enabled_dark.xml +++ b/app/src/main/res/drawable/images_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/import_export_light.xml b/app/src/main/res/drawable/import_export_day.xml similarity index 76% rename from app/src/main/res/drawable/import_export_light.xml rename to app/src/main/res/drawable/import_export_day.xml index 119da8c8..84927542 100644 --- a/app/src/main/res/drawable/import_export_light.xml +++ b/app/src/main/res/drawable/import_export_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/import_export_dark.xml b/app/src/main/res/drawable/import_export_night.xml similarity index 76% rename from app/src/main/res/drawable/import_export_dark.xml rename to app/src/main/res/drawable/import_export_night.xml index 1847f4fc..55c712b5 100644 --- a/app/src/main/res/drawable/import_export_dark.xml +++ b/app/src/main/res/drawable/import_export_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/incognito_mode_disabled_light.xml b/app/src/main/res/drawable/incognito_mode_disabled_day.xml similarity index 80% rename from app/src/main/res/drawable/incognito_mode_disabled_light.xml rename to app/src/main/res/drawable/incognito_mode_disabled_day.xml index 4bb39d26..db223220 100644 --- a/app/src/main/res/drawable/incognito_mode_disabled_light.xml +++ b/app/src/main/res/drawable/incognito_mode_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/incognito_mode_disabled_dark.xml b/app/src/main/res/drawable/incognito_mode_disabled_night.xml similarity index 80% rename from app/src/main/res/drawable/incognito_mode_disabled_dark.xml rename to app/src/main/res/drawable/incognito_mode_disabled_night.xml index 60925f2e..eb2d06bc 100644 --- a/app/src/main/res/drawable/incognito_mode_disabled_dark.xml +++ b/app/src/main/res/drawable/incognito_mode_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/incognito_mode_enabled_light.xml b/app/src/main/res/drawable/incognito_mode_enabled_day.xml similarity index 80% rename from app/src/main/res/drawable/incognito_mode_enabled_light.xml rename to app/src/main/res/drawable/incognito_mode_enabled_day.xml index 3a22087d..981a79ab 100644 --- a/app/src/main/res/drawable/incognito_mode_enabled_light.xml +++ b/app/src/main/res/drawable/incognito_mode_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/incognito_mode_enabled_dark.xml b/app/src/main/res/drawable/incognito_mode_enabled_night.xml similarity index 80% rename from app/src/main/res/drawable/incognito_mode_enabled_dark.xml rename to app/src/main/res/drawable/incognito_mode_enabled_night.xml index 9e90a540..cb663bdd 100644 --- a/app/src/main/res/drawable/incognito_mode_enabled_dark.xml +++ b/app/src/main/res/drawable/incognito_mode_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/javascript_enabled.xml b/app/src/main/res/drawable/javascript_enabled.xml index 75f611eb..fb8d1810 100644 --- a/app/src/main/res/drawable/javascript_enabled.xml +++ b/app/src/main/res/drawable/javascript_enabled.xml @@ -7,21 +7,21 @@ android:viewportHeight="256.0" android:viewportWidth="256.0" > - + - + - + - + - + + - + diff --git a/app/src/main/res/drawable/lock_dark.xml b/app/src/main/res/drawable/lock_night.xml similarity index 75% rename from app/src/main/res/drawable/lock_dark.xml rename to app/src/main/res/drawable/lock_night.xml index f67483a1..d55b7fed 100644 --- a/app/src/main/res/drawable/lock_dark.xml +++ b/app/src/main/res/drawable/lock_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/modify_url_disabled_light.xml b/app/src/main/res/drawable/modify_url_disabled_day.xml similarity index 76% rename from app/src/main/res/drawable/modify_url_disabled_light.xml rename to app/src/main/res/drawable/modify_url_disabled_day.xml index a8f2b293..20ff1976 100644 --- a/app/src/main/res/drawable/modify_url_disabled_light.xml +++ b/app/src/main/res/drawable/modify_url_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/modify_url_disabled_dark.xml b/app/src/main/res/drawable/modify_url_disabled_night.xml similarity index 76% rename from app/src/main/res/drawable/modify_url_disabled_dark.xml rename to app/src/main/res/drawable/modify_url_disabled_night.xml index 907eeecc..df266e46 100644 --- a/app/src/main/res/drawable/modify_url_disabled_dark.xml +++ b/app/src/main/res/drawable/modify_url_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/modify_url_enabled_light.xml b/app/src/main/res/drawable/modify_url_enabled_day.xml similarity index 76% rename from app/src/main/res/drawable/modify_url_enabled_light.xml rename to app/src/main/res/drawable/modify_url_enabled_day.xml index 8f5c094d..2f576652 100644 --- a/app/src/main/res/drawable/modify_url_enabled_light.xml +++ b/app/src/main/res/drawable/modify_url_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/modify_url_enabled_dark.xml b/app/src/main/res/drawable/modify_url_enabled_night.xml similarity index 76% rename from app/src/main/res/drawable/modify_url_enabled_dark.xml rename to app/src/main/res/drawable/modify_url_enabled_night.xml index 7bcd082d..136c5132 100644 --- a/app/src/main/res/drawable/modify_url_enabled_dark.xml +++ b/app/src/main/res/drawable/modify_url_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/more_disabled_light.xml b/app/src/main/res/drawable/more_disabled_day.xml similarity index 78% rename from app/src/main/res/drawable/more_disabled_light.xml rename to app/src/main/res/drawable/more_disabled_day.xml index 1ea8021b..a2bdfd9f 100644 --- a/app/src/main/res/drawable/more_disabled_light.xml +++ b/app/src/main/res/drawable/more_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/more_disabled_dark.xml b/app/src/main/res/drawable/more_disabled_night.xml similarity index 78% rename from app/src/main/res/drawable/more_disabled_dark.xml rename to app/src/main/res/drawable/more_disabled_night.xml index ca98677d..16af07c1 100644 --- a/app/src/main/res/drawable/more_disabled_dark.xml +++ b/app/src/main/res/drawable/more_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/more_enabled_light.xml b/app/src/main/res/drawable/more_enabled_day.xml similarity index 78% rename from app/src/main/res/drawable/more_enabled_light.xml rename to app/src/main/res/drawable/more_enabled_day.xml index 0f494c9e..30317fcf 100644 --- a/app/src/main/res/drawable/more_enabled_light.xml +++ b/app/src/main/res/drawable/more_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/more_enabled_dark.xml b/app/src/main/res/drawable/more_enabled_night.xml similarity index 78% rename from app/src/main/res/drawable/more_enabled_dark.xml rename to app/src/main/res/drawable/more_enabled_night.xml index d7fcaa5f..a7f45e39 100644 --- a/app/src/main/res/drawable/more_enabled_dark.xml +++ b/app/src/main/res/drawable/more_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/move_down_disabled.xml b/app/src/main/res/drawable/move_down_disabled.xml index f1ca21e5..580f2430 100644 --- a/app/src/main/res/drawable/move_down_disabled.xml +++ b/app/src/main/res/drawable/move_down_disabled.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/move_down_enabled_dark.xml b/app/src/main/res/drawable/move_down_enabled_dark.xml deleted file mode 100644 index 5009d42f..00000000 --- a/app/src/main/res/drawable/move_down_enabled_dark.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/app/src/main/res/drawable/move_down_enabled_day.xml b/app/src/main/res/drawable/move_down_enabled_day.xml new file mode 100644 index 00000000..7ff2e339 --- /dev/null +++ b/app/src/main/res/drawable/move_down_enabled_day.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/app/src/main/res/drawable/move_down_enabled_light.xml b/app/src/main/res/drawable/move_down_enabled_light.xml deleted file mode 100644 index 30e5ea1a..00000000 --- a/app/src/main/res/drawable/move_down_enabled_light.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/app/src/main/res/drawable/move_down_enabled_night.xml b/app/src/main/res/drawable/move_down_enabled_night.xml new file mode 100644 index 00000000..415811ba --- /dev/null +++ b/app/src/main/res/drawable/move_down_enabled_night.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/app/src/main/res/drawable/move_to_folder_light.xml b/app/src/main/res/drawable/move_to_folder_day.xml similarity index 77% rename from app/src/main/res/drawable/move_to_folder_light.xml rename to app/src/main/res/drawable/move_to_folder_day.xml index fdbc6dbf..e723dbf3 100644 --- a/app/src/main/res/drawable/move_to_folder_light.xml +++ b/app/src/main/res/drawable/move_to_folder_day.xml @@ -1,4 +1,4 @@ - @@ -12,8 +12,8 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/move_to_folder_dark.xml b/app/src/main/res/drawable/move_to_folder_night.xml similarity index 80% rename from app/src/main/res/drawable/move_to_folder_dark.xml rename to app/src/main/res/drawable/move_to_folder_night.xml index 4bedea14..98b0e0b6 100644 --- a/app/src/main/res/drawable/move_to_folder_dark.xml +++ b/app/src/main/res/drawable/move_to_folder_night.xml @@ -1,4 +1,4 @@ - @@ -12,7 +12,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/move_up_disabled.xml b/app/src/main/res/drawable/move_up_disabled.xml index 7d7dc93a..5f9735a9 100644 --- a/app/src/main/res/drawable/move_up_disabled.xml +++ b/app/src/main/res/drawable/move_up_disabled.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/move_up_enabled_dark.xml b/app/src/main/res/drawable/move_up_enabled_dark.xml deleted file mode 100644 index 65a78d9a..00000000 --- a/app/src/main/res/drawable/move_up_enabled_dark.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/app/src/main/res/drawable/move_up_enabled_day.xml b/app/src/main/res/drawable/move_up_enabled_day.xml new file mode 100644 index 00000000..b48cde0a --- /dev/null +++ b/app/src/main/res/drawable/move_up_enabled_day.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/app/src/main/res/drawable/move_up_enabled_light.xml b/app/src/main/res/drawable/move_up_enabled_light.xml deleted file mode 100644 index 75dfdb60..00000000 --- a/app/src/main/res/drawable/move_up_enabled_light.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/app/src/main/res/drawable/move_up_enabled_night.xml b/app/src/main/res/drawable/move_up_enabled_night.xml new file mode 100644 index 00000000..d5641b9a --- /dev/null +++ b/app/src/main/res/drawable/move_up_enabled_night.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/app/src/main/res/drawable/next.xml b/app/src/main/res/drawable/next.xml index 10b6dfd4..65484f23 100644 --- a/app/src/main/res/drawable/next.xml +++ b/app/src/main/res/drawable/next.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/night_mode_disabled_light.xml b/app/src/main/res/drawable/night_mode_disabled_day.xml similarity index 81% rename from app/src/main/res/drawable/night_mode_disabled_light.xml rename to app/src/main/res/drawable/night_mode_disabled_day.xml index 64c3f02c..804f0160 100644 --- a/app/src/main/res/drawable/night_mode_disabled_light.xml +++ b/app/src/main/res/drawable/night_mode_disabled_day.xml @@ -1,4 +1,4 @@ - @@ -12,7 +12,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/night_mode_disabled_dark.xml b/app/src/main/res/drawable/night_mode_disabled_night.xml similarity index 81% rename from app/src/main/res/drawable/night_mode_disabled_dark.xml rename to app/src/main/res/drawable/night_mode_disabled_night.xml index 128e37e8..9f44fe8b 100644 --- a/app/src/main/res/drawable/night_mode_disabled_dark.xml +++ b/app/src/main/res/drawable/night_mode_disabled_night.xml @@ -1,4 +1,4 @@ - @@ -12,7 +12,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/night_mode_enabled_light.xml b/app/src/main/res/drawable/night_mode_enabled_day.xml similarity index 81% rename from app/src/main/res/drawable/night_mode_enabled_light.xml rename to app/src/main/res/drawable/night_mode_enabled_day.xml index 464946ce..20979016 100644 --- a/app/src/main/res/drawable/night_mode_enabled_light.xml +++ b/app/src/main/res/drawable/night_mode_enabled_day.xml @@ -1,4 +1,4 @@ - @@ -12,7 +12,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/night_mode_enabled_dark.xml b/app/src/main/res/drawable/night_mode_enabled_night.xml similarity index 81% rename from app/src/main/res/drawable/night_mode_enabled_dark.xml rename to app/src/main/res/drawable/night_mode_enabled_night.xml index 38bf501e..38d0d8b1 100644 --- a/app/src/main/res/drawable/night_mode_enabled_dark.xml +++ b/app/src/main/res/drawable/night_mode_enabled_night.xml @@ -1,4 +1,4 @@ - @@ -12,7 +12,7 @@ android:autoMirrored="true" tools:ignore="VectorRaster" > - + diff --git a/app/src/main/res/drawable/previous.xml b/app/src/main/res/drawable/previous.xml index 299d1e77..23365e0d 100644 --- a/app/src/main/res/drawable/previous.xml +++ b/app/src/main/res/drawable/previous.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/privacy_browser_foreground.xml b/app/src/main/res/drawable/privacy_browser_foreground.xml index cd7183e6..0ee38afb 100644 --- a/app/src/main/res/drawable/privacy_browser_foreground.xml +++ b/app/src/main/res/drawable/privacy_browser_foreground.xml @@ -1,29 +1,34 @@ - - + - + - + + - + + - + + diff --git a/app/src/main/res/drawable/privacy_mode.xml b/app/src/main/res/drawable/privacy_mode.xml index 9a091697..eb264d6a 100644 --- a/app/src/main/res/drawable/privacy_mode.xml +++ b/app/src/main/res/drawable/privacy_mode.xml @@ -1,4 +1,4 @@ - - + - + - + + - + diff --git a/app/src/main/res/drawable/proxy_enabled_light.xml b/app/src/main/res/drawable/proxy_enabled_day.xml similarity index 72% rename from app/src/main/res/drawable/proxy_enabled_light.xml rename to app/src/main/res/drawable/proxy_enabled_day.xml index f67235cc..4981f4cf 100644 --- a/app/src/main/res/drawable/proxy_enabled_light.xml +++ b/app/src/main/res/drawable/proxy_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/proxy_enabled_dark.xml b/app/src/main/res/drawable/proxy_enabled_night.xml similarity index 72% rename from app/src/main/res/drawable/proxy_enabled_dark.xml rename to app/src/main/res/drawable/proxy_enabled_night.xml index 597d97f8..87a974eb 100644 --- a/app/src/main/res/drawable/proxy_enabled_dark.xml +++ b/app/src/main/res/drawable/proxy_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/proxy_ghosted_light.xml b/app/src/main/res/drawable/proxy_ghosted_day.xml similarity index 72% rename from app/src/main/res/drawable/proxy_ghosted_light.xml rename to app/src/main/res/drawable/proxy_ghosted_day.xml index 5bf8795f..0cd951a6 100644 --- a/app/src/main/res/drawable/proxy_ghosted_light.xml +++ b/app/src/main/res/drawable/proxy_ghosted_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/proxy_ghosted_dark.xml b/app/src/main/res/drawable/proxy_ghosted_night.xml similarity index 72% rename from app/src/main/res/drawable/proxy_ghosted_dark.xml rename to app/src/main/res/drawable/proxy_ghosted_night.xml index ccc948bf..d2ec6ba4 100644 --- a/app/src/main/res/drawable/proxy_ghosted_dark.xml +++ b/app/src/main/res/drawable/proxy_ghosted_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/refresh_disabled_light.xml b/app/src/main/res/drawable/refresh_disabled_day.xml similarity index 80% rename from app/src/main/res/drawable/refresh_disabled_light.xml rename to app/src/main/res/drawable/refresh_disabled_day.xml index db7bc07f..61a1d0cb 100644 --- a/app/src/main/res/drawable/refresh_disabled_light.xml +++ b/app/src/main/res/drawable/refresh_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/refresh_disabled_dark.xml b/app/src/main/res/drawable/refresh_disabled_night.xml similarity index 80% rename from app/src/main/res/drawable/refresh_disabled_dark.xml rename to app/src/main/res/drawable/refresh_disabled_night.xml index 667e82d9..44e074d5 100644 --- a/app/src/main/res/drawable/refresh_disabled_dark.xml +++ b/app/src/main/res/drawable/refresh_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/refresh_enabled_light.xml b/app/src/main/res/drawable/refresh_enabled_day.xml similarity index 80% rename from app/src/main/res/drawable/refresh_enabled_light.xml rename to app/src/main/res/drawable/refresh_enabled_day.xml index 2591a66b..8a675c7f 100644 --- a/app/src/main/res/drawable/refresh_enabled_light.xml +++ b/app/src/main/res/drawable/refresh_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/refresh_enabled_dark.xml b/app/src/main/res/drawable/refresh_enabled_night.xml similarity index 80% rename from app/src/main/res/drawable/refresh_enabled_dark.xml rename to app/src/main/res/drawable/refresh_enabled_night.xml index 70b41c37..2423ff7d 100644 --- a/app/src/main/res/drawable/refresh_enabled_dark.xml +++ b/app/src/main/res/drawable/refresh_enabled_night.xml @@ -1,17 +1,17 @@ - + - + diff --git a/app/src/main/res/drawable/save_light.xml b/app/src/main/res/drawable/save_day.xml similarity index 69% rename from app/src/main/res/drawable/save_light.xml rename to app/src/main/res/drawable/save_day.xml index df119f5c..26559dfc 100644 --- a/app/src/main/res/drawable/save_light.xml +++ b/app/src/main/res/drawable/save_day.xml @@ -1,4 +1,4 @@ - + - + \ No newline at end of file diff --git a/app/src/main/res/drawable/save_dialog_light.xml b/app/src/main/res/drawable/save_dialog_day.xml similarity index 73% rename from app/src/main/res/drawable/save_dialog_light.xml rename to app/src/main/res/drawable/save_dialog_day.xml index 21aca678..f18953e4 100644 --- a/app/src/main/res/drawable/save_dialog_light.xml +++ b/app/src/main/res/drawable/save_dialog_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/save_dialog_dark.xml b/app/src/main/res/drawable/save_dialog_night.xml similarity index 73% rename from app/src/main/res/drawable/save_dialog_dark.xml rename to app/src/main/res/drawable/save_dialog_night.xml index d20d248a..43aee33d 100644 --- a/app/src/main/res/drawable/save_dialog_dark.xml +++ b/app/src/main/res/drawable/save_dialog_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/save_dark.xml b/app/src/main/res/drawable/save_night.xml similarity index 73% rename from app/src/main/res/drawable/save_dark.xml rename to app/src/main/res/drawable/save_night.xml index e26d3bfd..4553fd0b 100644 --- a/app/src/main/res/drawable/save_dark.xml +++ b/app/src/main/res/drawable/save_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/search_custom_url_enabled_light.xml b/app/src/main/res/drawable/search_custom_url_enabled_day.xml similarity index 88% rename from app/src/main/res/drawable/search_custom_url_enabled_light.xml rename to app/src/main/res/drawable/search_custom_url_enabled_day.xml index 5ad69243..e1d4074f 100644 --- a/app/src/main/res/drawable/search_custom_url_enabled_light.xml +++ b/app/src/main/res/drawable/search_custom_url_enabled_day.xml @@ -4,14 +4,14 @@ - + diff --git a/app/src/main/res/drawable/search_custom_url_enabled_dark.xml b/app/src/main/res/drawable/search_custom_url_enabled_night.xml similarity index 88% rename from app/src/main/res/drawable/search_custom_url_enabled_dark.xml rename to app/src/main/res/drawable/search_custom_url_enabled_night.xml index fdf809fc..e03c1300 100644 --- a/app/src/main/res/drawable/search_custom_url_enabled_dark.xml +++ b/app/src/main/res/drawable/search_custom_url_enabled_night.xml @@ -4,14 +4,14 @@ - + diff --git a/app/src/main/res/drawable/search_custom_url_ghosted_light.xml b/app/src/main/res/drawable/search_custom_url_ghosted_day.xml similarity index 88% rename from app/src/main/res/drawable/search_custom_url_ghosted_light.xml rename to app/src/main/res/drawable/search_custom_url_ghosted_day.xml index f064d2b8..5026ae7d 100644 --- a/app/src/main/res/drawable/search_custom_url_ghosted_light.xml +++ b/app/src/main/res/drawable/search_custom_url_ghosted_day.xml @@ -4,14 +4,14 @@ - + diff --git a/app/src/main/res/drawable/search_custom_url_ghosted_dark.xml b/app/src/main/res/drawable/search_custom_url_ghosted_night.xml similarity index 88% rename from app/src/main/res/drawable/search_custom_url_ghosted_dark.xml rename to app/src/main/res/drawable/search_custom_url_ghosted_night.xml index 2521845b..ac7cd942 100644 --- a/app/src/main/res/drawable/search_custom_url_ghosted_dark.xml +++ b/app/src/main/res/drawable/search_custom_url_ghosted_night.xml @@ -4,14 +4,14 @@ - + diff --git a/app/src/main/res/drawable/search_enabled_light.xml b/app/src/main/res/drawable/search_enabled_day.xml similarity index 93% rename from app/src/main/res/drawable/search_enabled_light.xml rename to app/src/main/res/drawable/search_enabled_day.xml index a7eb2e7a..78a75026 100644 --- a/app/src/main/res/drawable/search_enabled_light.xml +++ b/app/src/main/res/drawable/search_enabled_day.xml @@ -4,14 +4,14 @@ - + diff --git a/app/src/main/res/drawable/search_enabled_dark.xml b/app/src/main/res/drawable/search_enabled_night.xml similarity index 93% rename from app/src/main/res/drawable/search_enabled_dark.xml rename to app/src/main/res/drawable/search_enabled_night.xml index 150202a5..e9477a27 100644 --- a/app/src/main/res/drawable/search_enabled_dark.xml +++ b/app/src/main/res/drawable/search_enabled_night.xml @@ -4,14 +4,14 @@ - + diff --git a/app/src/main/res/drawable/select_all_light.xml b/app/src/main/res/drawable/select_all_day.xml similarity index 67% rename from app/src/main/res/drawable/select_all_light.xml rename to app/src/main/res/drawable/select_all_day.xml index e5ed2b13..4ee0387c 100644 --- a/app/src/main/res/drawable/select_all_light.xml +++ b/app/src/main/res/drawable/select_all_day.xml @@ -1,4 +1,4 @@ - + - + \ No newline at end of file diff --git a/app/src/main/res/drawable/select_all_dark.xml b/app/src/main/res/drawable/select_all_night.xml similarity index 71% rename from app/src/main/res/drawable/select_all_dark.xml rename to app/src/main/res/drawable/select_all_night.xml index 61008a29..616c3485 100644 --- a/app/src/main/res/drawable/select_all_dark.xml +++ b/app/src/main/res/drawable/select_all_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/settings.xml b/app/src/main/res/drawable/settings.xml index 28cefcfb..eafa18c6 100644 --- a/app/src/main/res/drawable/settings.xml +++ b/app/src/main/res/drawable/settings.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/social_media_disabled_light.xml b/app/src/main/res/drawable/social_media_disabled_day.xml similarity index 83% rename from app/src/main/res/drawable/social_media_disabled_light.xml rename to app/src/main/res/drawable/social_media_disabled_day.xml index 547fb97b..84e6b2b1 100644 --- a/app/src/main/res/drawable/social_media_disabled_light.xml +++ b/app/src/main/res/drawable/social_media_disabled_day.xml @@ -1,17 +1,17 @@ - + - + diff --git a/app/src/main/res/drawable/social_media_disabled_dark.xml b/app/src/main/res/drawable/social_media_disabled_night.xml similarity index 83% rename from app/src/main/res/drawable/social_media_disabled_dark.xml rename to app/src/main/res/drawable/social_media_disabled_night.xml index 259b5a3f..2e432f3a 100644 --- a/app/src/main/res/drawable/social_media_disabled_dark.xml +++ b/app/src/main/res/drawable/social_media_disabled_night.xml @@ -1,17 +1,17 @@ - + - + diff --git a/app/src/main/res/drawable/social_media_enabled_light.xml b/app/src/main/res/drawable/social_media_enabled_day.xml similarity index 83% rename from app/src/main/res/drawable/social_media_enabled_light.xml rename to app/src/main/res/drawable/social_media_enabled_day.xml index 5843202e..2aba5239 100644 --- a/app/src/main/res/drawable/social_media_enabled_light.xml +++ b/app/src/main/res/drawable/social_media_enabled_day.xml @@ -1,17 +1,17 @@ - + - + diff --git a/app/src/main/res/drawable/social_media_enabled_dark.xml b/app/src/main/res/drawable/social_media_enabled_night.xml similarity index 83% rename from app/src/main/res/drawable/social_media_enabled_dark.xml rename to app/src/main/res/drawable/social_media_enabled_night.xml index 2ec52c39..a8f611cd 100644 --- a/app/src/main/res/drawable/social_media_enabled_dark.xml +++ b/app/src/main/res/drawable/social_media_enabled_night.xml @@ -1,17 +1,17 @@ - + - + diff --git a/app/src/main/res/drawable/social_media_ghosted_light.xml b/app/src/main/res/drawable/social_media_ghosted_day.xml similarity index 83% rename from app/src/main/res/drawable/social_media_ghosted_light.xml rename to app/src/main/res/drawable/social_media_ghosted_day.xml index e347ff94..01d25ef3 100644 --- a/app/src/main/res/drawable/social_media_ghosted_light.xml +++ b/app/src/main/res/drawable/social_media_ghosted_day.xml @@ -1,17 +1,17 @@ - + - + diff --git a/app/src/main/res/drawable/social_media_ghosted_dark.xml b/app/src/main/res/drawable/social_media_ghosted_night.xml similarity index 83% rename from app/src/main/res/drawable/social_media_ghosted_dark.xml rename to app/src/main/res/drawable/social_media_ghosted_night.xml index c4a24c90..f2f156f7 100644 --- a/app/src/main/res/drawable/social_media_ghosted_dark.xml +++ b/app/src/main/res/drawable/social_media_ghosted_night.xml @@ -1,17 +1,17 @@ - + - + diff --git a/app/src/main/res/drawable/sort_light.xml b/app/src/main/res/drawable/sort_day.xml similarity index 72% rename from app/src/main/res/drawable/sort_light.xml rename to app/src/main/res/drawable/sort_day.xml index 26ad9008..eeaa084a 100644 --- a/app/src/main/res/drawable/sort_light.xml +++ b/app/src/main/res/drawable/sort_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/sort_dark.xml b/app/src/main/res/drawable/sort_night.xml similarity index 77% rename from app/src/main/res/drawable/sort_dark.xml rename to app/src/main/res/drawable/sort_night.xml index a5a6c138..279c99d0 100644 --- a/app/src/main/res/drawable/sort_dark.xml +++ b/app/src/main/res/drawable/sort_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/sort_selected_dark.xml b/app/src/main/res/drawable/sort_selected_day.xml similarity index 74% rename from app/src/main/res/drawable/sort_selected_dark.xml rename to app/src/main/res/drawable/sort_selected_day.xml index 228510bb..ea40a786 100644 --- a/app/src/main/res/drawable/sort_selected_dark.xml +++ b/app/src/main/res/drawable/sort_selected_day.xml @@ -1,4 +1,4 @@ - @@ -12,15 +12,13 @@ android:viewportWidth="24" tools:ignore="VectorRaster"> - + - + diff --git a/app/src/main/res/drawable/sort_selected_light.xml b/app/src/main/res/drawable/sort_selected_night.xml similarity index 74% rename from app/src/main/res/drawable/sort_selected_light.xml rename to app/src/main/res/drawable/sort_selected_night.xml index f980582f..8c9f8afb 100644 --- a/app/src/main/res/drawable/sort_selected_light.xml +++ b/app/src/main/res/drawable/sort_selected_night.xml @@ -1,4 +1,4 @@ - @@ -12,15 +12,13 @@ android:viewportWidth="24" tools:ignore="VectorRaster"> - + - + diff --git a/app/src/main/res/drawable/ssl_certificate_disabled_light.xml b/app/src/main/res/drawable/ssl_certificate_disabled_day.xml similarity index 85% rename from app/src/main/res/drawable/ssl_certificate_disabled_light.xml rename to app/src/main/res/drawable/ssl_certificate_disabled_day.xml index 80f30c2a..3002d75b 100644 --- a/app/src/main/res/drawable/ssl_certificate_disabled_light.xml +++ b/app/src/main/res/drawable/ssl_certificate_disabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/ssl_certificate_disabled_dark.xml b/app/src/main/res/drawable/ssl_certificate_disabled_night.xml similarity index 85% rename from app/src/main/res/drawable/ssl_certificate_disabled_dark.xml rename to app/src/main/res/drawable/ssl_certificate_disabled_night.xml index f57b7e22..d0a66708 100644 --- a/app/src/main/res/drawable/ssl_certificate_disabled_dark.xml +++ b/app/src/main/res/drawable/ssl_certificate_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/ssl_certificate_enabled_light.xml b/app/src/main/res/drawable/ssl_certificate_enabled_day.xml similarity index 81% rename from app/src/main/res/drawable/ssl_certificate_enabled_light.xml rename to app/src/main/res/drawable/ssl_certificate_enabled_day.xml index 80d5541d..0273ee49 100644 --- a/app/src/main/res/drawable/ssl_certificate_enabled_light.xml +++ b/app/src/main/res/drawable/ssl_certificate_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/ssl_certificate_enabled_dark.xml b/app/src/main/res/drawable/ssl_certificate_enabled_night.xml similarity index 81% rename from app/src/main/res/drawable/ssl_certificate_enabled_dark.xml rename to app/src/main/res/drawable/ssl_certificate_enabled_night.xml index 9d5436c1..2b04dac6 100644 --- a/app/src/main/res/drawable/ssl_certificate_enabled_dark.xml +++ b/app/src/main/res/drawable/ssl_certificate_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/tab_disabled_dark.xml b/app/src/main/res/drawable/tab_disabled_dark.xml index fa382a2b..989bc9b7 100644 --- a/app/src/main/res/drawable/tab_disabled_dark.xml +++ b/app/src/main/res/drawable/tab_disabled_dark.xml @@ -1,4 +1,4 @@ - + + + + + - + diff --git a/app/src/main/res/drawable/theme_dark.xml b/app/src/main/res/drawable/theme_night.xml similarity index 76% rename from app/src/main/res/drawable/theme_dark.xml rename to app/src/main/res/drawable/theme_night.xml index d4305902..9c77a037 100644 --- a/app/src/main/res/drawable/theme_dark.xml +++ b/app/src/main/res/drawable/theme_night.xml @@ -1,4 +1,4 @@ - + - + \ No newline at end of file diff --git a/app/src/main/res/drawable/user_agent_light.xml b/app/src/main/res/drawable/user_agent_day.xml similarity index 82% rename from app/src/main/res/drawable/user_agent_light.xml rename to app/src/main/res/drawable/user_agent_day.xml index 05e5555b..328990f8 100644 --- a/app/src/main/res/drawable/user_agent_light.xml +++ b/app/src/main/res/drawable/user_agent_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/user_agent_dark.xml b/app/src/main/res/drawable/user_agent_night.xml similarity index 82% rename from app/src/main/res/drawable/user_agent_dark.xml rename to app/src/main/res/drawable/user_agent_night.xml index 7419f4d9..c0d78f78 100644 --- a/app/src/main/res/drawable/user_agent_dark.xml +++ b/app/src/main/res/drawable/user_agent_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/warning.xml b/app/src/main/res/drawable/warning.xml index c4e2c125..22f8bbf7 100644 --- a/app/src/main/res/drawable/warning.xml +++ b/app/src/main/res/drawable/warning.xml @@ -1,4 +1,4 @@ - - + - + - + + - + diff --git a/app/src/main/res/drawable/wide_viewport_disabled_dark.xml b/app/src/main/res/drawable/wide_viewport_disabled_night.xml similarity index 65% rename from app/src/main/res/drawable/wide_viewport_disabled_dark.xml rename to app/src/main/res/drawable/wide_viewport_disabled_night.xml index 1ca8326e..9fecb89b 100644 --- a/app/src/main/res/drawable/wide_viewport_disabled_dark.xml +++ b/app/src/main/res/drawable/wide_viewport_disabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/wide_viewport_enabled_light.xml b/app/src/main/res/drawable/wide_viewport_enabled_day.xml similarity index 65% rename from app/src/main/res/drawable/wide_viewport_enabled_light.xml rename to app/src/main/res/drawable/wide_viewport_enabled_day.xml index 2f24f6d2..63fb0128 100644 --- a/app/src/main/res/drawable/wide_viewport_enabled_light.xml +++ b/app/src/main/res/drawable/wide_viewport_enabled_day.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/drawable/wide_viewport_enabled_dark.xml b/app/src/main/res/drawable/wide_viewport_enabled_night.xml similarity index 65% rename from app/src/main/res/drawable/wide_viewport_enabled_dark.xml rename to app/src/main/res/drawable/wide_viewport_enabled_night.xml index 44e36fe6..6598c2b2 100644 --- a/app/src/main/res/drawable/wide_viewport_enabled_dark.xml +++ b/app/src/main/res/drawable/wide_viewport_enabled_night.xml @@ -1,4 +1,4 @@ - + - + diff --git a/app/src/main/res/layout-w900dp/bookmarks_drawer.xml b/app/src/main/res/layout-w900dp/bookmarks_drawer.xml index fdd09704..3d2e8148 100644 --- a/app/src/main/res/layout-w900dp/bookmarks_drawer.xml +++ b/app/src/main/res/layout-w900dp/bookmarks_drawer.xml @@ -1,7 +1,7 @@ - + android:layout_width="match_parent" > - + android:background="?android:attr/colorBackground" > - + android:layout_width="match_parent" /> - + app:tabMode="scrollable" /> - + - + + android:layout_width="match_parent" > + `tools:ignore="ContentDescription"` suppresses the lint warning about supplying a content description for the image view, + which isn't needed in this case because the image view is only decorative. --> @@ -64,13 +63,13 @@ android:id="@+id/version" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textColor="?attr/aboutText" + android:textColor="?attr/blueTextColor" android:textIsSelectable="true" android:layout_below="@id/privacy_browser_textview" android:layout_toEndOf="@id/icon" /> - + android:textColor="?attr/blueTitleTextColor" /> - + - + android:layout_width="match_parent" > - + + android:layout_width="match_parent" + android:background="?android:attr/colorBackground" > + android:layout_width="match_parent" /> + `android:dividerHeight` must be at least `1dp` or the list view is inconsistent in calculating how many bookmarks are displayed. --> + android:src="?attr/createFolderIcon" /> + android:src="?attr/createBookmarkIcon" /> \ No newline at end of file diff --git a/app/src/main/res/layout/bookmarks_databaseview_coordinatorlayout.xml b/app/src/main/res/layout/bookmarks_databaseview_coordinatorlayout.xml index 298c5796..414ab2f9 100644 --- a/app/src/main/res/layout/bookmarks_databaseview_coordinatorlayout.xml +++ b/app/src/main/res/layout/bookmarks_databaseview_coordinatorlayout.xml @@ -1,7 +1,7 @@ - + android:layout_width="match_parent" > - + + android:layout_width="match_parent" + android:background="?android:attr/colorBackground" > + android:layout_width="match_parent" /> diff --git a/app/src/main/res/layout/bookmarks_drawer.xml b/app/src/main/res/layout/bookmarks_drawer.xml index 58a0c119..635e7e74 100644 --- a/app/src/main/res/layout/bookmarks_drawer.xml +++ b/app/src/main/res/layout/bookmarks_drawer.xml @@ -1,7 +1,7 @@ + - - + + android:layout_width="match_parent" + android:background="?android:attr/colorBackground" > + android:layout_width="match_parent" /> diff --git a/app/src/main/res/layout/guide_coordinatorlayout.xml b/app/src/main/res/layout/guide_coordinatorlayout.xml index a95e6a0c..b193b360 100644 --- a/app/src/main/res/layout/guide_coordinatorlayout.xml +++ b/app/src/main/res/layout/guide_coordinatorlayout.xml @@ -1,7 +1,7 @@ - + android:layout_width="match_parent" > - + - + android:background="?android:attr/colorBackground" > - + android:layout_width="match_parent" /> - + app:tabMode="scrollable" /> diff --git a/app/src/main/res/layout/import_export_coordinatorlayout.xml b/app/src/main/res/layout/import_export_coordinatorlayout.xml index b6eebd1f..f84dad44 100644 --- a/app/src/main/res/layout/import_export_coordinatorlayout.xml +++ b/app/src/main/res/layout/import_export_coordinatorlayout.xml @@ -18,17 +18,14 @@ You should have received a copy of the GNU General Public License along with Privacy Browser. If not, see . --> - + android:layout_width="match_parent" > - + + android:layout_width="match_parent" + android:background="?android:attr/colorBackground" > + android:layout_width="match_parent" /> @@ -127,7 +121,6 @@ android:layout_gravity="center_horizontal" android:layout_marginTop="10dp" android:text="@string/openkeychain_required" - android:textColor="?android:textColorPrimary" android:textAlignment="center" /> @@ -245,7 +238,6 @@ android:layout_gravity="center_horizontal" android:layout_margin="5dp" android:text="@string/openkeychain_import_instructions" - android:textColor="?android:textColorPrimary" android:textAlignment="center" />