Commit 3d3e623a authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

format date formatting

parent 501b0ea3
......@@ -15,6 +15,7 @@ import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.util.extensions.formatToSimple
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.textview.MaterialTextView
import com.squareup.picasso.Picasso
......@@ -151,7 +152,7 @@ class ArticleScreenController :
contentView.text = parsedHtml
articleDate.text = viewState.item.published.toString()
articleDate.text = viewState.item.published.formatToSimple
Picasso.get()
.load(viewState.item.previewUrl)
......
......@@ -8,10 +8,9 @@ import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.domain.model.ArticlePreviewModel
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import com.biganto.visual.roompark.util.extensions.formatToSimple
import com.biganto.visual.roompark.util.extensions.setGone
import com.squareup.picasso.Picasso
import java.text.SimpleDateFormat
import java.util.*
/**
......@@ -28,15 +27,13 @@ class ArticlesPreviewAdapter : CommonRecyclerAdapter<ArticlePreviewViewHolder,Ar
class ArticlePreviewViewHolder(itemView: View) : CommonViewHolder<ArticlePreviewModel>(itemView) {
private val dateFormatter = SimpleDateFormat("dd / MM / yyyy", Locale.getDefault())
@BindView(R.id.imageHolder) lateinit var preview:ImageView
@BindView(R.id.feed_date_text_view) lateinit var articleDate:TextView
@BindView(R.id.feed_title_info_text_view) lateinit var articleTitle:TextView
@BindView(R.id.feed_read) lateinit var articleIsRead:View
override fun onViewBound(model: ArticlePreviewModel) {
articleDate.text = dateFormatter.format(model.published)
articleDate.text = model.published.formatToSimple
articleTitle.text = model.title
articleIsRead.setGone(model.isRead)
......
......@@ -6,13 +6,19 @@ import android.graphics.RectF
import android.view.View
import timber.log.Timber
import java.text.DecimalFormat
import java.text.SimpleDateFormat
import java.util.*
/**
* Created by Vladislav Bogdashkin on 23.10.2019.
*/
private val dateFormatter = SimpleDateFormat("dd / MM / yyyy", Locale.getDefault())
val Date.formatToSimple: String
get() = dateFormatter.format(this)
val Boolean?.asInt
get() = if (this != null && this) 1 else 0
......
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