Commit 726b46dd authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

adjust pictures sizes

parent 6dbbbb66
...@@ -50,7 +50,7 @@ fun fromRaw(raw:ArticleRaw) : ArticleEntity { ...@@ -50,7 +50,7 @@ fun fromRaw(raw:ArticleRaw) : ArticleEntity {
fun fromRaw(raw:NewsArticleRaw,feedId:Int):ArticleEntity{ fun fromRaw(raw:NewsArticleRaw,feedId:Int):ArticleEntity{
val entity = ArticleEntity() val entity = ArticleEntity()
entity.setId(raw.id) entity.setId(raw.id)
entity.setPreview("https://room-park.ru${raw.preview}") entity.setPreview(raw.preview)
entity.setAnnounce(raw.announce) entity.setAnnounce(raw.announce)
entity.setPublished(raw.published) entity.setPublished(raw.published)
entity.setTitle(raw.title) entity.setTitle(raw.title)
......
...@@ -14,7 +14,6 @@ import com.biganto.visual.roompark.R ...@@ -14,7 +14,6 @@ import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.util.view_utils.html.HtmlTagHandler
import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.textview.MaterialTextView import com.google.android.material.textview.MaterialTextView
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
...@@ -123,7 +122,7 @@ class ArticleScreenController : ...@@ -123,7 +122,7 @@ class ArticleScreenController :
val imageGetter = PicassoImageGetter(contentView) val imageGetter = PicassoImageGetter(contentView)
val parsedHtml = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) val parsedHtml = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
Html.fromHtml(viewState.item.htmlBody, Html.fromHtml(viewState.item.htmlBody,
HtmlCompat.FROM_HTML_MODE_LEGACY HtmlCompat.FROM_HTML_MODE_COMPACT
, ,
imageGetter imageGetter
// Html.ImageGetter { url -> // Html.ImageGetter { url ->
...@@ -135,7 +134,7 @@ class ArticleScreenController : ...@@ -135,7 +134,7 @@ class ArticleScreenController :
// .toDrawable(resources!!) // .toDrawable(resources!!)
//// .current //// .current
// } // }
, HtmlTagHandler()) , null)
else Html.fromHtml(viewState.item.htmlBody else Html.fromHtml(viewState.item.htmlBody
, ,
imageGetter imageGetter
...@@ -148,7 +147,7 @@ class ArticleScreenController : ...@@ -148,7 +147,7 @@ class ArticleScreenController :
// .toDrawable(resources!!) // .toDrawable(resources!!)
//// .current //// .current
// } // }
, HtmlTagHandler()) , null)
contentView.text = parsedHtml contentView.text = parsedHtml
......
...@@ -42,9 +42,12 @@ class PicassoImageGetter(private val target: MaterialTextView) : Html.ImageGette ...@@ -42,9 +42,12 @@ class PicassoImageGetter(private val target: MaterialTextView) : Html.ImageGette
var width = drawable.intrinsicWidth var width = drawable.intrinsicWidth
var height = drawable.intrinsicHeight var height = drawable.intrinsicHeight
target.let { target.let {
val aspect = it.measuredWidthAndState.toFloat()/width.toFloat() val aspect = it.width.toFloat()/width.toFloat()
height = (height*min(aspect,1.0f)).toInt()
width = min(width,it.measuredWidthAndState) height = if (width>it.width) (height*min(aspect,1.0f)).toInt()
else (height.toFloat()*aspect).toInt()
width = if (width>it.width) width
else it.width
drawable.setBounds(0, 0, width, height) drawable.setBounds(0, 0, width, height)
setBounds(0, 0, width, height) setBounds(0, 0, width, height)
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_favorites" /> app:srcCompat="@drawable/ic_favorites" />
<TextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/articleDate" android:id="@+id/articleDate"
style="@style/Feed.Notice" style="@style/Feed.Notice"
android:layout_width="0dp" android:layout_width="0dp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment