Skip to content
This repository was archived by the owner on Feb 17, 2020. It is now read-only.

Commit bc3d0c9

Browse files
committed
Merge branches 'add_track_event_detail' and 'develop' of github.com:squanchy-dev/squanchy-android into add_track_event_detail
# Conflicts: # app/src/main/java/net/squanchy/eventdetails/widget/EventDetailsLayout.kt
1 parent c06b5b7 commit bc3d0c9

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

app/src/main/java/net/squanchy/eventdetails/widget/EventDetailsLayout.kt

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package net.squanchy.eventdetails.widget
22

33
import android.content.Context
4-
import android.content.res.Resources
54
import android.graphics.Color
65
import android.support.annotation.AttrRes
6+
import android.support.annotation.ColorInt
77
import android.support.constraint.ConstraintLayout
88
import android.support.v4.content.ContextCompat
99
import android.text.SpannableStringBuilder
@@ -19,8 +19,8 @@ import net.squanchy.R
1919
import net.squanchy.eventdetails.domain.view.ExperienceLevel
2020
import net.squanchy.schedule.domain.view.Event
2121
import net.squanchy.schedule.domain.view.Place
22-
import net.squanchy.support.content.res.getColorFromAttribute
2322
import net.squanchy.schedule.domain.view.Track
23+
import net.squanchy.support.content.res.getColorFromAttribute
2424
import net.squanchy.support.lang.getOrThrow
2525
import net.squanchy.support.text.parseHtml
2626
import org.joda.time.DateTimeZone
@@ -81,17 +81,10 @@ class EventDetailsLayout @JvmOverloads constructor(
8181
}
8282

8383
private fun createColorSpan(targetView: View, @AttrRes attributeResId: Int): ForegroundColorSpan {
84-
val color = getColorFromTheme(targetView.context.theme, attributeResId)
84+
val color = targetView.context.theme.getColorFromAttribute(attributeResId)
8585
return ForegroundColorSpan(color)
8686
}
8787

88-
@ColorInt
89-
private fun getColorFromTheme(theme: Resources.Theme, @AttrRes attributeId: Int): Int {
90-
val typedValue = TypedValue()
91-
theme.resolveAttribute(attributeId, typedValue, true)
92-
return typedValue.data
93-
}
94-
9588
private fun updateLevel(level: Option<ExperienceLevel>) {
9689
if (level.isDefined()) {
9790
levelGroup.isVisible = true
@@ -111,11 +104,6 @@ class EventDetailsLayout @JvmOverloads constructor(
111104
endCompoundDrawable?.setTint(color)
112105
}
113106

114-
private fun createColorSpan(targetView: View, @AttrRes attributeResId: Int): ForegroundColorSpan {
115-
val color = targetView.context.theme.getColorFromAttribute(attributeResId)
116-
return ForegroundColorSpan(color)
117-
}
118-
119107
private fun updateTrack(trackOption: Option<Track>) {
120108
if (trackOption.isDefined()) {
121109
trackGroup.isVisible = true

0 commit comments

Comments
 (0)