Skip to content
Snippets Groups Projects
Verified Commit d46ab2f5 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fixed link coloring

parent 0f1aadc4
No related branches found
No related tags found
No related merge requests found
Pipeline #398 canceled
......@@ -127,7 +127,6 @@ class ContentFormatter @Inject constructor(
}
}
spans.reverse()
for (span in spans) {
span.apply(formattedText)
}
......
......@@ -22,8 +22,6 @@ package de.kuschku.quasseldroid.util.irc.format.model
import android.text.Spannable
import android.text.Spanned
import de.kuschku.libquassel.protocol.NetworkId
import de.kuschku.quasseldroid.util.irc.format.ChannelLinkSpan
import de.kuschku.quasseldroid.util.irc.format.QuasselURLSpan
import de.kuschku.quasseldroid.util.irc.format.spans.*
sealed class IrcFormat {
......
......@@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.kuschku.quasseldroid.util.irc.format
package de.kuschku.quasseldroid.util.irc.format.spans
import android.text.TextPaint
import android.text.style.ClickableSpan
......
......@@ -19,18 +19,26 @@
package de.kuschku.quasseldroid.util.irc.format.spans
import android.text.TextPaint
import android.text.style.ForegroundColorSpan
import androidx.annotation.ColorInt
sealed class IrcForegroundColorSpan<T : IrcForegroundColorSpan<T>>(@ColorInt color: Int) :
ForegroundColorSpan(color), Copyable<T> {
override fun updateDrawState(ds: TextPaint?) {
if (ds != null) {
ds.color = foregroundColor
ds.linkColor = foregroundColor
}
}
class MIRC(private val mircColor: Int, @ColorInt color: Int) :
IrcForegroundColorSpan<MIRC>(color), Copyable<MIRC> {
override fun copy() = MIRC(mircColor, foregroundColor)
override fun toString(): String {
return "IrcForegroundColorSpan.MIRC(mircColor=$mircColor, color=${foregroundColor.toString(16)})"
return "IrcForegroundColorSpan.MIRC(mircColor=$mircColor, color=${foregroundColor.toUInt().toString(
16)})"
}
override fun equals(other: Any?) = when (other) {
......@@ -43,7 +51,7 @@ sealed class IrcForegroundColorSpan<T : IrcForegroundColorSpan<T>>(@ColorInt col
IrcForegroundColorSpan<HEX>(color), Copyable<HEX> {
override fun copy() = HEX(foregroundColor)
override fun toString(): String {
return "IrcBackgroundColorSpan.HEX(color=${foregroundColor.toString(16)})"
return "IrcBackgroundColorSpan.HEX(color=${foregroundColor.toUInt().toString(16)})"
}
override fun equals(other: Any?) = when (other) {
......
......@@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.kuschku.quasseldroid.util.irc.format
package de.kuschku.quasseldroid.util.irc.format.spans
import android.text.TextPaint
import android.text.style.URLSpan
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment