Browse Source

move color(-calculation) related implementation to distinct class

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 years ago
parent
commit
fe42bb799b
99 changed files with 1815 additions and 1198 deletions
  1. BIN
      screenshots/gplay/debug/com.owncloud.android.ui.fragment.FileDetailFragmentStaticServerIT_showDetailsActivities_dark_blue.png
  2. 2 2
      src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt
  3. 3 3
      src/main/java/com/nextcloud/client/jobs/NotificationWork.kt
  4. 6 5
      src/main/java/com/nextcloud/client/logger/ui/LogsActivity.kt
  5. 2 2
      src/main/java/com/nextcloud/client/media/PlayerService.kt
  6. 2 2
      src/main/java/com/nextcloud/client/notifications/AppNotificationManagerImpl.kt
  7. 3 2
      src/main/java/com/nextcloud/client/onboarding/WhatsNewActivity.java
  8. 4 3
      src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt
  9. 11 9
      src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt
  10. 6 6
      src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java
  11. 2 2
      src/main/java/com/owncloud/android/authentication/DeepLinkLoginActivity.java
  12. 2 2
      src/main/java/com/owncloud/android/datamodel/MediaProvider.java
  13. 2 2
      src/main/java/com/owncloud/android/files/services/FileDownloader.java
  14. 2 2
      src/main/java/com/owncloud/android/files/services/FileUploader.java
  15. 4 3
      src/main/java/com/owncloud/android/media/MediaControlView.java
  16. 2 2
      src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java
  17. 3 3
      src/main/java/com/owncloud/android/ui/ThemeableSwitchPreference.java
  18. 2 2
      src/main/java/com/owncloud/android/ui/activities/ActivitiesActivity.java
  19. 11 8
      src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java
  20. 16 12
      src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
  21. 2 2
      src/main/java/com/owncloud/android/ui/activity/EditorWebView.java
  22. 2 2
      src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java
  23. 6 5
      src/main/java/com/owncloud/android/ui/activity/FileActivity.java
  24. 6 4
      src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
  25. 9 6
      src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java
  26. 2 2
      src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java
  27. 3 3
      src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java
  28. 13 11
      src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java
  29. 17 12
      src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java
  30. 22 19
      src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
  31. 2 2
      src/main/java/com/owncloud/android/ui/activity/ShareActivity.java
  32. 6 4
      src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java
  33. 11 8
      src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java
  34. 13 8
      src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java
  35. 2 2
      src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java
  36. 7 5
      src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java
  37. 2 2
      src/main/java/com/owncloud/android/ui/adapter/LinkShareViewHolder.java
  38. 5 3
      src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java
  39. 4 3
      src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java
  40. 15 10
      src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java
  41. 2 2
      src/main/java/com/owncloud/android/ui/adapter/RichDocumentsTemplateAdapter.java
  42. 4 4
      src/main/java/com/owncloud/android/ui/adapter/ShareViewHolder.java
  43. 4 3
      src/main/java/com/owncloud/android/ui/adapter/SyncedFolderAdapter.java
  44. 2 2
      src/main/java/com/owncloud/android/ui/adapter/TemplateAdapter.java
  45. 5 4
      src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java
  46. 3 2
      src/main/java/com/owncloud/android/ui/adapter/UserListAdapter.java
  47. 2 2
      src/main/java/com/owncloud/android/ui/dialog/AccountRemovalConfirmationDialog.java
  48. 9 5
      src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java
  49. 9 5
      src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.java
  50. 2 2
      src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java
  51. 7 5
      src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java
  52. 5 4
      src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java
  53. 4 4
      src/main/java/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.java
  54. 3 3
      src/main/java/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.java
  55. 3 3
      src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.java
  56. 2 2
      src/main/java/com/owncloud/android/ui/dialog/LocalStoragePathPickerDialogFragment.java
  57. 5 4
      src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java
  58. 2 2
      src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java
  59. 6 7
      src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java
  60. 4 4
      src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.java
  61. 3 3
      src/main/java/com/owncloud/android/ui/dialog/SendShareDialog.java
  62. 5 5
      src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java
  63. 7 6
      src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java
  64. 5 4
      src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.java
  65. 2 2
      src/main/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragment.java
  66. 23 18
      src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java
  67. 9 5
      src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java
  68. 2 2
      src/main/java/com/owncloud/android/ui/fragment/FeatureFragment.java
  69. 8 6
      src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java
  70. 5 3
      src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java
  71. 3 2
      src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java
  72. 8 6
      src/main/java/com/owncloud/android/ui/fragment/OCFileListBottomSheetDialog.java
  73. 12 9
      src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java
  74. 6 5
      src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java
  75. 14 9
      src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java
  76. 2 2
      src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java
  77. 3 2
      src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java
  78. 2 2
      src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java
  79. 3 3
      src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java
  80. 2 2
      src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java
  81. 2 2
      src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.java
  82. 2 1
      src/main/java/com/owncloud/android/utils/DisplayUtils.java
  83. 5 3
      src/main/java/com/owncloud/android/utils/MimeTypeUtil.java
  84. 0 842
      src/main/java/com/owncloud/android/utils/ThemeUtils.java
  85. 57 0
      src/main/java/com/owncloud/android/utils/theme/CapabilityUtils.java
  86. 99 0
      src/main/java/com/owncloud/android/utils/theme/ThemeAvatarUtils.java
  87. 79 0
      src/main/java/com/owncloud/android/utils/theme/ThemeBarUtils.java
  88. 85 0
      src/main/java/com/owncloud/android/utils/theme/ThemeButtonUtils.java
  89. 70 0
      src/main/java/com/owncloud/android/utils/theme/ThemeCheckableUtils.java
  90. 319 0
      src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java
  91. 69 0
      src/main/java/com/owncloud/android/utils/theme/ThemeDrawableUtils.java
  92. 58 0
      src/main/java/com/owncloud/android/utils/theme/ThemeFabUtils.java
  93. 66 0
      src/main/java/com/owncloud/android/utils/theme/ThemeLayoutUtils.java
  94. 46 0
      src/main/java/com/owncloud/android/utils/theme/ThemeMenuUtils.java
  95. 46 0
      src/main/java/com/owncloud/android/utils/theme/ThemeSnackbarUtils.java
  96. 103 0
      src/main/java/com/owncloud/android/utils/theme/ThemeTextInputUtils.java
  97. 45 0
      src/main/java/com/owncloud/android/utils/theme/ThemeTextUtils.java
  98. 159 0
      src/main/java/com/owncloud/android/utils/theme/ThemeToolbarUtils.java
  99. 64 0
      src/main/java/com/owncloud/android/utils/theme/ThemeUtils.java

BIN
screenshots/gplay/debug/com.owncloud.android.ui.fragment.FileDetailFragmentStaticServerIT_showDetailsActivities_dark_blue.png


+ 2 - 2
src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt

@@ -54,7 +54,7 @@ import com.owncloud.android.ui.activity.ManageAccountsActivity.PENDING_FOR_REMOV
 import com.owncloud.android.ui.activity.SyncedFoldersActivity
 import com.owncloud.android.ui.notifications.NotificationUtils
 import com.owncloud.android.utils.SyncedFolderUtils
-import com.owncloud.android.utils.ThemeUtils
+import com.owncloud.android.utils.theme.ThemeColorUtils
 import java.util.ArrayList
 import java.util.Random
 
@@ -200,7 +200,7 @@ class MediaFoldersDetectionWork constructor(
         )
             .setSmallIcon(R.drawable.notification_icon)
             .setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.notification_icon))
-            .setColor(ThemeUtils.primaryColor(context))
+            .setColor(ThemeColorUtils.primaryColor(context))
             .setSubText(user.accountName)
             .setContentTitle(contentTitle)
             .setContentText(subtitle)

+ 3 - 3
src/main/java/com/nextcloud/client/jobs/NotificationWork.kt

@@ -56,7 +56,7 @@ import com.owncloud.android.ui.activity.FileDisplayActivity
 import com.owncloud.android.ui.activity.NotificationsActivity
 import com.owncloud.android.ui.notifications.NotificationUtils
 import com.owncloud.android.utils.PushUtils
-import com.owncloud.android.utils.ThemeUtils
+import com.owncloud.android.utils.theme.ThemeColorUtils
 import dagger.android.AndroidInjection
 import org.apache.commons.httpclient.HttpMethod
 import org.apache.commons.httpclient.HttpStatus
@@ -163,7 +163,7 @@ class NotificationWork constructor(
         val notificationBuilder = NotificationCompat.Builder(context, NotificationUtils.NOTIFICATION_CHANNEL_PUSH)
             .setSmallIcon(R.drawable.notification_icon)
             .setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.notification_icon))
-            .setColor(ThemeUtils.primaryColor(user.toPlatformAccount(), false, context))
+            .setColor(ThemeColorUtils.primaryColor(user.toPlatformAccount(), false, context))
             .setShowWhen(true)
             .setSubText(user.accountName)
             .setContentTitle(notification.getSubject())
@@ -218,7 +218,7 @@ class NotificationWork constructor(
             NotificationCompat.Builder(context, NotificationUtils.NOTIFICATION_CHANNEL_PUSH)
                 .setSmallIcon(R.drawable.notification_icon)
                 .setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.notification_icon))
-                .setColor(ThemeUtils.primaryColor(user.toPlatformAccount(), false, context))
+                .setColor(ThemeColorUtils.primaryColor(user.toPlatformAccount(), false, context))
                 .setShowWhen(true)
                 .setSubText(user.accountName)
                 .setContentTitle(context.getString(R.string.new_notification))

+ 6 - 5
src/main/java/com/nextcloud/client/logger/ui/LogsActivity.kt

@@ -33,7 +33,8 @@ import com.nextcloud.client.di.ViewModelFactory
 import com.owncloud.android.R
 import com.owncloud.android.databinding.LogsActivityBinding
 import com.owncloud.android.ui.activity.ToolbarActivity
-import com.owncloud.android.utils.ThemeUtils
+import com.owncloud.android.utils.theme.ThemeBarUtils
+import com.owncloud.android.utils.theme.ThemeToolbarUtils
 import javax.inject.Inject
 
 class LogsActivity : ToolbarActivity() {
@@ -64,7 +65,7 @@ class LogsActivity : ToolbarActivity() {
         }
 
         findViewById<ProgressBar>(R.id.logs_loading_progress).apply {
-            ThemeUtils.themeProgressBar(context, this)
+            ThemeBarUtils.themeProgressBar(context, this)
         }
 
         logsAdapter = LogsAdapter(this)
@@ -78,9 +79,9 @@ class LogsActivity : ToolbarActivity() {
 
         setupToolbar()
         supportActionBar?.setDisplayHomeAsUpEnabled(true)
-        supportActionBar?.apply { ThemeUtils.setColoredTitle(this, getString(R.string.logs_title), baseContext) }
+        supportActionBar?.apply { ThemeToolbarUtils.setColoredTitle(this, getString(R.string.logs_title), baseContext) }
 
-        ThemeUtils.tintBackButton(supportActionBar, baseContext)
+        ThemeToolbarUtils.tintBackButton(supportActionBar, baseContext)
     }
 
     override fun onCreateOptionsMenu(menu: Menu): Boolean {
@@ -88,7 +89,7 @@ class LogsActivity : ToolbarActivity() {
         (menu.findItem(R.id.action_search).actionView as SearchView).apply {
             setOnQueryTextListener(searchBoxListener)
 
-            ThemeUtils.themeSearchView(this, context)
+            ThemeToolbarUtils.themeSearchView(this, context)
         }
         return super.onCreateOptionsMenu(menu)
     }

+ 2 - 2
src/main/java/com/nextcloud/client/media/PlayerService.kt

@@ -33,7 +33,7 @@ import com.nextcloud.client.network.ClientFactory
 import com.owncloud.android.R
 import com.owncloud.android.datamodel.OCFile
 import com.owncloud.android.ui.notifications.NotificationUtils
-import com.owncloud.android.utils.ThemeUtils
+import com.owncloud.android.utils.theme.ThemeColorUtils
 import dagger.android.AndroidInjection
 import java.util.Locale
 import javax.inject.Inject
@@ -97,7 +97,7 @@ class PlayerService : Service() {
         AndroidInjection.inject(this)
         player = Player(applicationContext, clientFactory, playerListener, audioManager)
         notificationBuilder = NotificationCompat.Builder(this)
-        notificationBuilder.color = ThemeUtils.primaryColor(this)
+        notificationBuilder.color = ThemeColorUtils.primaryColor(this)
 
         val stop = Intent(this, PlayerService::class.java)
         stop.action = ACTION_STOP

+ 2 - 2
src/main/java/com/nextcloud/client/notifications/AppNotificationManagerImpl.kt

@@ -16,7 +16,7 @@ import com.owncloud.android.ui.activity.FileDisplayActivity
 import com.owncloud.android.ui.notifications.NotificationUtils
 import com.owncloud.android.ui.preview.PreviewImageActivity
 import com.owncloud.android.ui.preview.PreviewImageFragment
-import com.owncloud.android.utils.ThemeUtils
+import com.owncloud.android.utils.theme.ThemeColorUtils
 import javax.inject.Inject
 
 class AppNotificationManagerImpl @Inject constructor(
@@ -31,7 +31,7 @@ class AppNotificationManagerImpl @Inject constructor(
     }
 
     private fun builder(channelId: String): NotificationCompat.Builder {
-        val color = ThemeUtils.primaryColor(context, true)
+        val color = ThemeColorUtils.primaryColor(context, true)
         return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
             NotificationCompat.Builder(context, channelId).setColor(color)
         } else {

+ 3 - 2
src/main/java/com/nextcloud/client/onboarding/WhatsNewActivity.java

@@ -37,7 +37,8 @@ import com.owncloud.android.R;
 import com.owncloud.android.ui.adapter.FeaturesViewAdapter;
 import com.owncloud.android.ui.adapter.FeaturesWebViewAdapter;
 import com.owncloud.android.ui.whatsnew.ProgressIndicator;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import javax.inject.Inject;
 
@@ -85,7 +86,7 @@ public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPa
         mPager.addOnPageChangeListener(this);
 
         mForwardFinishButton = findViewById(R.id.forward);
-        ThemeUtils.colorImageButton(mForwardFinishButton, fontColor);
+        ThemeButtonUtils.colorImageButton(mForwardFinishButton, fontColor);
 
         mForwardFinishButton.setOnClickListener(view -> {
             if (mProgress.hasNextStep()) {

+ 4 - 3
src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt

@@ -47,7 +47,8 @@ import com.owncloud.android.ui.adapter.UserListItem
 import com.owncloud.android.ui.asynctasks.RetrieveStatusAsyncTask
 import com.owncloud.android.utils.DisplayUtils
 import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener
-import com.owncloud.android.utils.ThemeUtils
+import com.owncloud.android.utils.theme.ThemeColorUtils
+import com.owncloud.android.utils.theme.ThemeDrawableUtils
 import kotlinx.android.synthetic.main.account_item.*
 import kotlinx.android.synthetic.main.dialog_choose_account.*
 import java.util.ArrayList
@@ -107,9 +108,9 @@ class ChooseAccountDialogFragment :
             account.text = user.accountName
 
             // Defining user right indicator
-            val icon = ThemeUtils.tintDrawable(
+            val icon = ThemeDrawableUtils.tintDrawable(
                 ContextCompat.getDrawable(requireContext(), R.drawable.ic_check_circle),
-                ThemeUtils.primaryColor(requireContext(), true)
+                ThemeColorUtils.primaryColor(requireContext(), true)
             )
             account_menu.setImageDrawable(icon)
 

+ 11 - 9
src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt

@@ -53,7 +53,9 @@ import com.owncloud.android.ui.activity.BaseActivity
 import com.owncloud.android.ui.adapter.PredefinedStatusClickListener
 import com.owncloud.android.ui.adapter.PredefinedStatusListAdapter
 import com.owncloud.android.utils.DisplayUtils
-import com.owncloud.android.utils.ThemeUtils
+import com.owncloud.android.utils.theme.ThemeButtonUtils
+import com.owncloud.android.utils.theme.ThemeColorUtils
+import com.owncloud.android.utils.theme.ThemeTextInputUtils
 import com.vanniktech.emoji.EmojiManager
 import com.vanniktech.emoji.EmojiPopup
 import com.vanniktech.emoji.google.GoogleEmojiProvider
@@ -211,12 +213,12 @@ class SetStatusDialogFragment :
             }
         }
 
-        clearStatus.setTextColor(ThemeUtils.primaryColor(context, true))
-        ThemeUtils.colorPrimaryButton(setStatus, context)
-        ThemeUtils.colorTextInput(
+        clearStatus.setTextColor(ThemeColorUtils.primaryColor(context, true))
+        ThemeButtonUtils.colorPrimaryButton(setStatus, context)
+        ThemeTextInputUtils.colorTextInput(
             binding.customStatusInputContainer,
             binding.customStatusInput,
-            ThemeUtils.primaryColor(activity)
+            ThemeColorUtils.primaryColor(activity)
         )
     }
 
@@ -325,19 +327,19 @@ class SetStatusDialogFragment :
         when (statusType) {
             StatusType.ONLINE -> {
                 clearTopStatus()
-                onlineStatus.setBackgroundColor(ThemeUtils.primaryColor(context))
+                onlineStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context))
             }
             StatusType.AWAY -> {
                 clearTopStatus()
-                awayStatus.setBackgroundColor(ThemeUtils.primaryColor(context))
+                awayStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context))
             }
             StatusType.DND -> {
                 clearTopStatus()
-                dndStatus.setBackgroundColor(ThemeUtils.primaryColor(context))
+                dndStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context))
             }
             StatusType.INVISIBLE -> {
                 clearTopStatus()
-                invisibleStatus.setBackgroundColor(ThemeUtils.primaryColor(context))
+                invisibleStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context))
             }
             else -> clearTopStatus()
         }

+ 6 - 6
src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -73,8 +73,6 @@ import android.webkit.WebResourceRequest;
 import android.webkit.WebResourceResponse;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
 import android.widget.TextView;
 import android.widget.TextView.OnEditorActionListener;
 import android.widget.Toast;
@@ -124,7 +122,9 @@ import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertL
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
 import com.owncloud.android.utils.PermissionUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -435,7 +435,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 accountSetupWebviewBinding.loginWebviewProgressBar.setVisibility(View.GONE);
                 accountSetupWebviewBinding.loginWebview.setVisibility(View.VISIBLE);
 
-                ThemeUtils.colorStatusBar(AuthenticatorActivity.this, primaryColor);
+                ThemeToolbarUtils.colorStatusBar(AuthenticatorActivity.this, primaryColor);
                 getWindow().setNavigationBarColor(primaryColor);
             }
 
@@ -540,8 +540,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 
         if (deviceInfo.hasCamera(this)) {
             accountSetupBinding.scanQr.setOnClickListener(v -> onScan());
-            ThemeUtils.tintDrawable(accountSetupBinding.scanQr.getDrawable(),
-                                    getResources().getColor(R.color.login_text_color));
+            ThemeDrawableUtils.tintDrawable(accountSetupBinding.scanQr.getDrawable(),
+                                            getResources().getColor(R.color.login_text_color));
         } else {
             accountSetupBinding.scanQr.setVisibility(View.GONE);
         }

+ 2 - 2
src/main/java/com/owncloud/android/authentication/DeepLinkLoginActivity.java

@@ -6,7 +6,7 @@ import android.widget.TextView;
 import android.widget.Toast;
 
 import com.owncloud.android.R;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 public class DeepLinkLoginActivity extends AuthenticatorActivity {
     @Override
@@ -29,7 +29,7 @@ public class DeepLinkLoginActivity extends AuthenticatorActivity {
                 LoginUrlInfo loginUrlInfo = parseLoginDataUrl(prefix, data.toString());
 
                 TextView loginText = findViewById(R.id.loginInfo);
-                loginText.setTextColor(ThemeUtils.fontColor(this));
+                loginText.setTextColor(ThemeColorUtils.fontColor(this));
                 loginText.setText(String.format("Login with %1$s to %2$s", loginUrlInfo.username,
                                                 loginUrlInfo.serverAddress));
             } catch (IllegalArgumentException e) {

+ 2 - 2
src/main/java/com/owncloud/android/datamodel/MediaProvider.java

@@ -33,7 +33,7 @@ import com.google.android.material.snackbar.Snackbar;
 import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.utils.PermissionUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -180,7 +180,7 @@ public final class MediaProvider {
                         R.string.permission_storage_access, Snackbar.LENGTH_INDEFINITE)
                         .setAction(R.string.common_ok, v -> PermissionUtil.requestWriteExternalStoreagePermission(activity));
 
-                ThemeUtils.colorSnackbar(activity.getApplicationContext(), snackbar);
+                ThemeSnackbarUtils.colorSnackbar(activity.getApplicationContext(), snackbar);
 
                 snackbar.show();
             } else {

+ 2 - 2
src/main/java/com/owncloud/android/files/services/FileDownloader.java

@@ -66,7 +66,7 @@ import com.owncloud.android.ui.preview.PreviewImageActivity;
 import com.owncloud.android.ui.preview.PreviewImageFragment;
 import com.owncloud.android.utils.ErrorMessageAdapter;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.io.File;
 import java.util.AbstractList;
@@ -149,7 +149,7 @@ public class FileDownloader extends Service
                 .setContentText(getApplicationContext().getResources().getString(R.string.foreground_service_download))
                 .setSmallIcon(R.drawable.notification_icon)
                 .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.notification_icon))
-                .setColor(ThemeUtils.primaryColor(getApplicationContext(), true));
+                .setColor(ThemeColorUtils.primaryColor(getApplicationContext(), true));
 
         if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             builder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD);

+ 2 - 2
src/main/java/com/owncloud/android/files/services/FileUploader.java

@@ -77,7 +77,7 @@ import com.owncloud.android.ui.activity.ConflictsResolveActivity;
 import com.owncloud.android.ui.activity.UploadListActivity;
 import com.owncloud.android.ui.notifications.NotificationUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -231,7 +231,7 @@ public class FileUploader extends Service
             .setContentText(getApplicationContext().getResources().getString(R.string.foreground_service_upload))
             .setSmallIcon(R.drawable.notification_icon)
             .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.notification_icon))
-            .setColor(ThemeUtils.primaryColor(getApplicationContext(), true));
+            .setColor(ThemeColorUtils.primaryColor(getApplicationContext(), true));
 
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
             builder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD);

+ 4 - 3
src/main/java/com/owncloud/android/media/MediaControlView.java

@@ -40,7 +40,8 @@ import android.widget.TextView;
 
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeBarUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.util.Formatter;
 import java.util.Locale;
@@ -125,10 +126,10 @@ public class MediaControlView extends FrameLayout implements OnClickListener, On
         if (progressBar != null) {
             if (progressBar instanceof SeekBar) {
                 SeekBar seeker = (SeekBar) progressBar;
-                ThemeUtils.colorHorizontalSeekBar(seeker, getContext());
+                ThemeBarUtils.colorHorizontalSeekBar(seeker, getContext());
                 seeker.setOnSeekBarChangeListener(this);
             } else {
-                ThemeUtils.colorHorizontalProgressBar(progressBar, ThemeUtils.primaryAccentColor(getContext()));
+                ThemeBarUtils.colorHorizontalProgressBar(progressBar, ThemeColorUtils.primaryAccentColor(getContext()));
             }
             progressBar.setMax(1000);
         }

