mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 02:17:43 +03:00
Use extensions
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
298943963f
commit
b773a1455f
2 changed files with 35 additions and 14 deletions
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Alper Ozturk
|
||||
* Copyright (C) 2023 Alper Ozturk
|
||||
* Copyright (C) 2023 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.nextcloud.utils.extensions
|
||||
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.widget.TextView
|
||||
import androidx.core.text.HtmlCompat
|
||||
|
||||
fun TextView.setHtmlContent(value: String) {
|
||||
movementMethod = LinkMovementMethod.getInstance()
|
||||
text = HtmlCompat.fromHtml(value, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
}
|
|
@ -24,7 +24,7 @@ package com.owncloud.android.ui.activity
|
|||
import android.os.Bundle
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.MenuItem
|
||||
import androidx.core.text.HtmlCompat
|
||||
import com.nextcloud.utils.extensions.setHtmlContent
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.databinding.CommunityLayoutBinding
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
|
@ -53,8 +53,6 @@ class CommunityActivity : DrawerActivity() {
|
|||
}
|
||||
|
||||
private fun setupContributeForumView() {
|
||||
val contributeForumView = binding.communityContributeForumText
|
||||
contributeForumView.movementMethod = LinkMovementMethod.getInstance()
|
||||
val htmlContent = getString(R.string.community_contribute_forum_text) + " " +
|
||||
getString(
|
||||
R.string.community_contribute_forum_text_link,
|
||||
|
@ -63,12 +61,10 @@ class CommunityActivity : DrawerActivity() {
|
|||
getString(R.string.help_link),
|
||||
getString(R.string.community_contribute_forum_forum)
|
||||
)
|
||||
contributeForumView.text = HtmlCompat.fromHtml(htmlContent, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
binding.communityContributeForumText.setHtmlContent(htmlContent)
|
||||
}
|
||||
|
||||
private fun setupContributeTranslationView() {
|
||||
val contributeTranslationView = binding.communityContributeTranslateText
|
||||
contributeTranslationView.movementMethod = LinkMovementMethod.getInstance()
|
||||
val htmlContent = getString(
|
||||
R.string.community_contribute_translate_link,
|
||||
viewThemeUtils.files.primaryColorToHexString(this),
|
||||
|
@ -76,13 +72,10 @@ class CommunityActivity : DrawerActivity() {
|
|||
getString(R.string.community_contribute_translate_translate)
|
||||
) + " " +
|
||||
getString(R.string.community_contribute_translate_text)
|
||||
|
||||
contributeTranslationView.text = HtmlCompat.fromHtml(htmlContent, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
binding.communityContributeTranslateText.setHtmlContent(htmlContent)
|
||||
}
|
||||
|
||||
private fun setupContributeGithubView() {
|
||||
val contributeGithubView = binding.communityContributeGithubText
|
||||
contributeGithubView.movementMethod = LinkMovementMethod.getInstance()
|
||||
val htmlContent = getString(
|
||||
R.string.community_contribute_github_text,
|
||||
getString(
|
||||
|
@ -91,10 +84,7 @@ class CommunityActivity : DrawerActivity() {
|
|||
getString(R.string.contributing_link)
|
||||
)
|
||||
)
|
||||
contributeGithubView.text = HtmlCompat.fromHtml(
|
||||
htmlContent,
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
binding.communityContributeGithubText.setHtmlContent(htmlContent)
|
||||
}
|
||||
|
||||
private fun setupReportButton() {
|
||||
|
|
Loading…
Reference in a new issue