Fixed dialog theme status bar color + added more colors (for fun)

This commit is contained in:
Sylvain Berfini 2024-04-24 17:09:23 +02:00
parent fbf2d39640
commit 2070f8fb08
9 changed files with 161 additions and 57 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -118,10 +118,23 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
val showColorSelector = MutableLiveData<Boolean>()
val color = MutableLiveData<String>()
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<Boolean>()

View file

@ -17,9 +17,6 @@
<variable
name="translateClickListener"
type="View.OnClickListener" />
<variable
name="clearCacheCLickListener"
type="View.OnClickListener" />
<variable
name="debugClickListener"
type="View.OnClickListener" />
@ -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"/>
<ImageView
android:onClick="@{clearCacheCLickListener}"
android:id="@+id/clear_cache_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="16dp"
android:src="@drawable/file"
app:tint="?attr/color_main1_500"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/clear_cache_title"
app:layout_constraintTop_toTopOf="@id/clear_cache_title"
app:layout_constraintBottom_toBottomOf="@id/clear_cache_title" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/header_style"
android:onClick="@{clearCacheCLickListener}"
android:id="@+id/clear_cache_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="24dp"
android:layout_marginBottom="@dimen/screen_bottom_margin"
android:text="@string/help_clear_cache_directory"
app:layout_constraintVertical_bias="0"
app:layout_constraintTop_toBottomOf="@id/debug_title"
app:layout_constraintStart_toEndOf="@id/clear_cache_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View file

@ -616,6 +616,15 @@
<string name="menu_forward_chat_message">Transférer</string>
<string name="menu_copy_chat_message">Copier le texte</string>
<!-- Colors -->
<string name="orange">Orange</string>
<string name="yellow">Jaune</string>
<string name="green">Vert</string>
<string name="blue">Bleu</string>
<string name="red">Rouge</string>
<string name="pink">Rose</string>
<string name="purple">Violet</string>
<!-- Misc -->
<string name="connection_error_for_non_default_account">Erreur de connexion au compte</string>
<string name="network_not_reachable">Vous n\'êtes pas connecté à internet</string>

View file

@ -67,9 +67,39 @@
<color name="gradient_start">#FF923F</color>
<color name="gradient_progress">#80FFFFFF</color>
<color name="yellow_main_100">#FFE799</color>
<color name="yellow_main_100_alpha_50">#80FFE799</color>
<color name="yellow_main_300">#FFDE70</color>
<color name="yellow_main_500">#FFD23F</color>
<color name="yellow_main_700">#FFCB1F</color>
<color name="yellow_main_100">#FFF5D6</color>
<color name="yellow_main_100_alpha_50">#80FFF5D6</color>
<color name="yellow_main_300">#FFE799</color>
<color name="yellow_main_500">#F5BC00</color>
<color name="yellow_main_700">#A37D00</color>
<color name="green_main_100">#DCF9E7</color>
<color name="green_main_100_alpha_50">#80DCF9E7</color>
<color name="green_main_300">#A8F0C2</color>
<color name="green_main_500">#25D366</color>
<color name="green_main_700">#1C9C4B</color>
<color name="blue_main_100">#D6F4FF</color>
<color name="blue_main_100_alpha_50">#80D6F4FF</color>
<color name="blue_main_300">#99E4FF</color>
<color name="blue_main_500">#00aff0</color>
<color name="blue_main_700">#0078A3</color>
<color name="red_main_100">#FBE1DA</color>
<color name="red_main_100_alpha_50">#80FBE1DA</color>
<color name="red_main_300">#F5B53A</color>
<color name="red_main_500">#E14318</color>
<color name="red_main_700">#A63211</color>
<color name="pink_main_100">#FFD6F1</color>
<color name="pink_main_100_alpha_50">#80FFD6F1</color>
<color name="pink_main_300">#FF99DD</color>
<color name="pink_main_500">#FF00A9</color>
<color name="pink_main_700">#B8007A</color>
<color name="purple_main_100">#FFD6FF</color>
<color name="purple_main_100_alpha_50">#80FFD6FF</color>
<color name="purple_main_300">#FF99FF</color>
<color name="purple_main_500">#800080</color>
<color name="purple_main_700">#520052</color>
</resources>

View file

@ -652,6 +652,15 @@
<string name="menu_forward_chat_message">Forward</string>
<string name="menu_copy_chat_message">Copy</string>
<!-- Colors -->
<string name="orange">Orange</string>
<string name="yellow">Yellow</string>
<string name="green">Green</string>
<string name="blue">Blue</string>
<string name="red">Red</string>
<string name="pink">Pink</string>
<string name="purple">Purple</string>
<!-- Misc -->
<string name="connection_error_for_non_default_account">Account connection error</string>
<string name="network_not_reachable">You aren\'t connected to internet</string>