+ 2 - 2
src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java

@@ -47,7 +47,7 @@ import com.owncloud.android.operations.UpdateOCVersionOperation;
 import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
 import com.owncloud.android.ui.notifications.NotificationUtils;
 import com.owncloud.android.utils.DataHolderUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import org.apache.jackrabbit.webdav.DavException;
 
@@ -509,7 +509,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
     private NotificationCompat.Builder createNotificationBuilder() {
         NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext());
         notificationBuilder.setSmallIcon(R.drawable.notification_icon).setAutoCancel(true);
-        notificationBuilder.setColor(ThemeUtils.primaryColor(getContext(), true));
+        notificationBuilder.setColor(ThemeColorUtils.primaryColor(getContext(), true));
         return notificationBuilder;
     }
 

+ 3 - 3
src/main/java/com/owncloud/android/ui/ThemeableSwitchPreference.java

@@ -30,7 +30,7 @@ import android.view.ViewGroup;
 import android.widget.Switch;
 
 import com.owncloud.android.R;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import androidx.appcompat.app.AppCompatDelegate;
 import androidx.core.graphics.drawable.DrawableCompat;
@@ -74,8 +74,8 @@ public class ThemeableSwitchPreference extends SwitchPreference {
                 Switch switchView = (Switch) child;
 
                 if(thumbColorStateList == null && trackColorStateList == null) {
-                    int thumbColor = ThemeUtils.primaryAccentColor(getContext());
-                    if (ThemeUtils.darkTheme(getContext()) &&
+                    int thumbColor = ThemeColorUtils.primaryAccentColor(getContext());
+                    if (ThemeColorUtils.darkTheme(getContext()) &&
                         AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) {
                         thumbColor = Color.WHITE;
                     }

+ 2 - 2
src/main/java/com/owncloud/android/ui/activities/ActivitiesActivity.java

@@ -40,7 +40,7 @@ import com.owncloud.android.ui.interfaces.ActivityListInterface;
 import com.owncloud.android.ui.preview.PreviewImageActivity;
 import com.owncloud.android.ui.preview.PreviewImageFragment;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeLayoutUtils;
 
 import java.util.List;
 
@@ -83,7 +83,7 @@ public class ActivitiesActivity extends DrawerActivity implements ActivityListIn
         // setup toolbar
         setupToolbar();
 
-        ThemeUtils.colorSwipeRefreshLayout(this, binding.swipeContainingList);
+        ThemeLayoutUtils.colorSwipeRefreshLayout(this, binding.swipeContainingList);
 
         // setup drawer
         setupDrawer(R.id.nav_activity);

+ 11 - 8
src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java

@@ -31,7 +31,9 @@ import android.widget.TextView;
 import com.google.android.material.button.MaterialButton;
 import com.owncloud.android.R;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 /**
  * Activity providing information about ways to participate in the app's development.
@@ -63,21 +65,22 @@ public class CommunityActivity extends DrawerActivity {
         contributeIrcView.setMovementMethod(LinkMovementMethod.getInstance());
         contributeIrcView.setText(Html.fromHtml(getString(R.string.community_contribute_irc_text) + " " +
                                                     getString(R.string.community_contribute_irc_text_link,
-                        ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)),
-                        getString(R.string.irc_weblink))));
+                                                              ThemeColorUtils.primaryColorToHexString(this),
+                                                              getString(R.string.irc_weblink))));
 
         TextView contributeForumView = findViewById(R.id.community_contribute_forum_text);
         contributeForumView.setMovementMethod(LinkMovementMethod.getInstance());
         contributeForumView.setText(Html.fromHtml(getString(R.string.community_contribute_forum_text) + " " +
                                                       getString(R.string.community_contribute_forum_text_link,
-                                                                ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)),
-                                                                getString(R.string.help_link), getString(R.string.community_contribute_forum_forum))));
+                                                                ThemeColorUtils.primaryColorToHexString(this),
+                                                                getString(R.string.help_link),
+                                                                getString(R.string.community_contribute_forum_forum))));
 
         TextView contributeTranslationView = findViewById(R.id.community_contribute_translate_text);
         contributeTranslationView.setMovementMethod(LinkMovementMethod.getInstance());
         contributeTranslationView.setText(Html.fromHtml(
             getString(R.string.community_contribute_translate_link,
-                      ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)),
+                      ThemeColorUtils.primaryColorToHexString(this),
                       getString(R.string.translation_link),
                       getString(R.string.community_contribute_translate_translate)) + " " +
                 getString(R.string.community_contribute_translate_text)));
@@ -87,11 +90,11 @@ public class CommunityActivity extends DrawerActivity {
         contributeGithubView.setText(Html.fromHtml(
             getString(R.string.community_contribute_github_text,
                       getString(R.string.community_contribute_github_text_link,
-                                ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)),
+                                ThemeColorUtils.primaryColorToHexString(this),
                                 getString(R.string.contributing_link)))));
 
         MaterialButton reportButton = findViewById(R.id.community_testing_report);
-        ThemeUtils.colorPrimaryButton(reportButton, this);
+        ThemeButtonUtils.colorPrimaryButton(reportButton, this);
         reportButton.setOnClickListener(v -> DisplayUtils.startLinkIntent(this, R.string.report_issue_link));
     }
 

+ 16 - 12
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -88,8 +88,11 @@ import com.owncloud.android.ui.trashbin.TrashbinActivity;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.DrawerMenuUtil;
 import com.owncloud.android.utils.FilesSyncHelper;
-import com.owncloud.android.utils.ThemeUtils;
 import com.owncloud.android.utils.svg.MenuSimpleTarget;
+import com.owncloud.android.utils.theme.ThemeBarUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.ThemeMenuUtils;
 
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
@@ -254,8 +257,9 @@ public abstract class DrawerActivity extends ToolbarActivity
         Drawable backArrow = ResourcesCompat.getDrawable(getResources(),
                                                          R.drawable.ic_arrow_back,
                                                          null);
-        mDrawerToggle.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, ThemeUtils.appBarPrimaryFontColor(this)));
-        mDrawerToggle.getDrawerArrowDrawable().setColor(ThemeUtils.appBarPrimaryFontColor(this));
+        mDrawerToggle.setHomeAsUpIndicator(
+            ThemeDrawableUtils.tintDrawable(backArrow, ThemeColorUtils.appBarPrimaryFontColor(this)));
+        mDrawerToggle.getDrawerArrowDrawable().setColor(ThemeColorUtils.appBarPrimaryFontColor(this));
     }
 
     /**
@@ -266,14 +270,14 @@ public abstract class DrawerActivity extends ToolbarActivity
         mQuotaProgressBar = (ProgressBar) findQuotaViewById(R.id.drawer_quota_ProgressBar);
         mQuotaTextPercentage = (TextView) findQuotaViewById(R.id.drawer_quota_percentage);
         mQuotaTextLink = (TextView) findQuotaViewById(R.id.drawer_quota_link);
-        ThemeUtils.colorProgressBar(mQuotaProgressBar, ThemeUtils.primaryColor(this));
+        ThemeBarUtils.colorProgressBar(mQuotaProgressBar, ThemeColorUtils.primaryColor(this));
     }
 
     /**
      * setup drawer header, basically the logo color
      */
     private void setupDrawerHeader(FrameLayout drawerHeader) {
-        drawerHeader.setBackgroundColor(ThemeUtils.primaryColor(getAccount(), true, this));
+        drawerHeader.setBackgroundColor(ThemeColorUtils.primaryColor(getAccount(), true, this));
     }
 
     /**
@@ -604,7 +608,7 @@ public abstract class DrawerActivity extends ToolbarActivity
 
         mQuotaProgressBar.setProgress(relative);
 
-        ThemeUtils.colorProgressBar(mQuotaProgressBar, DisplayUtils.getRelativeInfoColor(this, relative));
+        ThemeBarUtils.colorProgressBar(mQuotaProgressBar, DisplayUtils.getRelativeInfoColor(this, relative));
 
         updateQuotaLink();
         showQuota(true);
@@ -692,7 +696,7 @@ public abstract class DrawerActivity extends ToolbarActivity
             mCheckedMenuItem = menuItemId;
             MenuItem currentItem = mNavigationView.getMenu().findItem(menuItemId);
             int drawerColor = getResources().getColor(R.color.drawer_text_color);
-            int activeColor = ThemeUtils.primaryColor(null, true, true, this);
+            int activeColor = ThemeColorUtils.primaryColor(null, true, true, this);
 
             currentItem.setChecked(true);
 
@@ -701,11 +705,11 @@ public abstract class DrawerActivity extends ToolbarActivity
                 MenuItem menuItem = mNavigationView.getMenu().getItem(i);
                 if (menuItem.getIcon() != null) {
                     if (menuItem == currentItem) {
-                        ThemeUtils.tintDrawable(currentItem.getIcon(), activeColor);
-                        ThemeUtils.tintMenuItemText(currentItem, activeColor);
+                        ThemeDrawableUtils.tintDrawable(currentItem.getIcon(), activeColor);
+                        ThemeMenuUtils.tintMenuItemText(currentItem, activeColor);
                     } else {
-                        ThemeUtils.tintDrawable(menuItem.getIcon(), drawerColor);
-                        ThemeUtils.tintMenuItemText(menuItem, drawerColor);
+                        ThemeDrawableUtils.tintDrawable(menuItem.getIcon(), drawerColor);
+                        ThemeMenuUtils.tintMenuItemText(menuItem, drawerColor);
                     }
                 }
             }
@@ -811,7 +815,7 @@ public abstract class DrawerActivity extends ToolbarActivity
 
         if (menuItem != null) {
             if (drawable != null) {
-                menuItem.setIcon(ThemeUtils.tintDrawable(drawable, greyColor));
+                menuItem.setIcon(ThemeDrawableUtils.tintDrawable(drawable, greyColor));
             } else {
                 menuItem.setIcon(R.drawable.ic_link);
             }

+ 2 - 2
src/main/java/com/owncloud/android/ui/activity/EditorWebView.java

@@ -45,7 +45,7 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.datamodel.ThumbnailsCacheManager;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
@@ -94,7 +94,7 @@ public abstract class EditorWebView extends ExternalSiteWebView {
                                                                     R.string.timeout_richDocuments, Snackbar.LENGTH_INDEFINITE)
                         .setAction(R.string.common_back, v -> closeView());
 
-                    ThemeUtils.colorSnackbar(getApplicationContext(), snackbar);
+                    ThemeSnackbarUtils.colorSnackbar(getApplicationContext(), snackbar);
                     setLoadingSnackbar(snackbar);
                     snackbar.show();
                 }

+ 2 - 2
src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java

@@ -38,7 +38,7 @@ import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import java.io.InputStream;
 
@@ -186,7 +186,7 @@ public class ExternalSiteWebView extends FileActivity {
     private void setupActionBar(String title) {
         ActionBar actionBar = getSupportActionBar();
         if (actionBar != null) {
-            ThemeUtils.setColoredTitle(actionBar, title, this);
+            ThemeToolbarUtils.setColoredTitle(actionBar, title, this);
 
             if (showSidebar) {
                 actionBar.setDisplayHomeAsUpEnabled(true);

+ 6 - 5
src/main/java/com/owncloud/android/ui/activity/FileActivity.java

@@ -88,7 +88,8 @@ import com.owncloud.android.utils.ClipboardUtil;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
 import com.owncloud.android.utils.FilesSyncHelper;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
@@ -198,7 +199,7 @@ public abstract class FileActivity extends DrawerActivity
             mFileOperationsHelper.setOpIdWaitingFor(
                     savedInstanceState.getLong(KEY_WAITING_FOR_OP_ID, Long.MAX_VALUE)
                     );
-            ThemeUtils.setColoredTitle(getSupportActionBar(), savedInstanceState.getString(KEY_ACTION_BAR_TITLE), this);
+            ThemeToolbarUtils.setColoredTitle(getSupportActionBar(), savedInstanceState.getString(KEY_ACTION_BAR_TITLE), this);
         } else {
             account = getIntent().getParcelableExtra(FileActivity.EXTRA_ACCOUNT);
             mFile = getIntent().getParcelableExtra(FileActivity.EXTRA_FILE);
@@ -699,7 +700,7 @@ public abstract class FileActivity extends DrawerActivity
         Snackbar snackbar = Snackbar.make(activity.findViewById(android.R.id.content), R.string.clipboard_text_copied,
                                           Snackbar.LENGTH_LONG)
             .setAction(R.string.share, v -> showShareLinkDialog(activity, file, link));
-        ThemeUtils.colorSnackbar(activity, snackbar);
+        ThemeSnackbarUtils.colorSnackbar(activity, snackbar);
         snackbar.show();
     }
 
@@ -776,7 +777,7 @@ public abstract class FileActivity extends DrawerActivity
                 snackbar = Snackbar.make(sharingFragment.getView(), defaultError, Snackbar.LENGTH_LONG);
             }
 
-            ThemeUtils.colorSnackbar(this, snackbar);
+            ThemeSnackbarUtils.colorSnackbar(this, snackbar);
             snackbar.show();
         }
     }
@@ -831,7 +832,7 @@ public abstract class FileActivity extends DrawerActivity
                                                                                            operation,
                                                                                            getResources()),
                                                   Snackbar.LENGTH_LONG);
-                ThemeUtils.colorSnackbar(this, snackbar);
+                ThemeSnackbarUtils.colorSnackbar(this, snackbar);
                 snackbar.show();
             }
         }

+ 6 - 4
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -117,7 +117,9 @@ import com.owncloud.android.utils.FileSortOrder;
 import com.owncloud.android.utils.MimeTypeUtil;
 import com.owncloud.android.utils.PermissionUtil;
 import com.owncloud.android.utils.PushUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
@@ -304,7 +306,7 @@ public class FileDisplayActivity extends FileActivity
                     .create();
 
                 alertDialog.show();
-                alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(ThemeUtils.primaryAccentColor(this));
+                alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(ThemeColorUtils.primaryAccentColor(this));
             } catch (WindowManager.BadTokenException e) {
                 Log_OC.e(TAG, "Error showing wrong storage info, so skipping it: " + e.getMessage());
             }
@@ -325,7 +327,7 @@ public class FileDisplayActivity extends FileActivity
                                                   R.string.permission_storage_access,
                                                   Snackbar.LENGTH_INDEFINITE)
                     .setAction(R.string.common_ok, v -> PermissionUtil.requestWriteExternalStoreagePermission(this));
-                ThemeUtils.colorSnackbar(this, snackbar);
+                ThemeSnackbarUtils.colorSnackbar(this, snackbar);
                 snackbar.show();
             } else {
                 // No explanation needed, request the permission.
@@ -767,7 +769,7 @@ public class FileDisplayActivity extends FileActivity
             searchView.setIconified(false);
         });
 
-        ThemeUtils.themeSearchView(searchView, this);
+        ThemeToolbarUtils.themeSearchView(searchView, this);
 
         // populate list of menu items to show/hide when drawer is opened/closed
         mDrawerMenuItemstoShowHideList = new ArrayList<>(1);

+ 9 - 6
src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -56,7 +56,10 @@ import com.owncloud.android.utils.DataHolderUtil;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
 import com.owncloud.android.utils.FileSortOrder;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -386,9 +389,9 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
             actionBar.setDisplayHomeAsUpEnabled(!atRoot);
             actionBar.setHomeButtonEnabled(!atRoot);
 
-            ThemeUtils.tintBackButton(actionBar, this);
+            ThemeToolbarUtils.tintBackButton(actionBar, this);
 
-            ThemeUtils.setColoredTitle(getSupportActionBar(), atRoot ? caption : currentDir.getFileName(), this);
+            ThemeToolbarUtils.setColoredTitle(getSupportActionBar(), atRoot ? caption : currentDir.getFileName(), this);
         }
     }
 
@@ -400,15 +403,15 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         mChooseBtn = findViewById(R.id.folder_picker_btn_choose);
 
         if (mChooseBtn != null) {
-            ThemeUtils.colorPrimaryButton(mChooseBtn, this);
+            ThemeButtonUtils.colorPrimaryButton(mChooseBtn, this);
             mChooseBtn.setOnClickListener(this);
         }
 
         if (mCancelBtn != null) {
             if (this instanceof FilePickerActivity) {
-                ThemeUtils.colorPrimaryButton(mCancelBtn, this);
+                ThemeButtonUtils.colorPrimaryButton(mCancelBtn, this);
             } else {
-                mCancelBtn.setTextColor(ThemeUtils.primaryColor(this, true));
+                mCancelBtn.setTextColor(ThemeColorUtils.primaryColor(this, true));
             }
             mCancelBtn.setOnClickListener(this);
         }

+ 2 - 2
src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java

@@ -57,7 +57,7 @@ import com.owncloud.android.ui.adapter.UserListItem;
 import com.owncloud.android.ui.dialog.AccountRemovalConfirmationDialog;
 import com.owncloud.android.ui.events.AccountRemovedEvent;
 import com.owncloud.android.ui.helpers.FileOperationsHelper;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
@@ -133,7 +133,7 @@ public class ManageAccountsActivity extends FileActivity implements UserListAdap
 
         // set title Action bar
         updateActionBarTitleAndHomeButtonByString(getResources().getString(R.string.prefs_manage_accounts));
-        ThemeUtils.tintBackButton(actionBar, this);
+        ThemeToolbarUtils.tintBackButton(actionBar, this);
 
         List<User> users = accountManager.getAllUsers();
         originalUsers = toAccountNames(users);

+ 3 - 3
src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java

@@ -49,7 +49,7 @@ import com.owncloud.android.ui.asynctasks.DeleteAllNotificationsTask;
 import com.owncloud.android.ui.notifications.NotificationsContract;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.PushUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeLayoutUtils;
 
 import java.util.List;
 
@@ -101,8 +101,8 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio
 
         updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_notifications));
 
-        ThemeUtils.colorSwipeRefreshLayout(this, binding.swipeContainingList);
-        ThemeUtils.colorSwipeRefreshLayout(this, binding.swipeContainingEmpty);
+        ThemeLayoutUtils.colorSwipeRefreshLayout(this, binding.swipeContainingList);
+        ThemeLayoutUtils.colorSwipeRefreshLayout(this, binding.swipeContainingEmpty);
 
         // setup drawer
         setupDrawer(R.id.nav_notifications);

+ 13 - 11
src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java

@@ -43,7 +43,9 @@ import com.nextcloud.client.preferences.AppPreferencesImpl;
 import com.owncloud.android.R;
 import com.owncloud.android.databinding.PasscodelockBinding;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
 import java.util.Arrays;
 
@@ -91,26 +93,26 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
         binding = PasscodelockBinding.inflate(getLayoutInflater());
         setContentView(binding.getRoot());
 
-        int elementColor = ThemeUtils.primaryColor(this, true);
+        int elementColor = ThemeColorUtils.primaryColor(this, true);
 
-        ThemeUtils.themeBorderlessButton(binding.cancel, ThemeUtils.primaryColor(this, true));
+        ThemeButtonUtils.themeBorderlessButton(binding.cancel, ThemeColorUtils.primaryColor(this, true));
 
         passCodeEditTexts[0] = binding.txt0;
-        ThemeUtils.colorEditText(passCodeEditTexts[0], elementColor);
-        ThemeUtils.themeEditText(this, passCodeEditTexts[0], false);
+        ThemeTextInputUtils.colorEditText(passCodeEditTexts[0], elementColor);
+        ThemeTextInputUtils.themeEditText(this, passCodeEditTexts[0], false);
         passCodeEditTexts[0].requestFocus();
 
         passCodeEditTexts[1] = binding.txt1;
-        ThemeUtils.colorEditText(passCodeEditTexts[1], elementColor);
-        ThemeUtils.themeEditText(this, passCodeEditTexts[1], false);
+        ThemeTextInputUtils.colorEditText(passCodeEditTexts[1], elementColor);
+        ThemeTextInputUtils.themeEditText(this, passCodeEditTexts[1], false);
 
         passCodeEditTexts[2] = binding.txt2;
-        ThemeUtils.colorEditText(passCodeEditTexts[2], elementColor);
-        ThemeUtils.themeEditText(this, passCodeEditTexts[2], false);
+        ThemeTextInputUtils.colorEditText(passCodeEditTexts[2], elementColor);
+        ThemeTextInputUtils.themeEditText(this, passCodeEditTexts[2], false);
 
         passCodeEditTexts[3] = binding.txt3;
-        ThemeUtils.colorEditText(passCodeEditTexts[3], elementColor);
-        ThemeUtils.themeEditText(this, passCodeEditTexts[3], false);
+        ThemeTextInputUtils.colorEditText(passCodeEditTexts[3], elementColor);
+        ThemeTextInputUtils.themeEditText(this, passCodeEditTexts[3], false);
 
         Window window = getWindow();
         if (window != null) {

+ 17 - 12
src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -90,7 +90,11 @@ import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
 import com.owncloud.android.utils.FileSortOrder;
 import com.owncloud.android.utils.MimeType;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import java.io.File;
 import java.io.FileWriter;
@@ -414,7 +418,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
             final TextInputLayout userInputContainer = view.findViewById(R.id.user_input_container);
             setFilename(userInput, selectPos);
             userInput.requestFocus();
-            ThemeUtils.colorTextInput(userInputContainer, userInput, ThemeUtils.primaryColor(getContext()));
+            ThemeTextInputUtils.colorTextInput(userInputContainer, userInput, ThemeColorUtils.primaryColor(getContext()));
 
             final Spinner spinner = view.findViewById(R.id.file_type);
             setupSpinner(adapter, selectPos, userInput, spinner);
@@ -701,7 +705,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
         ActionBar actionBar = getSupportActionBar();
 
         if (isHaveMultipleAccount()) {
-            ThemeUtils.setColoredSubtitle(actionBar, getAccount().name, this);
+            ThemeToolbarUtils.setColoredSubtitle(actionBar, getAccount().name, this);
         } else if (actionBar != null) {
             actionBar.setSubtitle(null);
         }
@@ -724,9 +728,9 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
         if (actionBar != null) {
             if (TextUtils.isEmpty(current_dir)) {
-                ThemeUtils.setColoredTitle(actionBar, R.string.uploader_top_message, this);
+                ThemeToolbarUtils.setColoredTitle(actionBar, R.string.uploader_top_message, this);
             } else {
-                ThemeUtils.setColoredTitle(actionBar, current_dir, this);
+                ThemeToolbarUtils.setColoredTitle(actionBar, current_dir, this);
             }
 
             actionBar.setDisplayHomeAsUpEnabled(notRoot);
@@ -767,23 +771,23 @@ public class ReceiveExternalFilesActivity extends FileActivity
                 mListView.setAdapter(sa);
             }
             MaterialButton btnChooseFolder = findViewById(R.id.uploader_choose_folder);
-            ThemeUtils.colorPrimaryButton(btnChooseFolder, this);
+            ThemeButtonUtils.colorPrimaryButton(btnChooseFolder, this);
             btnChooseFolder.setOnClickListener(this);
 
             if (mFile.canWrite()) {
                 btnChooseFolder.setEnabled(true);
-                ThemeUtils.colorPrimaryButton(btnChooseFolder, this);
+                ThemeButtonUtils.colorPrimaryButton(btnChooseFolder, this);
             } else {
                 btnChooseFolder.setEnabled(false);
                 btnChooseFolder.setBackgroundColor(Color.GRAY);
             }
 
-            ThemeUtils.colorStatusBar(this);
+            ThemeToolbarUtils.colorStatusBar(this);
 
-            ThemeUtils.tintBackButton(actionBar, this);
+            ThemeToolbarUtils.tintBackButton(actionBar, this);
 
             Button btnNewFolder = findViewById(R.id.uploader_cancel);
-            btnNewFolder.setTextColor(ThemeUtils.primaryColor(this, true));
+            btnNewFolder.setTextColor(ThemeColorUtils.primaryColor(this, true));
             btnNewFolder.setOnClickListener(this);
 
             mListView.setOnItemClickListener(this);
@@ -808,7 +812,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
             if (mEmptyListContainer != null && mEmptyListMessage != null) {
                 mEmptyListHeadline.setText(headline);
                 mEmptyListMessage.setText(message);
-                mEmptyListIcon.setImageDrawable(ThemeUtils.tintDrawable(icon, ThemeUtils.primaryColor(this, true)));
+                mEmptyListIcon.setImageDrawable(
+                    ThemeDrawableUtils.tintDrawable(icon, ThemeColorUtils.primaryColor(this, true)));
                 mEmptyListIcon.setVisibility(View.VISIBLE);
                 mEmptyListMessage.setVisibility(View.VISIBLE);
             }
@@ -1033,7 +1038,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
         newFolderMenuItem.setEnabled(mFile.canWrite());
 
         // hacky as no default way is provided
-        ThemeUtils.themeSearchView(searchView, this);
+        ThemeToolbarUtils.themeSearchView(searchView, this);
 
         return true;
     }

+ 22 - 19
src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

@@ -76,7 +76,10 @@ import com.owncloud.android.utils.DeviceCredentialUtils;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.EncryptionUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeTextUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -155,7 +158,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
         // Register context menu for list of preferences.
         registerForContextMenu(getListView());
 
-        int accentColor = ThemeUtils.primaryAccentColor(this);
+        int accentColor = ThemeColorUtils.primaryAccentColor(this);
         String appVersion = getAppVersion();
         PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("preference_screen");
 
@@ -188,8 +191,8 @@ public class SettingsActivity extends ThemedPreferenceActivity
         PreferenceCategory preferenceCategoryDev = (PreferenceCategory) findPreference("dev_category");
 
         if (getResources().getBoolean(R.bool.is_beta)) {
-            preferenceCategoryDev.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_dev),
-                    accentColor));
+            preferenceCategoryDev.setTitle(ThemeTextUtils.getColoredTitle(getString(R.string.prefs_category_dev),
+                                                                          accentColor));
 
             /* Link to dev apks */
             Preference pDevLink = findPreference("dev_link");
@@ -228,8 +231,8 @@ public class SettingsActivity extends ThemedPreferenceActivity
 
     private void setupAboutCategory(int accentColor, String appVersion) {
         PreferenceCategory preferenceCategoryAbout = (PreferenceCategory) findPreference("about");
-        preferenceCategoryAbout.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_about),
-                accentColor));
+        preferenceCategoryAbout.setTitle(ThemeTextUtils.getColoredTitle(getString(R.string.prefs_category_about),
+                                                                        accentColor));
 
         /* About App */
         Preference pAboutApp = findPreference("about_app");
@@ -314,8 +317,8 @@ public class SettingsActivity extends ThemedPreferenceActivity
 
     private void setupMoreCategory(int accentColor) {
         PreferenceCategory preferenceCategoryMore = (PreferenceCategory) findPreference("more");
-        preferenceCategoryMore.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_more),
-                accentColor));
+        preferenceCategoryMore.setTitle(ThemeTextUtils.getColoredTitle(getString(R.string.prefs_category_more),
+                                                                       accentColor));
 
         setupAutoUploadPreference(preferenceCategoryMore);
 
