Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
carloscj6 committed Nov 25, 2019
1 parent 79e227c commit e7ea8ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.revosleap.wpdroid.ui.recyclerview.itemViews

import android.os.Build
import android.text.Html
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -37,11 +39,11 @@ class ItemViewBlog : ItemViewBinder<PostResponse, ItemViewBlog.BlogItemView>(),

class BlogItemView(itemView: View) : RecyclerView.ViewHolder(itemView), AnkoLogger {
val imageView: ImageView = itemView.findViewById(R.id.imageViewPost)
val title: HtmlTextView = itemView.findViewById(R.id.textViewPostTitle)
val title: TextView = itemView.findViewById(R.id.textViewPostTitle)
val info: TextView = itemView.findViewById(R.id.textViewTimeInfo)

fun bind(postResponse: PostResponse) {
title.setHtml(postResponse.title?.rendered!!)
val titleText=postResponse.title?.rendered!!
getImage(postResponse.featuredMedia!!)
itemView.setOnClickListener {
itemView.context.startActivity<ArticleActivity>(Utilities.BLOG_ID to postResponse.id)
Expand All @@ -50,6 +52,9 @@ class ItemViewBlog : ItemViewBinder<PostResponse, ItemViewBlog.BlogItemView>(),
val sdfInput = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault())
val date = sdfInput.parse(postResponse.dateGmt)
info.text = sdf.format(date)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
title.text = Html.fromHtml(titleText, Html.FROM_HTML_MODE_COMPACT)
} else title.text = Html.fromHtml(titleText)
}

private fun getImage(id: Long) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_posts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:contentDescription="@string/app_name"/>

</androidx.cardview.widget.CardView>
<org.sufficientlysecure.htmltextview.HtmlTextView
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
Expand Down

0 comments on commit e7ea8ef

Please sign in to comment.