From c4d1e68d83525fb013b59be43e048d95f326b279 Mon Sep 17 00:00:00 2001 From: Norbel Ambanumben Date: Tue, 31 Oct 2023 21:51:30 +0100 Subject: [PATCH] Updated translations trings --- .../ooniprobe/activity/OverviewActivity.java | 6 ++++-- .../openobservatory/ooniprobe/common/ReadMorePlugin.kt | 10 +++++----- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/OverviewActivity.java b/app/src/main/java/org/openobservatory/ooniprobe/activity/OverviewActivity.java index a5b2c3aee..296232913 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/OverviewActivity.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/OverviewActivity.java @@ -52,8 +52,10 @@ public static Intent newIntent(Context context, AbstractSuite testSuite) { binding.icon.setImageResource(testSuite.getIcon()); binding.customUrl.setVisibility(testSuite.getName().equals(WebsitesSuite.NAME) ? View.VISIBLE : View.GONE); Markwon markwon = Markwon.builder(this) - .usePlugin(new ReadMorePlugin()) - .build(); + .usePlugin(new ReadMorePlugin( + getString(R.string.OONIRun_ReadMore), + getString(R.string.OONIRun_ReadLess)) + ).build(); if (testSuite.getName().equals(ExperimentalSuite.NAME)) { String experimentalLinks = "\n\n* [STUN Reachability](https://github.com/ooni/spec/blob/master/nettests/ts-025-stun-reachability.md)" + diff --git a/app/src/main/java/org/openobservatory/ooniprobe/common/ReadMorePlugin.kt b/app/src/main/java/org/openobservatory/ooniprobe/common/ReadMorePlugin.kt index 4041f6958..a792cfb4d 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/common/ReadMorePlugin.kt +++ b/app/src/main/java/org/openobservatory/ooniprobe/common/ReadMorePlugin.kt @@ -13,10 +13,8 @@ import io.noties.markwon.AbstractMarkwonPlugin * Read more plugin based on text length. * @see ReadMorePluginSample */ -class ReadMorePlugin : AbstractMarkwonPlugin() { +class ReadMorePlugin(private val labelMore:String, private val labelLess:String) : AbstractMarkwonPlugin() { private val maxLength = 150 - private val labelMore = "\n\nRead more >" - private val labelLess = "\n\nRead less >" override fun afterSetText(textView: TextView) { val text = textView.text @@ -57,7 +55,8 @@ class ReadMorePlugin : AbstractMarkwonPlugin() { val fullText = createFullText(text, builder) builder.append(" ...") val length = builder.length - builder.append(labelMore) + builder.append("\n\n") + builder.append(labelMore) builder.setSpan(object : ClickableSpan() { override fun onClick(widget: View) { (widget as TextView).text = fullText @@ -76,6 +75,7 @@ class ReadMorePlugin : AbstractMarkwonPlugin() { val builder = SpannableStringBuilder(text) builder.append(' ') val length = builder.length + builder.append("\n\n") builder.append(labelLess) builder.setSpan(object : ClickableSpan() { override fun onClick(widget: View) { @@ -141,4 +141,4 @@ class ReadMorePlugin : AbstractMarkwonPlugin() { } else last } } -} \ No newline at end of file +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index db87e2f35..d350c9f65 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -468,6 +468,8 @@ The OONI Run link is either malformed or your app is out of date. You will test a random sample of websites. Please wait for the test to finish running before tapping on an OONI Run link. + Read more > + Read less > Drugs & Alcohol Religion Pornography