@@ -512,8 +515,8 @@ public class SettingsActivity extends ThemedPreferenceActivity
 
     private void setupDetailsCategory(int accentColor, PreferenceScreen preferenceScreen) {
         PreferenceCategory preferenceCategoryDetails = (PreferenceCategory) findPreference("details");
-        preferenceCategoryDetails.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_details),
-                accentColor));
+        preferenceCategoryDetails.setTitle(ThemeTextUtils.getColoredTitle(getString(R.string.prefs_category_details),
+                                                                          accentColor));
 
         boolean fPassCodeEnabled = getResources().getBoolean(R.bool.passcode_enabled);
         boolean fDeviceCredentialsEnabled = getResources().getBoolean(R.bool.device_credentials_enabled);
@@ -608,8 +611,8 @@ public class SettingsActivity extends ThemedPreferenceActivity
     private void setupAutoUploadCategory(int accentColor, PreferenceScreen preferenceScreen) {
         PreferenceCategory preferenceCategorySyncedFolders =
                 (PreferenceCategory) findPreference("synced_folders_category");
-        preferenceCategorySyncedFolders.setTitle(ThemeUtils.getColoredTitle(getString(R.string.drawer_synced_folders),
-                accentColor));
+        preferenceCategorySyncedFolders.setTitle(ThemeTextUtils.getColoredTitle(getString(R.string.drawer_synced_folders),
+                                                                                accentColor));
 
         if (!getResources().getBoolean(R.bool.syncedFolder_light)) {
             preferenceScreen.removePreference(preferenceCategorySyncedFolders);
@@ -680,8 +683,8 @@ public class SettingsActivity extends ThemedPreferenceActivity
 
     private void setupGeneralCategory(int accentColor) {
         PreferenceCategory preferenceCategoryGeneral = (PreferenceCategory) findPreference("general");
-        preferenceCategoryGeneral.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_general),
-                accentColor));
+        preferenceCategoryGeneral.setTitle(ThemeTextUtils.getColoredTitle(getString(R.string.prefs_category_general),
+                                                                          accentColor));
 
         prefStoragePath = (ListPreference) findPreference(AppPreferencesImpl.STORAGE_PATH);
         if (prefStoragePath != null) {
@@ -763,12 +766,12 @@ public class SettingsActivity extends ThemedPreferenceActivity
         ActionBar actionBar = getDelegate().getSupportActionBar();
 
         if (actionBar != null) {
-            ThemeUtils.setColoredTitle(actionBar, getString(R.string.actionbar_settings), this);
-            ThemeUtils.colorStatusBar(this);
-            actionBar.setBackgroundDrawable(new ColorDrawable(ThemeUtils.primaryAppbarColor(this)));
+            ThemeToolbarUtils.setColoredTitle(actionBar, getString(R.string.actionbar_settings), this);
+            ThemeToolbarUtils.colorStatusBar(this);
+            actionBar.setBackgroundDrawable(new ColorDrawable(ThemeColorUtils.primaryAppbarColor(this)));
 
             actionBar.setDisplayHomeAsUpEnabled(true);
-            ThemeUtils.tintBackButton(actionBar, this);
+            ThemeToolbarUtils.tintBackButton(actionBar, this);
         }
     }
 
@@ -881,7 +884,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
                 ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
                 String mnemonic = arbitraryDataProvider.getValue(user.getAccountName(), EncryptionUtils.MNEMONIC);
 
-                int accentColor = ThemeUtils.primaryAccentColor(this);
+                int accentColor = ThemeColorUtils.primaryAccentColor(this);
 
                 AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.FallbackTheming_Dialog);
                 AlertDialog alertDialog = builder.setTitle(R.string.prefs_e2e_mnemonic)

+ 2 - 2
src/main/java/com/owncloud/android/ui/activity/ShareActivity.java

@@ -38,7 +38,7 @@ import com.owncloud.android.operations.GetSharesForFileOperation;
 import com.owncloud.android.ui.fragment.FileDetailSharingFragment;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentTransaction;
@@ -91,7 +91,7 @@ public class ShareActivity extends FileActivity {
         // Name
         binding.shareFileName.setText(getResources().getString(R.string.share_file, file.getFileName()));
 
-        binding.shareHeaderDivider.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(this),
+        binding.shareHeaderDivider.getBackground().setColorFilter(ThemeColorUtils.primaryAccentColor(this),
                                                                   PorterDuff.Mode.SRC_ATOP);
 
         // Size

+ 6 - 4
src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java

@@ -68,7 +68,9 @@ import com.owncloud.android.ui.dialog.parcel.SyncedFolderParcelable;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.PermissionUtil;
 import com.owncloud.android.utils.SyncedFolderUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -202,7 +204,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
             .setMessage(getString(R.string.power_save_check_dialog_message))
             .show();
 
-        alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ThemeUtils.primaryAccentColor(this));
+        alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ThemeColorUtils.primaryAccentColor(this));
     }
 
     /**
@@ -214,7 +216,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
         adapter = new SyncedFolderAdapter(this, clock, gridWidth, this, lightVersion);
         syncedFolderProvider = new SyncedFolderProvider(getContentResolver(), preferences, clock);
         binding.emptyList.emptyListIcon.setImageResource(R.drawable.nav_synced_folders);
-        ThemeUtils.colorPrimaryButton(binding.emptyList.emptyListViewAction, this);
+        ThemeButtonUtils.colorPrimaryButton(binding.emptyList.emptyListViewAction, this);
 
         final GridLayoutManager lm = new GridLayoutManager(this, gridWidth);
         adapter.setLayoutManager(lm);
@@ -817,7 +819,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
             if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
                 AlertDialog alertDialog = alertDialogBuilder.show();
 
-                int color = ThemeUtils.primaryAccentColor(this);
+                int color = ThemeColorUtils.primaryAccentColor(this);
                 alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
                 alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
             }

+ 11 - 8
src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java

@@ -42,7 +42,10 @@ import com.google.android.material.textview.MaterialTextView;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import androidx.annotation.StringRes;
 import androidx.appcompat.app.ActionBar;
@@ -79,11 +82,11 @@ public abstract class ToolbarActivity extends BaseActivity {
      * to use the toolbar.
      */
     private void setupToolbar(boolean isHomeSearchToolbarShow, boolean showSortListButtonGroup) {
-        int fontColor = ThemeUtils.appBarPrimaryFontColor(this);
+        int fontColor = ThemeColorUtils.appBarPrimaryFontColor(this);
 
         mToolbar = findViewById(R.id.toolbar);
         setSupportActionBar(mToolbar);
-        ThemeUtils.colorStatusBar(this);
+        ThemeToolbarUtils.colorStatusBar(this);
 
         mAppBar = findViewById(R.id.appbar);
         mDefaultToolbar = findViewById(R.id.default_toolbar);
@@ -108,11 +111,11 @@ public abstract class ToolbarActivity extends BaseActivity {
         mToolbarSpinner = findViewById(R.id.toolbar_spinner);
 
         if (mToolbar.getOverflowIcon() != null) {
-            ThemeUtils.tintDrawable(mToolbar.getOverflowIcon(), fontColor);
+            ThemeDrawableUtils.tintDrawable(mToolbar.getOverflowIcon(), fontColor);
         }
 
         if (mToolbar.getNavigationIcon() != null) {
-            ThemeUtils.tintDrawable(mToolbar.getNavigationIcon(), fontColor);
+            ThemeDrawableUtils.tintDrawable(mToolbar.getNavigationIcon(), fontColor);
         }
     }
 
@@ -163,13 +166,13 @@ public abstract class ToolbarActivity extends BaseActivity {
                                                                                 R.animator.appbar_elevation_off));
             mDefaultToolbar.setVisibility(View.GONE);
             mHomeSearchToolbar.setVisibility(View.VISIBLE);
-            ThemeUtils.colorStatusBar(this, ContextCompat.getColor(this, R.color.bg_default));
+            ThemeToolbarUtils.colorStatusBar(this, ContextCompat.getColor(this, R.color.bg_default));
         } else {
             mAppBar.setStateListAnimator(AnimatorInflater.loadStateListAnimator(mAppBar.getContext(),
                                                                                 R.animator.appbar_elevation_on));
             mDefaultToolbar.setVisibility(View.VISIBLE);
             mHomeSearchToolbar.setVisibility(View.GONE);
-            ThemeUtils.colorStatusBar(this);
+            ThemeToolbarUtils.colorStatusBar(this);
         }
     }
 
@@ -185,7 +188,7 @@ public abstract class ToolbarActivity extends BaseActivity {
 
         // set & color the chosen title
         ActionBar actionBar = getSupportActionBar();
-        ThemeUtils.setColoredTitle(actionBar, titleToSet, this);
+        ThemeToolbarUtils.setColoredTitle(actionBar, titleToSet, this);
 
         // set home button properties
         if (actionBar != null) {

+ 13 - 8
src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java

@@ -51,7 +51,11 @@ import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
 import com.owncloud.android.ui.fragment.ExtendedListFragment;
 import com.owncloud.android.ui.fragment.LocalFileListFragment;
 import com.owncloud.android.utils.FileSortOrder;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -171,11 +175,11 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
 
         // Set input controllers
         MaterialButton cancelButton = findViewById(R.id.upload_files_btn_cancel);
-        cancelButton.setTextColor(ThemeUtils.primaryColor(this, true));
+        cancelButton.setTextColor(ThemeColorUtils.primaryColor(this, true));
         cancelButton.setOnClickListener(this);
 
         MaterialButton uploadButton = findViewById(R.id.upload_files_btn_upload);
-        ThemeUtils.colorPrimaryButton(uploadButton, this);
+        ThemeButtonUtils.colorPrimaryButton(uploadButton, this);
         uploadButton.setOnClickListener(this);
 
         int localBehaviour = preferences.getUploaderBehaviour();
@@ -208,7 +212,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
             actionBar.setDisplayHomeAsUpEnabled(mCurrentDir != null);
             actionBar.setDisplayShowTitleEnabled(false);
 
-            ThemeUtils.tintBackButton(actionBar, this);
+            ThemeToolbarUtils.tintBackButton(actionBar, this);
         }
 
         showToolbarSpinner();
@@ -268,11 +272,11 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
             setSelectAllMenuItem(selectAll, mSelectAll);
         }
 
-        int fontColor = ThemeUtils.appBarPrimaryFontColor(this);
+        int fontColor = ThemeColorUtils.appBarPrimaryFontColor(this);
         final MenuItem item = menu.findItem(R.id.action_search);
         mSearchView = (SearchView) MenuItemCompat.getActionView(item);
-        ThemeUtils.themeSearchView(mSearchView, this);
-        ThemeUtils.tintDrawable(menu.findItem(R.id.action_choose_storage_path).getIcon(), fontColor);
+        ThemeToolbarUtils.themeSearchView(mSearchView, this);
+        ThemeDrawableUtils.tintDrawable(menu.findItem(R.id.action_choose_storage_path).getIcon(), fontColor);
 
         mSearchView.setOnSearchClickListener(v -> mToolbarSpinner.setVisibility(View.GONE));
 
@@ -413,7 +417,8 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
         if (checked) {
             selectAll.setIcon(R.drawable.ic_select_none);
         } else {
-            selectAll.setIcon(ThemeUtils.tintDrawable(R.drawable.ic_select_all, ThemeUtils.primaryColor(this)));
+            selectAll.setIcon(
+                ThemeDrawableUtils.tintDrawable(R.drawable.ic_select_all, ThemeColorUtils.primaryColor(this)));
         }
     }
 

+ 2 - 2
src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java

@@ -55,7 +55,7 @@ import com.owncloud.android.operations.CheckCurrentCredentialsOperation;
 import com.owncloud.android.ui.adapter.UploadListAdapter;
 import com.owncloud.android.ui.decoration.MediaGridItemDecoration;
 import com.owncloud.android.utils.FilesSyncHelper;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeLayoutUtils;
 
 import javax.inject.Inject;
 
