mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 20:45:17 +00:00
Make style consistent across platforms
This commit is contained in:
parent
c9ecd0ded3
commit
e667c6ee7e
@ -41,8 +41,8 @@
|
||||
android:paddingBottom="15dp"
|
||||
app:widgetBackground="?conversation_item_bubble_background"
|
||||
app:foregroundTintColor="?android:colorControlNormal"
|
||||
app:backgroundTintColor="?conversation_item_bubble_background"
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color"/>
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color_outgoing"
|
||||
app:waveformBackgroundColor="?conversation_item_audio_seek_bar_background_color"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.DocumentView
|
||||
android:id="@+id/attachment_document"
|
||||
|
@ -8,6 +8,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:foregroundTintColor="?android:colorControlNormal"
|
||||
app:backgroundTintColor="?message_received_background_color"
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color"
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color_incoming"
|
||||
app:waveformBackgroundColor="?conversation_item_audio_seek_bar_background_color"
|
||||
tools:visibility="visible"/>
|
||||
|
@ -6,6 +6,6 @@
|
||||
android:layout_width="210dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:foregroundTintColor="?android:colorControlNormal"
|
||||
app:backgroundTintColor="?message_sent_background_color"
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color"
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color_outgoing"
|
||||
app:waveformBackgroundColor="?conversation_item_audio_seek_bar_background_color"
|
||||
android:visibility="gone"/>
|
||||
|
@ -28,7 +28,8 @@
|
||||
|
||||
<item name="menu_info_icon">@drawable/ic_outline_info_24</item>
|
||||
|
||||
<item name="conversation_item_audio_seek_bar_color">?colorControlNormal</item>
|
||||
<item name="conversation_item_audio_seek_bar_color_incoming">@color/accent</item>
|
||||
<item name="conversation_item_audio_seek_bar_color_outgoing">@color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Session.DayNight" parent="Theme.Session.Light">
|
||||
|
@ -84,7 +84,9 @@
|
||||
<attr name="conversation_item_sticky_date_background" format="reference" />
|
||||
<attr name="conversation_item_sticky_date_text_color" format="color" />
|
||||
<attr name="conversation_item_image_outline_color" format="color" />
|
||||
<attr name="conversation_item_audio_seek_bar_color" format="reference|color" />
|
||||
<attr name="conversation_item_audio_seek_bar_color_incoming" format="reference|color" />
|
||||
<attr name="conversation_item_audio_seek_bar_color_outgoing" format="reference|color" />
|
||||
<attr name="conversation_item_audio_seek_bar_background_color" format="reference|color" />
|
||||
|
||||
<attr name="dialog_info_icon" format="reference" />
|
||||
<attr name="dialog_alert_icon" format="reference" />
|
||||
@ -173,8 +175,8 @@
|
||||
<declare-styleable name="MessageAudioView">
|
||||
<attr name="widgetBackground" format="color"/>
|
||||
<attr name="foregroundTintColor" format="color" />
|
||||
<attr name="backgroundTintColor" format="color" />
|
||||
<attr name="waveformFillColor" format="reference|color" />
|
||||
<attr name="waveformBackgroundColor" format="reference|color" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="CircleColorImageView">
|
||||
|
@ -88,7 +88,9 @@
|
||||
<item name="quick_camera_icon">@drawable/ic_baseline_photo_camera_24</item>
|
||||
<item name="quick_mic_icon">@drawable/ic_baseline_mic_24</item>
|
||||
|
||||
<item name="conversation_item_audio_seek_bar_color">?colorAccent</item>
|
||||
<item name="conversation_item_audio_seek_bar_color_incoming">@color/accent</item>
|
||||
<item name="conversation_item_audio_seek_bar_color_outgoing">@color/accent</item>
|
||||
<item name="conversation_item_audio_seek_bar_background_color">@color/text</item>
|
||||
</style>
|
||||
|
||||
<!-- This should be the default theme for the application. -->
|
||||
|
@ -30,6 +30,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||
import org.thoughtcrime.securesms.events.PartProgressEvent
|
||||
import org.thoughtcrime.securesms.logging.Log
|
||||
import org.thoughtcrime.securesms.loki.api.PrepareAttachmentAudioExtrasJob
|
||||
import org.thoughtcrime.securesms.loki.utilities.getColorWithID
|
||||
import org.thoughtcrime.securesms.mms.AudioSlide
|
||||
import org.thoughtcrime.securesms.mms.SlideClickListener
|
||||
import java.io.IOException
|
||||
@ -115,8 +116,8 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
if (attrs != null) {
|
||||
val typedArray = context.theme.obtainStyledAttributes(attrs, R.styleable.MessageAudioView, 0, 0)
|
||||
setTint(typedArray.getColor(R.styleable.MessageAudioView_foregroundTintColor, Color.WHITE),
|
||||
typedArray.getColor(R.styleable.MessageAudioView_backgroundTintColor, Color.WHITE),
|
||||
typedArray.getColor(R.styleable.MessageAudioView_waveformFillColor, Color.WHITE))
|
||||
typedArray.getColor(R.styleable.MessageAudioView_waveformFillColor, Color.WHITE),
|
||||
typedArray.getColor(R.styleable.MessageAudioView_waveformBackgroundColor, Color.WHITE))
|
||||
container.setBackgroundColor(typedArray.getColor(R.styleable.MessageAudioView_widgetBackground, Color.TRANSPARENT))
|
||||
typedArray.recycle()
|
||||
}
|
||||
@ -182,23 +183,22 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
downloadListener = listener
|
||||
}
|
||||
|
||||
fun setTint(@ColorInt foregroundTint: Int, @ColorInt backgroundTint: Int, @ColorInt waveformFill: Int) {
|
||||
playButton.backgroundTintList = ColorStateList.valueOf(foregroundTint)
|
||||
playButton.imageTintList = ColorStateList.valueOf(backgroundTint)
|
||||
pauseButton.backgroundTintList = ColorStateList.valueOf(foregroundTint)
|
||||
pauseButton.imageTintList = ColorStateList.valueOf(backgroundTint)
|
||||
fun setTint(@ColorInt foregroundTint: Int, @ColorInt waveformFill: Int, @ColorInt waveformBackground: Int) {
|
||||
playButton.backgroundTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.white, context.theme))
|
||||
playButton.imageTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.black, context.theme))
|
||||
pauseButton.backgroundTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.white, context.theme))
|
||||
pauseButton.imageTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.black, context.theme))
|
||||
|
||||
downloadButton.setColorFilter(foregroundTint, PorterDuff.Mode.SRC_IN)
|
||||
|
||||
downloadProgress.backgroundTintList = ColorStateList.valueOf(foregroundTint)
|
||||
downloadProgress.progressTintList = ColorStateList.valueOf(backgroundTint)
|
||||
downloadProgress.indeterminateTintList = ColorStateList.valueOf(backgroundTint)
|
||||
downloadProgress.backgroundTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.white, context.theme))
|
||||
downloadProgress.progressTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.black, context.theme))
|
||||
downloadProgress.indeterminateTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.black, context.theme))
|
||||
|
||||
totalDuration.setTextColor(foregroundTint)
|
||||
|
||||
// Seek bar's progress color is set from the XML template. Whereas the background is computed.
|
||||
seekBar.barProgressColor = waveformFill
|
||||
seekBar.barBackgroundColor = ColorUtils.blendARGB(foregroundTint, backgroundTint, 0.75f)
|
||||
seekBar.barBackgroundColor = waveformBackground
|
||||
}
|
||||
|
||||
override fun onPlayerStart(player: AudioSlidePlayer) {
|
||||
@ -309,7 +309,7 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
private var active = false
|
||||
|
||||
companion object {
|
||||
private const val UPDATE_PERIOD = 350L // In milliseconds.
|
||||
private const val UPDATE_PERIOD = 250L // In milliseconds.
|
||||
private val random = Random()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user