From 2070f8fb08128cb0a70ab1a7b4c4fdb549307c03 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 24 Apr 2024 17:09:23 +0200 Subject: [PATCH] Fixed dialog theme status bar color + added more colors (for fun) --- .../java/org/linphone/ui/GenericActivity.kt | 5 ++ .../java/org/linphone/ui/call/CallActivity.kt | 5 ++ .../ui/main/help/fragment/HelpFragment.kt | 14 ---- .../settings/viewmodel/SettingsViewModel.kt | 19 ++++- app/src/main/res/layout/help_fragment.xml | 36 +-------- app/src/main/res/values-fr/strings.xml | 9 +++ app/src/main/res/values/colors.xml | 40 +++++++-- app/src/main/res/values/strings.xml | 9 +++ app/src/main/res/values/themes.xml | 81 ++++++++++++++++++- 9 files changed, 161 insertions(+), 57 deletions(-) diff --git a/app/src/main/java/org/linphone/ui/GenericActivity.kt b/app/src/main/java/org/linphone/ui/GenericActivity.kt index 1defc24f4..d4d03976a 100644 --- a/app/src/main/java/org/linphone/ui/GenericActivity.kt +++ b/app/src/main/java/org/linphone/ui/GenericActivity.kt @@ -54,6 +54,11 @@ open class GenericActivity : AppCompatActivity() { val theme = super.getTheme() when (mainColor) { "yellow" -> theme.applyStyle(R.style.Theme_LinphoneYellow, true) + "green" -> theme.applyStyle(R.style.Theme_LinphoneGreen, true) + "blue" -> theme.applyStyle(R.style.Theme_LinphoneBlue, true) + "red" -> theme.applyStyle(R.style.Theme_LinphoneRed, true) + "pink" -> theme.applyStyle(R.style.Theme_LinphonePink, true) + "purple" -> theme.applyStyle(R.style.Theme_LinphonePurple, true) else -> theme.applyStyle(R.style.Theme_Linphone, true) } return theme diff --git a/app/src/main/java/org/linphone/ui/call/CallActivity.kt b/app/src/main/java/org/linphone/ui/call/CallActivity.kt index 2bd8931c0..dbb10be91 100644 --- a/app/src/main/java/org/linphone/ui/call/CallActivity.kt +++ b/app/src/main/java/org/linphone/ui/call/CallActivity.kt @@ -101,6 +101,11 @@ class CallActivity : GenericActivity() { val theme = super.getTheme() when (mainColor) { "yellow" -> theme.applyStyle(R.style.Theme_LinphoneInCallYellow, true) + "green" -> theme.applyStyle(R.style.Theme_LinphoneInCallGreen, true) + "blue" -> theme.applyStyle(R.style.Theme_LinphoneInCallBlue, true) + "red" -> theme.applyStyle(R.style.Theme_LinphoneInCallRed, true) + "pink" -> theme.applyStyle(R.style.Theme_LinphoneInCallPink, true) + "purple" -> theme.applyStyle(R.style.Theme_LinphoneInCallPurple, true) else -> theme.applyStyle(R.style.Theme_LinphoneInCall, true) } return theme diff --git a/app/src/main/java/org/linphone/ui/main/help/fragment/HelpFragment.kt b/app/src/main/java/org/linphone/ui/main/help/fragment/HelpFragment.kt index 3c4838aac..70af601e3 100644 --- a/app/src/main/java/org/linphone/ui/main/help/fragment/HelpFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/help/fragment/HelpFragment.kt @@ -26,10 +26,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.annotation.UiThread -import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController import androidx.navigation.navGraphViewModels -import kotlinx.coroutines.launch import org.linphone.R import org.linphone.core.tools.Log import org.linphone.databinding.HelpFragmentBinding @@ -38,7 +36,6 @@ import org.linphone.ui.main.fragment.GenericFragment import org.linphone.ui.main.help.viewmodel.HelpViewModel import org.linphone.ui.main.history.model.ConfirmationDialogModel import org.linphone.utils.DialogUtils -import org.linphone.utils.FileUtils @UiThread class HelpFragment : GenericFragment() { @@ -111,17 +108,6 @@ class HelpFragment : GenericFragment() { } } - binding.setClearCacheCLickListener { - lifecycleScope.launch { - Log.w("$TAG User requested we clear the cache folder, doing it") - FileUtils.clearCacheDirectory() - (requireActivity() as GenericActivity).showGreenToast( - getString(R.string.help_cache_directory_cleared_toast_message), - R.drawable.info - ) - } - } - viewModel.newVersionAvailableEvent.observe(viewLifecycleOwner) { it.consume { pair -> val version = pair.first diff --git a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt index 31599fe23..770b4b296 100644 --- a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt @@ -118,10 +118,23 @@ class SettingsViewModel @UiThread constructor() : ViewModel() { val showColorSelector = MutableLiveData() val color = MutableLiveData() val availableColorsNames = arrayListOf( - "Orange", - "Yellow" + AppUtils.getString(R.string.orange), + AppUtils.getString(R.string.yellow), + AppUtils.getString(R.string.green), + AppUtils.getString(R.string.blue), + AppUtils.getString(R.string.red), + AppUtils.getString(R.string.pink), + AppUtils.getString(R.string.purple) + ) + val availableColorsValues = arrayListOf( + "orange", + "yellow", + "green", + "blue", + "red", + "pink", + "purple" ) - val availableColorsValues = arrayListOf("orange", "yellow") // Advanced settings val keepAliveThirdPartyAccountsService = MutableLiveData() diff --git a/app/src/main/res/layout/help_fragment.xml b/app/src/main/res/layout/help_fragment.xml index 41c4ed2af..35570b02b 100644 --- a/app/src/main/res/layout/help_fragment.xml +++ b/app/src/main/res/layout/help_fragment.xml @@ -17,9 +17,6 @@ - @@ -288,41 +285,12 @@ android:drawableEnd="@drawable/caret_right" android:drawablePadding="8dp" app:drawableTint="?attr/color_main2_500" + app:layout_constraintVertical_bias="0" app:layout_constraintTop_toBottomOf="@id/advanced_title" - app:layout_constraintBottom_toTopOf="@id/clear_cache_icon" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/debug_icon" app:layout_constraintEnd_toEndOf="parent"/> - - - - diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d6b58b5e3..445cef971 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -616,6 +616,15 @@ Transférer Copier le texte + + Orange + Jaune + Vert + Bleu + Rouge + Rose + Violet + Erreur de connexion au compte Vous n\'êtes pas connecté à internet diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index d541a812f..b5590f4fb 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -67,9 +67,39 @@ #FF923F #80FFFFFF - #FFE799 - #80FFE799 - #FFDE70 - #FFD23F - #FFCB1F + #FFF5D6 + #80FFF5D6 + #FFE799 + #F5BC00 + #A37D00 + + #DCF9E7 + #80DCF9E7 + #A8F0C2 + #25D366 + #1C9C4B + + #D6F4FF + #80D6F4FF + #99E4FF + #00aff0 + #0078A3 + + #FBE1DA + #80FBE1DA + #F5B53A + #E14318 + #A63211 + + #FFD6F1 + #80FFD6F1 + #FF99DD + #FF00A9 + #B8007A + + #FFD6FF + #80FFD6FF + #FF99FF + #800080 + #520052 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e070c004c..9d852d6dc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -652,6 +652,15 @@ Forward Copy + + Orange + Yellow + Green + Blue + Red + Pink + Purple + Account connection error You aren\'t connected to internet diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 55d0cc34a..60698bf80 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -59,6 +59,7 @@ + + + + + + + + + + - + + + + + + + + + +