@@ -164,7 +164,7 @@ public class UploadListActivity extends FileActivity {
         binding.list.setLayoutManager(lm);
         binding.list.setAdapter(uploadListAdapter);
 
-        ThemeUtils.colorSwipeRefreshLayout(this, swipeListRefreshLayout);
+        ThemeLayoutUtils.colorSwipeRefreshLayout(this, swipeListRefreshLayout);
         swipeListRefreshLayout.setOnRefreshListener(this::refresh);
 
         loadItems();

+ 7 - 5
src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -59,7 +59,8 @@ import com.owncloud.android.ui.dialog.AccountRemovalConfirmationDialog;
 import com.owncloud.android.ui.events.TokenPushEvent;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.PushUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
@@ -136,10 +137,11 @@ public class UserInfoActivity extends DrawerActivity implements Injectable {
         if (actionBar != null) {
             actionBar.setDisplayHomeAsUpEnabled(true);
             actionBar.setDisplayShowHomeEnabled(true);
-            ThemeUtils.tintBackButton(actionBar, this);
+            ThemeToolbarUtils.tintBackButton(actionBar, this);
         }
 
-        binding.userinfoList.setAdapter(new UserInfoAdapter(null, ThemeUtils.primaryColor(getAccount(), true, this)));
+        binding.userinfoList.setAdapter(
+            new UserInfoAdapter(null, ThemeColorUtils.primaryColor(getAccount(), true, this)));
 
         if (userInfo != null) {
             populateUserInfoUi(userInfo);
@@ -210,7 +212,7 @@ public class UserInfoActivity extends DrawerActivity implements Injectable {
             if (backgroundImageView != null) {
 
                 String background = getStorageManager().getCapability(user.getAccountName()).getServerBackground();
-                int primaryColor = ThemeUtils.primaryColor(getAccount(), false, this);
+                int primaryColor = ThemeColorUtils.primaryColor(getAccount(), false, this);
 
                 if (URLUtil.isValidUrl(background)) {
                     // background image
@@ -258,7 +260,7 @@ public class UserInfoActivity extends DrawerActivity implements Injectable {
                                binding.userinfoIcon,
                                this);
 
-        int tint = ThemeUtils.primaryColor(user.toPlatformAccount(), true, this);
+        int tint = ThemeColorUtils.primaryColor(user.toPlatformAccount(), true, this);
 
         if (!TextUtils.isEmpty(userInfo.getDisplayName())) {
             binding.userinfoFullName.setText(userInfo.getDisplayName());

+ 2 - 2
src/main/java/com/owncloud/android/ui/adapter/LinkShareViewHolder.java

@@ -31,7 +31,7 @@ import com.owncloud.android.R;
 import com.owncloud.android.databinding.FileDetailsShareLinkShareItemBinding;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.lib.resources.shares.ShareType;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeAvatarUtils;
 
 import androidx.annotation.NonNull;
 import androidx.core.content.res.ResourcesCompat;
@@ -71,7 +71,7 @@ class LinkShareViewHolder extends RecyclerView.ViewHolder {
                 binding.name.setText(R.string.share_link);
             }
 
-            ThemeUtils.colorIconImageViewWithBackground(binding.icon, context);
+            ThemeAvatarUtils.colorIconImageViewWithBackground(binding.icon, context);
         }
 
         binding.copyLink.setOnClickListener(v -> listener.copyLink(publicShare));

+ 5 - 3
src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java

@@ -38,7 +38,8 @@ import com.owncloud.android.ui.interfaces.LocalFileListFragmentInterface;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileSortOrder;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -152,8 +153,9 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
                 if (isCheckedFile(file)) {
                     gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources()
                             .getColor(R.color.selected_item_background));
-                    gridViewHolder.checkbox.setImageDrawable(ThemeUtils.tintDrawable(R.drawable.ic_checkbox_marked,
-                            ThemeUtils.primaryColor(mContext)));
+                    gridViewHolder.checkbox.setImageDrawable(
+                        ThemeDrawableUtils.tintDrawable(R.drawable.ic_checkbox_marked,
+                                                        ThemeColorUtils.primaryColor(mContext)));
                 } else {
                     gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources().getColor(R.color.bg_default));
                     gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline);

+ 4 - 3
src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java

@@ -56,10 +56,11 @@ import com.owncloud.android.ui.activity.NotificationsActivity;
 import com.owncloud.android.ui.asynctasks.DeleteNotificationTask;
 import com.owncloud.android.ui.asynctasks.NotificationExecuteActionTask;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
 import com.owncloud.android.utils.svg.SvgDecoder;
 import com.owncloud.android.utils.svg.SvgDrawableTranscoder;
 import com.owncloud.android.utils.svg.SvgSoftwareLayerSetter;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -176,10 +177,10 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
         for (Action action : notification.getActions()) {
             button = new MaterialButton(notificationsActivity);
 
-            int primaryColor = ThemeUtils.primaryColor(notificationsActivity);
+            int primaryColor = ThemeColorUtils.primaryColor(notificationsActivity);
 
             if (action.primary) {
-                ThemeUtils.colorPrimaryButton(button, notificationsActivity);
+                ThemeButtonUtils.colorPrimaryButton(button, notificationsActivity);
             } else {
                 button.setBackgroundColor(resources.getColor(R.color.grey_200));
                 button.setTextColor(primaryColor);

+ 15 - 10
src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java

@@ -83,7 +83,10 @@ import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileSortOrder;
 import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeAvatarUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -337,8 +340,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
         if (holder instanceof OCFileListFooterViewHolder) {
             OCFileListFooterViewHolder footerViewHolder = (OCFileListFooterViewHolder) holder;
             footerViewHolder.footerText.setText(getFooterText());
-            footerViewHolder.progressBar.getIndeterminateDrawable().setColorFilter(ThemeUtils.primaryColor(activity),
-                                                                                   PorterDuff.Mode.SRC_IN);
+            footerViewHolder.progressBar.getIndeterminateDrawable()
+                .setColorFilter(ThemeColorUtils.primaryColor(activity), PorterDuff.Mode.SRC_IN);
             footerViewHolder.progressBar.setVisibility(
                 ocFileListFragmentInterface.isLoading() ? View.VISIBLE : View.GONE);
         } else if (holder instanceof OCFileListHeaderViewHolder) {
@@ -370,8 +373,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
             } else if (isCheckedFile(file)) {
                 gridViewHolder.itemLayout.setBackgroundColor(activity.getResources()
                                                                  .getColor(R.color.selected_item_background));
-                gridViewHolder.checkbox.setImageDrawable(ThemeUtils.tintDrawable(R.drawable.ic_checkbox_marked,
-                                                                                 ThemeUtils.primaryColor(activity)));
+                gridViewHolder.checkbox.setImageDrawable(
+                    ThemeDrawableUtils.tintDrawable(R.drawable.ic_checkbox_marked,
+                                                    ThemeColorUtils.primaryColor(activity)));
             } else {
                 gridViewHolder.itemLayout.setBackgroundColor(activity.getResources().getColor(R.color.bg_default));
                 gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline);
@@ -432,14 +436,14 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
 
                         if (i == 0 && sharees.size() > 3) {
                             avatar.setImageResource(R.drawable.ic_people);
-                            ThemeUtils.setIconColor(avatar.getDrawable());
+                            ThemeDrawableUtils.setIconColor(avatar.getDrawable());
                         } else {
                             switch (sharee.getShareType()) {
                                 case GROUP:
                                 case EMAIL:
                                 case ROOM:
                                 case CIRCLE:
-                                    ThemeUtils.createAvatar(sharee.getShareType(), avatar, activity);
+                                    ThemeAvatarUtils.createAvatar(sharee.getShareType(), avatar, activity);
                                     break;
 
                                 default:
@@ -580,9 +584,10 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
             placeholder = TextDrawable.createAvatarByUserId(userId, avatarRadius);
         } catch (Exception e) {
             Log_OC.e(TAG, "Error calculating RGB value for active account icon.", e);
-            placeholder = ThemeUtils.tintDrawable(ResourcesCompat.getDrawable(resources,
-                                                                              R.drawable.account_circle_white, null),
-                                                  R.color.black);
+            placeholder = ThemeDrawableUtils.tintDrawable(ResourcesCompat.getDrawable(resources,
+                                                                                      R.drawable.account_circle_white,
+                                                                                      null),
+                                                          R.color.black);
         }
 
         avatar.setTag(null);

+ 2 - 2
src/main/java/com/owncloud/android/ui/adapter/RichDocumentsTemplateAdapter.java

@@ -35,7 +35,7 @@ import com.owncloud.android.databinding.TemplateButtonBinding;
 import com.owncloud.android.datamodel.Template;
 import com.owncloud.android.ui.dialog.ChooseRichDocumentsTemplateDialogFragment;
 import com.owncloud.android.utils.NextcloudServer;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.glide.CustomGlideStreamLoader;
 
 import java.util.ArrayList;
@@ -71,7 +71,7 @@ public class RichDocumentsTemplateAdapter extends RecyclerView.Adapter<RichDocum
         this.context = context;
         this.currentAccountProvider = currentAccountProvider;
         this.clientFactory = clientFactory;
-        colorSelected = ThemeUtils.primaryColor(context, true);
+        colorSelected = ThemeColorUtils.primaryColor(context, true);
         colorUnselected = context.getResources().getColor(R.color.grey_200);
     }
 

+ 4 - 4
src/main/java/com/owncloud/android/ui/adapter/ShareViewHolder.java

@@ -32,7 +32,7 @@ import com.owncloud.android.databinding.FileDetailsShareShareItemBinding;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.TextDrawable;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeAvatarUtils;
 
 import androidx.annotation.DrawableRes;
 import androidx.annotation.NonNull;
@@ -67,14 +67,14 @@ class ShareViewHolder extends RecyclerView.ViewHolder {
         switch (share.getShareType()) {
             case GROUP:
                 name = context.getString(R.string.share_group_clarification, name);
-                ThemeUtils.createAvatar(share.getShareType(), binding.icon, context);
+                ThemeAvatarUtils.createAvatar(share.getShareType(), binding.icon, context);
                 break;
             case ROOM:
                 name = context.getString(R.string.share_room_clarification, name);
-                ThemeUtils.createAvatar(share.getShareType(), binding.icon, context);
+                ThemeAvatarUtils.createAvatar(share.getShareType(), binding.icon, context);
                 break;
             case CIRCLE:
-                ThemeUtils.createAvatar(share.getShareType(), binding.icon, context);
+                ThemeAvatarUtils.createAvatar(share.getShareType(), binding.icon, context);
                 break;
             case FEDERATED:
                 name = context.getString(R.string.share_remote_clarification, name);

+ 4 - 3
src/main/java/com/owncloud/android/ui/adapter/SyncedFolderAdapter.java

@@ -40,7 +40,8 @@ import com.owncloud.android.R;
 import com.owncloud.android.datamodel.MediaFolderType;
 import com.owncloud.android.datamodel.SyncedFolderDisplayItem;
 import com.owncloud.android.datamodel.ThumbnailsCacheManager;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -455,8 +456,8 @@ public class SyncedFolderAdapter extends SectionedRecyclerViewAdapter<SectionedV
 
     private void setSyncButtonActiveIcon(ImageButton syncStatusButton, boolean enabled) {
         if (enabled) {
-            syncStatusButton.setImageDrawable(ThemeUtils.tintDrawable(R.drawable.ic_cloud_sync_on,
-                                                                      ThemeUtils.primaryColor(context, true)));
+            syncStatusButton.setImageDrawable(ThemeDrawableUtils.tintDrawable(R.drawable.ic_cloud_sync_on,
+                                                                              ThemeColorUtils.primaryColor(context, true)));
         } else {
             syncStatusButton.setImageResource(R.drawable.ic_cloud_sync_off);
         }

+ 2 - 2
src/main/java/com/owncloud/android/ui/adapter/TemplateAdapter.java

@@ -38,7 +38,7 @@ import com.owncloud.android.databinding.TemplateButtonBinding;
 import com.owncloud.android.lib.common.Template;
 import com.owncloud.android.lib.common.TemplateList;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.glide.CustomGlideStreamLoader;
 
 import androidx.annotation.NonNull;
@@ -71,7 +71,7 @@ public class TemplateAdapter extends RecyclerView.Adapter<TemplateAdapter.ViewHo
         this.context = context;
         this.currentAccountProvider = currentAccountProvider;
         this.clientFactory = clientFactory;
-        colorSelected = ThemeUtils.primaryColor(context, true);
+        colorSelected = ThemeColorUtils.primaryColor(context, true);
         colorUnselected = context.getResources().getColor(R.color.grey_200);
     }
 

+ 5 - 4
src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java

@@ -68,7 +68,8 @@ import com.owncloud.android.ui.activity.ConflictsResolveActivity;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeBarUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.io.File;
 import java.util.Arrays;
@@ -112,7 +113,7 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
 
         headerViewHolder.title.setText(String.format(parentActivity.getString(R.string.uploads_view_group_header),
                                                      group.getGroupName(), group.getGroupItemCount()));
-        headerViewHolder.title.setTextColor(ThemeUtils.primaryAccentColor(parentActivity));
+        headerViewHolder.title.setTextColor(ThemeColorUtils.primaryAccentColor(parentActivity));
 
         headerViewHolder.title.setOnClickListener(v -> toggleSectionExpanded(section));
 
@@ -275,8 +276,8 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
         String status = getStatusText(item);
         switch (item.getUploadStatus()) {
             case UPLOAD_IN_PROGRESS:
-                ThemeUtils.colorHorizontalProgressBar(itemViewHolder.progressBar,
-                                                      ThemeUtils.primaryAccentColor(parentActivity));
+                ThemeBarUtils.colorHorizontalProgressBar(itemViewHolder.progressBar,
+                                                         ThemeColorUtils.primaryAccentColor(parentActivity));
                 itemViewHolder.progressBar.setProgress(0);
                 itemViewHolder.progressBar.setVisibility(View.VISIBLE);
 

+ 3 - 2
src/main/java/com/owncloud/android/ui/adapter/UserListAdapter.java

@@ -42,7 +42,8 @@ import com.owncloud.android.lib.common.OwnCloudAccount;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.activity.BaseActivity;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -192,7 +193,7 @@ public class UserListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
             super(binding.getRoot());
             this.binding = binding;
 
-            ThemeUtils.tintDrawable(binding.ticker.getDrawable(), ThemeUtils.primaryColor(context, true));
+            ThemeDrawableUtils.tintDrawable(binding.ticker.getDrawable(), ThemeColorUtils.primaryColor(context, true));
 
             binding.getRoot().setOnClickListener(this);
             if (showDotsMenu) {

+ 2 - 2
src/main/java/com/owncloud/android/ui/dialog/AccountRemovalConfirmationDialog.java

@@ -29,7 +29,7 @@ import com.nextcloud.client.account.User;
 import com.nextcloud.client.di.Injectable;
 import com.nextcloud.client.jobs.BackgroundJobManager;
 import com.owncloud.android.R;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import javax.inject.Inject;
 
@@ -64,7 +64,7 @@ public class AccountRemovalConfirmationDialog extends DialogFragment implements
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getActivity());
+        int color = ThemeColorUtils.primaryAccentColor(getActivity());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 

+ 9 - 5
src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java

@@ -56,7 +56,9 @@ import com.owncloud.android.ui.adapter.RichDocumentsTemplateAdapter;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.NextcloudServer;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
 import org.parceler.Parcels;
 
@@ -112,16 +114,16 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
         positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
-        ThemeUtils.themeBorderlessButton(positiveButton, color);
+        ThemeButtonUtils.themeBorderlessButton(positiveButton, color);
         positiveButton.setOnClickListener(this);
         positiveButton.setEnabled(false);
 
-        ThemeUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL), color);
+        ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL), color);
 
         checkEnablingCreateButton();
     }
@@ -153,7 +155,9 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
         View view = binding.getRoot();
 
         binding.filename.requestFocus();
-        ThemeUtils.colorTextInput(binding.filenameContainer, binding.filename, ThemeUtils.primaryColor(getContext()));
+        ThemeTextInputUtils.colorTextInput(binding.filenameContainer,
+                                           binding.filename,
+                                           ThemeColorUtils.primaryColor(getContext()));
 
         Type type = Type.valueOf(arguments.getString(ARG_TYPE));
         new FetchTemplateTask(this, client).execute(type);

+ 9 - 5
src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.java

@@ -62,7 +62,9 @@ import com.owncloud.android.ui.activity.TextEditorWebView;
 import com.owncloud.android.ui.adapter.TemplateAdapter;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileStorageUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
 import java.lang.ref.WeakReference;
 
@@ -116,16 +118,16 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
         positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
-        ThemeUtils.themeBorderlessButton(positiveButton, color);
+        ThemeButtonUtils.themeBorderlessButton(positiveButton, color);
         positiveButton.setOnClickListener(this);
         positiveButton.setEnabled(false);
 
-        ThemeUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL), color);
+        ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL), color);
 
         checkEnablingCreateButton();
     }
@@ -159,7 +161,9 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
         View view = binding.getRoot();
 
         binding.filename.requestFocus();
