From 2fa5e4f90afd6dda3530c271bea0509a0dc84614 Mon Sep 17 00:00:00 2001 From: Tucan444 <66880425+Tucan444@users.noreply.github.com> Date: Mon, 3 May 2021 14:45:47 +0200 Subject: [PATCH] _ --- .../java/com/example/wikispot/Extentions.kt | 12 +- .../wikispot/adapters/FileViewsAdapter.kt | 2 +- .../wikispot/fragments/settingsFragment.kt | 13 +- .../modelClasses/SettingsSaveManager.kt | 2 + .../example/wikispot/projectScopeVariables.kt | 1 + .../src/main/res/layout/fragment_settings.xml | 24 ++ .../app/src/main/res/values/colors.xml | 211 +++++++++--------- .../app/src/main/res/values/themes.xml | 159 +++++++++++++ 8 files changed, 307 insertions(+), 117 deletions(-) diff --git a/app/WikiSpot/app/src/main/java/com/example/wikispot/Extentions.kt b/app/WikiSpot/app/src/main/java/com/example/wikispot/Extentions.kt index 3a4fc8e..1ca9ada 100644 --- a/app/WikiSpot/app/src/main/java/com/example/wikispot/Extentions.kt +++ b/app/WikiSpot/app/src/main/java/com/example/wikispot/Extentions.kt @@ -27,9 +27,17 @@ fun Context.showSnack(message: String, view: View, length: Int = Snackbar.LENGTH fun Context.getThemeId(): Int { if (ThemeOptions.darkTheme) { - return R.style.Theme_WikiSpotDark + if (!ThemeOptions.moreColors) { + return R.style.Theme_WikiSpotDark + } else { + return R.style.Theme_WikiSpotDark_ + } } else { - return R.style.Theme_WikiSpot + if (!ThemeOptions.moreColors) { + return R.style.Theme_WikiSpot + } else { + return R.style.Theme_WikiSpot_ + } } } diff --git a/app/WikiSpot/app/src/main/java/com/example/wikispot/adapters/FileViewsAdapter.kt b/app/WikiSpot/app/src/main/java/com/example/wikispot/adapters/FileViewsAdapter.kt index 5f9a5f5..4155e77 100644 --- a/app/WikiSpot/app/src/main/java/com/example/wikispot/adapters/FileViewsAdapter.kt +++ b/app/WikiSpot/app/src/main/java/com/example/wikispot/adapters/FileViewsAdapter.kt @@ -124,7 +124,7 @@ class FileViewsAdapter(private val context: Context, private val fileViews: Arra pdfUrl = it } - itemView.filenameText.text = fileView.filename + itemView.filenameText.text = fileView.filename.replace("_", " ") itemView.fileDescription.text = fileView.fileDescription } diff --git a/app/WikiSpot/app/src/main/java/com/example/wikispot/fragments/settingsFragment.kt b/app/WikiSpot/app/src/main/java/com/example/wikispot/fragments/settingsFragment.kt index b1cd330..b227dbd 100644 --- a/app/WikiSpot/app/src/main/java/com/example/wikispot/fragments/settingsFragment.kt +++ b/app/WikiSpot/app/src/main/java/com/example/wikispot/fragments/settingsFragment.kt @@ -1,6 +1,7 @@ package com.example.wikispot.fragments import android.content.Intent +import android.content.res.Resources import android.os.Bundle import androidx.fragment.app.Fragment import android.view.View @@ -10,6 +11,7 @@ import com.example.wikispot.activities.MainActivity import com.example.wikispot.modelClasses.ServerManager import com.example.wikispot.modelClasses.SettingsSaveManager import kotlinx.android.synthetic.main.fragment_settings.* +import javax.xml.transform.sax.TemplatesHandler class settingsFragment : Fragment(R.layout.fragment_settings) { @@ -41,12 +43,17 @@ class settingsFragment : Fragment(R.layout.fragment_settings) { settingsSaveManager.saveSettings() restartAppPartially() } + + moreColorsSwitch.setOnCheckedChangeListener { _, isChecked -> + ThemeOptions.moreColors = isChecked + settingsSaveManager.saveSettings() + restartAppPartially() + } } private fun loadSettings() { - if (ThemeOptions.darkTheme) { - darkThemeSwitch.isChecked = true - } + darkThemeSwitch.isChecked = ThemeOptions.darkTheme + moreColorsSwitch.isChecked = ThemeOptions.moreColors } private fun restartAppPartially() { diff --git a/app/WikiSpot/app/src/main/java/com/example/wikispot/modelClasses/SettingsSaveManager.kt b/app/WikiSpot/app/src/main/java/com/example/wikispot/modelClasses/SettingsSaveManager.kt index 1e4bf4f..78220df 100644 --- a/app/WikiSpot/app/src/main/java/com/example/wikispot/modelClasses/SettingsSaveManager.kt +++ b/app/WikiSpot/app/src/main/java/com/example/wikispot/modelClasses/SettingsSaveManager.kt @@ -15,6 +15,7 @@ class SettingsSaveManager(val context: Context) { val sharedPreferences = context.getSharedPreferences("settings", Context.MODE_PRIVATE) ThemeOptions.darkTheme = sharedPreferences.getBoolean("darkMode", ThemeOptions.darkTheme) + ThemeOptions.moreColors = sharedPreferences.getBoolean("moreColors", ThemeOptions.moreColors) // checking if we want to use system default theme try { @@ -38,6 +39,7 @@ class SettingsSaveManager(val context: Context) { editor.apply{ putBoolean("appRunningFirstTime", false) putBoolean("darkMode", ThemeOptions.darkTheme) + putBoolean("moreColors", ThemeOptions.moreColors) }.apply() } diff --git a/app/WikiSpot/app/src/main/java/com/example/wikispot/projectScopeVariables.kt b/app/WikiSpot/app/src/main/java/com/example/wikispot/projectScopeVariables.kt index 6bca192..f23d9cd 100644 --- a/app/WikiSpot/app/src/main/java/com/example/wikispot/projectScopeVariables.kt +++ b/app/WikiSpot/app/src/main/java/com/example/wikispot/projectScopeVariables.kt @@ -65,6 +65,7 @@ object CustomBackstackVariables { object ThemeOptions { var darkTheme = false + var moreColors = false } object StartDirections { diff --git a/app/WikiSpot/app/src/main/res/layout/fragment_settings.xml b/app/WikiSpot/app/src/main/res/layout/fragment_settings.xml index 33af92d..762cc62 100644 --- a/app/WikiSpot/app/src/main/res/layout/fragment_settings.xml +++ b/app/WikiSpot/app/src/main/res/layout/fragment_settings.xml @@ -42,4 +42,28 @@ app:layout_constraintTop_toTopOf="@+id/darkThemeSwitchText" tools:ignore="UseSwitchCompatOrMaterialXml" /> + + + + \ No newline at end of file diff --git a/app/WikiSpot/app/src/main/res/values/colors.xml b/app/WikiSpot/app/src/main/res/values/colors.xml index dfe0750..319bf7d 100644 --- a/app/WikiSpot/app/src/main/res/values/colors.xml +++ b/app/WikiSpot/app/src/main/res/values/colors.xml @@ -1,169 +1,160 @@ + #FF000000 #FFFFFFFF #00000000 - #4CAF50 - #388E3C - @color/white + #4CAF50 + #388E3C + @color/white - #E91E63 - #F48FB1 - @color/black + #E5BAFF + #F48FB1 + @color/black - #E6FFFFFF - #89000000 - #89000000 - #96262626 + #E6FFFFFF + #89000000 + #89000000 + #96262626 - #C28FF9 - #9B49E3 - #33C4BCC9 - #EC000000 + #C28FF9 + #9B49E3 + #33C4BCC9 + #EC000000 - #80E5BEFF - #80FFB5F0 + #80E5BEFF + #80FFB5F0 - #FFF9FF - #FFFAFF + #FFF9FF + #FFFAFF - #FCB0EF - #9ECFFF - #9FE7FF - #7FFFFFFF - #FFF + #FCB0EF + #9ECFFF + #9FE7FF + #7FFFFFFF + #FFF - #A1DEFC - #A5CBFF - #F9B6F6 - #FBF1FF + #A1DEFC + #A5CBFF + #F9B6F6 + #FBF1FF - #83E1FF - #9EC6FF - #FEBBFF + #83E1FF + #9EC6FF + #FEBBFF - #92EB97FC - #A198F9 - #74C7F7 + #92EB97FC + #A198F9 + #74C7F7 - #FFB6FB - #A7D2FF - #96E7FF + #FFB6FB + #A7D2FF + #96E7FF - #22FFFFFF - #22FFFFFF + #22FFFFFF + #22FFFFFF - #FF7272 + #FF7272 - - - - #99C8FCFF - #99CCF7FF - #99E7EFFF + #99C8FCFF + #99CCF7FF + #99E7EFFF - #020C3C - #0E144A - @color/black + #020C3C + #0E144A + @color/black - #8D4BDD - #F48FB1 - @color/black + #8D4BDD + #F48FB1 + @color/black - #E7E7E7 - #CCBEBEBE - #CCCCCC - #CDE0DFDF + #E7E7E7 + #CCBEBEBE + #CCCCCC + #CDE0DFDF - #F76751F8 - #F75241C2 - #26644F69 - #EC000000 + #F76751F8 + #F75241C2 + #26644F69 + #EC000000 - #80AC78C4 - #80855C95 + #80AC78C4 + #80855C95 - #33284E - #302444 + #33284E + #302444 - #4D473D6A - #2DC39CE1 + #4D473D6A + #2DC39CE1 - #6F3131 + #6F3131 - #4D306D - #222D54 - #1D2043 - #221934 - #BF323232 + #4D306D + #222D54 + #1D2043 + #221934 + #BF323232 - #1E293E - #212C51 - #FA452862 - #323251 + #1E293E + #212C51 + #FA452862 + #323251 . - #263863 - #1F2360 - #452159 + #263863 + #1F2360 + #452159 - #4B3377 - #352C5B - #2B2E5C + #4B3377 + #352C5B + #2B2E5C - #542766 - #1A294A - #2A3B65 + #542766 + #1A294A + #2A3B65 - #8842475F - #79454D78 - #6F363F67 + #8842475F + #79454D78 + #6F363F67 - - - \ No newline at end of file diff --git a/app/WikiSpot/app/src/main/res/values/themes.xml b/app/WikiSpot/app/src/main/res/values/themes.xml index 207212a..2a243d1 100644 --- a/app/WikiSpot/app/src/main/res/values/themes.xml +++ b/app/WikiSpot/app/src/main/res/values/themes.xml @@ -158,4 +158,163 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file