View file

@ -59,6 +59,7 @@
<style name="Theme.LinphoneYellow" parent="Theme.Linphone">
<item name="android:statusBarColor">@color/yellow_main_500</item>
<item name="color_main1_100">@color/yellow_main_100</item>
<item name="color_main1_100_alpha_50">@color/yellow_main_100_alpha_50</item>
<item name="color_main1_300">@color/yellow_main_300</item>
@ -66,6 +67,56 @@
<item name="color_main1_700">@color/yellow_main_700</item>
</style>
<style name="Theme.LinphoneGreen" parent="Theme.Linphone">
<item name="android:statusBarColor">@color/green_main_500</item>
<item name="color_main1_100">@color/green_main_100</item>
<item name="color_main1_100_alpha_50">@color/green_main_100_alpha_50</item>
<item name="color_main1_300">@color/green_main_300</item>
<item name="color_main1_500">@color/green_main_500</item>
<item name="color_main1_700">@color/green_main_700</item>
</style>
<style name="Theme.LinphoneBlue" parent="Theme.Linphone">
<item name="android:statusBarColor">@color/blue_main_500</item>
<item name="color_main1_100">@color/blue_main_100</item>
<item name="color_main1_100_alpha_50">@color/blue_main_100_alpha_50</item>
<item name="color_main1_300">@color/blue_main_300</item>
<item name="color_main1_500">@color/blue_main_500</item>
<item name="color_main1_700">@color/blue_main_700</item>
</style>
<style name="Theme.LinphoneRed" parent="Theme.Linphone">
<item name="android:statusBarColor">@color/red_main_500</item>
<item name="color_main1_100">@color/red_main_100</item>
<item name="color_main1_100_alpha_50">@color/red_main_100_alpha_50</item>
<item name="color_main1_300">@color/red_main_300</item>
<item name="color_main1_500">@color/red_main_500</item>
<item name="color_main1_700">@color/red_main_700</item>
</style>
<style name="Theme.LinphonePink" parent="Theme.Linphone">
<item name="android:statusBarColor">@color/pink_main_500</item>
<item name="color_main1_100">@color/pink_main_100</item>
<item name="color_main1_100_alpha_50">@color/pink_main_100_alpha_50</item>
<item name="color_main1_300">@color/pink_main_300</item>
<item name="color_main1_500">@color/pink_main_500</item>
<item name="color_main1_700">@color/pink_main_700</item>
</style>
<style name="Theme.LinphonePurple" parent="Theme.Linphone">
<item name="android:statusBarColor">@color/purple_main_500</item>
<item name="color_main1_100">@color/purple_main_100</item>
<item name="color_main1_100_alpha_50">@color/purple_main_100_alpha_50</item>
<item name="color_main1_300">@color/purple_main_300</item>
<item name="color_main1_500">@color/purple_main_500</item>
<item name="color_main1_700">@color/purple_main_700</item>
</style>
<!-- In-call application theme. -->
<style name="Theme.LinphoneInCall" parent="Theme.Linphone">
<item name="android:navigationBarColor">@color/gray_600</item>
@ -77,7 +128,35 @@
<item name="android:windowBackground">@color/black</item>
</style>
<style name="Theme.LinphoneDialog" parent="Theme.Linphone">
<style name="Theme.LinphoneInCallGreen" parent="Theme.LinphoneGreen">
<item name="android:navigationBarColor">@color/gray_600</item>
<item name="android:windowBackground">@color/black</item>
</style>
<style name="Theme.LinphoneInCallBlue" parent="Theme.LinphoneBlue">
<item name="android:navigationBarColor">@color/gray_600</item>
<item name="android:windowBackground">@color/black</item>
</style>
<style name="Theme.LinphoneInCallRed" parent="Theme.LinphoneRed">
<item name="android:navigationBarColor">@color/gray_600</item>
<item name="android:windowBackground">@color/black</item>
</style>
<style name="Theme.LinphoneInCallPink" parent="Theme.LinphonePink">
<item name="android:navigationBarColor">@color/gray_600</item>
<item name="android:windowBackground">@color/black</item>
</style>
<style name="Theme.LinphoneInCallPurple" parent="Theme.LinphonePurple">
<item name="android:navigationBarColor">@color/gray_600</item>
<item name="android:windowBackground">@color/black</item>
</style>
<style name="Theme.LinphoneDialog" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:statusBarColor">@color/gray_600</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowActivityTransitions">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowBackground">@color/transparent_color</item>
<item name="android:navigationBarColor">@color/transparent_color</item>