-        ThemeUtils.colorTextInput(binding.filenameContainer, binding.filename, ThemeUtils.primaryColor(getContext()));
+        ThemeTextInputUtils.colorTextInput(binding.filenameContainer,
+                                           binding.filename,
+                                           ThemeColorUtils.primaryColor(getContext()));
 
         binding.filename.setOnKeyListener((v, keyCode, event) -> {
             checkEnablingCreateButton();

+ 2 - 2
src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java

@@ -21,7 +21,7 @@ import android.app.Dialog;
 import android.os.Bundle;
 
 import com.owncloud.android.R;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
@@ -75,7 +75,7 @@ public class ConfirmationDialogFragment extends DialogFragment {
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 

+ 7 - 5
src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java

@@ -39,7 +39,8 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.adapter.LocalFileListAdapter;
 import com.owncloud.android.ui.adapter.OCFileListAdapter;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeCheckableUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -114,7 +115,7 @@ public class ConflictsResolveDialog extends DialogFragment {
             return;
         }
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
         positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
         setPositiveButtonStatus(false);
 
@@ -153,8 +154,9 @@ public class ConflictsResolveDialog extends DialogFragment {
         // Inflate the layout for the dialog
         binding = ConflictResolveDialogBinding.inflate(requireActivity().getLayoutInflater());
 
-        ThemeUtils.tintCheckbox(binding.newCheckbox, ThemeUtils.primaryColor(getContext()));
-        ThemeUtils.tintCheckbox(binding.existingCheckbox, ThemeUtils.primaryColor(getContext()));
+        ThemeCheckableUtils.tintCheckbox(ThemeColorUtils.primaryColor(getContext()),
+                                         binding.newCheckbox,
+                                         binding.existingCheckbox);
 
         // Build the dialog
         AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
@@ -227,7 +229,7 @@ public class ConflictsResolveDialog extends DialogFragment {
 
     private void setPositiveButtonStatus(boolean enabled) {
         if (enabled) {
-            positiveButton.setTextColor(ThemeUtils.primaryAccentColor(requireContext()));
+            positiveButton.setTextColor(ThemeColorUtils.primaryAccentColor(requireContext()));
         } else {
             positiveButton.setTextColor(ResourcesCompat.getColor(requireContext().getResources(),
                                                                  R.color.grey_200,

+ 5 - 4
src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java

@@ -36,7 +36,8 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.resources.files.FileUtils;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
@@ -75,7 +76,7 @@ public class CreateFolderDialogFragment
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
@@ -86,7 +87,7 @@ public class CreateFolderDialogFragment
     @NonNull
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
-        int primaryColor = ThemeUtils.primaryColor(getActivity());
+        int primaryColor = ThemeColorUtils.primaryColor(getActivity());
         mParentFolder = getArguments().getParcelable(ARG_PARENT_FOLDER);
 
         // Inflate the layout for the dialog
@@ -97,7 +98,7 @@ public class CreateFolderDialogFragment
         // Setup layout
         binding.userInput.setText("");
         binding.userInput.requestFocus();
-        ThemeUtils.colorTextInput(binding.userInputContainer, binding.userInput, primaryColor);
+        ThemeTextInputUtils.colorTextInput(binding.userInputContainer, binding.userInput, primaryColor);
 
         // Build the dialog
         AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

+ 4 - 4
src/main/java/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.java

@@ -32,7 +32,7 @@ import com.owncloud.android.R;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.helpers.FileOperationsHelper;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.util.Calendar;
 
@@ -111,9 +111,9 @@ public class ExpirationDatePickerDialogFragment
                 });
 
         dialog.show();
-        dialog.getButton(DatePickerDialog.BUTTON_NEUTRAL).setTextColor(ThemeUtils.primaryColor(getContext(), true));
-        dialog.getButton(DatePickerDialog.BUTTON_NEGATIVE).setTextColor(ThemeUtils.primaryColor(getContext(), true));
-        dialog.getButton(DatePickerDialog.BUTTON_POSITIVE).setTextColor(ThemeUtils.primaryColor(getContext(), true));
+        dialog.getButton(DatePickerDialog.BUTTON_NEUTRAL).setTextColor(ThemeColorUtils.primaryColor(getContext(), true));
+        dialog.getButton(DatePickerDialog.BUTTON_NEGATIVE).setTextColor(ThemeColorUtils.primaryColor(getContext(), true));
+        dialog.getButton(DatePickerDialog.BUTTON_POSITIVE).setTextColor(ThemeColorUtils.primaryColor(getContext(), true));
 
         // Prevent days in the past may be chosen
         DatePicker picker = dialog.getDatePicker();

+ 3 - 3
src/main/java/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.java

@@ -28,7 +28,7 @@ import android.view.KeyEvent;
 import android.widget.ProgressBar;
 
 import com.owncloud.android.R;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;
@@ -71,8 +71,8 @@ public class IndeterminateProgressDialog extends DialogFragment {
             @Override
             public void onShow(DialogInterface dialog) {
                 ProgressBar v = progressDialog.findViewById(android.R.id.progress);
-                v.getIndeterminateDrawable().setColorFilter(ThemeUtils.primaryAccentColor(getContext()),
-                        android.graphics.PorterDuff.Mode.MULTIPLY);
+                v.getIndeterminateDrawable().setColorFilter(ThemeColorUtils.primaryAccentColor(getContext()),
+                                                            android.graphics.PorterDuff.Mode.MULTIPLY);
 
             }
         });

+ 3 - 3
src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.java

@@ -29,7 +29,7 @@ import android.widget.ProgressBar;
 import android.widget.TextView;
 
 import com.owncloud.android.R;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;
@@ -62,8 +62,8 @@ public class LoadingDialog extends DialogFragment {
 
         // set progress wheel color
         ProgressBar progressBar = v.findViewById(R.id.loadingBar);
-        progressBar.getIndeterminateDrawable().setColorFilter(ThemeUtils.primaryAccentColor(getContext()),
-                PorterDuff.Mode.SRC_IN);
+        progressBar.getIndeterminateDrawable().setColorFilter(ThemeColorUtils.primaryAccentColor(getContext()),
+                                                              PorterDuff.Mode.SRC_IN);
 
         return v;
     }

+ 2 - 2
src/main/java/com/owncloud/android/ui/dialog/LocalStoragePathPickerDialogFragment.java

@@ -32,7 +32,7 @@ import com.owncloud.android.R;
 import com.owncloud.android.ui.adapter.StoragePathAdapter;
 import com.owncloud.android.ui.adapter.StoragePathItem;
 import com.owncloud.android.utils.FileStorageUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -79,7 +79,7 @@ public class LocalStoragePathPickerDialogFragment extends DialogFragment
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 

+ 5 - 4
src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java

@@ -34,7 +34,8 @@ import com.owncloud.android.databinding.NoteDialogBinding;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -77,7 +78,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
@@ -88,7 +89,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
     @NonNull
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
-        int primaryColor = ThemeUtils.primaryColor(getContext());
+        int primaryColor = ThemeColorUtils.primaryColor(getContext());
 
         // Inflate the layout for the dialog
         LayoutInflater inflater = requireActivity().getLayoutInflater();
@@ -98,7 +99,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
         // Setup layout
         binding.noteText.setText(share.getNote());
         binding.noteText.requestFocus();
-        ThemeUtils.colorTextInput(binding.noteContainer, binding.noteText, primaryColor);
+        ThemeTextInputUtils.colorTextInput(binding.noteContainer, binding.noteText, primaryColor);
 
         // Build the dialog
         AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());

+ 2 - 2
src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java

@@ -27,7 +27,7 @@ import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -128,7 +128,7 @@ public class RemoveFilesDialogFragment extends ConfirmationDialogFragment implem
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getActivity());
+        int color = ThemeColorUtils.primaryAccentColor(getActivity());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 

+ 6 - 7
src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java

@@ -28,14 +28,12 @@ package com.owncloud.android.ui.dialog;
 
 import android.app.Dialog;
 import android.content.DialogInterface;
-import android.graphics.PorterDuff;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.Window;
 import android.view.WindowManager.LayoutParams;
-import android.widget.EditText;
 
 import com.owncloud.android.R;
 import com.owncloud.android.databinding.EditBoxDialogBinding;
@@ -43,7 +41,8 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.resources.files.FileUtils;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
@@ -82,7 +81,7 @@ public class RenameFileDialogFragment
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
@@ -105,9 +104,9 @@ public class RenameFileDialogFragment
         // Setup layout
         String currentName = mTargetFile.getFileName();
         binding.userInput.setText(currentName);
-        ThemeUtils.colorTextInput(binding.userInputContainer,
-                                  binding.userInput,
-                                  ThemeUtils.primaryColor(getActivity()));
+        ThemeTextInputUtils.colorTextInput(binding.userInputContainer,
+                                           binding.userInput,
+                                           ThemeColorUtils.primaryColor(getActivity()));
         int selectionStart = 0;
         int extensionStart = mTargetFile.isFolder() ? -1 : currentName.lastIndexOf('.');
         int selectionEnd = extensionStart >= 0 ? extensionStart : currentName.length();

+ 4 - 4
src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.java

@@ -37,7 +37,7 @@ import com.owncloud.android.databinding.EditBoxDialogBinding;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
@@ -69,7 +69,7 @@ public class RenamePublicShareDialogFragment
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
@@ -82,7 +82,7 @@ public class RenamePublicShareDialogFragment
     @NonNull
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
-        int accentColor = ThemeUtils.primaryAccentColor(getContext());
+        int accentColor = ThemeColorUtils.primaryAccentColor(getContext());
         publicShare = requireArguments().getParcelable(ARG_PUBLIC_SHARE);
 
         // Inflate the layout for the dialog
@@ -95,7 +95,7 @@ public class RenamePublicShareDialogFragment
         inputText.setText(publicShare.getLabel());
         inputText.requestFocus();
         inputText.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP);
-        inputText.setHighlightColor(ThemeUtils.primaryColor(getActivity()));
+        inputText.setHighlightColor(ThemeColorUtils.primaryColor(getActivity()));
 
         // Build the dialog
         AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());

+ 3 - 3
src/main/java/com/owncloud/android/ui/dialog/SendShareDialog.java

@@ -25,7 +25,7 @@ import com.owncloud.android.ui.adapter.SendButtonAdapter;
 import com.owncloud.android.ui.components.SendButtonData;
 import com.owncloud.android.ui.helpers.FileOperationsHelper;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -194,9 +194,9 @@ public class SendShareDialog extends BottomSheetDialogFragment {
     }
 
     private void themeShareButtonImage(ImageView shareImageView) {
-        shareImageView.getBackground().setColorFilter(ThemeUtils.primaryColor(getContext(), true),
+        shareImageView.getBackground().setColorFilter(ThemeColorUtils.primaryColor(getContext(), true),
                                                       PorterDuff.Mode.SRC_IN);
-        shareImageView.getDrawable().mutate().setColorFilter(ThemeUtils.fontColor(getContext()),
+        shareImageView.getDrawable().mutate().setColorFilter(ThemeColorUtils.fontColor(getContext()),
                 PorterDuff.Mode.SRC_IN);
     }
 

+ 5 - 5
src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java

@@ -46,7 +46,7 @@ import com.owncloud.android.lib.resources.users.SendCSROperation;
 import com.owncloud.android.lib.resources.users.StorePrivateKeyOperation;
 import com.owncloud.android.utils.CsrHelper;
 import com.owncloud.android.utils.EncryptionUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.io.IOException;
 import java.security.KeyPair;
@@ -108,7 +108,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
@@ -125,7 +125,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
     @NonNull
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
-        int primaryColor = ThemeUtils.primaryColor(getContext());
+        int primaryColor = ThemeColorUtils.primaryColor(getContext());
         user = getArguments().getParcelable(ARG_USER);
 
         arbitraryDataProvider = new ArbitraryDataProvider(getContext().getContentResolver());
@@ -402,7 +402,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
 
     @VisibleForTesting
     public void showMnemonicInfo() {
-        int color = ThemeUtils.primaryAccentColor(getContext());
+        int color = ThemeColorUtils.primaryAccentColor(getContext());
         requireDialog().setTitle(R.string.end_to_end_encryption_passphrase_title);
 
         textView.setText(R.string.end_to_end_encryption_keywords_description);
@@ -428,7 +428,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
         textView.setText(R.string.end_to_end_encryption_unsuccessful);
         positiveButton.setText(R.string.end_to_end_encryption_dialog_close);
         positiveButton.setVisibility(View.VISIBLE);
-        positiveButton.setTextColor(ThemeUtils.primaryAccentColor(getContext()));
+        positiveButton.setTextColor(ThemeColorUtils.primaryAccentColor(getContext()));
     }
 
     @VisibleForTesting

+ 7 - 6
src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java

@@ -35,7 +35,8 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
@@ -66,8 +67,8 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
         if (alertDialog != null) {
-            alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ThemeUtils.primaryAccentColor(getContext()));
-            alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(ThemeUtils.primaryAccentColor(getContext()));
+            alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ThemeColorUtils.primaryAccentColor(getContext()));
+            alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(ThemeColorUtils.primaryAccentColor(getContext()));
             alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL)
                 .setTextColor(getResources().getColor(R.color.highlight_textColor_Warning));
         }
@@ -136,9 +137,9 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
 
         // Setup layout
         binding.sharePassword.setText("");
-        ThemeUtils.colorTextInput(binding.sharePasswordContainer,
-                                  binding.sharePassword,
-                                  ThemeUtils.primaryColor(getActivity()));
+        ThemeTextInputUtils.colorTextInput(binding.sharePasswordContainer,
+                                           binding.sharePassword,
+                                           ThemeColorUtils.primaryColor(getActivity()));
         binding.sharePassword.requestFocus();
 
         int title;

+ 5 - 4
src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.java

@@ -34,7 +34,8 @@ import com.google.android.material.button.MaterialButton;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.utils.FileSortOrder;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;
@@ -95,7 +96,7 @@ public class SortingOrderDialogFragment extends DialogFragment {
      */
     private void setupDialogElements(View view) {
         mCancel = view.findViewById(R.id.cancel);
-        mCancel.setTextColor(ThemeUtils.primaryAccentColor(getContext()));
+        mCancel.setTextColor(ThemeColorUtils.primaryAccentColor(getContext()));
 
         mTaggedViews = new View[12];
         mTaggedViews[0] = view.findViewById(R.id.sortByNameAscending);
@@ -130,13 +131,13 @@ public class SortingOrderDialogFragment extends DialogFragment {
      * tints the icon reflecting the actual sorting choice in the apps primary color.
      */
     private void setupActiveOrderSelection() {
-        final int color = ThemeUtils.primaryColor(null, true, true, getContext());
+        final int color = ThemeColorUtils.primaryColor(null, true, true, getContext());
         for (View view: mTaggedViews) {
             if (!((FileSortOrder) view.getTag()).name.equals(mCurrentSortOrderName)) {
                 continue;
             }
             if (view instanceof ImageButton) {
-                ThemeUtils.colorImageButton((ImageButton)view, color);
+                ThemeButtonUtils.colorImageButton((ImageButton)view, color);
             }
             if (view instanceof TextView) {
                 ((TextView)view).setTextColor(color);

+ 2 - 2
src/main/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragment.java

@@ -30,7 +30,7 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.RequiresApi;
@@ -80,7 +80,7 @@ public class SyncFileNotEnoughSpaceDialogFragment extends ConfirmationDialogFrag
     public void onStart() {
         super.onStart();
 
-        int color = ThemeUtils.primaryAccentColor(getActivity());
+        int color = ThemeColorUtils.primaryAccentColor(getActivity());
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
         if (alertDialog != null) {

+ 23 - 18
src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java

@@ -46,7 +46,9 @@ import com.owncloud.android.ui.activity.UploadFilesActivity;
 import com.owncloud.android.ui.dialog.parcel.SyncedFolderParcelable;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileStorageUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeCheckableUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.io.File;
 
@@ -151,7 +153,7 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
      * @param view the parent view
      */
     private void setupDialogElements(View view) {
-        int accentColor = ThemeUtils.primaryAccentColor(getContext());
+        int accentColor = ThemeColorUtils.primaryAccentColor(getContext());
 
         if (mSyncedFolder.getType().getId() > MediaFolderType.CUSTOM.getId()) {
             // hide local folder chooser and delete for non-custom folders
@@ -177,7 +179,7 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
 
         // find/saves UI elements
         mEnabledSwitch = view.findViewById(R.id.sync_enabled);
-        ThemeUtils.tintSwitch(mEnabledSwitch, accentColor);
+        ThemeCheckableUtils.tintSwitch(mEnabledSwitch, accentColor);
 
         mLocalFolderPath = view.findViewById(R.id.synced_folders_settings_local_folder_path);
 
@@ -185,27 +187,29 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
         mRemoteFolderSummary = view.findViewById(R.id.remote_folder_summary);
 
         mUploadOnWifiCheckbox = view.findViewById(R.id.setting_instant_upload_on_wifi_checkbox);
-        ThemeUtils.tintCheckbox(mUploadOnWifiCheckbox, accentColor);
 
         mUploadOnChargingCheckbox = view.findViewById(R.id.setting_instant_upload_on_charging_checkbox);
-        ThemeUtils.tintCheckbox(mUploadOnChargingCheckbox, accentColor);
 
         mUploadExistingCheckbox = view.findViewById(R.id.setting_instant_upload_existing_checkbox);
-        ThemeUtils.tintCheckbox(mUploadExistingCheckbox, accentColor);
 
         mUploadUseSubfoldersCheckbox = view.findViewById(
                 R.id.setting_instant_upload_path_use_subfolders_checkbox);
-        ThemeUtils.tintCheckbox(mUploadUseSubfoldersCheckbox, accentColor);
+
+        ThemeCheckableUtils.tintCheckbox(accentColor,
+                                         mUploadOnWifiCheckbox,
+                                         mUploadOnChargingCheckbox,
+                                         mUploadExistingCheckbox,
+                                         mUploadUseSubfoldersCheckbox);
 
         mUploadBehaviorSummary = view.findViewById(R.id.setting_instant_behaviour_summary);
 
         mNameCollisionPolicySummary = view.findViewById(R.id.setting_instant_name_collision_policy_summary);
 
         mCancel = view.findViewById(R.id.cancel);
-        ThemeUtils.themeBorderlessButton(mCancel, accentColor);
+        ThemeButtonUtils.themeBorderlessButton(mCancel, accentColor);
 
         mSave = view.findViewById(R.id.save);
-        ThemeUtils.themeBorderlessButton(mSave, accentColor);
+        ThemeButtonUtils.themeBorderlessButton(mSave, accentColor);
 
         // Set values
         setEnabled(mSyncedFolder.isEnabled());
@@ -351,16 +355,17 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
         view.findViewById(R.id.setting_instant_name_collision_policy_container).setAlpha(alpha);
 
         if (enable) {
-            int accentColor = ThemeUtils.primaryAccentColor(getContext());
-            ThemeUtils.tintCheckbox(mUploadOnWifiCheckbox, accentColor);
-            ThemeUtils.tintCheckbox(mUploadOnChargingCheckbox, accentColor);
-            ThemeUtils.tintCheckbox(mUploadExistingCheckbox, accentColor);
-            ThemeUtils.tintCheckbox(mUploadUseSubfoldersCheckbox, accentColor);
+            ThemeCheckableUtils.tintCheckbox(ThemeColorUtils.primaryAccentColor(getContext()),
+                                             mUploadOnWifiCheckbox,
+                                             mUploadOnChargingCheckbox,
+                                             mUploadExistingCheckbox,
+                                             mUploadUseSubfoldersCheckbox);
         } else {
-            ThemeUtils.tintCheckbox(mUploadOnWifiCheckbox, Color.GRAY);
-            ThemeUtils.tintCheckbox(mUploadOnChargingCheckbox, Color.GRAY);
-            ThemeUtils.tintCheckbox(mUploadExistingCheckbox, Color.GRAY);
-            ThemeUtils.tintCheckbox(mUploadUseSubfoldersCheckbox, Color.GRAY);
+            ThemeCheckableUtils.tintCheckbox(Color.GRAY,
+                                             mUploadOnWifiCheckbox,
+                                             mUploadOnChargingCheckbox,
+                                             mUploadExistingCheckbox,
+                                             mUploadUseSubfoldersCheckbox);
         }
 
         checkWritableFolder();

+ 9 - 5
src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java

@@ -67,7 +67,10 @@ import com.owncloud.android.ui.activity.UploadFilesActivity;
 import com.owncloud.android.ui.adapter.LocalFileListAdapter;
 import com.owncloud.android.ui.adapter.OCFileListAdapter;
 import com.owncloud.android.ui.events.SearchEvent;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.ThemeLayoutUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import org.greenrobot.eventbus.EventBus;
 import org.parceler.Parcel;
@@ -190,10 +193,10 @@ public class ExtendedListFragment extends Fragment implements
         closeButton = searchView.findViewById(androidx.appcompat.R.id.search_close_btn);
         searchView.setOnQueryTextListener(this);
         searchView.setOnCloseListener(this);
-        ThemeUtils.themeSearchView(searchView, requireContext());
+        ThemeToolbarUtils.themeSearchView(searchView, requireContext());
 
         SearchView.SearchAutoComplete theTextArea = searchView.findViewById(R.id.search_src_text);
-        theTextArea.setHighlightColor(ThemeUtils.primaryAccentColor(getContext()));
+        theTextArea.setHighlightColor(ThemeColorUtils.primaryAccentColor(getContext()));
 
         final Handler handler = new Handler();
 
@@ -378,7 +381,7 @@ public class ExtendedListFragment extends Fragment implements
 
         // Pull-down to refresh layout
         mRefreshListLayout = v.findViewById(R.id.swipe_containing_list);
-        ThemeUtils.colorSwipeRefreshLayout(getContext(), mRefreshListLayout);
+        ThemeLayoutUtils.colorSwipeRefreshLayout(getContext(), mRefreshListLayout);
         mRefreshListLayout.setOnRefreshListener(this);
 
         mSortButton = getActivity().findViewById(R.id.sort_button);
@@ -612,7 +615,8 @@ public class ExtendedListFragment extends Fragment implements
                     if (tintIcon) {
                         if (getContext() != null) {
                             mEmptyListIcon.setImageDrawable(
-                                ThemeUtils.tintDrawable(icon, ThemeUtils.primaryColor(getContext(), true)));
+                                ThemeDrawableUtils.tintDrawable(icon,
+                                                                ThemeColorUtils.primaryColor(getContext(),true)));
                         }
                     } else {
                         mEmptyListIcon.setImageResource(icon);

+ 2 - 2
src/main/java/com/owncloud/android/ui/fragment/FeatureFragment.java

@@ -15,7 +15,7 @@ import android.widget.TextView;
 
 import com.owncloud.android.R;
 import com.owncloud.android.features.FeatureItem;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -48,7 +48,7 @@ public class FeatureFragment extends Fragment {
 
         ImageView whatsNewImage = view.findViewById(R.id.whatsNewImage);
         if (item.shouldShowImage()) {
-            whatsNewImage.setImageDrawable(ThemeUtils.tintDrawable(item.getImage(), fontColor));
+            whatsNewImage.setImageDrawable(ThemeDrawableUtils.tintDrawable(item.getImage(), fontColor));
         }
 
         TextView whatsNewTitle = view.findViewById(R.id.whatsNewTitle);

+ 8 - 6
src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java

@@ -59,7 +59,9 @@ import com.owncloud.android.ui.helpers.FileOperationsHelper;
 import com.owncloud.android.ui.interfaces.ActivityListInterface;
 import com.owncloud.android.ui.interfaces.VersionListInterface;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeLayoutUtils;
+import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
 import org.apache.commons.httpclient.HttpStatus;
 import org.greenrobot.eventbus.EventBus;
@@ -142,8 +144,8 @@ public class FileDetailActivitiesFragment extends Fragment implements
 
         setupView();
 
-        ThemeUtils.colorSwipeRefreshLayout(getContext(), binding.swipeContainingEmpty);
-        ThemeUtils.colorSwipeRefreshLayout(getContext(), binding.swipeContainingList);
+        ThemeLayoutUtils.colorSwipeRefreshLayout(getContext(), binding.swipeContainingEmpty);
+        ThemeLayoutUtils.colorSwipeRefreshLayout(getContext(), binding.swipeContainingList);
 
         fetchAndSetData(-1);
 
@@ -174,9 +176,9 @@ public class FileDetailActivitiesFragment extends Fragment implements
 
         binding.submitComment.setOnClickListener(v -> submitComment());
 
-        ThemeUtils.colorTextInput(binding.commentInputFieldContainer,
-                                  binding.commentInputField,
-                                  ThemeUtils.primaryColor(getContext()));
+        ThemeTextInputUtils.colorTextInput(binding.commentInputFieldContainer,
+                                           binding.commentInputField,
+                                           ThemeColorUtils.primaryColor(getContext()));
 
         DisplayUtils.setAvatar(user,
                                this,

+ 5 - 3
src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java

@@ -62,7 +62,9 @@ import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
 import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeBarUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeLayoutUtils;
 
 import java.lang.ref.WeakReference;
 
@@ -204,7 +206,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
     @Override
     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
         if (getFile() != null && user != null) {
-            ThemeUtils.colorHorizontalProgressBar(binding.progressBar, ThemeUtils.primaryAccentColor(getContext()));
+            ThemeBarUtils.colorHorizontalProgressBar(binding.progressBar, ThemeColorUtils.primaryAccentColor(getContext()));
             progressListener = new ProgressListener(binding.progressBar);
             binding.cancelBtn.setOnClickListener(this);
             binding.favorite.setOnClickListener(this);
@@ -230,7 +232,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
         binding.tabLayout.addTab(binding.tabLayout.newTab().setText(R.string.drawer_item_activities).setIcon(R.drawable.ic_activity));
         binding.tabLayout.addTab(binding.tabLayout.newTab().setText(R.string.share_dialog_title).setIcon(R.drawable.shared_via_users));
 
-        ThemeUtils.colorTabLayout(getContext(), binding.tabLayout);
+        ThemeLayoutUtils.colorTabLayout(getContext(), binding.tabLayout);
 
         final FileDetailTabAdapter adapter = new FileDetailTabAdapter(getFragmentManager(), getFile(), user);
         binding.pager.setAdapter(adapter);

+ 3 - 2
src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

@@ -65,7 +65,8 @@ import com.owncloud.android.ui.fragment.util.SharingMenuHelper;
 import com.owncloud.android.ui.helpers.FileOperationsHelper;
 import com.owncloud.android.utils.ClipboardUtil;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -201,7 +202,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
             (SearchManager) fileActivity.getSystemService(Context.SEARCH_SERVICE),
             binding.searchView,
             fileActivity.getComponentName());
-        ThemeUtils.themeSearchView(binding.searchView, requireContext());
+        ThemeToolbarUtils.themeSearchView(binding.searchView, requireContext());
 
         if (file.canReshare()) {
             binding.searchView.setQueryHint(getResources().getString(R.string.share_search));

+ 8 - 6
src/main/java/com/owncloud/android/ui/fragment/OCFileListBottomSheetDialog.java

@@ -40,7 +40,9 @@ import com.owncloud.android.lib.common.DirectEditing;
 import com.owncloud.android.lib.resources.status.OCCapability;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 /**
  * FAB menu {@link android.app.Dialog} styled as a bottom sheet for main actions.
@@ -76,11 +78,11 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog {
             getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
         }
 
-        int primaryColor = ThemeUtils.primaryColor(getContext(), true);
-        ThemeUtils.tintDrawable(binding.menuIconUploadFiles.getDrawable(), primaryColor);
-        ThemeUtils.tintDrawable(binding.menuIconUploadFromApp.getDrawable(), primaryColor);
-        ThemeUtils.tintDrawable(binding.menuIconDirectCameraUpload.getDrawable(), primaryColor);
-        ThemeUtils.tintDrawable(binding.menuIconMkdir.getDrawable(), primaryColor);
+        int primaryColor = ThemeColorUtils.primaryColor(getContext(), true);
+        ThemeDrawableUtils.tintDrawable(binding.menuIconUploadFiles.getDrawable(), primaryColor);
+        ThemeDrawableUtils.tintDrawable(binding.menuIconUploadFromApp.getDrawable(), primaryColor);
+        ThemeDrawableUtils.tintDrawable(binding.menuIconDirectCameraUpload.getDrawable(), primaryColor);
+        ThemeDrawableUtils.tintDrawable(binding.menuIconMkdir.getDrawable(), primaryColor);
 
         binding.addToCloud.setText(getContext().getResources().getString(R.string.add_to_cloud,
                 ThemeUtils.getDefaultDisplayNameForRootFolder(getContext())));

+ 12 - 9
src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -101,7 +101,10 @@ import com.owncloud.android.utils.EncryptionUtils;
 import com.owncloud.android.utils.FileSortOrder;
 import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeFabUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import org.apache.commons.httpclient.HttpStatus;
 import org.greenrobot.eventbus.EventBus;
@@ -291,7 +294,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
         mFabMain = requireActivity().findViewById(R.id.fab_main);
 
         if (mFabMain != null) { // is not available in FolderPickerActivity
-            ThemeUtils.colorFloatingActionButton(mFabMain, R.drawable.ic_plus, requireContext());
+            ThemeFabUtils.colorFloatingActionButton(mFabMain, R.drawable.ic_plus, requireContext());
         }
 
         Log_OC.i(TAG, "onCreateView() end");
@@ -432,7 +435,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
         FileActivity activity = (FileActivity) getActivity();
 
         if (mFabMain != null) { // is not available in FolderPickerActivity
-            ThemeUtils.colorFloatingActionButton(mFabMain, R.drawable.ic_plus, requireContext());
+            ThemeFabUtils.colorFloatingActionButton(mFabMain, R.drawable.ic_plus, requireContext());
             mFabMain.setOnClickListener(v -> new OCFileListBottomSheetDialog(activity,
                                                                              this,
                                                                              deviceInfo,
@@ -660,7 +663,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
             mode.invalidate();
 
             //set actionMode color
-            ThemeUtils.colorStatusBar(getActivity(), ThemeUtils.actionModeColor(requireContext()));
+            ThemeToolbarUtils.colorStatusBar(getActivity(), ThemeColorUtils.actionModeColor(requireContext()));
 
             // hide FAB in multi selection mode
             setFabVisible(false);
@@ -1649,7 +1652,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
     protected void setTitle(@StringRes final int title) {
         getActivity().runOnUiThread(() -> {
             if (getActivity() != null && ((FileDisplayActivity) getActivity()).getSupportActionBar() != null) {
-                ThemeUtils.setColoredTitle(((FileDisplayActivity) getActivity()).getSupportActionBar(),
+                ThemeToolbarUtils.setColoredTitle(((FileDisplayActivity) getActivity()).getSupportActionBar(),
                                            title, getContext());
             }
         });
@@ -1661,7 +1664,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
                 ActionBar actionBar = ((FileDisplayActivity) getActivity()).getSupportActionBar();
 
                 if (actionBar != null) {
-                    ThemeUtils.setColoredTitle(actionBar, title, getContext());
+                    ThemeToolbarUtils.setColoredTitle(actionBar, title, getContext());
                 }
             }
         });
@@ -1810,7 +1813,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
             getActivity().runOnUiThread(() -> {
                 if (visible) {
                     mFabMain.show();
-                    ThemeUtils.colorFloatingActionButton(mFabMain, requireContext());
+                    ThemeFabUtils.colorFloatingActionButton(mFabMain, requireContext());
                 } else {
                     mFabMain.hide();
                 }
@@ -1860,10 +1863,10 @@ public class OCFileListFragment extends ExtendedListFragment implements
             getActivity().runOnUiThread(() -> {
                 if (enabled) {
                     mFabMain.setEnabled(true);
-                    ThemeUtils.colorFloatingActionButton(mFabMain, requireContext());
+                    ThemeFabUtils.colorFloatingActionButton(mFabMain, requireContext());
                 } else {
                     mFabMain.setEnabled(false);
-                    ThemeUtils.colorFloatingActionButton(mFabMain, requireContext(), Color.GRAY);
+                    ThemeFabUtils.colorFloatingActionButton(mFabMain, requireContext(), Color.GRAY);
                 }
             });
         }

+ 6 - 5
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java

@@ -70,7 +70,8 @@ import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.BitmapUtils;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.PermissionUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
@@ -154,7 +155,7 @@ public class ContactListFragment extends FileFragment implements Injectable {
         if (contactsPreferenceActivity != null) {
             ActionBar actionBar = contactsPreferenceActivity.getSupportActionBar();
             if (actionBar != null) {
-                ThemeUtils.setColoredTitle(actionBar, R.string.actionbar_contacts_restore, getContext());
+                ThemeToolbarUtils.setColoredTitle(actionBar, R.string.actionbar_contacts_restore, getContext());
                 actionBar.setDisplayHomeAsUpEnabled(true);
             }
             contactsPreferenceActivity.setDrawerIndicatorEnabled(false);
@@ -200,7 +201,7 @@ public class ContactListFragment extends FileFragment implements Injectable {
             }
         });
 
-        binding.contactlistRestoreSelected.setTextColor(ThemeUtils.primaryAccentColor(getContext()));
+        binding.contactlistRestoreSelected.setTextColor(ThemeColorUtils.primaryAccentColor(getContext()));
 
         return view;
     }
@@ -680,7 +681,7 @@ class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.Contac
 
         if (checked) {
             checkedTextView.getCheckMarkDrawable()
-                .setColorFilter(ThemeUtils.primaryColor(context), PorterDuff.Mode.SRC_ATOP);
+                .setColorFilter(ThemeColorUtils.primaryColor(context), PorterDuff.Mode.SRC_ATOP);
         } else {
             checkedTextView.getCheckMarkDrawable().clearColorFilter();
         }
@@ -690,7 +691,7 @@ class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.Contac
         holder.getName().setChecked(!holder.getName().isChecked());
 
         if (holder.getName().isChecked()) {
-            holder.getName().getCheckMarkDrawable().setColorFilter(ThemeUtils.primaryColor(context),
+            holder.getName().getCheckMarkDrawable().setColorFilter(ThemeColorUtils.primaryColor(context),
                                                                    PorterDuff.Mode.SRC_ATOP);
 
             checkedVCards.add(verifiedPosition);

+ 14 - 9
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java

@@ -52,7 +52,12 @@ import com.owncloud.android.ui.activity.SettingsActivity;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.PermissionUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.ThemeCheckableUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
+import com.owncloud.android.utils.theme.ThemeUtils;
 
 import java.util.Calendar;
 import java.util.Collections;
@@ -139,15 +144,15 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
         ActionBar actionBar = contactsPreferenceActivity != null ? contactsPreferenceActivity.getSupportActionBar() : null;
 
         if (actionBar != null) {
-            ThemeUtils.setColoredTitle(actionBar, getString(R.string.actionbar_contacts), getContext());
+            ThemeToolbarUtils.setColoredTitle(actionBar, getString(R.string.actionbar_contacts), getContext());
 
             actionBar.setDisplayHomeAsUpEnabled(true);
-            ThemeUtils.tintBackButton(actionBar, getContext());
+            ThemeToolbarUtils.tintBackButton(actionBar, getContext());
         }
 
         arbitraryDataProvider = new ArbitraryDataProvider(getContext().getContentResolver());
 
-        ThemeUtils.tintSwitch(backupSwitch, ThemeUtils.primaryAccentColor(getContext()));
+        ThemeCheckableUtils.tintSwitch(backupSwitch, ThemeColorUtils.primaryAccentColor(getContext()));
         backupSwitch.setChecked(arbitraryDataProvider.getBooleanValue(user, PREFERENCE_CONTACTS_AUTOMATIC_BACKUP));
 
         onCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {
@@ -184,8 +189,8 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
             calendarPickerOpen = true;
         }
 
-        ThemeUtils.colorPrimaryButton(backupNow, getContext());
-        ThemeUtils.colorPrimaryButton(contactsDatePickerBtn, getContext());
+        ThemeButtonUtils.colorPrimaryButton(backupNow, getContext());
+        ThemeButtonUtils.colorPrimaryButton(contactsDatePickerBtn, getContext());
 
         return view;
     }
@@ -376,7 +381,7 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
                                 PermissionUtil.PERMISSIONS_READ_CONTACTS_AUTOMATIC)
                         );
 
-                ThemeUtils.colorSnackbar(contactsPreferenceActivity, snackbar);
+                ThemeSnackbarUtils.colorSnackbar(contactsPreferenceActivity, snackbar);
 
                 snackbar.show();
 
@@ -450,8 +455,8 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
             datePickerDialog.setTitle("");
             datePickerDialog.show();
 
-            datePickerDialog.getButton(DatePickerDialog.BUTTON_NEGATIVE).setTextColor(ThemeUtils.primaryColor(getContext(),true));
-            datePickerDialog.getButton(DatePickerDialog.BUTTON_POSITIVE).setTextColor(ThemeUtils.primaryColor(getContext(), true));
+            datePickerDialog.getButton(DatePickerDialog.BUTTON_NEGATIVE).setTextColor(ThemeColorUtils.primaryColor(getContext(),true));
+            datePickerDialog.getButton(DatePickerDialog.BUTTON_POSITIVE).setTextColor(ThemeColorUtils.primaryColor(getContext(), true));
 
             // set background to transparent
             datePickerDialog.getButton(DatePickerDialog.BUTTON_NEGATIVE).setBackgroundColor(0x00000000);

+ 2 - 2
src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java

@@ -25,7 +25,7 @@ import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Process;
 
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.security.SecureRandom;
 
@@ -62,7 +62,7 @@ public final class NotificationUtils {
      * @return              An instance of the regular {@link NotificationCompat.Builder}.
      */
     public static NotificationCompat.Builder newNotificationBuilder(Context context) {
-        return new NotificationCompat.Builder(context).setColor(ThemeUtils.primaryColor(context));
+        return new NotificationCompat.Builder(context).setColor(ThemeColorUtils.primaryColor(context));
     }
 
     @SuppressFBWarnings("DMI")

+ 3 - 2
src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java

@@ -33,7 +33,8 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.fragment.FileFragment;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeBarUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import java.lang.ref.WeakReference;
 
@@ -139,7 +140,7 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
         mView = inflater.inflate(R.layout.file_download_fragment, container, false);
 
         ProgressBar progressBar = mView.findViewById(R.id.progressBar);
-        ThemeUtils.colorHorizontalProgressBar(progressBar, ThemeUtils.primaryAccentColor(getContext()));
+        ThemeBarUtils.colorHorizontalProgressBar(progressBar, ThemeColorUtils.primaryAccentColor(getContext()));
         mProgressListener = new ProgressListener(progressBar);
 
         (mView.findViewById(R.id.cancelBtn)).setOnClickListener(this);

+ 2 - 2
src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -58,7 +58,7 @@ import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import javax.inject.Inject;
 
@@ -121,7 +121,7 @@ public class PreviewImageActivity extends FileActivity implements
         // ActionBar
         updateActionBarTitleAndHomeButton(null);
 
-        ThemeUtils.tintBackButton(actionBar, this, Color.WHITE);
+        ThemeToolbarUtils.tintBackButton(actionBar, this, Color.WHITE);
 
         mFullScreenAnchorView = getWindow().getDecorView();
         // to keep our UI controls visibility in line with system bars visibility

+ 3 - 3
src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java

@@ -46,7 +46,7 @@ import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 import com.owncloud.android.utils.StringUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import javax.inject.Inject;
 
@@ -165,13 +165,13 @@ public abstract class PreviewTextFragment extends FileFragment implements Search
         Prism4j prism4j = new Prism4j(new MarkwonGrammarLocator());
         Prism4jTheme prism4jTheme = Prism4jThemeDefault.create();
         TaskListDrawable drawable = new TaskListDrawable(Color.GRAY, Color.GRAY, Color.WHITE);
-        drawable.setColorFilter(ThemeUtils.primaryColor(activity, true), PorterDuff.Mode.SRC_ATOP);
+        drawable.setColorFilter(ThemeColorUtils.primaryColor(activity, true), PorterDuff.Mode.SRC_ATOP);
 
         final Markwon markwon = Markwon.builder(activity)
             .usePlugin(new AbstractMarkwonPlugin() {
                 @Override
                 public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
-                    builder.linkColor(ThemeUtils.primaryColor(activity, true));
+                    builder.linkColor(ThemeColorUtils.primaryColor(activity, true));
                     builder.headingBreakHeight(0);
                 }
 

+ 2 - 2
src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java

@@ -40,7 +40,7 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeFabUtils;
 
 import javax.inject.Inject;
 
@@ -106,7 +106,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment {
         fabMain.setVisibility(View.VISIBLE);
         fabMain.setEnabled(true);
         fabMain.setOnClickListener(v -> edit());
-        ThemeUtils.colorFloatingActionButton(fabMain, R.drawable.ic_edit, requireContext());
+        ThemeFabUtils.colorFloatingActionButton(fabMain, R.drawable.ic_edit, requireContext());
 
         return view;
     }

+ 2 - 2
src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.java

@@ -46,7 +46,7 @@ import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
 import com.owncloud.android.ui.interfaces.TrashbinActivityInterface;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileSortOrder;
-import com.owncloud.android.utils.ThemeUtils;
+import com.owncloud.android.utils.theme.ThemeLayoutUtils;
 
 import java.util.List;
 
@@ -125,7 +125,7 @@ public class TrashbinActivity extends DrawerActivity implements
         recyclerView.setHasFooter(true);
         recyclerView.setLayoutManager(new LinearLayoutManager(this));
 
-        ThemeUtils.colorSwipeRefreshLayout(this, binding.swipeContainingList);
+        ThemeLayoutUtils.colorSwipeRefreshLayout(this, binding.swipeContainingList);
         binding.swipeContainingList.setOnRefreshListener(this::loadFolder);
 
         findViewById(R.id.sort_button).setOnClickListener(l ->

+ 2 - 1
src/main/java/com/owncloud/android/utils/DisplayUtils.java

@@ -75,6 +75,7 @@ import com.owncloud.android.ui.fragment.OCFileListFragment;
 import com.owncloud.android.utils.glide.CustomGlideUriLoader;
 import com.owncloud.android.utils.svg.SvgDecoder;
 import com.owncloud.android.utils.svg.SvgDrawableTranscoder;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import org.greenrobot.eventbus.EventBus;
 import org.parceler.Parcels;
@@ -332,7 +333,7 @@ public final class DisplayUtils {
      */
     public static int getRelativeInfoColor(Context context, int relative) {
         if (relative < RELATIVE_THRESHOLD_WARNING) {
-            return ThemeUtils.primaryColor(context, true);
+            return ThemeColorUtils.primaryColor(context, true);
         } else {
             return context.getResources().getColor(R.color.infolevel_warning);
         }

+ 5 - 3
src/main/java/com/owncloud/android/utils/MimeTypeUtil.java

@@ -28,6 +28,8 @@ import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.network.WebdavEntry;
 import com.owncloud.android.lib.resources.files.model.ServerFileInterface;
+import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.ThemeDrawableUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -109,7 +111,7 @@ public final class MimeTypeUtil {
             Drawable icon = ContextCompat.getDrawable(context, iconId);
 
             if (R.drawable.file_zip == iconId) {
-                ThemeUtils.tintDrawable(icon, ThemeUtils.primaryColor(user, true, context));
+                ThemeDrawableUtils.tintDrawable(icon, ThemeColorUtils.primaryColor(user, true, context));
             }
 
             return icon;
@@ -179,10 +181,10 @@ public final class MimeTypeUtil {
             drawableId = R.drawable.folder;
         }
 
-        int color = ThemeUtils.primaryColor(user != null ? user.toPlatformAccount() : null,
+        int color = ThemeColorUtils.primaryColor(user != null ? user.toPlatformAccount() : null,
                                             true,
                                             context);
-        return ThemeUtils.tintDrawable(drawableId, color);
+        return ThemeDrawableUtils.tintDrawable(drawableId, color);
     }
 
     public static Drawable getDefaultFolderIcon(Context context) {

+ 0 - 842
src/main/java/com/owncloud/android/utils/ThemeUtils.java

@@ -1,842 +0,0 @@
-/*
- * Nextcloud Android client application
- *
- * @author Tobias Kaminsky
- * @author Andy Scherzinger
- * Copyright (C) 2017 Tobias Kaminsky
- * Copyright (C) 2017 Nextcloud GmbH
- * Copyright (C) 2018 Andy Scherzinger
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-package com.owncloud.android.utils;
-
-import android.accounts.Account;
-import android.app.Activity;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.Configuration;
-import android.graphics.Color;
-import android.graphics.PorterDuff;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.Spanned;
-import android.text.style.ForegroundColorSpan;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.SeekBar;
-
-import com.google.android.material.floatingactionbutton.FloatingActionButton;
-import com.google.android.material.snackbar.Snackbar;
-import com.google.android.material.tabs.TabLayout;
-import com.google.android.material.textfield.TextInputEditText;
-import com.google.android.material.textfield.TextInputLayout;
-import com.nextcloud.client.account.User;
-import com.nextcloud.client.account.UserAccountManagerImpl;
-import com.owncloud.android.MainApp;
-import com.owncloud.android.R;
-import com.owncloud.android.datamodel.FileDataStorageManager;
-import com.owncloud.android.lib.resources.shares.ShareType;
-import com.owncloud.android.lib.resources.status.OCCapability;
-
-import androidx.annotation.ColorInt;
-import androidx.annotation.DrawableRes;
-import androidx.annotation.Nullable;
-import androidx.appcompat.app.ActionBar;
-import androidx.appcompat.app.AppCompatDelegate;
-import androidx.appcompat.widget.AppCompatCheckBox;
-import androidx.appcompat.widget.SearchView;
-import androidx.appcompat.widget.SwitchCompat;
-import androidx.core.content.ContextCompat;
-import androidx.core.content.res.ResourcesCompat;
-import androidx.core.graphics.ColorUtils;
-import androidx.core.graphics.drawable.DrawableCompat;
-import androidx.core.widget.CompoundButtonCompat;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * Utility class with methods for client side theming.
- */
-public final class ThemeUtils {
-
-    private static final int INDEX_LUMINATION = 2;
-    private static final double MAX_LIGHTNESS = 0.92;
-    public static final double LUMINATION_THRESHOLD = 0.8;
-
-    private ThemeUtils() {
-        // utility class -> private constructor
-    }
-
-    public static int primaryAccentColor(Context context) {
-        OCCapability capability = getCapability(context);
-
-        try {
-            float adjust;
-            if (isDarkModeActive(context)) {
-                adjust = +0.5f;
-            } else {
-                adjust = -0.1f;
-            }
-            return adjustLightness(adjust, Color.parseColor(capability.getServerColor()), 0.35f);
-        } catch (Exception e) {
-            return context.getResources().getColor(R.color.color_accent);
-        }
-    }
-
-    public static int primaryDarkColor(Context context) {
-        return primaryDarkColor(null, context);
-    }
-
-    public static int primaryDarkColor(Account account, Context context) {
-        OCCapability capability = getCapability(account, context);
-
-        try {
-            return calculateDarkColor(Color.parseColor(capability.getServerColor()), context);
-        } catch (Exception e) {
-            return context.getResources().getColor(R.color.primary_dark);
-        }
-    }
-
-    public static int calculateDarkColor(int color, Context context) {
-        try {
-            return adjustLightness(-0.2f, color, -1f);
-        } catch (Exception e) {
-            return context.getResources().getColor(R.color.primary_dark);
-        }
-    }
-
-    public static int primaryColor(Context context) {
-        return primaryColor(context, false);
-    }
-
-    public static int primaryColor(Context context, boolean replaceEdgeColors) {
-        User nullUser = null;
-        return primaryColor(nullUser, replaceEdgeColors, context);
-    }
-
-    public static int primaryColor(User user, boolean replaceEdgeColors, Context context) {
-        return primaryColor(user != null ? user.toPlatformAccount() : null,
-                            replaceEdgeColors,
-                            false,
-                            context);
-    }
-
-    public static int primaryColor(Account account, boolean replaceEdgeColors, Context context) {
-        return primaryColor(account, replaceEdgeColors, false, context);
-    }
-
-    /**
-     * return the primary color defined in the server-side theming respecting Android dark/light theming and edge case
-     * scenarios including drawer menu.
-     *
-     * @param account                          the Nextcloud user
-     * @param replaceEdgeColors                flag if edge case color scenarios should be handled
-     * @param replaceEdgeColorsByInvertedColor flag in edge case handling should be done via color inversion
-     *                                         (black/white)
-     * @param context                          the context (needed to load client-side colors)
-     * @return the color
-     */
-    public static int primaryColor(Account account,
-                                   boolean replaceEdgeColors,
-                                   boolean replaceEdgeColorsByInvertedColor,
-                                   Context context) {
-        if (context == null) {
-            return Color.GRAY;
-        }
-
-        try {
-            int color = Color.parseColor(getCapability(account, context).getServerColor());
-            if (replaceEdgeColors) {
-                if (isDarkModeActive(context)) {
-                    if (Color.BLACK == color) {
-                        if (replaceEdgeColorsByInvertedColor) {
-                            return Color.WHITE;
-                        } else {
-                            return getNeutralGrey(context);
-                        }
-                    } else {
-                        return color;
-                    }
-                } else {
-                    if (Color.WHITE == color) {
-                        if (replaceEdgeColorsByInvertedColor) {
-                            return Color.BLACK;
-                        } else {
-                            return getNeutralGrey(context);
-                        }
-                    } else {
-                        return color;
-                    }
-                }
-            } else {
-                return color;
-            }
-        } catch (Exception e) {
-            return context.getResources().getColor(R.color.primary);
-        }
-    }
-
-    public static int getNeutralGrey(Context context) {
-        return darkTheme(context) ? context.getResources().getColor(R.color.fg_contrast) : Color.GRAY;
-    }
-
-    public static boolean themingEnabled(Context context) {
-        return getCapability(context).getServerColor() != null && !getCapability(context).getServerColor().isEmpty();
-    }
-
-    /**
-     * returns the font color based on the server side theming and uses black/white as a fallback based on
-     * replaceWhite.
-     *
-     * @param context      the context
-     * @param replaceWhite FLAG to return white/black if server side color isn't available
-     * @return int font color to use
-     */
-    public static int fontColor(Context context, boolean replaceWhite) {
-        if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) {
-            if (replaceWhite) {
-                return Color.BLACK;
-            } else {
-                return Color.WHITE;
-            }
-        }
-
-        try {
-            return Color.parseColor(getCapability(context).getServerTextColor());
-        } catch (Exception e) {
-            if (darkTheme(context)) {
-                return Color.WHITE;
-            } else {
-                return Color.BLACK;
-            }
-        }
-    }
-
-    public static int fontColor(Context context) {
-        return fontColor(context, false);
-    }
-
-    /**
-     * Tests if light color is set
-     *
-     * @param color the color
-     * @return true if primaryColor is lighter than MAX_LIGHTNESS
-     */
-    public static boolean lightTheme(int color) {
-        float[] hsl = colorToHSL(color);
-
-        return hsl[INDEX_LUMINATION] >= MAX_LIGHTNESS;
-    }
-
-    /**
-     * Tests if dark color is set
-     *
-     * @return true if dark theme -> e.g.use light font color, darker accent color
-     */
-    public static boolean darkTheme(Context context) {
-        int primaryColor = primaryColor(context);
-        float[] hsl = colorToHSL(primaryColor);
-
-        return hsl[INDEX_LUMINATION] <= 0.55;
-    }
-
-    public static int primaryAppbarColor(Context context) {
-        return ContextCompat.getColor(context, R.color.appbar);
-    }
-
-    public static int appBarPrimaryFontColor(Context context) {
-        return ContextCompat.getColor(context, R.color.fontAppbar);
-    }
-
-    public static int appBarSecondaryFontColor(Context context) {
-        return ContextCompat.getColor(context, R.color.fontSecondaryAppbar);
-    }
-
-    public static int actionModeColor(Context context) {
-        return ContextCompat.getColor(context, R.color.action_mode_background);
-    }
-
-    /**
-     * Set color of title to white/black depending on background color
-     *
-     * @param actionBar actionBar to be used
-     * @param title     title to be shown
-     */
-    public static void setColoredTitle(@Nullable ActionBar actionBar, String title, Context context) {
-        if (actionBar != null) {
-            Spannable text = new SpannableString(title);
-            text.setSpan(new ForegroundColorSpan(appBarPrimaryFontColor(context)),
-                         0,
-                         text.length(),
-                         Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-            actionBar.setTitle(text);
-        }
-    }
-
-    public static void setColoredTitle(@Nullable ActionBar actionBar, int titleId, Context context) {
-        setColoredTitle(actionBar, context.getString(titleId), context);
-    }
-
-    /**
-     * Set color of subtitle to white/black depending on background color
-     *
-     * @param actionBar actionBar to be used
-     * @param title     title to be shown
-     */
-    public static void setColoredSubtitle(@Nullable ActionBar actionBar, String title, Context context) {
-        if (actionBar != null) {
-            Spannable text = new SpannableString(title);
-            text.setSpan(new ForegroundColorSpan(appBarSecondaryFontColor(context)),
-                         0,
-                         text.length(),
-                         Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-            actionBar.setSubtitle(text);
-        }
-    }
-
-    /**
-     * For activities that do not use drawer, e.g. Settings, this can be used to correctly tint back button based on
-     * theme
-     *
-     * @param supportActionBar the back button's action bar
-     */
-    public static void tintBackButton(@Nullable ActionBar supportActionBar, Context context) {
-        tintBackButton(supportActionBar, context, ThemeUtils.appBarPrimaryFontColor(context));
-    }
-
-    public static void tintBackButton(@Nullable ActionBar supportActionBar, Context context, @ColorInt int color) {
-        if (supportActionBar == null) {
-            return;
-        }
-
-        Drawable backArrow = ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_arrow_back, null);
-        supportActionBar.setHomeAsUpIndicator(ThemeUtils.tintDrawable(backArrow, color));
-    }
-
-    public static Spanned getColoredTitle(String title, int color) {
-        Spannable text = new SpannableString(title);
-        text.setSpan(new ForegroundColorSpan(color),
-                     0,
-                     text.length(),
-                     Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-
-        return text;
-    }
-
-    public static String getDefaultDisplayNameForRootFolder(Context context) {
-        OCCapability capability = getCapability(context);
-
-        if (MainApp.isOnlyOnDevice()) {
-            return MainApp.getAppContext().getString(R.string.drawer_item_on_device);
-        } else {
-            if (capability.getServerName() == null || capability.getServerName().isEmpty()) {
-                return MainApp.getAppContext().getResources().getString(R.string.default_display_name_for_root_folder);
-            } else {
-                return capability.getServerName();
-            }
-        }
-
-    }
-
-    public static void setStatusBarColor(Activity activity, @ColorInt int color) {
-        if (activity != null) {
-            activity.getWindow().setStatusBarColor(color);
-        }
-    }
-
-    /**
-     * Adjust lightness of given color
-     *
-     * @param lightnessDelta values -1..+1
-     * @param color          original color
-     * @param threshold      0..1 as maximum value, -1 to disable
-     * @return color adjusted by lightness
-     */
-    public static int adjustLightness(float lightnessDelta, int color, float threshold) {
-        float[] hsl = colorToHSL(color);
-
-        if (threshold == -1f) {
-            hsl[INDEX_LUMINATION] += lightnessDelta;
-        } else {
-            hsl[INDEX_LUMINATION] = Math.min(hsl[INDEX_LUMINATION] + lightnessDelta, threshold);
-        }
-
-        return ColorUtils.HSLToColor(hsl);
-    }
-
-    private static float[] colorToHSL(int color) {
-        float[] hsl = new float[3];
-        ColorUtils.RGBToHSL(Color.red(color), Color.green(color), Color.blue(color), hsl);
-
-        return hsl;
-    }
-
-    public static void colorPrimaryButton(Button button, Context context) {
-        int primaryColor = ThemeUtils.primaryColor(null, true, false, context);
-        int fontColor = ThemeUtils.fontColor(context, false);
-
-        button.setBackgroundColor(primaryColor);
-
-        if (Color.BLACK == primaryColor) {
-            button.setTextColor(Color.WHITE);
-        } else if (Color.WHITE == primaryColor) {
-            button.setTextColor(Color.BLACK);
-        } else {
-            button.setTextColor(fontColor);
-        }
-    }
-
-    /**
-     * sets the tinting of the given ImageButton's icon to color_accent.
-     *
-     * @param imageButton the image button who's icon should be colored
-     */
-    public static void colorImageButton(ImageButton imageButton, @ColorInt int color) {
-        if (imageButton != null) {
-            imageButton.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
-        }
-    }
-
-    public static void colorEditText(EditText editText, int color) {
-        if (editText != null) {
-            editText.setTextColor(color);
-            editText.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
-        }
-    }
-
-    /**
-     * sets the coloring of the given progress bar to given color.
-     *
-     * @param progressBar the progress bar to be colored
-     * @param color       the color to be used
-     */
-    public static void colorHorizontalProgressBar(ProgressBar progressBar, @ColorInt int color) {
-        if (progressBar != null) {
-            progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
-            progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
-        }
-    }
-
-    /**
-     * sets the coloring of the given progress bar's progress to given color.
-     *
-     * @param progressBar the progress bar to be colored
-     * @param color       the color to be used
-     */
-    public static void colorProgressBar(ProgressBar progressBar, @ColorInt int color) {
-        if (progressBar != null) {
-            progressBar.setProgressTintList(ColorStateList.valueOf(color));
-        }
-    }
-
-    /**
-     * sets the coloring of the given seek bar to color_accent.
-     *
-     * @param seekBar the seek bar to be colored
-     */
-    public static void colorHorizontalSeekBar(SeekBar seekBar, Context context) {
-        int color = ThemeUtils.primaryAccentColor(context);
-
-        colorHorizontalProgressBar(seekBar, color);
-        seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
-    }
-
-    public static void colorSwipeRefreshLayout(Context context, SwipeRefreshLayout swipeRefreshLayout) {
-        int primaryColor = ThemeUtils.primaryColor(context);
-        int darkColor = ThemeUtils.primaryDarkColor(context);
-        int accentColor = ThemeUtils.primaryAccentColor(context);
-
-        swipeRefreshLayout.setColorSchemeColors(accentColor, primaryColor, darkColor);
-        swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.bg_elevation_one);
-    }
-
-    /**
-     * set the Nextcloud standard colors for the snackbar.
-     *
-     * @param context  the context relevant for setting the color according to the context's theme
-     * @param snackbar the snackbar to be colored
-     */
-    public static void colorSnackbar(Context context, Snackbar snackbar) {
-        // Changing action button text color
-        snackbar.setActionTextColor(ContextCompat.getColor(context, R.color.fg_inverse));
-    }
-
-    /**
-     * Sets the color of the status bar to {@code color}.
-     *
-     * @param fragmentActivity fragment activity
-     * @param color            the color
-     */
-    public static void colorStatusBar(Activity fragmentActivity, @ColorInt int color) {
-        Window window = fragmentActivity.getWindow();
-        boolean isLightTheme = lightTheme(color);
-        if (window != null) {
-            window.setStatusBarColor(color);
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-                View decor = window.getDecorView();
-                if (isLightTheme) {
-                    int systemUiFlagLightStatusBar;
-                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
-                        systemUiFlagLightStatusBar = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
-                    } else {
-                        systemUiFlagLightStatusBar = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
-                    }
-                    decor.setSystemUiVisibility(systemUiFlagLightStatusBar);
-                } else {
-                    decor.setSystemUiVisibility(0);
-                }
-            } else if (isLightTheme) {
-                window.setStatusBarColor(Color.BLACK);
-            }
-        }
-    }
-
-    public static void colorStatusBar(Activity fragmentActivity) {
-        colorStatusBar(fragmentActivity, primaryAppbarColor(fragmentActivity));
-    }
-
-    public static void colorTabLayout(Context context, TabLayout tabLayout) {
-        int primaryColor = primaryColor(context, true);
-        int textColor = context.getResources().getColor(R.color.text_color);
-        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
-        tabLayout.setSelectedTabIndicatorColor(primaryColor);
-        tabLayout.setTabTextColors(textColor, primaryColor);
-        tabLayout.setTabIconTint(new ColorStateList(
-            new int[][]{
-                new int[]{android.R.attr.state_selected},
-                new int[]{android.R.attr.state_enabled},
-                new int[]{-android.R.attr.state_enabled}
-            },
-            new int[]{
-                primaryColor,
-                textColor,
-                Color.GRAY
-            }
-        ));
-    }
-
-    /**
-     * Sets the color of the (containerized) text input TextInputLayout to {@code color} for hint text, box stroke and
-     * highlight color.
-     *
-     * @param textInputLayout   the TextInputLayout instance
-     * @param textInputEditText the TextInputEditText child element
-     * @param color             the color to be used for the hint text and box stroke
-     */
-    public static void colorTextInput(TextInputLayout textInputLayout, TextInputEditText textInputEditText, int color) {
-        textInputEditText.setHighlightColor(color);
-        colorTextInputLayout(textInputLayout, color);
-    }
-
-    /**
-     * Sets the color of the  TextInputLayout to {@code color} for hint text and box stroke.
-     *
-     * @param textInputLayout the TextInputLayout instance
-     * @param color           the color to be used for the hint text and box stroke
-     */
-    private static void colorTextInputLayout(TextInputLayout textInputLayout, int color) {
-        textInputLayout.setBoxStrokeColor(color);
-        textInputLayout.setDefaultHintTextColor(new ColorStateList(
-            new int[][]{
-                new int[]{-android.R.attr.state_focused},
-                new int[]{android.R.attr.state_focused},
-            },
-            new int[]{
-                Color.GRAY,
-                color
-            }
-        ));
-    }
-
-    public static void themeBorderlessButton(Button button, int primaryColor) {
-        if (button == null) {
-            return;
-        }
-
-        Context context = button.getContext();
-        int disabledColor = ContextCompat.getColor(context, R.color.disabled_text);
-        button.setTextColor(new ColorStateList(
-            new int[][]{
-                new int[]{android.R.attr.state_enabled}, // enabled
-                new int[]{-android.R.attr.state_enabled}, // disabled
-            },
-            new int[]{
-                primaryColor,
-                disabledColor
-            }
-        ));
-    }
-
-    public static void themeEditText(Context context, EditText editText, boolean themedBackground) {
-        if (editText == null) {
-            return;
-        }
-
-        int color = ContextCompat.getColor(context, R.color.text_color);
-
-        if (themedBackground) {
-            if (darkTheme(context)) {
-                color = ContextCompat.getColor(context, R.color.themed_fg);
-            } else {
-                color = ContextCompat.getColor(context, R.color.themed_fg_inverse);
-            }
-        }
-
-        setEditTextColor(context, editText, color);
-    }
-
-    private static void setEditTextColor(Context context, EditText editText, int color) {
-        editText.setTextColor(color);
-        editText.setHighlightColor(context.getResources().getColor(R.color.fg_contrast));
-    }
-
-    /**
-     * Theme search view
-     *
-     * @param searchView searchView to be changed
-     * @param context    the app's context
-     */
-    public static void themeSearchView(SearchView searchView, Context context) {
-        // hacky as no default way is provided
-        int fontColor = appBarPrimaryFontColor(context);
-        SearchView.SearchAutoComplete editText = searchView.findViewById(R.id.search_src_text);
-        editText.setTextSize(16);
-        setEditTextColor(context, editText, fontColor);
-        editText.setHintTextColor(appBarSecondaryFontColor(context));
-
-        ImageView closeButton = searchView.findViewById(androidx.appcompat.R.id.search_close_btn);
-        closeButton.setColorFilter(fontColor);
-        ImageView searchButton = searchView.findViewById(androidx.appcompat.R.id.search_button);
-        searchButton.setColorFilter(fontColor);
-    }
-
-    public static void themeProgressBar(Context context, ProgressBar progressBar) {
-        int color = ThemeUtils.primaryAccentColor(context);
-        progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
-    }
-
-    public static void tintCheckbox(AppCompatCheckBox checkBox, int color) {
-        CompoundButtonCompat.setButtonTintList(checkBox, new ColorStateList(
-            new int[][]{
-                new int[]{-android.R.attr.state_checked},
-                new int[]{android.R.attr.state_checked},
-            },
-            new int[]{
-                Color.GRAY,
-                color
-            }
-        ));
-    }
-
-    public static void tintSwitch(SwitchCompat switchView, int color) {
-        tintSwitch(switchView, color, false);
-    }
-
-    public static void tintSwitch(SwitchCompat switchView, int color, boolean colorText) {
-        if (colorText) {
-            switchView.setTextColor(color);
-        }
-
-        int trackColor = Color.argb(77, Color.red(color), Color.green(color), Color.blue(color));
-
-        // setting the thumb color
-        DrawableCompat.setTintList(switchView.getThumbDrawable(), new ColorStateList(
-            new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
-            new int[]{color, Color.WHITE}));
-
-        // setting the track color
-        DrawableCompat.setTintList(switchView.getTrackDrawable(), new ColorStateList(
-            new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
-            new int[]{trackColor, MainApp.getAppContext().getResources().getColor(R.color.switch_track_color_unchecked)}));
-    }
-
-    public static Drawable tintDrawable(@DrawableRes int id, int color) {
-        Drawable drawable = ResourcesCompat.getDrawable(MainApp.getAppContext().getResources(), id, null);
-
-        return tintDrawable(drawable, color);
-    }
-
-    @Nullable
-    public static Drawable tintDrawable(Drawable drawable, int color) {
-        if (drawable != null) {
-            Drawable wrap = DrawableCompat.wrap(drawable);
-            wrap.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
-
-            return wrap;
-        }
-
-        return null;
-    }
-
-    /**
-     * Will change a menu item text tint
-     *
-     * @param item  the menu item object
-     * @param color the wanted color (as resource or color)
-     */
-    public static void tintMenuItemText(MenuItem item, int color) {
-        SpannableString newItemTitle = new SpannableString(item.getTitle());
-        newItemTitle.setSpan(new ForegroundColorSpan(color), 0, newItemTitle.length(),
-                             Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-        item.setTitle(newItemTitle);
-    }
-
-    public static String colorToHexString(int color) {
-        return String.format("#%06X", 0xFFFFFF & color);
-    }
-
-    public static void colorFloatingActionButton(FloatingActionButton button, @DrawableRes int drawable,
-                                                 Context context) {
-        int primaryColor = ThemeUtils.primaryColor(null, true, false, context);
-
-        colorFloatingActionButton(button, context, primaryColor);
-        button.setImageDrawable(ThemeUtils.tintDrawable(drawable, getColorForPrimary(primaryColor, context)));
-    }
-
-    public static void colorFloatingActionButton(FloatingActionButton button, Context context) {
-        colorFloatingActionButton(button, context, ThemeUtils.primaryColor(null, true, false, context));
-    }
-
-    public static void colorFloatingActionButton(FloatingActionButton button, Context context, int primaryColor) {
-        colorFloatingActionButton(button, primaryColor, calculateDarkColor(primaryColor, context));
-    }
-
-    public static void colorFloatingActionButton(FloatingActionButton button, int backgroundColor, int rippleColor) {
-        button.setBackgroundTintList(ColorStateList.valueOf(backgroundColor));
-        button.setRippleColor(rippleColor);
-    }
-
-    public static void colorIconImageViewWithBackground(ImageView imageView, Context context) {
-        int primaryColor = ThemeUtils.primaryColor(null, true, false, context);
-
-        imageView.getBackground().setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN);
-        imageView.getDrawable().mutate().setColorFilter(getColorForPrimary(primaryColor, context),
-                                                        PorterDuff.Mode.SRC_IN);
-    }
-
-    /**
-     * returns a primary color matching color for texts/icons on top of a primary-colored element (like buttons).
-     *
-     * @param primaryColor the primary color
-     */
-    public static int getColorForPrimary(int primaryColor, Context context) {
-        if (Color.BLACK == primaryColor) {
-            return Color.WHITE;
-        } else if (Color.WHITE == primaryColor) {
-            return Color.BLACK;
-        } else {
-            return ThemeUtils.fontColor(context, false);
-        }
-    }
-
-    private static OCCapability getCapability(Context context) {
-        return getCapability(null, context);
-    }
-
-    private static OCCapability getCapability(Account acc, Context context) {
-        Account account = null;
-
-        if (acc != null) {
-            account = acc;
-        } else if (context != null) {
-            // TODO: refactor when dark theme work is completed
-            account = UserAccountManagerImpl.fromContext(context).getCurrentAccount();
-        }
-
-        if (account != null) {
-            FileDataStorageManager storageManager = new FileDataStorageManager(account, context.getContentResolver());
-            return storageManager.getCapability(account.name);
-        } else {
-            return new OCCapability();
-        }
-    }
-
-    public static Drawable setIconColor(Drawable drawable) {
-        int color;
-        if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) {
-            color = Color.WHITE;
-        } else {
-            color = Color.BLACK;
-        }
-        return tintDrawable(drawable, color);
-    }
-
-    public static boolean isDarkModeActive(Context context) {
-        int nightModeFlag = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
-
-        return Configuration.UI_MODE_NIGHT_YES == nightModeFlag;
-    }
-
-    @SuppressFBWarnings(
-        value = "SF_SWITCH_NO_DEFAULT",
-        justification = "We only create avatars for a subset of share types")
-    public static void createAvatar(ShareType type, ImageView avatar, Context context) {
-        switch (type) {
-            case GROUP:
-                avatar.setImageResource(R.drawable.ic_group);
-                avatar.setBackground(ResourcesCompat.getDrawable(context.getResources(),
-                                                                 R.drawable.round_bgnd,
-                                                                 null));
-                avatar.setCropToPadding(true);
-                avatar.setPadding(4, 4, 4, 4);
-                ThemeUtils.colorIconImageViewWithBackground(avatar, context);
-                break;
-
-            case ROOM:
-                avatar.setImageResource(R.drawable.first_run_talk);
-                avatar.setBackground(ResourcesCompat.getDrawable(context.getResources(),
-                                                                 R.drawable.round_bgnd,
-                                                                 null));
-                avatar.setCropToPadding(true);
-                avatar.setPadding(8, 8, 8, 8);
-                ThemeUtils.colorIconImageViewWithBackground(avatar, context);
-                break;
-
-            case CIRCLE:
-                avatar.setImageResource(R.drawable.ic_circles);
-                avatar.setBackground(ResourcesCompat.getDrawable(context.getResources(),
-                                                                 R.drawable.round_bgnd,
-                                                                 null));
-                avatar.getBackground().setColorFilter(context.getResources().getColor(R.color.nc_grey),
-                                                      PorterDuff.Mode.SRC_IN);
-                avatar.getDrawable().mutate().setColorFilter(context.getResources().getColor(R.color.icon_on_nc_grey),
-                                                             PorterDuff.Mode.SRC_IN);
-                avatar.setCropToPadding(true);
-                avatar.setPadding(4, 4, 4, 4);
-                break;
-
-            case EMAIL:
-                avatar.setImageResource(R.drawable.ic_email);
-                avatar.setBackground(ResourcesCompat.getDrawable(context.getResources(),
-                                                                 R.drawable.round_bgnd,
-                                                                 null));
-                avatar.setCropToPadding(true);
-                avatar.setPadding(8, 8, 8, 8);
-                avatar.getBackground().setColorFilter(context.getResources().getColor(R.color.nc_grey),
-                                                      PorterDuff.Mode.SRC_IN);
-                avatar.getDrawable().mutate().setColorFilter(context.getResources().getColor(R.color.icon_on_nc_grey),
-                                                             PorterDuff.Mode.SRC_IN);
-                break;
-        }
-    }
-}

+ 57 - 0
src/main/java/com/owncloud/android/utils/theme/CapabilityUtils.java

@@ -0,0 +1,57 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.accounts.Account;
+import android.content.Context;
+
+import com.nextcloud.client.account.UserAccountManagerImpl;
+import com.owncloud.android.datamodel.FileDataStorageManager;
+import com.owncloud.android.lib.resources.status.OCCapability;
+
+/**
+ * Utility class with methods for client side button theming.
+ */
+public final class CapabilityUtils {
+    public static OCCapability getCapability(Context context) {
+        return getCapability(null, context);
+    }
+
+    private static OCCapability getCapability(Account acc, Context context) {
+        Account account = null;
+
+        if (acc != null) {
+            account = acc;
+        } else if (context != null) {
+            // TODO: refactor when dark theme work is completed
+            account = UserAccountManagerImpl.fromContext(context).getCurrentAccount();
+        }
+
+        if (account != null) {
+            FileDataStorageManager storageManager = new FileDataStorageManager(account, context.getContentResolver());
+            return storageManager.getCapability(account.name);
+        } else {
+            return new OCCapability();
+        }
+    }
+}

+ 99 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeAvatarUtils.java

@@ -0,0 +1,99 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.Context;
+import android.graphics.PorterDuff;
+import android.widget.ImageView;
+
+import com.owncloud.android.R;
+import com.owncloud.android.lib.resources.shares.ShareType;
+
+import androidx.core.content.res.ResourcesCompat;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+/**
+ * Utility class with methods for client side button theming.
+ */
+public final class ThemeAvatarUtils {
+    public static void colorIconImageViewWithBackground(ImageView imageView, Context context) {
+        int primaryColor = ThemeColorUtils.primaryColor(null, true, false, context);
+
+        imageView.getBackground().setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN);
+        imageView.getDrawable().mutate().setColorFilter(ThemeColorUtils.getColorForPrimary(primaryColor, context),
+                                                        PorterDuff.Mode.SRC_IN);
+    }
+
+    @SuppressFBWarnings(
+        value = "SF_SWITCH_NO_DEFAULT",
+        justification = "We only create avatars for a subset of share types")
+    public static void createAvatar(ShareType type, ImageView avatar, Context context) {
+        switch (type) {
+            case GROUP:
+                avatar.setImageResource(R.drawable.ic_group);
+                avatar.setBackground(ResourcesCompat.getDrawable(context.getResources(),
+                                                                 R.drawable.round_bgnd,
+                                                                 null));
+                avatar.setCropToPadding(true);
+                avatar.setPadding(4, 4, 4, 4);
+                ThemeAvatarUtils.colorIconImageViewWithBackground(avatar, context);
+                break;
+
+            case ROOM:
+                avatar.setImageResource(R.drawable.first_run_talk);
+                avatar.setBackground(ResourcesCompat.getDrawable(context.getResources(),
+                                                                 R.drawable.round_bgnd,
+                                                                 null));
+                avatar.setCropToPadding(true);
+                avatar.setPadding(8, 8, 8, 8);
+                ThemeAvatarUtils.colorIconImageViewWithBackground(avatar, context);
+                break;
+
+            case CIRCLE:
+                avatar.setImageResource(R.drawable.ic_circles);
+                avatar.setBackground(ResourcesCompat.getDrawable(context.getResources(),
+                                                                 R.drawable.round_bgnd,
+                                                                 null));
+                avatar.getBackground().setColorFilter(context.getResources().getColor(R.color.nc_grey),
+                                                      PorterDuff.Mode.SRC_IN);
+                avatar.getDrawable().mutate().setColorFilter(context.getResources().getColor(R.color.icon_on_nc_grey),
+                                                             PorterDuff.Mode.SRC_IN);
+                avatar.setCropToPadding(true);
+                avatar.setPadding(4, 4, 4, 4);
+                break;
+
+            case EMAIL:
+                avatar.setImageResource(R.drawable.ic_email);
+                avatar.setBackground(ResourcesCompat.getDrawable(context.getResources(),
+                                                                 R.drawable.round_bgnd,
+                                                                 null));
+                avatar.setCropToPadding(true);
+                avatar.setPadding(8, 8, 8, 8);
+                avatar.getBackground().setColorFilter(context.getResources().getColor(R.color.nc_grey),
+                                                      PorterDuff.Mode.SRC_IN);
+                avatar.getDrawable().mutate().setColorFilter(context.getResources().getColor(R.color.icon_on_nc_grey),
+                                                             PorterDuff.Mode.SRC_IN);
+                break;
+        }
+    }
+}

+ 79 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeBarUtils.java

@@ -0,0 +1,79 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.graphics.PorterDuff;
+import android.widget.ProgressBar;
+import android.widget.SeekBar;
+
+import androidx.annotation.ColorInt;
+
+/**
+ * Utility class with methods for client side button theming.
+ */
+public final class ThemeBarUtils {
+    /**
+     * sets the coloring of the given progress bar to given color.
+     *
+     * @param progressBar the progress bar to be colored
+     * @param color       the color to be used
+     */
+    public static void colorHorizontalProgressBar(ProgressBar progressBar, @ColorInt int color) {
+        if (progressBar != null) {
+            progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
+            progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
+        }
+    }
+
+    /**
+     * sets the coloring of the given progress bar's progress to given color.
+     *
+     * @param progressBar the progress bar to be colored
+     * @param color       the color to be used
+     */
+    public static void colorProgressBar(ProgressBar progressBar, @ColorInt int color) {
+        if (progressBar != null) {
+            progressBar.setProgressTintList(ColorStateList.valueOf(color));
+        }
+    }
+
+    /**
+     * sets the coloring of the given seek bar to color_accent.
+     *
+     * @param seekBar the seek bar to be colored
+     */
+    public static void colorHorizontalSeekBar(SeekBar seekBar, Context context) {
+        int color = ThemeColorUtils.primaryAccentColor(context);
+
+        colorHorizontalProgressBar(seekBar, color);
+        seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
+    }
+
+    public static void themeProgressBar(Context context, ProgressBar progressBar) {
+        // TODO harmonize methods
+        int color = ThemeColorUtils.primaryAccentColor(context);
+        progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
+    }
+}

+ 85 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeButtonUtils.java

@@ -0,0 +1,85 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.widget.Button;
+import android.widget.ImageButton;
+
+import com.owncloud.android.R;
+
+import androidx.annotation.ColorInt;
+import androidx.core.content.ContextCompat;
+
+/**
+ * Utility class with methods for client side button theming.
+ */
+public final class ThemeButtonUtils {
+    /**
+     * sets the tinting of the given ImageButton's icon to color_accent.
+     *
+     * @param imageButton the image button who's icon should be colored
+     */
+    public static void colorImageButton(ImageButton imageButton, @ColorInt int color) {
+        if (imageButton != null) {
+            imageButton.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
+        }
+    }
+
+    public static void colorPrimaryButton(Button button, Context context) {
+        int primaryColor = ThemeColorUtils.primaryColor(null, true, false, context);
+        int fontColor = ThemeColorUtils.fontColor(context, false);
+
+        button.setBackgroundColor(primaryColor);
+
+        if (Color.BLACK == primaryColor) {
+            button.setTextColor(Color.WHITE);
+        } else if (Color.WHITE == primaryColor) {
+            button.setTextColor(Color.BLACK);
+        } else {
+            button.setTextColor(fontColor);
+        }
+    }
+
+    public static void themeBorderlessButton(Button button, int primaryColor) {
+        if (button == null) {
+            return;
+        }
+
+        Context context = button.getContext();
+        int disabledColor = ContextCompat.getColor(context, R.color.disabled_text);
+        button.setTextColor(new ColorStateList(
+            new int[][]{
+                new int[]{android.R.attr.state_enabled}, // enabled
+                new int[]{-android.R.attr.state_enabled}, // disabled
+            },
+            new int[]{
+                primaryColor,
+                disabledColor
+            }
+        ));
+    }
+}

+ 70 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeCheckableUtils.java

@@ -0,0 +1,70 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+
+import androidx.appcompat.widget.AppCompatCheckBox;
+import androidx.appcompat.widget.SwitchCompat;
+import androidx.core.graphics.drawable.DrawableCompat;
+import androidx.core.widget.CompoundButtonCompat;
+
+/**
+ * Utility class with methods for client side checkable theming.
+ */
+public final class ThemeCheckableUtils {
+    public static void tintCheckbox(int color, AppCompatCheckBox... checkBoxes) {
+        if (checkBoxes != null) {
+            for (AppCompatCheckBox checkBox : checkBoxes) {
+                CompoundButtonCompat.setButtonTintList(checkBox, new ColorStateList(
+                    new int[][]{
+                        new int[]{-android.R.attr.state_checked},
+                        new int[]{android.R.attr.state_checked},
+                    },
+                    new int[]{
+                        Color.GRAY,
+                        color
+                    }
+                ));
+            }
+        }
+    }
+
+    public static void tintSwitch(SwitchCompat switchView, int color) {
+        int trackColor = Color.argb(77, Color.red(color), Color.green(color), Color.blue(color));
+
+        // setting the thumb color
+        DrawableCompat.setTintList(switchView.getThumbDrawable(), new ColorStateList(
+            new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
+            new int[]{color, Color.WHITE}));
+
+        // setting the track color
+        DrawableCompat.setTintList(switchView.getTrackDrawable(), new ColorStateList(
+            new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
+            new int[]{trackColor, MainApp.getAppContext().getResources().getColor(R.color.switch_track_color_unchecked)}));
+    }
+}

+ 319 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java

@@ -0,0 +1,319 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.accounts.Account;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.graphics.Color;
+
+import com.nextcloud.client.account.User;
+import com.nextcloud.client.account.UserAccountManagerImpl;
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.FileDataStorageManager;
+import com.owncloud.android.lib.resources.status.OCCapability;
+
+import androidx.appcompat.app.AppCompatDelegate;
+import androidx.core.content.ContextCompat;
+import androidx.core.graphics.ColorUtils;
+
+/**
+ * Utility class with methods for theming related .
+ */
+public final class ThemeColorUtils {
+
+    private static final int INDEX_LUMINATION = 2;
+    private static final double MAX_LIGHTNESS = 0.92;
+    public static final double LUMINATION_THRESHOLD = 0.8;
+
+    private ThemeColorUtils() {
+        // utility class -> private constructor
+    }
+
+    public static int primaryAccentColor(Context context) {
+        OCCapability capability = getCapability(context);
+
+        try {
+            float adjust;
+            if (isDarkModeActive(context)) {
+                adjust = +0.5f;
+            } else {
+                adjust = -0.1f;
+            }
+            return adjustLightness(adjust, Color.parseColor(capability.getServerColor()), 0.35f);
+        } catch (Exception e) {
+            return context.getResources().getColor(R.color.color_accent);
+        }
+    }
+
+    public static int primaryDarkColor(Context context) {
+        return primaryDarkColor(null, context);
+    }
+
+    public static int primaryDarkColor(Account account, Context context) {
+        OCCapability capability = getCapability(account, context);
+
+        try {
+            return calculateDarkColor(Color.parseColor(capability.getServerColor()), context);
+        } catch (Exception e) {
+            return context.getResources().getColor(R.color.primary_dark);
+        }
+    }
+
+    public static int calculateDarkColor(int color, Context context) {
+        try {
+            return adjustLightness(-0.2f, color, -1f);
+        } catch (Exception e) {
+            return context.getResources().getColor(R.color.primary_dark);
+        }
+    }
+
+    public static int primaryColor(Context context) {
+        return primaryColor(context, false);
+    }
+
+    public static int primaryColor(Context context, boolean replaceEdgeColors) {
+        User nullUser = null;
+        return primaryColor(nullUser, replaceEdgeColors, context);
+    }
+
+    public static int primaryColor(User user, boolean replaceEdgeColors, Context context) {
+        return primaryColor(user != null ? user.toPlatformAccount() : null,
+                            replaceEdgeColors,
+                            false,
+                            context);
+    }
+
+    public static int primaryColor(Account account, boolean replaceEdgeColors, Context context) {
+        return primaryColor(account, replaceEdgeColors, false, context);
+    }
+
+    /**
+     * return the primary color defined in the server-side theming respecting Android dark/light theming and edge case
+     * scenarios including drawer menu.
+     *
+     * @param account                          the Nextcloud user
+     * @param replaceEdgeColors                flag if edge case color scenarios should be handled
+     * @param replaceEdgeColorsByInvertedColor flag in edge case handling should be done via color inversion
+     *                                         (black/white)
+     * @param context                          the context (needed to load client-side colors)
+     * @return the color
+     */
+    public static int primaryColor(Account account,
+                                   boolean replaceEdgeColors,
+                                   boolean replaceEdgeColorsByInvertedColor,
+                                   Context context) {
+        if (context == null) {
+            return Color.GRAY;
+        }
+
+        try {
+            int color = Color.parseColor(getCapability(account, context).getServerColor());
+            if (replaceEdgeColors) {
+                if (isDarkModeActive(context)) {
+                    if (Color.BLACK == color) {
+                        if (replaceEdgeColorsByInvertedColor) {
+                            return Color.WHITE;
+                        } else {
+                            return getNeutralGrey(context);
+                        }
+                    } else {
+                        return color;
+                    }
+                } else {
+                    if (Color.WHITE == color) {
+                        if (replaceEdgeColorsByInvertedColor) {
+                            return Color.BLACK;
+                        } else {
+                            return getNeutralGrey(context);
+                        }
+                    } else {
+                        return color;
+                    }
+                }
+            } else {
+                return color;
+            }
+        } catch (Exception e) {
+            return context.getResources().getColor(R.color.primary);
+        }
+    }
+
+    public static int getNeutralGrey(Context context) {
+        return darkTheme(context) ? context.getResources().getColor(R.color.fg_contrast) : Color.GRAY;
+    }
+
+    public static boolean themingEnabled(Context context) {
+        return getCapability(context).getServerColor() != null && !getCapability(context).getServerColor().isEmpty();
+    }
+
+    /**
+     * returns the font color based on the server side theming and uses black/white as a fallback based on
+     * replaceWhite.
+     *
+     * @param context      the context
+     * @param replaceWhite FLAG to return white/black if server side color isn't available
+     * @return int font color to use
+     */
+    public static int fontColor(Context context, boolean replaceWhite) {
+        if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) {
+            if (replaceWhite) {
+                return Color.BLACK;
+            } else {
+                return Color.WHITE;
+            }
+        }
+
+        try {
+            return Color.parseColor(getCapability(context).getServerTextColor());
+        } catch (Exception e) {
+            if (darkTheme(context)) {
+                return Color.WHITE;
+            } else {
+                return Color.BLACK;
+            }
+        }
+    }
+
+    public static int fontColor(Context context) {
+        return fontColor(context, false);
+    }
+
+    /**
+     * Tests if light color is set
+     *
+     * @param color the color
+     * @return true if primaryColor is lighter than MAX_LIGHTNESS
+     */
+    public static boolean lightTheme(int color) {
+        float[] hsl = colorToHSL(color);
+
+        return hsl[INDEX_LUMINATION] >= MAX_LIGHTNESS;
+    }
+
+    /**
+     * Tests if dark color is set
+     *
+     * @return true if dark theme -> e.g.use light font color, darker accent color
+     */
+    public static boolean darkTheme(Context context) {
+        int primaryColor = primaryColor(context);
+        float[] hsl = colorToHSL(primaryColor);
+
+        return hsl[INDEX_LUMINATION] <= 0.55;
+    }
+
+    public static int primaryAppbarColor(Context context) {
+        return ContextCompat.getColor(context, R.color.appbar);
+    }
+
+    public static int appBarPrimaryFontColor(Context context) {
+        return ContextCompat.getColor(context, R.color.fontAppbar);
+    }
+
+    public static int appBarSecondaryFontColor(Context context) {
+        return ContextCompat.getColor(context, R.color.fontSecondaryAppbar);
+    }
+
+    public static int actionModeColor(Context context) {
+        return ContextCompat.getColor(context, R.color.action_mode_background);
+    }
+
+    /**
+     * Adjust lightness of given color
+     *
+     * @param lightnessDelta values -1..+1
+     * @param color          original color
+     * @param threshold      0..1 as maximum value, -1 to disable
+     * @return color adjusted by lightness
+     */
+    public static int adjustLightness(float lightnessDelta, int color, float threshold) {
+        float[] hsl = colorToHSL(color);
+
+        if (threshold == -1f) {
+            hsl[INDEX_LUMINATION] += lightnessDelta;
+        } else {
+            hsl[INDEX_LUMINATION] = Math.min(hsl[INDEX_LUMINATION] + lightnessDelta, threshold);
+        }
+
+        return ColorUtils.HSLToColor(hsl);
+    }
+
+    private static float[] colorToHSL(int color) {
+        float[] hsl = new float[3];
+        ColorUtils.RGBToHSL(Color.red(color), Color.green(color), Color.blue(color), hsl);
+
+        return hsl;
+    }
+
+    public static String colorToHexString(int color) {
+        return String.format("#%06X", 0xFFFFFF & color);
+    }
+
+    /**
+     * returns a primary color matching color for texts/icons on top of a primary-colored element (like buttons).
+     *
+     * @param primaryColor the primary color
+     */
+    public static int getColorForPrimary(int primaryColor, Context context) {
+        if (Color.BLACK == primaryColor) {
+            return Color.WHITE;
+        } else if (Color.WHITE == primaryColor) {
+            return Color.BLACK;
+        } else {
+            return ThemeColorUtils.fontColor(context, false);
+        }
+    }
+
+    private static OCCapability getCapability(Context context) {
+        return getCapability(null, context);
+    }
+
+    private static OCCapability getCapability(Account acc, Context context) {
+        Account account = null;
+
+        if (acc != null) {
+            account = acc;
+        } else if (context != null) {
+            // TODO: refactor when dark theme work is completed
+            account = UserAccountManagerImpl.fromContext(context).getCurrentAccount();
+        }
+
+        if (account != null) {
+            FileDataStorageManager storageManager = new FileDataStorageManager(account, context.getContentResolver());
+            return storageManager.getCapability(account.name);
+        } else {
+            return new OCCapability();
+        }
+    }
+
+    public static boolean isDarkModeActive(Context context) {
+        int nightModeFlag = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+
+        return Configuration.UI_MODE_NIGHT_YES == nightModeFlag;
+    }
+
+    public static String primaryColorToHexString(Context context) {
+        return String.format("#%06X", 0xFFFFFF & primaryColor(context, true));
+    }
+}

+ 69 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeDrawableUtils.java

@@ -0,0 +1,69 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+
+import com.owncloud.android.MainApp;
+
+import androidx.annotation.DrawableRes;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatDelegate;
+import androidx.core.content.res.ResourcesCompat;
+import androidx.core.graphics.drawable.DrawableCompat;
+
+/**
+ * Utility class with methods for client side button theming.
+ */
+public final class ThemeDrawableUtils {
+    public static Drawable tintDrawable(@DrawableRes int id, int color) {
+        return tintDrawable(ResourcesCompat.getDrawable(MainApp.getAppContext().getResources(), id, null),
+                            color);
+    }
+
+    @Nullable
+    public static Drawable tintDrawable(Drawable drawable, int color) {
+        if (drawable != null) {
+            Drawable wrap = DrawableCompat.wrap(drawable);
+            wrap.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
+
+            return wrap;
+        }
+
+        return null;
+    }
+
+    public static void setIconColor(Drawable drawable) {
+        int color;
+
+        if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES) {
+            color = Color.WHITE;
+        } else {
+            color = Color.BLACK;
+        }
+
+        ThemeDrawableUtils.tintDrawable(drawable, color);
+    }
+}

+ 58 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeFabUtils.java

@@ -0,0 +1,58 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.Context;
+import android.content.res.ColorStateList;
+
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+
+import androidx.annotation.DrawableRes;
+
+/**
+ * Utility class with methods for client side FAB theming.
+ */
+public final class ThemeFabUtils {
+    public static void colorFloatingActionButton(FloatingActionButton button, @DrawableRes int drawable,
+                                                 Context context) {
+        int primaryColor = ThemeColorUtils.primaryColor(null, true, false, context);
+
+        colorFloatingActionButton(button, context, primaryColor);
+        button.setImageDrawable(ThemeDrawableUtils.tintDrawable(drawable,
+                                                                ThemeColorUtils.getColorForPrimary(primaryColor,
+                                                                                                   context)));
+    }
+
+    public static void colorFloatingActionButton(FloatingActionButton button, Context context) {
+        colorFloatingActionButton(button, context, ThemeColorUtils.primaryColor(null, true, false, context));
+    }
+
+    public static void colorFloatingActionButton(FloatingActionButton button, Context context, int primaryColor) {
+        colorFloatingActionButton(button, primaryColor, ThemeColorUtils.calculateDarkColor(primaryColor, context));
+    }
+
+    public static void colorFloatingActionButton(FloatingActionButton button, int backgroundColor, int rippleColor) {
+        button.setBackgroundTintList(ColorStateList.valueOf(backgroundColor));
+        button.setRippleColor(rippleColor);
+    }
+}

+ 66 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeLayoutUtils.java

@@ -0,0 +1,66 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+
+import com.google.android.material.tabs.TabLayout;
+import com.owncloud.android.R;
+
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+/**
+ * Utility class with methods for client side checkable theming.
+ */
+public final class ThemeLayoutUtils {
+    public static void colorSwipeRefreshLayout(Context context, SwipeRefreshLayout swipeRefreshLayout) {
+        int primaryColor = ThemeColorUtils.primaryColor(context);
+        int darkColor = ThemeColorUtils.primaryDarkColor(context);
+        int accentColor = ThemeColorUtils.primaryAccentColor(context);
+
+        swipeRefreshLayout.setColorSchemeColors(accentColor, primaryColor, darkColor);
+        swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.bg_elevation_one);
+    }
+
+    public static void colorTabLayout(Context context, TabLayout tabLayout) {
+        int primaryColor = ThemeColorUtils.primaryColor(context, true);
+        int textColor = context.getResources().getColor(R.color.text_color);
+        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
+        tabLayout.setSelectedTabIndicatorColor(primaryColor);
+        tabLayout.setTabTextColors(textColor, primaryColor);
+        tabLayout.setTabIconTint(new ColorStateList(
+            new int[][]{
+                new int[]{android.R.attr.state_selected},
+                new int[]{android.R.attr.state_enabled},
+                new int[]{-android.R.attr.state_enabled}
+            },
+            new int[]{
+                primaryColor,
+                textColor,
+                Color.GRAY
+            }
+        ));
+    }
+}

+ 46 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeMenuUtils.java

@@ -0,0 +1,46 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.style.ForegroundColorSpan;
+import android.view.MenuItem;
+
+/**
+ * Utility class with methods for client side checkable theming.
+ */
+public final class ThemeMenuUtils {
+    /**
+     * Will change a menu item text tint
+     *
+     * @param item  the menu item object
+     * @param color the wanted color (as resource or color)
+     */
+    public static void tintMenuItemText(MenuItem item, int color) {
+        SpannableString newItemTitle = new SpannableString(item.getTitle());
+        newItemTitle.setSpan(new ForegroundColorSpan(color), 0, newItemTitle.length(),
+                             Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+        item.setTitle(newItemTitle);
+    }
+}

+ 46 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeSnackbarUtils.java

@@ -0,0 +1,46 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.Context;
+
+import com.google.android.material.snackbar.Snackbar;
+import com.owncloud.android.R;
+
+import androidx.core.content.ContextCompat;
+
+/**
+ * Utility class with methods for client side button theming.
+ */
+public final class ThemeSnackbarUtils {
+    /**
+     * set the Nextcloud standard colors for the snackbar.
+     *
+     * @param context  the context relevant for setting the color according to the context's theme
+     * @param snackbar the snackbar to be colored
+     */
+    public static void colorSnackbar(Context context, Snackbar snackbar) {
+        // Changing action button text color
+        snackbar.setActionTextColor(ContextCompat.getColor(context, R.color.fg_inverse));
+    }
+}

+ 103 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeTextInputUtils.java

@@ -0,0 +1,103 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.widget.EditText;
+
+import com.google.android.material.textfield.TextInputEditText;
+import com.google.android.material.textfield.TextInputLayout;
+import com.owncloud.android.R;
+
+import androidx.core.content.ContextCompat;
+
+/**
+ * Utility class with methods for client side text input theming.
+ */
+public final class ThemeTextInputUtils {
+    /**
+     * Sets the color of the (containerized) text input TextInputLayout to {@code color} for hint text, box stroke and
+     * highlight color.
+     *
+     * @param textInputLayout   the TextInputLayout instance
+     * @param textInputEditText the TextInputEditText child element
+     * @param color             the color to be used for the hint text and box stroke
+     */
+    public static void colorTextInput(TextInputLayout textInputLayout, TextInputEditText textInputEditText, int color) {
+        textInputEditText.setHighlightColor(color);
+        colorTextInputLayout(textInputLayout, color);
+    }
+
+    /**
+     * Sets the color of the  TextInputLayout to {@code color} for hint text and box stroke.
+     *
+     * @param textInputLayout the TextInputLayout instance
+     * @param color           the color to be used for the hint text and box stroke
+     */
+    private static void colorTextInputLayout(TextInputLayout textInputLayout, int color) {
+        textInputLayout.setBoxStrokeColor(color);
+        textInputLayout.setDefaultHintTextColor(new ColorStateList(
+            new int[][]{
+                new int[]{-android.R.attr.state_focused},
+                new int[]{android.R.attr.state_focused},
+            },
+            new int[]{
+                Color.GRAY,
+                color
+            }
+        ));
+    }
+
+    public static void themeEditText(Context context, EditText editText, boolean themedBackground) {
+        if (editText == null) {
+            return;
+        }
+
+        int color = ContextCompat.getColor(context, R.color.text_color);
+
+        if (themedBackground) {
+            if (ThemeColorUtils.darkTheme(context)) {
+                color = ContextCompat.getColor(context, R.color.themed_fg);
+            } else {
+                color = ContextCompat.getColor(context, R.color.themed_fg_inverse);
+            }
+        }
+
+        setEditTextColor(context, editText, color);
+    }
+
+    public static void setEditTextColor(Context context, EditText editText, int color) {
+        editText.setTextColor(color);
+        editText.setHighlightColor(context.getResources().getColor(R.color.fg_contrast));
+    }
+
+    public static void colorEditText(EditText editText, int color) {
+        if (editText != null) {
+            editText.setTextColor(color);
+            editText.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
+        }
+    }
+}

+ 45 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeTextUtils.java

@@ -0,0 +1,45 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.Spanned;
+import android.text.style.ForegroundColorSpan;
+
+/**
+ * Utility class with methods for client side checkable theming.
+ */
+public final class ThemeTextUtils {
+    public static Spanned getColoredTitle(String title, int color) {
+        Spannable text = new SpannableString(title);
+        text.setSpan(new ForegroundColorSpan(color),
+                     0,
+                     text.length(),
+                     Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+
+        return text;
+    }
+
+
+}

+ 159 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeToolbarUtils.java

@@ -0,0 +1,159 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.style.ForegroundColorSpan;
+import android.view.View;
+import android.view.Window;
+import android.widget.ImageView;
+
+import com.owncloud.android.R;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.widget.SearchView;
+import androidx.core.content.res.ResourcesCompat;
+
+/**
+ * Utility class with methods for client side action/toolbar theming.
+ */
+public final class ThemeToolbarUtils {
+    /**
+     * For activities that do not use drawer, e.g. Settings, this can be used to correctly tint back button based on
+     * theme
+     *
+     * @param supportActionBar the back button's action bar
+     */
+    public static void tintBackButton(@Nullable ActionBar supportActionBar, Context context) {
+        tintBackButton(supportActionBar, context, ThemeColorUtils.appBarPrimaryFontColor(context));
+    }
+
+    public static void tintBackButton(@Nullable ActionBar supportActionBar, Context context, @ColorInt int color) {
+        if (supportActionBar == null) {
+            return;
+        }
+
+        Drawable backArrow = ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_arrow_back, null);
+        supportActionBar.setHomeAsUpIndicator(ThemeDrawableUtils.tintDrawable(backArrow, color));
+    }
+
+    /**
+     * Set color of title to white/black depending on background color
+     *
+     * @param actionBar actionBar to be used
+     * @param title     title to be shown
+     */
+    public static void setColoredTitle(@Nullable ActionBar actionBar, String title, Context context) {
+        if (actionBar != null) {
+            Spannable text = new SpannableString(title);
+            text.setSpan(new ForegroundColorSpan(ThemeColorUtils.appBarPrimaryFontColor(context)),
+                         0,
+                         text.length(),
+                         Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+            actionBar.setTitle(text);
+        }
+    }
+
+    public static void setColoredTitle(@Nullable ActionBar actionBar, int titleId, Context context) {
+        setColoredTitle(actionBar, context.getString(titleId), context);
+    }
+
+    /**
+     * Set color of subtitle to white/black depending on background color
+     *
+     * @param actionBar actionBar to be used
+     * @param title     title to be shown
+     */
+    public static void setColoredSubtitle(@Nullable ActionBar actionBar, String title, Context context) {
+        if (actionBar != null) {
+            Spannable text = new SpannableString(title);
+            text.setSpan(new ForegroundColorSpan(ThemeColorUtils.appBarSecondaryFontColor(context)),
+                         0,
+                         text.length(),
+                         Spannable.SPAN_INCLUSIVE_INCLUSIVE);
+            actionBar.setSubtitle(text);
+        }
+    }
+
+    /**
+     * Theme search view
+     *
+     * @param searchView searchView to be changed
+     * @param context    the app's context
+     */
+    public static void themeSearchView(SearchView searchView, Context context) {
+        // hacky as no default way is provided
+        int fontColor = ThemeColorUtils.appBarPrimaryFontColor(context);
+        SearchView.SearchAutoComplete editText = searchView.findViewById(R.id.search_src_text);
+        editText.setTextSize(16);
+        ThemeTextInputUtils.setEditTextColor(context, editText, fontColor);
+        editText.setHintTextColor(ThemeColorUtils.appBarSecondaryFontColor(context));
+
+        ImageView closeButton = searchView.findViewById(androidx.appcompat.R.id.search_close_btn);
+        closeButton.setColorFilter(fontColor);
+        ImageView searchButton = searchView.findViewById(androidx.appcompat.R.id.search_button);
+        searchButton.setColorFilter(fontColor);
+    }
+
+    /**
+     * Sets the color of the status bar to {@code color}.
+     *
+     * @param fragmentActivity fragment activity
+     * @param color            the color
+     */
+    public static void colorStatusBar(Activity fragmentActivity, @ColorInt int color) {
+        Window window = fragmentActivity.getWindow();
+        boolean isLightTheme = ThemeColorUtils.lightTheme(color);
+        if (window != null) {
+            window.setStatusBarColor(color);
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                View decor = window.getDecorView();
+                if (isLightTheme) {
+                    int systemUiFlagLightStatusBar;
+                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                        systemUiFlagLightStatusBar = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
+                    } else {
+                        systemUiFlagLightStatusBar = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
+                    }
+                    decor.setSystemUiVisibility(systemUiFlagLightStatusBar);
+                } else {
+                    decor.setSystemUiVisibility(0);
+                }
+            } else if (isLightTheme) {
+                window.setStatusBarColor(Color.BLACK);
+            }
+        }
+    }
+
+    public static void colorStatusBar(Activity fragmentActivity) {
+        colorStatusBar(fragmentActivity, ThemeColorUtils.primaryAppbarColor(fragmentActivity));
+    }
+}

+ 64 - 0
src/main/java/com/owncloud/android/utils/theme/ThemeUtils.java

@@ -0,0 +1,64 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * @author Andy Scherzinger
+ * Copyright (C) 2017 Tobias Kaminsky
+ * Copyright (C) 2017 Nextcloud GmbH
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils.theme;
+
+import android.content.Context;
+import android.content.res.Configuration;
+
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+import com.owncloud.android.lib.resources.status.OCCapability;
+
+/**
+ * Utility class with methods for client side theming.
+ */
+public final class ThemeUtils {
+    private ThemeUtils() {
+        // utility class -> private constructor
+    }
+
+    public static boolean themingEnabled(Context context) {
+        return CapabilityUtils.getCapability(context).getServerColor() != null
+            && !CapabilityUtils.getCapability(context).getServerColor().isEmpty();
+    }
+
+    public static String getDefaultDisplayNameForRootFolder(Context context) {
+        OCCapability capability = CapabilityUtils.getCapability(context);
+
+        if (MainApp.isOnlyOnDevice()) {
+            return MainApp.getAppContext().getString(R.string.drawer_item_on_device);
+        } else {
+            if (capability.getServerName() == null || capability.getServerName().isEmpty()) {
+                return MainApp.getAppContext().getResources().getString(R.string.default_display_name_for_root_folder);
+            } else {
+                return capability.getServerName();
+            }
+        }
+    }
+
+    public static boolean isDarkModeActive(Context context) {
+        int nightModeFlag = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+
+        return Configuration.UI_MODE_NIGHT_YES == nightModeFlag;
+    }
+}