Skip to content

Commit

Permalink
Updated translations trings
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel committed Oct 31, 2023
1 parent d532158 commit c4d1e68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import io.noties.markwon.AbstractMarkwonPlugin
* Read more plugin based on text length.
* @see <a href="https://github.com/noties/Markwon/blob/v4.6.2/app-sample/src/main/java/io/noties/markwon/app/samples/ReadMorePluginSample.java#L208C2-L208C2">ReadMorePluginSample</a>
*/
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
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -141,4 +141,4 @@ class ReadMorePlugin : AbstractMarkwonPlugin() {
} else last
}
}
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@
<string name="OONIRun_InvalidParameter_Msg">The OONI Run link is either malformed or your app is out of date.</string>
<string name="OONIRun_RandomSamplingOfURLs">You will test a random sample of websites.</string>
<string name="OONIRun_TestRunningError">Please wait for the test to finish running before tapping on an OONI Run link.</string>
<string name="OONIRun_ReadMore">Read more ></string>
<string name="OONIRun_ReadLess">Read less ></string>
<string name="CategoryCode_ALDR_Name">Drugs &amp; Alcohol</string>
<string name="CategoryCode_REL_Name">Religion</string>
<string name="CategoryCode_PORN_Name">Pornography</string>
Expand Down

0 comments on commit c4d1e68

Please sign in to comment.