From bdcfbbb377c35f152e42708e1f4617788847b13f Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 26 Sep 2022 19:31:09 +0200 Subject: [PATCH] move community activity hyperlink theming to m3 Signed-off-by: Andy Scherzinger --- .../owncloud/android/ui/activity/CommunityActivity.java | 8 +++++--- .../com/owncloud/android/utils/theme/ThemeColorUtils.java | 4 ---- .../utils/theme/newm3/FilesSpecificViewThemeUtils.kt | 6 ++++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java index 71270e6c94..05662f63b7 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java @@ -64,7 +64,9 @@ public class CommunityActivity extends DrawerActivity { contributeForumView.setMovementMethod(LinkMovementMethod.getInstance()); contributeForumView.setText(Html.fromHtml(getString(R.string.community_contribute_forum_text) + " " + getString(R.string.community_contribute_forum_text_link, - themeColorUtils.primaryColorToHexString(this), + viewThemeUtils + .files + .primaryColorToHexString(this), getString(R.string.help_link), getString(R.string.community_contribute_forum_forum)))); @@ -72,7 +74,7 @@ public class CommunityActivity extends DrawerActivity { contributeTranslationView.setMovementMethod(LinkMovementMethod.getInstance()); contributeTranslationView.setText(Html.fromHtml( getString(R.string.community_contribute_translate_link, - themeColorUtils.primaryColorToHexString(this), + viewThemeUtils.files.primaryColorToHexString(this), getString(R.string.translation_link), getString(R.string.community_contribute_translate_translate)) + " " + getString(R.string.community_contribute_translate_text))); @@ -82,7 +84,7 @@ public class CommunityActivity extends DrawerActivity { contributeGithubView.setText(Html.fromHtml( getString(R.string.community_contribute_github_text, getString(R.string.community_contribute_github_text_link, - themeColorUtils.primaryColorToHexString(this), + viewThemeUtils.files.primaryColorToHexString(this), getString(R.string.contributing_link))))); MaterialButton reportButton = binding.communityTestingReport; diff --git a/app/src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java b/app/src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java index 04edbd045d..435e84192a 100644 --- a/app/src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java +++ b/app/src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java @@ -294,10 +294,6 @@ public class ThemeColorUtils { return Configuration.UI_MODE_NIGHT_YES == nightModeFlag; } - public String primaryColorToHexString(Context context) { - return String.format("#%06X", 0xFFFFFF & primaryColor(context, true)); - } - public int unchangedPrimaryColor(Account account, Context context) { try { return Color.parseColor(getCapability(account, context).getServerColor()); diff --git a/app/src/main/java/com/owncloud/android/utils/theme/newm3/FilesSpecificViewThemeUtils.kt b/app/src/main/java/com/owncloud/android/utils/theme/newm3/FilesSpecificViewThemeUtils.kt index 89d61a2cbf..132297e7d8 100644 --- a/app/src/main/java/com/owncloud/android/utils/theme/newm3/FilesSpecificViewThemeUtils.kt +++ b/app/src/main/java/com/owncloud/android/utils/theme/newm3/FilesSpecificViewThemeUtils.kt @@ -199,6 +199,12 @@ class FilesSpecificViewThemeUtils @Inject constructor( } } + fun primaryColorToHexString(context: Context): String { + return withScheme(context) { scheme -> + String.format("#%06X", 0xFFFFFF and scheme.primary) + } + } + companion object { private val TAG = FilesSpecificViewThemeUtils::class.simpleName