mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Fix crash when switching between color gradient tabs.
This commit is contained in:
@@ -44,5 +44,6 @@ class ColorizerView @JvmOverloads constructor(
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
projections.forEach { it.release() }
|
||||
projections = emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,9 +107,19 @@ class ChatColorPreviewView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
redrawChatColors()
|
||||
}
|
||||
|
||||
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
|
||||
super.onLayout(changed, left, top, right, bottom)
|
||||
|
||||
redrawChatColors()
|
||||
}
|
||||
|
||||
private fun redrawChatColors() {
|
||||
if (chatColors != null) {
|
||||
setChatColors(requireNotNull(chatColors))
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ class CustomChatColorCreatorPageFragment :
|
||||
|
||||
private lateinit var hueSlider: AppCompatSeekBar
|
||||
private lateinit var saturationSlider: AppCompatSeekBar
|
||||
private lateinit var preview: ChatColorPreviewView
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
val args: CustomChatColorCreatorFragmentArgs = CustomChatColorCreatorFragmentArgs.fromBundle(requireArguments())
|
||||
@@ -59,7 +60,8 @@ class CustomChatColorCreatorPageFragment :
|
||||
factory
|
||||
)[CustomChatColorCreatorViewModel::class.java]
|
||||
|
||||
val preview: ChatColorPreviewView = view.findViewById(R.id.chat_color_preview)
|
||||
preview = view.findViewById(R.id.chat_color_preview)
|
||||
|
||||
val hueThumb = ThumbDrawable(requireContext())
|
||||
val saturationThumb = ThumbDrawable(requireContext())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user