added clickable links

remotes/origin/devel
yattoz 2019-12-13 20:19:34 +01:00
parent d4f6064e69
commit 900f9175b0
2 changed files with 7 additions and 24 deletions

View File

@ -36,7 +36,6 @@ import fr.forum_thalie.tsumugi.alarm.RadioAlarm
import fr.forum_thalie.tsumugi.alarm.RadioSleeper
import fr.forum_thalie.tsumugi.playerstore.PlayerStore
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.exp
import kotlin.math.ln
import kotlin.system.exitProcess
@ -362,16 +361,6 @@ class RadioService : MediaBrowserServiceCompat() {
Log.e(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
// Note : Kotlin supports UTF-8 by default.
numberOfSongs++
val s = entry.title!!
val a = ArrayList<Int>()
for (j in s.indices)
{
a.add(s[j].toInt())
}
Log.e(tag, a.toString())
Log.e(tag, "raw: ${it}")
val data = entry.title!!
PlayerStore.instance.currentSong.setTitleArtist(data)
}

View File

@ -2,18 +2,16 @@ package fr.forum_thalie.tsumugi.ui.news
import android.annotation.SuppressLint
import android.app.Activity
import android.app.PendingIntent.getActivity
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Point
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.graphics.drawable.LevelListDrawable
import android.net.Uri
import android.os.AsyncTask
import android.text.Html.ImageGetter
import android.text.method.LinkMovementMethod
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.TextView
@ -121,19 +119,16 @@ class NewsAdapter(private val dataSet: ArrayList<News>, private val c: Context
val author = holder.itemView.findViewById<TextView>(R.id.news_author)
val header = holder.itemView.findViewById<TextView>(R.id.news_header)
val date = holder.itemView.findViewById<TextView>(R.id.news_date)
title.text = dataSet[position].title
title.setOnClickListener {
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(dataSet[position].link)
c.startActivity(i)
}
val titleLink = "<a href=\"${dataSet[position].link}\">${dataSet[position].title}</>"
title.text = HtmlCompat.fromHtml(titleLink, HtmlCompat.FROM_HTML_MODE_LEGACY)
title.movementMethod = LinkMovementMethod.getInstance()
header.text = HtmlCompat.fromHtml(dataSet[position].header, HtmlCompat.FROM_HTML_MODE_LEGACY).replace(Regex("\n"), " ")
author.text = "| ${dataSet[position].author}"
val sdf = SimpleDateFormat("dd MMM yyyy", Locale.getDefault())
date.text = sdf.format(dataSet[position].date)
TextViewCompat.setAutoSizeTextTypeWithDefaults(author, TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM)
//val html = HtmlCompat.fromHtml(dataSet[position].text, HtmlCompat.FROM_HTML_MODE_LEGACY)
val spanned = HtmlCompat.fromHtml(
dataSet[position].text,
@ -149,8 +144,7 @@ class NewsAdapter(private val dataSet: ArrayList<News>, private val c: Context
}, null
)
text.text = spanned
text.movementMethod = LinkMovementMethod.getInstance()
}
// Return the size of your dataset (invoked by the layout manager)