Skip to content

Commit

Permalink
zobrazování obrázků v novinkách
Browse files Browse the repository at this point in the history
  • Loading branch information
Kutner Lukas authored and Kutner Lukas committed Jun 4, 2018
1 parent 98970dc commit ebd977a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions app/src/main/kotlin/cz/kutner/comicsdb/model/NewsItem.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package cz.kutner.comicsdb.model

import android.text.Spanned
import androidx.core.text.parseAsHtml
import java.util.*

data class NewsItem(val title: String?, val nick: String, val text: String, val time: Date) : Item {
fun getTextFromHtml(): Spanned? =
text.replace("href='/", "href='http://www.comicsdb.cz/").parseAsHtml()
fun getTextWithUrl(): String =
text.replace("href='/", "href='http://www.comicsdb.cz/")
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/list_item_news.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
android:layout_height="wrap_content"
android:layout_below="@+id/newsItemTime"
android:paddingTop="5dp"
android:text="@{newsItem.getTextFromHtml()}"
app:htmlWithImage="@{newsItem.getTextWithUrl()}"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Vlastní text zprávy, který může být docela dost dlouhý, ale to nevadí, protože se to docela pěkně zalomí" />

Expand Down

0 comments on commit ebd977a

Please sign in to comment.