diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 531d00c0d..c9f0f1591 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -66,9 +66,6 @@
-
-
-
diff --git a/app/src/main/java/com/nextcloud/talk/activities/BaseActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/BaseActivity.kt
index 04bf8d088..73c59c69f 100644
--- a/app/src/main/java/com/nextcloud/talk/activities/BaseActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/activities/BaseActivity.kt
@@ -132,7 +132,7 @@ open class BaseActivity : AppCompatActivity() {
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
diff --git a/app/src/main/java/com/nextcloud/talk/activities/FullScreenTextViewerActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/FullScreenTextViewerActivity.kt
index 4b5baa820..f534517a2 100644
--- a/app/src/main/java/com/nextcloud/talk/activities/FullScreenTextViewerActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/activities/FullScreenTextViewerActivity.kt
@@ -104,7 +104,7 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
supportActionBar?.title = fileName
supportActionBar?.setDisplayHomeAsUpEnabled(true)
- viewThemeUtils.themeStatusBar(this, binding.textviewToolbar)
+ viewThemeUtils.androidViewThemeUtils.themeStatusBar(this, binding.textviewToolbar)
if (resources != null) {
DisplayUtils.applyColorToNavigationBar(
diff --git a/app/src/main/java/com/nextcloud/talk/adapters/items/ContactItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/ContactItem.java
index a28c2f3a3..fa5e21a91 100644
--- a/app/src/main/java/com/nextcloud/talk/adapters/items/ContactItem.java
+++ b/app/src/main/java/com/nextcloud/talk/adapters/items/ContactItem.java
@@ -113,7 +113,7 @@ public class ContactItem extends AbstractFlexibleItem(R.id.cancelReplyButton))
+ viewThemeUtils.androidViewThemeUtils
+ .themeImageButton(binding.messageInputView.findViewById(R.id.cancelReplyButton))
cancelNotificationsForCurrentConversation()
@@ -2523,12 +2524,12 @@ class ChatController(args: Bundle) :
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.menu_conversation, menu)
- viewThemeUtils.colorToolbarMenuIcon(
+ viewThemeUtils.androidViewThemeUtils.colorToolbarMenuIcon(
binding.messageInputView.context,
menu.findItem(R.id.conversation_voice_call)
)
- viewThemeUtils.colorToolbarMenuIcon(
+ viewThemeUtils.androidViewThemeUtils.colorToolbarMenuIcon(
binding.messageInputView.context,
menu.findItem(R.id.conversation_video_call)
)
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt
index ccac1d0b9..a45841619 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.kt
@@ -380,7 +380,7 @@ class ContactsController(args: Bundle) :
super.onPrepareOptionsMenu(menu)
if (searchItem != null) {
- viewThemeUtils.colorToolbarMenuIcon(
+ viewThemeUtils.androidViewThemeUtils.colorToolbarMenuIcon(
binding.titleTextView.context,
searchItem!!
)
@@ -638,7 +638,7 @@ class ContactsController(args: Bundle) :
PorterDuff.Mode.SRC_IN
)
- viewThemeUtils.colorImageViewButton(binding.conversationPrivacyToggle.publicCallLink)
+ viewThemeUtils.androidViewThemeUtils.colorImageViewButton(binding.conversationPrivacyToggle.publicCallLink)
disengageProgressBar()
}
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt
index 80866b882..be493a22c 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt
@@ -227,7 +227,7 @@ class ConversationInfoController(args: Bundle) :
binding.addParticipantsAction.visibility = View.GONE
- viewThemeUtils.colorCircularProgressBar(binding.progressBar)
+ viewThemeUtils.androidViewThemeUtils.colorCircularProgressBar(binding.progressBar)
}
private fun setupWebinaryView() {
@@ -376,7 +376,7 @@ class ConversationInfoController(args: Bundle) :
}
viewThemeUtils.colorMaterialAlertDialogBackground(binding.conversationInfoName.context, dialogBuilder)
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
@@ -547,7 +547,7 @@ class ConversationInfoController(args: Bundle) :
}
viewThemeUtils.colorMaterialAlertDialogBackground(binding.conversationInfoName.context, dialogBuilder)
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.kt
index 854fadea6..7b0590c7f 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.kt
@@ -353,14 +353,14 @@ class ConversationsListController(bundle: Bundle) :
}
activity.binding.searchText.setOnClickListener {
showSearchView(activity, searchView, searchItem)
- viewThemeUtils.themeStatusBar(activity, searchView!!)
+ viewThemeUtils.androidViewThemeUtils.themeStatusBar(activity, searchView!!)
}
}
searchView!!.setOnCloseListener {
if (TextUtils.isEmpty(searchView!!.query.toString())) {
searchView!!.onActionViewCollapsed()
if (activity != null) {
- viewThemeUtils.resetStatusBar(activity, searchView!!)
+ viewThemeUtils.androidViewThemeUtils.resetStatusBar(activity, searchView!!)
}
} else {
searchView!!.post { searchView!!.setQuery(TAG, true) }
@@ -400,7 +400,8 @@ class ConversationsListController(bundle: Bundle) :
mainActivity.binding.toolbar.visibility = View.GONE
mainActivity.binding.searchToolbar.visibility = View.VISIBLE
if (resources != null) {
- viewThemeUtils.resetStatusBar(mainActivity, mainActivity.binding.searchToolbar)
+ viewThemeUtils.androidViewThemeUtils
+ .resetStatusBar(mainActivity, mainActivity.binding.searchToolbar)
}
}
val layoutManager = binding.recyclerView.layoutManager as SmoothScrollLinearLayoutManager?
@@ -950,7 +951,7 @@ class ConversationsListController(bundle: Bundle) :
}
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
@@ -1146,7 +1147,7 @@ class ConversationsListController(bundle: Bundle) :
}
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
@@ -1189,7 +1190,7 @@ class ConversationsListController(bundle: Bundle) :
}
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
@@ -1231,7 +1232,7 @@ class ConversationsListController(bundle: Bundle) :
}
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ProfileController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ProfileController.kt
index 71e01ca3d..a6ed67903 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/ProfileController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/ProfileController.kt
@@ -755,7 +755,7 @@ class ProfileController : BaseController(R.layout.controller_profile) {
initUserInfoEditText(holder, item)
holder.binding.icon.contentDescription = item.hint
- viewThemeUtils.colorImageView(holder.binding.icon)
+ viewThemeUtils.androidViewThemeUtils.colorImageView(holder.binding.icon)
if (!TextUtils.isEmpty(item.text) || controller.edit) {
holder.binding.userInfoDetailContainer.visibility = View.VISIBLE
controller.viewThemeUtils.colorTextInputLayout(holder.binding.userInfoInputLayout)
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.kt b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.kt
index 34d0804db..8a1a852f7 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.kt
@@ -392,7 +392,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
val dialog = materialAlertDialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
@@ -968,7 +968,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
dialog.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/base/BaseController.kt b/app/src/main/java/com/nextcloud/talk/controllers/base/BaseController.kt
index f9ae3b379..67d7de12b 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/base/BaseController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/base/BaseController.kt
@@ -217,9 +217,9 @@ abstract class BaseController(@LayoutRes var layoutRes: Int, args: Bundle? = nul
private fun colorizeStatusBar(showSearchBar: Boolean, activity: Activity?, resources: Resources?) {
if (activity != null && resources != null) {
if (showSearchBar) {
- view?.let { viewThemeUtils.resetStatusBar(activity, it) }
+ view?.let { viewThemeUtils.androidViewThemeUtils.resetStatusBar(activity, it) }
} else {
- view?.let { viewThemeUtils.themeStatusBar(activity, it) }
+ view?.let { viewThemeUtils.androidViewThemeUtils.themeStatusBar(activity, it) }
}
}
}
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.kt b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.kt
index c169b7d05..2bdaf70ca 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.kt
@@ -126,7 +126,7 @@ class EntryMenuController(args: Bundle) :
rootView = view,
editText = binding.textEdit,
onEmojiPopupShownListener = {
- viewThemeUtils.colorImageView(binding.smileyButton)
+ viewThemeUtils.androidViewThemeUtils.colorImageView(binding.smileyButton)
},
onEmojiPopupDismissListener = {
binding.smileyButton.imageTintList = ColorStateList.valueOf(
diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.kt b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.kt
index 5ed400524..e313bd4c8 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.kt
+++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.kt
@@ -117,7 +117,7 @@ class OperationsMenuController(args: Bundle) : BaseController(
sharedApplication!!.componentApplication.inject(this)
currentUser = userManager.currentUser.blockingGet()
- viewThemeUtils.colorCircularProgressBar(binding.progressBar)
+ viewThemeUtils.androidViewThemeUtils.colorCircularProgressBar(binding.progressBar)
if (!TextUtils.isEmpty(callUrl) && callUrl.contains("/call")) {
conversationToken = callUrl.substring(callUrl.lastIndexOf("/") + 1)
diff --git a/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt b/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt
index 3b87d924d..e9e644448 100644
--- a/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt
+++ b/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt
@@ -101,9 +101,9 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
}
private fun themeDialog() {
- viewThemeUtils.colorPrimaryTextViewElement(binding.pollQuestion)
- viewThemeUtils.colorPrimaryTextViewElement(binding.pollOptions)
- viewThemeUtils.colorPrimaryTextViewElement(binding.pollSettings)
+ viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(binding.pollQuestion)
+ viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(binding.pollOptions)
+ viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(binding.pollSettings)
viewThemeUtils.colorTextInputLayout(binding.pollCreateQuestionTextInputLayout)
@@ -111,8 +111,8 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
viewThemeUtils.colorMaterialButtonText(binding.pollDismiss)
viewThemeUtils.colorMaterialButtonPrimaryFilled(binding.pollCreateButton)
- viewThemeUtils.themeCheckbox(binding.pollPrivatePollCheckbox)
- viewThemeUtils.themeCheckbox(binding.pollMultipleAnswersCheckbox)
+ viewThemeUtils.androidViewThemeUtils.themeCheckbox(binding.pollPrivatePollCheckbox)
+ viewThemeUtils.androidViewThemeUtils.themeCheckbox(binding.pollMultipleAnswersCheckbox)
}
private fun setupListeners() {
diff --git a/app/src/main/java/com/nextcloud/talk/polls/ui/PollLoadingFragment.kt b/app/src/main/java/com/nextcloud/talk/polls/ui/PollLoadingFragment.kt
index 785669cd8..c80154777 100644
--- a/app/src/main/java/com/nextcloud/talk/polls/ui/PollLoadingFragment.kt
+++ b/app/src/main/java/com/nextcloud/talk/polls/ui/PollLoadingFragment.kt
@@ -55,7 +55,7 @@ class PollLoadingFragment : Fragment() {
): View {
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
binding.root.layoutParams.height = fragmentHeight
- viewThemeUtils.colorCircularProgressBar(binding.pollLoadingProgressbar)
+ viewThemeUtils.androidViewThemeUtils.colorCircularProgressBar(binding.pollLoadingProgressbar)
return binding.root
}
diff --git a/app/src/main/java/com/nextcloud/talk/polls/ui/PollResultsFragment.kt b/app/src/main/java/com/nextcloud/talk/polls/ui/PollResultsFragment.kt
index 6264aa5ec..670e45e12 100644
--- a/app/src/main/java/com/nextcloud/talk/polls/ui/PollResultsFragment.kt
+++ b/app/src/main/java/com/nextcloud/talk/polls/ui/PollResultsFragment.kt
@@ -139,7 +139,7 @@ class PollResultsFragment : Fragment(), PollResultItemClickListener {
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
diff --git a/app/src/main/java/com/nextcloud/talk/polls/ui/PollVoteFragment.kt b/app/src/main/java/com/nextcloud/talk/polls/ui/PollVoteFragment.kt
index 0dde5d01b..453a660ec 100644
--- a/app/src/main/java/com/nextcloud/talk/polls/ui/PollVoteFragment.kt
+++ b/app/src/main/java/com/nextcloud/talk/polls/ui/PollVoteFragment.kt
@@ -149,7 +149,7 @@ class PollVoteFragment : Fragment() {
RadioButton(context).apply { text = option }
}?.forEachIndexed { index, radioButton ->
radioButton.id = index
- viewThemeUtils.themeRadioButton(radioButton)
+ viewThemeUtils.androidViewThemeUtils.themeRadioButton(radioButton)
makeOptionBoldIfSelfVoted(radioButton, poll, index)
binding.pollVoteRadioGroup.addView(radioButton)
@@ -170,7 +170,7 @@ class PollVoteFragment : Fragment() {
setLayoutParams(layoutParams)
}
}?.forEachIndexed { index, checkBox ->
- viewThemeUtils.themeCheckbox(checkBox)
+ viewThemeUtils.androidViewThemeUtils.themeCheckbox(checkBox)
checkBox.id = index
makeOptionBoldIfSelfVoted(checkBox, poll, index)
binding.voteOptionsCheckboxesWrapper.addView(checkBox)
@@ -222,7 +222,7 @@ class PollVoteFragment : Fragment() {
val dialog = dialogBuilder.show()
- viewThemeUtils.colorTextButtons(
+ viewThemeUtils.androidViewThemeUtils.colorTextButtons(
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
)
diff --git a/app/src/main/java/com/nextcloud/talk/remotefilebrowser/activities/RemoteFileBrowserActivity.kt b/app/src/main/java/com/nextcloud/talk/remotefilebrowser/activities/RemoteFileBrowserActivity.kt
index 6dabd3567..aa483410d 100644
--- a/app/src/main/java/com/nextcloud/talk/remotefilebrowser/activities/RemoteFileBrowserActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/remotefilebrowser/activities/RemoteFileBrowserActivity.kt
@@ -84,7 +84,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
binding.pathNavigationBackButton.iconTint = ColorStateList.valueOf(scheme.onSurface)
binding.pathNavigationBackButton.setTextColor(scheme.onSurface)
viewThemeUtils.colorMaterialTextButton(binding.pathNavigationBackButton)
- viewThemeUtils.themeStatusBar(this, binding.remoteFileBrowserItemsToolbar)
+ viewThemeUtils.androidViewThemeUtils.themeStatusBar(this, binding.remoteFileBrowserItemsToolbar)
setContentView(binding.root)
DisplayUtils.applyColorToNavigationBar(
diff --git a/app/src/main/java/com/nextcloud/talk/remotefilebrowser/adapters/RemoteFileBrowserItemsListViewHolder.kt b/app/src/main/java/com/nextcloud/talk/remotefilebrowser/adapters/RemoteFileBrowserItemsListViewHolder.kt
index 241707a91..64def2e63 100644
--- a/app/src/main/java/com/nextcloud/talk/remotefilebrowser/adapters/RemoteFileBrowserItemsListViewHolder.kt
+++ b/app/src/main/java/com/nextcloud/talk/remotefilebrowser/adapters/RemoteFileBrowserItemsListViewHolder.kt
@@ -129,7 +129,7 @@ class RemoteFileBrowserItemsListViewHolder(
private fun setSelectability() {
if (selectable) {
binding.selectFileCheckbox.visibility = View.VISIBLE
- viewThemeUtils.themeCheckbox(binding.selectFileCheckbox)
+ viewThemeUtils.androidViewThemeUtils.themeCheckbox(binding.selectFileCheckbox)
} else {
binding.selectFileCheckbox.visibility = View.GONE
}
diff --git a/app/src/main/java/com/nextcloud/talk/shareditems/activities/SharedItemsActivity.kt b/app/src/main/java/com/nextcloud/talk/shareditems/activities/SharedItemsActivity.kt
index 309498dc9..da5852bf4 100644
--- a/app/src/main/java/com/nextcloud/talk/shareditems/activities/SharedItemsActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/shareditems/activities/SharedItemsActivity.kt
@@ -73,7 +73,7 @@ class SharedItemsActivity : AppCompatActivity() {
setSupportActionBar(binding.sharedItemsToolbar)
setContentView(binding.root)
- viewThemeUtils.themeStatusBar(this, binding.sharedItemsToolbar)
+ viewThemeUtils.androidViewThemeUtils.themeStatusBar(this, binding.sharedItemsToolbar)
viewThemeUtils.themeToolbar(binding.sharedItemsToolbar)
viewThemeUtils.themeTabLayoutOnSurface(binding.sharedItemsTabs)
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt
index 40d291366..636f5dc3f 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt
@@ -53,7 +53,7 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle
setContentView(dialogAttachmentBinding.root)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- viewThemeUtils.themeDialog(dialogAttachmentBinding.root)
+ viewThemeUtils.androidViewThemeUtils.themeDialog(dialogAttachmentBinding.root)
initItemsStrings()
initItemsVisibility()
initItemsClickListeners()
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/AudioOutputDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/AudioOutputDialog.kt
index f55a30967..e4702d466 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/AudioOutputDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/AudioOutputDialog.kt
@@ -51,7 +51,7 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
setContentView(dialogAudioOutputBinding.root)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- viewThemeUtils.themeDialogDark(dialogAudioOutputBinding.root)
+ viewThemeUtils.androidViewThemeUtils.themeDialogDark(dialogAudioOutputBinding.root)
updateOutputDeviceList()
initClickListeners()
}
@@ -92,23 +92,28 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
private fun highlightActiveOutputChannel() {
when (callActivity.audioManager?.currentAudioDevice) {
WebRtcAudioManager.AudioDevice.BLUETOOTH -> {
- viewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputBluetoothIcon)
- viewThemeUtils.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputBluetoothText)
+ viewThemeUtils.androidViewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputBluetoothIcon)
+ viewThemeUtils.androidViewThemeUtils
+ .colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputBluetoothText)
}
WebRtcAudioManager.AudioDevice.SPEAKER_PHONE -> {
- viewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputSpeakerIcon)
- viewThemeUtils.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputSpeakerText)
+ viewThemeUtils.androidViewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputSpeakerIcon)
+ viewThemeUtils.androidViewThemeUtils
+ .colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputSpeakerText)
}
WebRtcAudioManager.AudioDevice.EARPIECE -> {
- viewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputEarspeakerIcon)
- viewThemeUtils.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputEarspeakerText)
+ viewThemeUtils.androidViewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputEarspeakerIcon)
+ viewThemeUtils.androidViewThemeUtils
+ .colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputEarspeakerText)
}
WebRtcAudioManager.AudioDevice.WIRED_HEADSET -> {
- viewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputWiredHeadsetIcon)
- viewThemeUtils.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputWiredHeadsetText)
+ viewThemeUtils.androidViewThemeUtils
+ .colorImageView(dialogAudioOutputBinding.audioOutputWiredHeadsetIcon)
+ viewThemeUtils.androidViewThemeUtils
+ .colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputWiredHeadsetText)
}
else -> Log.d(TAG, "AudioOutputDialog doesn't know this AudioDevice")
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java b/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java
index 4642a1503..d1a8822d5 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java
@@ -129,7 +129,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
binding.currentAccount.ticker.setVisibility(View.GONE);
binding.currentAccount.account.setText((Uri.parse(user.getBaseUrl()).getHost()));
- viewThemeUtils.colorImageView(binding.currentAccount.accountMenu);
+ viewThemeUtils.androidViewThemeUtils.colorImageView(binding.currentAccount.accountMenu);
if (user.getBaseUrl() != null &&
@@ -213,8 +213,8 @@ public class ChooseAccountDialogFragment extends DialogFragment {
}
private void themeViews() {
- viewThemeUtils.themeDialog(binding.getRoot());
- viewThemeUtils.themeDialogDivider(binding.divider);
+ viewThemeUtils.androidViewThemeUtils.themeDialog(binding.getRoot());
+ viewThemeUtils.androidViewThemeUtils.themeDialogDivider(binding.divider);
viewThemeUtils.colorMaterialTextButton(binding.setStatus);
viewThemeUtils.colorDialogMenuText(binding.setStatus);
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ContactsBottomDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ContactsBottomDialog.kt
index b4bc81478..ab425fcf9 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ContactsBottomDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ContactsBottomDialog.kt
@@ -59,7 +59,7 @@ class ContactsBottomDialog(
setContentView(binding.root)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- viewThemeUtils.themeDialog(binding.root)
+ viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root)
executeEntryMenuController(bundle)
}
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt
index c3e8bd1b7..0538a3c15 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt
@@ -97,7 +97,7 @@ class ConversationsListBottomDialog(
setContentView(binding.root)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- viewThemeUtils.themeDialog(binding.root)
+ viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root)
initHeaderDescription()
initItemsVisibility()
initClickListeners()
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt
index 173fee7db..a2af7d565 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt
@@ -83,7 +83,7 @@ class MessageActionsDialog(
setContentView(dialogMessageActionsBinding.root)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- viewThemeUtils.themeDialog(dialogMessageActionsBinding.root)
+ viewThemeUtils.androidViewThemeUtils.themeDialog(dialogMessageActionsBinding.root)
initEmojiBar(hasChatPermission)
initMenuItemCopy(!message.isDeleted)
initMenuReplyToMessage(message.replyable && hasChatPermission)
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ScopeDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ScopeDialog.kt
index 0f2914139..e97810a2e 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ScopeDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ScopeDialog.kt
@@ -59,7 +59,7 @@ class ScopeDialog(
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- viewThemeUtils.themeDialog(dialogScopeBinding.root)
+ viewThemeUtils.androidViewThemeUtils.themeDialog(dialogScopeBinding.root)
if (field == ProfileController.Field.DISPLAYNAME || field == ProfileController.Field.EMAIL) {
dialogScopeBinding.scopePrivate.visibility = View.GONE
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt
index 65e016d33..23a3eee27 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt
@@ -242,7 +242,7 @@ class SetStatusDialogFragment :
}
}
- viewThemeUtils.themeDialog(binding.root)
+ viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root)
viewThemeUtils.colorMaterialButtonText(binding.clearStatus)
viewThemeUtils.colorMaterialButtonPrimaryFilled(binding.setStatus)
@@ -419,7 +419,7 @@ class SetStatusDialogFragment :
}
}
viewThemeUtils.colorCardViewBackground(views.first)
- viewThemeUtils.colorPrimaryTextViewElement(views.second)
+ viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(views.second)
}
private fun clearTopStatus() {
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt
index 2ee767db2..38bcd4d92 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt
@@ -86,7 +86,7 @@ class ShowReactionsDialog(
binding = DialogMessageReactionsBinding.inflate(layoutInflater)
setContentView(binding.root)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- viewThemeUtils.themeDialog(binding.root)
+ viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root)
adapter = ReactionsAdapter(this, user)
binding.reactionsList.adapter = adapter
binding.reactionsList.layoutManager = LinearLayoutManager(context)
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/SortingOrderDialogFragment.java b/app/src/main/java/com/nextcloud/talk/ui/dialog/SortingOrderDialogFragment.java
index b2ba7bcaa..8fb5bdb09 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/SortingOrderDialogFragment.java
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/SortingOrderDialogFragment.java
@@ -120,7 +120,7 @@ public class SortingOrderDialogFragment extends DialogFragment implements View.O
* find all relevant UI elements and set their values.
*/
private void setupDialogElements() {
- viewThemeUtils.themeDialog(binding.root);
+ viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root);
viewThemeUtils.colorMaterialButtonPrimaryBorderless(binding.cancel);
taggedViews = new View[12];
@@ -166,7 +166,7 @@ public class SortingOrderDialogFragment extends DialogFragment implements View.O
viewThemeUtils.colorMaterialButtonText((MaterialButton) view);
}
if (view instanceof TextView) {
- viewThemeUtils.colorPrimaryTextViewElement((TextView) view);
+ viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement((TextView) view);
((TextView) view).setTypeface(Typeface.DEFAULT_BOLD);
}
}
diff --git a/app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt b/app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt
index 85cddb760..998a86991 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt
@@ -22,7 +22,6 @@
package com.nextcloud.talk.ui.theme
import android.annotation.TargetApi
-import android.app.Activity
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
@@ -32,24 +31,15 @@ import android.graphics.drawable.LayerDrawable
import android.os.Build
import android.text.Spannable
import android.text.SpannableString
-import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
-import android.widget.Button
-import android.widget.CheckBox
-import android.widget.EditText
-import android.widget.ImageButton
import android.widget.ImageView
import android.widget.LinearLayout
-import android.widget.ProgressBar
-import android.widget.RadioButton
-import android.widget.SeekBar
import android.widget.TextView
import androidx.annotation.ColorInt
import androidx.annotation.DrawableRes
import androidx.appcompat.content.res.AppCompatResources
import androidx.appcompat.widget.SearchView
-import androidx.appcompat.widget.SearchView.SearchAutoComplete
import androidx.appcompat.widget.SwitchCompat
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
@@ -70,12 +60,13 @@ import com.google.android.material.shape.MaterialShapeDrawable
import com.google.android.material.tabs.TabLayout
import com.google.android.material.textfield.TextInputLayout
import com.google.android.material.textview.MaterialTextView
+import com.nextcloud.android.common.ui.color.ColorUtil
import com.nextcloud.android.common.ui.theme.MaterialSchemes
+import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
import com.nextcloud.talk.R
+import com.nextcloud.talk.ui.theme.viewthemeutils.AndroidViewThemeUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.DrawableUtils
-import com.nextcloud.android.common.ui.color.ColorUtil
-import com.nextcloud.talk.utils.ui.PlatformThemeUtil.isDarkMode
import com.vanniktech.emoji.EmojiTextView
import com.yarolegovich.mp.MaterialPreferenceCategory
import com.yarolegovich.mp.MaterialSwitchPreference
@@ -85,49 +76,13 @@ import javax.inject.Inject
import kotlin.math.roundToInt
@Suppress("TooManyFunctions")
-class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, private val colorUtil: ColorUtil) {
-
- /**
- * Scheme for painting elements
- */
- fun getScheme(context: Context): Scheme = when {
- isDarkMode(context) -> schemes.darkScheme
- else -> schemes.lightScheme
- }
-
- private fun getSchemeDark(): Scheme = schemes.darkScheme
-
- private fun withScheme(view: View, block: (Scheme) -> Unit) {
- block(getScheme(view.context))
- }
-
- private fun withScheme(context: Context, block: (Scheme) -> Unit) {
- block(getScheme(context))
- }
-
- private fun withSchemeDark(block: (Scheme) -> Unit) {
- block(getSchemeDark())
- }
-
- fun themeToolbar(toolbar: MaterialToolbar) {
- withScheme(toolbar) { scheme ->
- toolbar.setBackgroundColor(scheme.surface)
- toolbar.setNavigationIconTint(scheme.onSurface)
- toolbar.setTitleTextColor(scheme.onSurface)
- }
- }
-
- fun colorViewBackground(view: View) {
- withScheme(view) { scheme ->
- view.setBackgroundColor(scheme.surface)
- }
- }
-
- fun colorToolbarMenuIcon(context: Context, item: MenuItem) {
- withScheme(context) { scheme ->
- item.icon.setColorFilter(scheme.onSurface, PorterDuff.Mode.SRC_ATOP)
- }
- }
+class ViewThemeUtils @Inject constructor(
+ schemes: MaterialSchemes,
+ private val colorUtil: ColorUtil,
+ @JvmField
+ val androidViewThemeUtils: AndroidViewThemeUtils
+) :
+ ViewThemeUtilsBase(schemes) {
fun colorToolbarOverflowIcon(toolbar: MaterialToolbar) {
withScheme(toolbar) { scheme ->
@@ -138,7 +93,7 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
fun themeSearchView(searchView: SearchView) {
withScheme(searchView) { scheme ->
// hacky as no default way is provided
- val editText = searchView.findViewById(R.id.search_src_text)
+ val editText = searchView.findViewById(R.id.search_src_text)
val searchPlate = searchView.findViewById(R.id.search_plate)
editText.textSize = SEARCH_TEXT_SIZE
editText.setHintTextColor(scheme.onSurfaceVariant)
@@ -154,41 +109,6 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
}
}
- fun themeStatusBar(activity: Activity, view: View) {
- withScheme(view) { scheme ->
- DisplayUtils.applyColorToStatusBar(activity, scheme.surface)
- }
- }
-
- fun resetStatusBar(activity: Activity, view: View) {
- DisplayUtils.applyColorToStatusBar(
- activity,
- ResourcesCompat.getColor(
- activity.resources,
- R.color.bg_default,
- activity.theme
- )
- )
- }
-
- fun themeDialog(view: View) {
- withScheme(view) { scheme ->
- view.setBackgroundColor(scheme.surface)
- }
- }
-
- fun themeDialogDark(view: View) {
- withSchemeDark { scheme ->
- view.setBackgroundColor(scheme.surface)
- }
- }
-
- fun themeDialogDivider(view: View) {
- withScheme(view) { scheme ->
- view.setBackgroundColor(scheme.surfaceVariant)
- }
- }
-
fun themeFAB(fab: FloatingActionButton) {
withScheme(fab) { scheme ->
fab.backgroundTintList = ColorStateList.valueOf(scheme.primaryContainer)
@@ -202,94 +122,6 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
}
}
- fun themeHorizontalSeekBar(seekBar: SeekBar) {
- withScheme(seekBar) { scheme ->
- themeHorizontalProgressBar(seekBar, scheme.primary)
- seekBar.thumb.setColorFilter(scheme.primary, PorterDuff.Mode.SRC_IN)
- }
- }
-
- fun themeHorizontalProgressBar(progressBar: ProgressBar?, @ColorInt color: Int) {
- if (progressBar != null) {
- progressBar.indeterminateDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN)
- progressBar.progressDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN)
- }
- }
-
- fun colorPrimaryTextViewElement(textView: TextView) {
- withScheme(textView) { scheme ->
- textView.setTextColor(scheme.primary)
- }
- }
-
- fun colorPrimaryTextViewElementDarkMode(textView: TextView) {
- withSchemeDark { scheme ->
- textView.setTextColor(scheme.primary)
- }
- }
-
- fun colorPrimaryView(view: View) {
- withScheme(view) { scheme ->
- view.setBackgroundColor(scheme.primary)
- }
- }
-
- /**
- * Colors the background as element color and the foreground as text color.
- */
- fun colorImageViewButton(imageView: ImageView) {
- withScheme(imageView) { scheme ->
- imageView.imageTintList = ColorStateList.valueOf(scheme.onPrimaryContainer)
- imageView.backgroundTintList = ColorStateList.valueOf(scheme.primaryContainer)
- }
- }
-
- fun themeImageButton(imageButton: ImageButton) {
- withScheme(imageButton) { scheme ->
- imageButton.imageTintList = ColorStateList(
- arrayOf(
- intArrayOf(android.R.attr.state_selected),
- intArrayOf(-android.R.attr.state_selected),
- intArrayOf(android.R.attr.state_enabled),
- intArrayOf(-android.R.attr.state_enabled)
- ),
- intArrayOf(
- scheme.primary,
- scheme.onSurfaceVariant,
- scheme.onSurfaceVariant,
- colorUtil.adjustOpacity(scheme.onSurface, ON_SURFACE_OPACITY_BUTTON_DISABLED)
- )
- )
- }
- }
-
- /**
- * Tints the image with element color
- */
- fun colorImageView(imageView: ImageView) {
- withScheme(imageView) { scheme ->
- imageView.imageTintList = ColorStateList.valueOf(scheme.primary)
- }
- }
-
- fun colorOutgoingQuoteText(textView: TextView) {
- withScheme(textView) { scheme ->
- textView.setTextColor(scheme.onSurfaceVariant)
- }
- }
-
- fun colorOutgoingQuoteAuthorText(textView: TextView) {
- withScheme(textView) { scheme ->
- ColorUtils.setAlphaComponent(scheme.onSurfaceVariant, ALPHA_80_INT)
- }
- }
-
- fun colorOutgoingQuoteBackground(view: View) {
- withScheme(view) { scheme ->
- view.setBackgroundColor(scheme.onSurfaceVariant)
- }
- }
-
fun colorMaterialTextButton(button: MaterialButton) {
withScheme(button) { scheme ->
button.rippleColor = ColorStateList(
@@ -318,25 +150,6 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
}
}
- fun colorTextButtons(vararg buttons: Button) {
- withScheme(buttons[0]) { scheme ->
- for (button in buttons) {
- button.setTextColor(
- ColorStateList(
- arrayOf(
- intArrayOf(android.R.attr.state_enabled),
- intArrayOf(-android.R.attr.state_enabled)
- ),
- intArrayOf(
- scheme.primary,
- colorUtil.adjustOpacity(scheme.onSurface, ON_SURFACE_OPACITY_BUTTON_DISABLED)
- )
- )
- )
- }
- }
- }
-
fun colorMaterialButtonPrimaryFilled(button: MaterialButton) {
withScheme(button) { scheme ->
button.backgroundTintList =
@@ -449,11 +262,20 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
val bubbleDrawable = DisplayUtils.getMessageSelector(
bgBubbleColor,
resources.getColor(R.color.transparent),
- bgBubbleColor, bubbleResource
+ bgBubbleColor,
+ bubbleResource
)
ViewCompat.setBackground(bubble, bubbleDrawable)
}
+ fun themeToolbar(toolbar: MaterialToolbar) {
+ withScheme(toolbar) { scheme ->
+ toolbar.setBackgroundColor(scheme.surface)
+ toolbar.setNavigationIconTint(scheme.onSurface)
+ toolbar.setTitleTextColor(scheme.onSurface)
+ }
+ }
+
fun themeOutgoingMessageBubble(bubble: ViewGroup, grouped: Boolean, deleted: Boolean) {
withScheme(bubble) { scheme ->
val bgBubbleColor = if (deleted) {
@@ -477,6 +299,24 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
}
}
+ fun colorOutgoingQuoteText(textView: TextView) {
+ withScheme(textView) { scheme ->
+ textView.setTextColor(scheme.onSurfaceVariant)
+ }
+ }
+
+ fun colorOutgoingQuoteAuthorText(textView: TextView) {
+ withScheme(textView) { scheme ->
+ ColorUtils.setAlphaComponent(scheme.onSurfaceVariant, ALPHA_80_INT)
+ }
+ }
+
+ fun colorOutgoingQuoteBackground(view: View) {
+ withScheme(view) { scheme ->
+ view.setBackgroundColor(scheme.onSurfaceVariant)
+ }
+ }
+
fun colorCardViewBackground(card: MaterialCardView) {
withScheme(card) { scheme ->
card.setCardBackgroundColor(scheme.surfaceVariant)
@@ -495,24 +335,6 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
}
}
- fun colorCircularProgressBarOnPrimaryContainer(progressBar: ProgressBar) {
- withScheme(progressBar) { scheme ->
- progressBar.indeterminateDrawable.setColorFilter(scheme.onPrimaryContainer, PorterDuff.Mode.SRC_ATOP)
- }
- }
-
- fun colorCircularProgressBar(progressBar: ProgressBar) {
- withScheme(progressBar) { scheme ->
- progressBar.indeterminateDrawable.setColorFilter(scheme.primary, PorterDuff.Mode.SRC_ATOP)
- }
- }
-
- fun colorCircularProgressBarOnSurfaceVariant(progressBar: ProgressBar) {
- withScheme(progressBar) { scheme ->
- progressBar.indeterminateDrawable.setColorFilter(scheme.onSurfaceVariant, PorterDuff.Mode.SRC_ATOP)
- }
- }
-
// TODO split this util into classes depending on framework views vs library views
fun colorPreferenceCategory(category: MaterialPreferenceCategory) {
withScheme(category) { scheme ->
@@ -564,35 +386,6 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
}
}
- fun colorDrawable(context: Context, drawable: Drawable) {
- val scheme = getScheme(context)
- drawable.setTint(scheme.primary)
- }
-
- fun themeCheckbox(checkbox: CheckBox) {
- withScheme(checkbox) { scheme ->
- checkbox.buttonTintList = ColorStateList(
- arrayOf(
- intArrayOf(-android.R.attr.state_checked),
- intArrayOf(android.R.attr.state_checked)
- ),
- intArrayOf(Color.GRAY, scheme.primary)
- )
- }
- }
-
- fun themeRadioButton(radioButton: RadioButton) {
- withScheme(radioButton) { scheme ->
- radioButton.buttonTintList = ColorStateList(
- arrayOf(
- intArrayOf(-android.R.attr.state_checked),
- intArrayOf(android.R.attr.state_checked)
- ),
- intArrayOf(Color.GRAY, scheme.primary)
- )
- }
- }
-
fun themeSwipeRefreshLayout(swipeRefreshLayout: SwipeRefreshLayout) {
withScheme(swipeRefreshLayout) { scheme ->
swipeRefreshLayout.setColorSchemeColors(scheme.primary)
@@ -606,25 +399,6 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
}
}
- fun colorEditText(editText: EditText) {
- withScheme(editText) { scheme ->
- // TODO check API-level compatibility
- // editText.background.setColorFilter(color, PorterDuff.Mode.SRC_ATOP)
- editText.backgroundTintList = ColorStateList(
- arrayOf(
- intArrayOf(-android.R.attr.state_focused),
- intArrayOf(android.R.attr.state_focused)
- ),
- intArrayOf(
- scheme.outline,
- scheme.primary
- )
- )
- editText.setHintTextColor(scheme.onSurfaceVariant)
- editText.setTextColor(scheme.onSurface)
- }
- }
-
fun colorTextInputLayout(textInputLayout: TextInputLayout) {
withScheme(textInputLayout) { scheme ->
val errorColor = scheme.onSurfaceVariant
@@ -696,6 +470,11 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
return drawable
}
+ private fun colorDrawable(context: Context, drawable: Drawable) {
+ val scheme = getScheme(context)
+ drawable.setTint(scheme.primary)
+ }
+
fun colorChipBackground(chip: Chip) {
withScheme(chip) { scheme ->
chip.chipBackgroundColor = ColorStateList.valueOf(scheme.primary)
diff --git a/app/src/main/java/com/nextcloud/talk/ui/theme/viewthemeutils/AndroidViewThemeUtils.kt b/app/src/main/java/com/nextcloud/talk/ui/theme/viewthemeutils/AndroidViewThemeUtils.kt
new file mode 100644
index 000000000..1de30a6c9
--- /dev/null
+++ b/app/src/main/java/com/nextcloud/talk/ui/theme/viewthemeutils/AndroidViewThemeUtils.kt
@@ -0,0 +1,256 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Álvaro Brey
+ * Copyright (C) 2022 Álvaro Brey
+ * Copyright (C) 2022 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.nextcloud.talk.ui.theme.viewthemeutils
+
+import android.app.Activity
+import android.content.Context
+import android.content.res.ColorStateList
+import android.graphics.Color
+import android.graphics.PorterDuff
+import android.view.MenuItem
+import android.view.View
+import android.widget.Button
+import android.widget.CheckBox
+import android.widget.EditText
+import android.widget.ImageButton
+import android.widget.ImageView
+import android.widget.ProgressBar
+import android.widget.RadioButton
+import android.widget.SeekBar
+import android.widget.TextView
+import androidx.annotation.ColorInt
+import androidx.core.content.res.ResourcesCompat
+import com.nextcloud.android.common.ui.color.ColorUtil
+import com.nextcloud.android.common.ui.theme.MaterialSchemes
+import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
+import com.nextcloud.talk.R
+import com.nextcloud.talk.utils.DisplayUtils
+import javax.inject.Inject
+
+/**
+ * View theme utils for platform views (android.widget.*, android.view.*)
+ */
+@Suppress("TooManyFunctions")
+class AndroidViewThemeUtils @Inject constructor(schemes: MaterialSchemes, private val colorUtil: ColorUtil) :
+ ViewThemeUtilsBase(schemes) {
+
+ fun colorViewBackground(view: View) {
+ withScheme(view) { scheme ->
+ view.setBackgroundColor(scheme.surface)
+ }
+ }
+
+ fun colorToolbarMenuIcon(context: Context, item: MenuItem) {
+ withScheme(context) { scheme ->
+ item.icon.setColorFilter(scheme.onSurface, PorterDuff.Mode.SRC_ATOP)
+ }
+ }
+
+ fun themeStatusBar(activity: Activity, view: View) {
+ withScheme(view) { scheme ->
+ DisplayUtils.applyColorToStatusBar(activity, scheme.surface)
+ }
+ }
+
+ fun resetStatusBar(activity: Activity, view: View) {
+ DisplayUtils.applyColorToStatusBar(
+ activity,
+ ResourcesCompat.getColor(
+ activity.resources,
+ R.color.bg_default,
+ activity.theme
+ )
+ )
+ }
+
+ fun themeDialog(view: View) {
+ withScheme(view) { scheme ->
+ view.setBackgroundColor(scheme.surface)
+ }
+ }
+
+ fun themeDialogDark(view: View) {
+ withSchemeDark { scheme ->
+ view.setBackgroundColor(scheme.surface)
+ }
+ }
+
+ fun themeDialogDivider(view: View) {
+ withScheme(view) { scheme ->
+ view.setBackgroundColor(scheme.surfaceVariant)
+ }
+ }
+
+ fun themeHorizontalSeekBar(seekBar: SeekBar) {
+ withScheme(seekBar) { scheme ->
+ themeHorizontalProgressBar(seekBar, scheme.primary)
+ seekBar.thumb.setColorFilter(scheme.primary, PorterDuff.Mode.SRC_IN)
+ }
+ }
+
+ fun themeHorizontalProgressBar(progressBar: ProgressBar?, @ColorInt color: Int) {
+ if (progressBar != null) {
+ progressBar.indeterminateDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN)
+ progressBar.progressDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN)
+ }
+ }
+
+ fun colorPrimaryTextViewElement(textView: TextView) {
+ withScheme(textView) { scheme ->
+ textView.setTextColor(scheme.primary)
+ }
+ }
+
+ fun colorPrimaryTextViewElementDarkMode(textView: TextView) {
+ withSchemeDark { scheme ->
+ textView.setTextColor(scheme.primary)
+ }
+ }
+
+ fun colorPrimaryView(view: View) {
+ withScheme(view) { scheme ->
+ view.setBackgroundColor(scheme.primary)
+ }
+ }
+
+ /**
+ * Colors the background as element color and the foreground as text color.
+ */
+ fun colorImageViewButton(imageView: ImageView) {
+ withScheme(imageView) { scheme ->
+ imageView.imageTintList = ColorStateList.valueOf(scheme.onPrimaryContainer)
+ imageView.backgroundTintList = ColorStateList.valueOf(scheme.primaryContainer)
+ }
+ }
+
+ fun themeImageButton(imageButton: ImageButton) {
+ withScheme(imageButton) { scheme ->
+ imageButton.imageTintList = ColorStateList(
+ arrayOf(
+ intArrayOf(android.R.attr.state_selected),
+ intArrayOf(-android.R.attr.state_selected),
+ intArrayOf(android.R.attr.state_enabled),
+ intArrayOf(-android.R.attr.state_enabled)
+ ),
+ intArrayOf(
+ scheme.primary,
+ scheme.onSurfaceVariant,
+ scheme.onSurfaceVariant,
+ colorUtil.adjustOpacity(scheme.onSurface, ON_SURFACE_OPACITY_BUTTON_DISABLED)
+ )
+ )
+ }
+ }
+
+ /**
+ * Tints the image with element color
+ */
+ fun colorImageView(imageView: ImageView) {
+ withScheme(imageView) { scheme ->
+ imageView.imageTintList = ColorStateList.valueOf(scheme.primary)
+ }
+ }
+
+ fun colorTextButtons(vararg buttons: Button) {
+ withScheme(buttons[0]) { scheme ->
+ for (button in buttons) {
+ button.setTextColor(
+ ColorStateList(
+ arrayOf(
+ intArrayOf(android.R.attr.state_enabled),
+ intArrayOf(-android.R.attr.state_enabled)
+ ),
+ intArrayOf(
+ scheme.primary,
+ colorUtil.adjustOpacity(scheme.onSurface, ON_SURFACE_OPACITY_BUTTON_DISABLED)
+ )
+ )
+ )
+ }
+ }
+ }
+
+ fun colorCircularProgressBarOnPrimaryContainer(progressBar: ProgressBar) {
+ withScheme(progressBar) { scheme ->
+ progressBar.indeterminateDrawable.setColorFilter(scheme.onPrimaryContainer, PorterDuff.Mode.SRC_ATOP)
+ }
+ }
+
+ fun colorCircularProgressBar(progressBar: ProgressBar) {
+ withScheme(progressBar) { scheme ->
+ progressBar.indeterminateDrawable.setColorFilter(scheme.primary, PorterDuff.Mode.SRC_ATOP)
+ }
+ }
+
+ fun colorCircularProgressBarOnSurfaceVariant(progressBar: ProgressBar) {
+ withScheme(progressBar) { scheme ->
+ progressBar.indeterminateDrawable.setColorFilter(scheme.onSurfaceVariant, PorterDuff.Mode.SRC_ATOP)
+ }
+ }
+
+ fun themeCheckbox(checkbox: CheckBox) {
+ withScheme(checkbox) { scheme ->
+ checkbox.buttonTintList = ColorStateList(
+ arrayOf(
+ intArrayOf(-android.R.attr.state_checked),
+ intArrayOf(android.R.attr.state_checked)
+ ),
+ intArrayOf(Color.GRAY, scheme.primary)
+ )
+ }
+ }
+
+ fun themeRadioButton(radioButton: RadioButton) {
+ withScheme(radioButton) { scheme ->
+ radioButton.buttonTintList = ColorStateList(
+ arrayOf(
+ intArrayOf(-android.R.attr.state_checked),
+ intArrayOf(android.R.attr.state_checked)
+ ),
+ intArrayOf(Color.GRAY, scheme.primary)
+ )
+ }
+ }
+
+ fun colorEditText(editText: EditText) {
+ withScheme(editText) { scheme ->
+ // TODO check API-level compatibility
+ // editText.background.setColorFilter(color, PorterDuff.Mode.SRC_ATOP)
+ editText.backgroundTintList = ColorStateList(
+ arrayOf(
+ intArrayOf(-android.R.attr.state_focused),
+ intArrayOf(android.R.attr.state_focused)
+ ),
+ intArrayOf(
+ scheme.outline,
+ scheme.primary
+ )
+ )
+ editText.setHintTextColor(scheme.onSurfaceVariant)
+ editText.setTextColor(scheme.onSurface)
+ }
+ }
+
+ companion object {
+ private const val ON_SURFACE_OPACITY_BUTTON_DISABLED: Float = 0.38f
+ }
+}
diff --git a/app/src/main/java/com/nextcloud/talk/utils/preferences/MagicUserInputModule.java b/app/src/main/java/com/nextcloud/talk/utils/preferences/MagicUserInputModule.java
index 3fa5fc4ca..47736d2e4 100644
--- a/app/src/main/java/com/nextcloud/talk/utils/preferences/MagicUserInputModule.java
+++ b/app/src/main/java/com/nextcloud/talk/utils/preferences/MagicUserInputModule.java
@@ -73,7 +73,7 @@ public class MagicUserInputModule extends StandardUserInputModule {
final Listener listener) {
final View view = LayoutInflater.from(context).inflate(R.layout.dialog_edittext, null);
final EditText inputField = view.findViewById(R.id.mp_text_input);
- viewThemeUtils.colorEditText(inputField);
+ viewThemeUtils.androidViewThemeUtils.colorEditText(inputField);
int paddingStartEnd = Math.round(view.getResources().getDimension(R.dimen.standard_padding));
int paddingTopBottom = Math.round(view.getResources().getDimension(R.dimen.dialog_padding_top_bottom));
@@ -101,7 +101,7 @@ public class MagicUserInputModule extends StandardUserInputModule {
final Dialog dialog = dialogBuilder.show();
TextView button = view.findViewById(R.id.mp_btn_confirm);
- viewThemeUtils.colorPrimaryTextViewElement(button);
+ viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/app/src/main/java/com/nextcloud/talk/utils/ui/PlatformThemeUtil.kt b/app/src/main/java/com/nextcloud/talk/utils/ui/PlatformThemeUtil.kt
deleted file mode 100644
index 5f65c3d24..000000000
--- a/app/src/main/java/com/nextcloud/talk/utils/ui/PlatformThemeUtil.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Nextcloud Talk application
- *
- * @author Álvaro Brey
- * Copyright (C) 2022 Álvaro Brey
- * Copyright (C) 2022 Nextcloud GmbH
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package com.nextcloud.talk.utils.ui
-
-import android.content.Context
-import android.content.res.Configuration
-
-object PlatformThemeUtil {
- fun isDarkMode(context: Context): Boolean =
- when (context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
- Configuration.UI_MODE_NIGHT_YES -> true
- else -> false
- }
-}