mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Begin splitting ViewThemeUtils. Part 1: AndroidViewThemeUtils, for platform views
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
b90afdc5c7
commit
a2caf425a6
@ -66,9 +66,6 @@
|
|||||||
<MarkdownNavigatorCodeStyleSettings>
|
<MarkdownNavigatorCodeStyleSettings>
|
||||||
<option name="RIGHT_MARGIN" value="120" />
|
<option name="RIGHT_MARGIN" value="120" />
|
||||||
</MarkdownNavigatorCodeStyleSettings>
|
</MarkdownNavigatorCodeStyleSettings>
|
||||||
<XML>
|
|
||||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
|
||||||
</XML>
|
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||||
<option name="ALIGN_MULTILINE_METHOD_BRACKETS" value="true" />
|
<option name="ALIGN_MULTILINE_METHOD_BRACKETS" value="true" />
|
||||||
|
@ -132,7 +132,7 @@ open class BaseActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
|
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
|
@ -104,7 +104,7 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
|
|||||||
supportActionBar?.title = fileName
|
supportActionBar?.title = fileName
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
|
||||||
viewThemeUtils.themeStatusBar(this, binding.textviewToolbar)
|
viewThemeUtils.androidViewThemeUtils.themeStatusBar(this, binding.textviewToolbar)
|
||||||
|
|
||||||
if (resources != null) {
|
if (resources != null) {
|
||||||
DisplayUtils.applyColorToNavigationBar(
|
DisplayUtils.applyColorToNavigationBar(
|
||||||
|
@ -113,7 +113,7 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
|||||||
holder.binding.avatarDraweeView.setController(null);
|
holder.binding.avatarDraweeView.setController(null);
|
||||||
|
|
||||||
if (participant.getSelected()) {
|
if (participant.getSelected()) {
|
||||||
viewThemeUtils.colorImageView(holder.binding.checkedImageView);
|
viewThemeUtils.androidViewThemeUtils.colorImageView(holder.binding.checkedImageView);
|
||||||
holder.binding.checkedImageView.setVisibility(View.VISIBLE);
|
holder.binding.checkedImageView.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.binding.checkedImageView.setVisibility(View.GONE);
|
holder.binding.checkedImageView.setVisibility(View.GONE);
|
||||||
|
@ -74,7 +74,7 @@ public class GenericTextHeaderItem extends AbstractHeaderItem<GenericTextHeaderI
|
|||||||
Log.d(TAG, "We have payloads, so ignoring!");
|
Log.d(TAG, "We have payloads, so ignoring!");
|
||||||
} else {
|
} else {
|
||||||
holder.binding.titleTextView.setText(title);
|
holder.binding.titleTextView.setText(title);
|
||||||
viewThemeUtils.colorPrimaryTextViewElement(holder.binding.titleTextView);
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(holder.binding.titleTextView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) : Mess
|
|||||||
.setTextColor(context!!.resources.getColor(R.color.textColorMaxContrast))
|
.setTextColor(context!!.resources.getColor(R.color.textColorMaxContrast))
|
||||||
|
|
||||||
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
||||||
viewThemeUtils.colorPrimaryView(binding.messageQuote.quoteColoredView)
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryView(binding.messageQuote.quoteColoredView)
|
||||||
} else {
|
} else {
|
||||||
binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.textColorMaxContrast)
|
binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.textColorMaxContrast)
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ class IncomingPollMessageViewHolder(incomingView: View, payload: Any) : MessageH
|
|||||||
.setTextColor(ContextCompat.getColor(context, R.color.textColorMaxContrast))
|
.setTextColor(ContextCompat.getColor(context, R.color.textColorMaxContrast))
|
||||||
|
|
||||||
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
||||||
viewThemeUtils.colorPrimaryView(binding.messageQuote.quoteColoredView)
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryView(binding.messageQuote.quoteColoredView)
|
||||||
} else {
|
} else {
|
||||||
binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.textColorMaxContrast)
|
binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.textColorMaxContrast)
|
||||||
}
|
}
|
||||||
|
@ -95,8 +95,8 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message
|
|||||||
|
|
||||||
updateDownloadState(message)
|
updateDownloadState(message)
|
||||||
binding.seekbar.max = message.voiceMessageDuration
|
binding.seekbar.max = message.voiceMessageDuration
|
||||||
viewThemeUtils.themeHorizontalSeekBar(binding.seekbar)
|
viewThemeUtils.androidViewThemeUtils.themeHorizontalSeekBar(binding.seekbar)
|
||||||
viewThemeUtils.colorCircularProgressBarOnSurfaceVariant(binding.progressBar)
|
viewThemeUtils.androidViewThemeUtils.colorCircularProgressBarOnSurfaceVariant(binding.progressBar)
|
||||||
|
|
||||||
if (message.isPlayingVoiceMessage) {
|
if (message.isPlayingVoiceMessage) {
|
||||||
showPlayButton()
|
showPlayButton()
|
||||||
@ -292,7 +292,7 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message
|
|||||||
.setTextColor(ContextCompat.getColor(context!!, R.color.textColorMaxContrast))
|
.setTextColor(ContextCompat.getColor(context!!, R.color.textColorMaxContrast))
|
||||||
|
|
||||||
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
||||||
viewThemeUtils.colorPrimaryView(binding.messageQuote.quoteColoredView)
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryView(binding.messageQuote.quoteColoredView)
|
||||||
} else {
|
} else {
|
||||||
binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.textColorMaxContrast)
|
binding.messageQuote.quoteColoredView.setBackgroundResource(R.color.textColorMaxContrast)
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ class MagicIncomingTextMessageViewHolder(itemView: View, payload: Any) : Message
|
|||||||
binding.messageQuote.quotedMessage.text = parentChatMessage.text
|
binding.messageQuote.quotedMessage.text = parentChatMessage.text
|
||||||
|
|
||||||
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
||||||
viewThemeUtils.colorPrimaryView(binding.messageQuote.quoteColoredView)
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryView(binding.messageQuote.quoteColoredView)
|
||||||
} else {
|
} else {
|
||||||
binding.messageQuote.quoteColoredView.setBackgroundColor(
|
binding.messageQuote.quoteColoredView.setBackgroundColor(
|
||||||
ContextCompat.getColor(binding.messageQuote.quoteColoredView.context, R.color.high_emphasis_text)
|
ContextCompat.getColor(binding.messageQuote.quoteColoredView.context, R.color.high_emphasis_text)
|
||||||
|
@ -150,7 +150,7 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom
|
|||||||
}
|
}
|
||||||
|
|
||||||
progressBar = getProgressBar();
|
progressBar = getProgressBar();
|
||||||
viewThemeUtils.colorCircularProgressBar(getProgressBar());
|
viewThemeUtils.androidViewThemeUtils.colorCircularProgressBar(getProgressBar());
|
||||||
image = getImage();
|
image = getImage();
|
||||||
clickView = getImage();
|
clickView = getImage();
|
||||||
getMessageText().setVisibility(View.VISIBLE);
|
getMessageText().setVisibility(View.VISIBLE);
|
||||||
@ -169,7 +169,7 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom
|
|||||||
clickView = getPreviewContactContainer();
|
clickView = getPreviewContactContainer();
|
||||||
viewThemeUtils.colorContactChatItemBackground(getPreviewContactContainer());
|
viewThemeUtils.colorContactChatItemBackground(getPreviewContactContainer());
|
||||||
viewThemeUtils.colorContactChatItemName(getPreviewContactName());
|
viewThemeUtils.colorContactChatItemName(getPreviewContactName());
|
||||||
viewThemeUtils.colorCircularProgressBarOnPrimaryContainer(getPreviewContactProgressBar());
|
viewThemeUtils.androidViewThemeUtils.colorCircularProgressBarOnPrimaryContainer(getPreviewContactProgressBar());
|
||||||
} else {
|
} else {
|
||||||
getPreviewContainer().setVisibility(View.VISIBLE);
|
getPreviewContainer().setVisibility(View.VISIBLE);
|
||||||
getPreviewContactContainer().setVisibility(View.GONE);
|
getPreviewContactContainer().setVisibility(View.GONE);
|
||||||
|
@ -90,8 +90,8 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
|
|||||||
|
|
||||||
updateDownloadState(message)
|
updateDownloadState(message)
|
||||||
binding.seekbar.max = message.voiceMessageDuration
|
binding.seekbar.max = message.voiceMessageDuration
|
||||||
viewThemeUtils.themeHorizontalSeekBar(binding.seekbar)
|
viewThemeUtils.androidViewThemeUtils.themeHorizontalSeekBar(binding.seekbar)
|
||||||
viewThemeUtils.colorCircularProgressBarOnSurfaceVariant(binding.progressBar)
|
viewThemeUtils.androidViewThemeUtils.colorCircularProgressBarOnSurfaceVariant(binding.progressBar)
|
||||||
|
|
||||||
handleIsPlayingVoiceMessageState(message)
|
handleIsPlayingVoiceMessageState(message)
|
||||||
|
|
||||||
|
@ -877,7 +877,7 @@ class ChatController(args: Bundle) :
|
|||||||
.nc_description_send_message_button
|
.nc_description_send_message_button
|
||||||
)
|
)
|
||||||
|
|
||||||
viewThemeUtils.colorImageView(binding.messageInputView.button)
|
viewThemeUtils.androidViewThemeUtils.colorImageView(binding.messageInputView.button)
|
||||||
|
|
||||||
if (currentConversation != null && currentConversation?.roomId != null) {
|
if (currentConversation != null && currentConversation?.roomId != null) {
|
||||||
loadAvatarForStatusBar()
|
loadAvatarForStatusBar()
|
||||||
@ -1440,7 +1440,7 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
val dialog = materialAlertDialogBuilder.show()
|
val dialog = materialAlertDialogBuilder.show()
|
||||||
|
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
@ -1772,7 +1772,8 @@ class ChatController(args: Bundle) :
|
|||||||
cancelReply()
|
cancelReply()
|
||||||
}
|
}
|
||||||
|
|
||||||
viewThemeUtils.themeImageButton(binding.messageInputView.findViewById<ImageButton>(R.id.cancelReplyButton))
|
viewThemeUtils.androidViewThemeUtils
|
||||||
|
.themeImageButton(binding.messageInputView.findViewById<ImageButton>(R.id.cancelReplyButton))
|
||||||
|
|
||||||
cancelNotificationsForCurrentConversation()
|
cancelNotificationsForCurrentConversation()
|
||||||
|
|
||||||
@ -2523,12 +2524,12 @@ class ChatController(args: Bundle) :
|
|||||||
super.onCreateOptionsMenu(menu, inflater)
|
super.onCreateOptionsMenu(menu, inflater)
|
||||||
inflater.inflate(R.menu.menu_conversation, menu)
|
inflater.inflate(R.menu.menu_conversation, menu)
|
||||||
|
|
||||||
viewThemeUtils.colorToolbarMenuIcon(
|
viewThemeUtils.androidViewThemeUtils.colorToolbarMenuIcon(
|
||||||
binding.messageInputView.context,
|
binding.messageInputView.context,
|
||||||
menu.findItem(R.id.conversation_voice_call)
|
menu.findItem(R.id.conversation_voice_call)
|
||||||
)
|
)
|
||||||
|
|
||||||
viewThemeUtils.colorToolbarMenuIcon(
|
viewThemeUtils.androidViewThemeUtils.colorToolbarMenuIcon(
|
||||||
binding.messageInputView.context,
|
binding.messageInputView.context,
|
||||||
menu.findItem(R.id.conversation_video_call)
|
menu.findItem(R.id.conversation_video_call)
|
||||||
)
|
)
|
||||||
|
@ -380,7 +380,7 @@ class ContactsController(args: Bundle) :
|
|||||||
super.onPrepareOptionsMenu(menu)
|
super.onPrepareOptionsMenu(menu)
|
||||||
|
|
||||||
if (searchItem != null) {
|
if (searchItem != null) {
|
||||||
viewThemeUtils.colorToolbarMenuIcon(
|
viewThemeUtils.androidViewThemeUtils.colorToolbarMenuIcon(
|
||||||
binding.titleTextView.context,
|
binding.titleTextView.context,
|
||||||
searchItem!!
|
searchItem!!
|
||||||
)
|
)
|
||||||
@ -638,7 +638,7 @@ class ContactsController(args: Bundle) :
|
|||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
|
|
||||||
viewThemeUtils.colorImageViewButton(binding.conversationPrivacyToggle.publicCallLink)
|
viewThemeUtils.androidViewThemeUtils.colorImageViewButton(binding.conversationPrivacyToggle.publicCallLink)
|
||||||
disengageProgressBar()
|
disengageProgressBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ class ConversationInfoController(args: Bundle) :
|
|||||||
|
|
||||||
binding.addParticipantsAction.visibility = View.GONE
|
binding.addParticipantsAction.visibility = View.GONE
|
||||||
|
|
||||||
viewThemeUtils.colorCircularProgressBar(binding.progressBar)
|
viewThemeUtils.androidViewThemeUtils.colorCircularProgressBar(binding.progressBar)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupWebinaryView() {
|
private fun setupWebinaryView() {
|
||||||
@ -376,7 +376,7 @@ class ConversationInfoController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
viewThemeUtils.colorMaterialAlertDialogBackground(binding.conversationInfoName.context, dialogBuilder)
|
viewThemeUtils.colorMaterialAlertDialogBackground(binding.conversationInfoName.context, dialogBuilder)
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
@ -547,7 +547,7 @@ class ConversationInfoController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
viewThemeUtils.colorMaterialAlertDialogBackground(binding.conversationInfoName.context, dialogBuilder)
|
viewThemeUtils.colorMaterialAlertDialogBackground(binding.conversationInfoName.context, dialogBuilder)
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
|
@ -353,14 +353,14 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
}
|
}
|
||||||
activity.binding.searchText.setOnClickListener {
|
activity.binding.searchText.setOnClickListener {
|
||||||
showSearchView(activity, searchView, searchItem)
|
showSearchView(activity, searchView, searchItem)
|
||||||
viewThemeUtils.themeStatusBar(activity, searchView!!)
|
viewThemeUtils.androidViewThemeUtils.themeStatusBar(activity, searchView!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
searchView!!.setOnCloseListener {
|
searchView!!.setOnCloseListener {
|
||||||
if (TextUtils.isEmpty(searchView!!.query.toString())) {
|
if (TextUtils.isEmpty(searchView!!.query.toString())) {
|
||||||
searchView!!.onActionViewCollapsed()
|
searchView!!.onActionViewCollapsed()
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
viewThemeUtils.resetStatusBar(activity, searchView!!)
|
viewThemeUtils.androidViewThemeUtils.resetStatusBar(activity, searchView!!)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
searchView!!.post { searchView!!.setQuery(TAG, true) }
|
searchView!!.post { searchView!!.setQuery(TAG, true) }
|
||||||
@ -400,7 +400,8 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
mainActivity.binding.toolbar.visibility = View.GONE
|
mainActivity.binding.toolbar.visibility = View.GONE
|
||||||
mainActivity.binding.searchToolbar.visibility = View.VISIBLE
|
mainActivity.binding.searchToolbar.visibility = View.VISIBLE
|
||||||
if (resources != null) {
|
if (resources != null) {
|
||||||
viewThemeUtils.resetStatusBar(mainActivity, mainActivity.binding.searchToolbar)
|
viewThemeUtils.androidViewThemeUtils
|
||||||
|
.resetStatusBar(mainActivity, mainActivity.binding.searchToolbar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val layoutManager = binding.recyclerView.layoutManager as SmoothScrollLinearLayoutManager?
|
val layoutManager = binding.recyclerView.layoutManager as SmoothScrollLinearLayoutManager?
|
||||||
@ -950,7 +951,7 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
}
|
}
|
||||||
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
|
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
@ -1146,7 +1147,7 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
}
|
}
|
||||||
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
|
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
@ -1189,7 +1190,7 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
}
|
}
|
||||||
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
|
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
@ -1231,7 +1232,7 @@ class ConversationsListController(bundle: Bundle) :
|
|||||||
}
|
}
|
||||||
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
|
viewThemeUtils.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
|
@ -755,7 +755,7 @@ class ProfileController : BaseController(R.layout.controller_profile) {
|
|||||||
initUserInfoEditText(holder, item)
|
initUserInfoEditText(holder, item)
|
||||||
|
|
||||||
holder.binding.icon.contentDescription = item.hint
|
holder.binding.icon.contentDescription = item.hint
|
||||||
viewThemeUtils.colorImageView(holder.binding.icon)
|
viewThemeUtils.androidViewThemeUtils.colorImageView(holder.binding.icon)
|
||||||
if (!TextUtils.isEmpty(item.text) || controller.edit) {
|
if (!TextUtils.isEmpty(item.text) || controller.edit) {
|
||||||
holder.binding.userInfoDetailContainer.visibility = View.VISIBLE
|
holder.binding.userInfoDetailContainer.visibility = View.VISIBLE
|
||||||
controller.viewThemeUtils.colorTextInputLayout(holder.binding.userInfoInputLayout)
|
controller.viewThemeUtils.colorTextInputLayout(holder.binding.userInfoInputLayout)
|
||||||
|
@ -392,7 +392,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
|||||||
|
|
||||||
val dialog = materialAlertDialogBuilder.show()
|
val dialog = materialAlertDialogBuilder.show()
|
||||||
|
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
@ -968,7 +968,7 @@ class SettingsController : BaseController(R.layout.controller_settings) {
|
|||||||
|
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
|
@ -217,9 +217,9 @@ abstract class BaseController(@LayoutRes var layoutRes: Int, args: Bundle? = nul
|
|||||||
private fun colorizeStatusBar(showSearchBar: Boolean, activity: Activity?, resources: Resources?) {
|
private fun colorizeStatusBar(showSearchBar: Boolean, activity: Activity?, resources: Resources?) {
|
||||||
if (activity != null && resources != null) {
|
if (activity != null && resources != null) {
|
||||||
if (showSearchBar) {
|
if (showSearchBar) {
|
||||||
view?.let { viewThemeUtils.resetStatusBar(activity, it) }
|
view?.let { viewThemeUtils.androidViewThemeUtils.resetStatusBar(activity, it) }
|
||||||
} else {
|
} else {
|
||||||
view?.let { viewThemeUtils.themeStatusBar(activity, it) }
|
view?.let { viewThemeUtils.androidViewThemeUtils.themeStatusBar(activity, it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ class EntryMenuController(args: Bundle) :
|
|||||||
rootView = view,
|
rootView = view,
|
||||||
editText = binding.textEdit,
|
editText = binding.textEdit,
|
||||||
onEmojiPopupShownListener = {
|
onEmojiPopupShownListener = {
|
||||||
viewThemeUtils.colorImageView(binding.smileyButton)
|
viewThemeUtils.androidViewThemeUtils.colorImageView(binding.smileyButton)
|
||||||
},
|
},
|
||||||
onEmojiPopupDismissListener = {
|
onEmojiPopupDismissListener = {
|
||||||
binding.smileyButton.imageTintList = ColorStateList.valueOf(
|
binding.smileyButton.imageTintList = ColorStateList.valueOf(
|
||||||
|
@ -117,7 +117,7 @@ class OperationsMenuController(args: Bundle) : BaseController(
|
|||||||
sharedApplication!!.componentApplication.inject(this)
|
sharedApplication!!.componentApplication.inject(this)
|
||||||
currentUser = userManager.currentUser.blockingGet()
|
currentUser = userManager.currentUser.blockingGet()
|
||||||
|
|
||||||
viewThemeUtils.colorCircularProgressBar(binding.progressBar)
|
viewThemeUtils.androidViewThemeUtils.colorCircularProgressBar(binding.progressBar)
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(callUrl) && callUrl.contains("/call")) {
|
if (!TextUtils.isEmpty(callUrl) && callUrl.contains("/call")) {
|
||||||
conversationToken = callUrl.substring(callUrl.lastIndexOf("/") + 1)
|
conversationToken = callUrl.substring(callUrl.lastIndexOf("/") + 1)
|
||||||
|
@ -101,9 +101,9 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun themeDialog() {
|
private fun themeDialog() {
|
||||||
viewThemeUtils.colorPrimaryTextViewElement(binding.pollQuestion)
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(binding.pollQuestion)
|
||||||
viewThemeUtils.colorPrimaryTextViewElement(binding.pollOptions)
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(binding.pollOptions)
|
||||||
viewThemeUtils.colorPrimaryTextViewElement(binding.pollSettings)
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(binding.pollSettings)
|
||||||
|
|
||||||
viewThemeUtils.colorTextInputLayout(binding.pollCreateQuestionTextInputLayout)
|
viewThemeUtils.colorTextInputLayout(binding.pollCreateQuestionTextInputLayout)
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
|
|||||||
viewThemeUtils.colorMaterialButtonText(binding.pollDismiss)
|
viewThemeUtils.colorMaterialButtonText(binding.pollDismiss)
|
||||||
viewThemeUtils.colorMaterialButtonPrimaryFilled(binding.pollCreateButton)
|
viewThemeUtils.colorMaterialButtonPrimaryFilled(binding.pollCreateButton)
|
||||||
|
|
||||||
viewThemeUtils.themeCheckbox(binding.pollPrivatePollCheckbox)
|
viewThemeUtils.androidViewThemeUtils.themeCheckbox(binding.pollPrivatePollCheckbox)
|
||||||
viewThemeUtils.themeCheckbox(binding.pollMultipleAnswersCheckbox)
|
viewThemeUtils.androidViewThemeUtils.themeCheckbox(binding.pollMultipleAnswersCheckbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupListeners() {
|
private fun setupListeners() {
|
||||||
|
@ -55,7 +55,7 @@ class PollLoadingFragment : Fragment() {
|
|||||||
): View {
|
): View {
|
||||||
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
|
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
|
||||||
binding.root.layoutParams.height = fragmentHeight
|
binding.root.layoutParams.height = fragmentHeight
|
||||||
viewThemeUtils.colorCircularProgressBar(binding.pollLoadingProgressbar)
|
viewThemeUtils.androidViewThemeUtils.colorCircularProgressBar(binding.pollLoadingProgressbar)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class PollResultsFragment : Fragment(), PollResultItemClickListener {
|
|||||||
|
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
|
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
|
@ -149,7 +149,7 @@ class PollVoteFragment : Fragment() {
|
|||||||
RadioButton(context).apply { text = option }
|
RadioButton(context).apply { text = option }
|
||||||
}?.forEachIndexed { index, radioButton ->
|
}?.forEachIndexed { index, radioButton ->
|
||||||
radioButton.id = index
|
radioButton.id = index
|
||||||
viewThemeUtils.themeRadioButton(radioButton)
|
viewThemeUtils.androidViewThemeUtils.themeRadioButton(radioButton)
|
||||||
makeOptionBoldIfSelfVoted(radioButton, poll, index)
|
makeOptionBoldIfSelfVoted(radioButton, poll, index)
|
||||||
binding.pollVoteRadioGroup.addView(radioButton)
|
binding.pollVoteRadioGroup.addView(radioButton)
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ class PollVoteFragment : Fragment() {
|
|||||||
setLayoutParams(layoutParams)
|
setLayoutParams(layoutParams)
|
||||||
}
|
}
|
||||||
}?.forEachIndexed { index, checkBox ->
|
}?.forEachIndexed { index, checkBox ->
|
||||||
viewThemeUtils.themeCheckbox(checkBox)
|
viewThemeUtils.androidViewThemeUtils.themeCheckbox(checkBox)
|
||||||
checkBox.id = index
|
checkBox.id = index
|
||||||
makeOptionBoldIfSelfVoted(checkBox, poll, index)
|
makeOptionBoldIfSelfVoted(checkBox, poll, index)
|
||||||
binding.voteOptionsCheckboxesWrapper.addView(checkBox)
|
binding.voteOptionsCheckboxesWrapper.addView(checkBox)
|
||||||
@ -222,7 +222,7 @@ class PollVoteFragment : Fragment() {
|
|||||||
|
|
||||||
val dialog = dialogBuilder.show()
|
val dialog = dialogBuilder.show()
|
||||||
|
|
||||||
viewThemeUtils.colorTextButtons(
|
viewThemeUtils.androidViewThemeUtils.colorTextButtons(
|
||||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
)
|
)
|
||||||
|
@ -84,7 +84,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||||||
binding.pathNavigationBackButton.iconTint = ColorStateList.valueOf(scheme.onSurface)
|
binding.pathNavigationBackButton.iconTint = ColorStateList.valueOf(scheme.onSurface)
|
||||||
binding.pathNavigationBackButton.setTextColor(scheme.onSurface)
|
binding.pathNavigationBackButton.setTextColor(scheme.onSurface)
|
||||||
viewThemeUtils.colorMaterialTextButton(binding.pathNavigationBackButton)
|
viewThemeUtils.colorMaterialTextButton(binding.pathNavigationBackButton)
|
||||||
viewThemeUtils.themeStatusBar(this, binding.remoteFileBrowserItemsToolbar)
|
viewThemeUtils.androidViewThemeUtils.themeStatusBar(this, binding.remoteFileBrowserItemsToolbar)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
DisplayUtils.applyColorToNavigationBar(
|
DisplayUtils.applyColorToNavigationBar(
|
||||||
|
@ -129,7 +129,7 @@ class RemoteFileBrowserItemsListViewHolder(
|
|||||||
private fun setSelectability() {
|
private fun setSelectability() {
|
||||||
if (selectable) {
|
if (selectable) {
|
||||||
binding.selectFileCheckbox.visibility = View.VISIBLE
|
binding.selectFileCheckbox.visibility = View.VISIBLE
|
||||||
viewThemeUtils.themeCheckbox(binding.selectFileCheckbox)
|
viewThemeUtils.androidViewThemeUtils.themeCheckbox(binding.selectFileCheckbox)
|
||||||
} else {
|
} else {
|
||||||
binding.selectFileCheckbox.visibility = View.GONE
|
binding.selectFileCheckbox.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ class SharedItemsActivity : AppCompatActivity() {
|
|||||||
setSupportActionBar(binding.sharedItemsToolbar)
|
setSupportActionBar(binding.sharedItemsToolbar)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
viewThemeUtils.themeStatusBar(this, binding.sharedItemsToolbar)
|
viewThemeUtils.androidViewThemeUtils.themeStatusBar(this, binding.sharedItemsToolbar)
|
||||||
viewThemeUtils.themeToolbar(binding.sharedItemsToolbar)
|
viewThemeUtils.themeToolbar(binding.sharedItemsToolbar)
|
||||||
viewThemeUtils.themeTabLayoutOnSurface(binding.sharedItemsTabs)
|
viewThemeUtils.themeTabLayoutOnSurface(binding.sharedItemsTabs)
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle
|
|||||||
setContentView(dialogAttachmentBinding.root)
|
setContentView(dialogAttachmentBinding.root)
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
viewThemeUtils.themeDialog(dialogAttachmentBinding.root)
|
viewThemeUtils.androidViewThemeUtils.themeDialog(dialogAttachmentBinding.root)
|
||||||
initItemsStrings()
|
initItemsStrings()
|
||||||
initItemsVisibility()
|
initItemsVisibility()
|
||||||
initItemsClickListeners()
|
initItemsClickListeners()
|
||||||
|
@ -51,7 +51,7 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
|
|||||||
setContentView(dialogAudioOutputBinding.root)
|
setContentView(dialogAudioOutputBinding.root)
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
viewThemeUtils.themeDialogDark(dialogAudioOutputBinding.root)
|
viewThemeUtils.androidViewThemeUtils.themeDialogDark(dialogAudioOutputBinding.root)
|
||||||
updateOutputDeviceList()
|
updateOutputDeviceList()
|
||||||
initClickListeners()
|
initClickListeners()
|
||||||
}
|
}
|
||||||
@ -92,23 +92,28 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
|
|||||||
private fun highlightActiveOutputChannel() {
|
private fun highlightActiveOutputChannel() {
|
||||||
when (callActivity.audioManager?.currentAudioDevice) {
|
when (callActivity.audioManager?.currentAudioDevice) {
|
||||||
WebRtcAudioManager.AudioDevice.BLUETOOTH -> {
|
WebRtcAudioManager.AudioDevice.BLUETOOTH -> {
|
||||||
viewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputBluetoothIcon)
|
viewThemeUtils.androidViewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputBluetoothIcon)
|
||||||
viewThemeUtils.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputBluetoothText)
|
viewThemeUtils.androidViewThemeUtils
|
||||||
|
.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputBluetoothText)
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcAudioManager.AudioDevice.SPEAKER_PHONE -> {
|
WebRtcAudioManager.AudioDevice.SPEAKER_PHONE -> {
|
||||||
viewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputSpeakerIcon)
|
viewThemeUtils.androidViewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputSpeakerIcon)
|
||||||
viewThemeUtils.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputSpeakerText)
|
viewThemeUtils.androidViewThemeUtils
|
||||||
|
.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputSpeakerText)
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcAudioManager.AudioDevice.EARPIECE -> {
|
WebRtcAudioManager.AudioDevice.EARPIECE -> {
|
||||||
viewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputEarspeakerIcon)
|
viewThemeUtils.androidViewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputEarspeakerIcon)
|
||||||
viewThemeUtils.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputEarspeakerText)
|
viewThemeUtils.androidViewThemeUtils
|
||||||
|
.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputEarspeakerText)
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcAudioManager.AudioDevice.WIRED_HEADSET -> {
|
WebRtcAudioManager.AudioDevice.WIRED_HEADSET -> {
|
||||||
viewThemeUtils.colorImageView(dialogAudioOutputBinding.audioOutputWiredHeadsetIcon)
|
viewThemeUtils.androidViewThemeUtils
|
||||||
viewThemeUtils.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputWiredHeadsetText)
|
.colorImageView(dialogAudioOutputBinding.audioOutputWiredHeadsetIcon)
|
||||||
|
viewThemeUtils.androidViewThemeUtils
|
||||||
|
.colorPrimaryTextViewElementDarkMode(dialogAudioOutputBinding.audioOutputWiredHeadsetText)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> Log.d(TAG, "AudioOutputDialog doesn't know this AudioDevice")
|
else -> Log.d(TAG, "AudioOutputDialog doesn't know this AudioDevice")
|
||||||
|
@ -129,7 +129,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||||||
binding.currentAccount.ticker.setVisibility(View.GONE);
|
binding.currentAccount.ticker.setVisibility(View.GONE);
|
||||||
binding.currentAccount.account.setText((Uri.parse(user.getBaseUrl()).getHost()));
|
binding.currentAccount.account.setText((Uri.parse(user.getBaseUrl()).getHost()));
|
||||||
|
|
||||||
viewThemeUtils.colorImageView(binding.currentAccount.accountMenu);
|
viewThemeUtils.androidViewThemeUtils.colorImageView(binding.currentAccount.accountMenu);
|
||||||
|
|
||||||
|
|
||||||
if (user.getBaseUrl() != null &&
|
if (user.getBaseUrl() != null &&
|
||||||
@ -213,8 +213,8 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void themeViews() {
|
private void themeViews() {
|
||||||
viewThemeUtils.themeDialog(binding.getRoot());
|
viewThemeUtils.androidViewThemeUtils.themeDialog(binding.getRoot());
|
||||||
viewThemeUtils.themeDialogDivider(binding.divider);
|
viewThemeUtils.androidViewThemeUtils.themeDialogDivider(binding.divider);
|
||||||
|
|
||||||
viewThemeUtils.colorMaterialTextButton(binding.setStatus);
|
viewThemeUtils.colorMaterialTextButton(binding.setStatus);
|
||||||
viewThemeUtils.colorDialogMenuText(binding.setStatus);
|
viewThemeUtils.colorDialogMenuText(binding.setStatus);
|
||||||
|
@ -59,7 +59,7 @@ class ContactsBottomDialog(
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
viewThemeUtils.themeDialog(binding.root)
|
viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root)
|
||||||
executeEntryMenuController(bundle)
|
executeEntryMenuController(bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class ConversationsListBottomDialog(
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
viewThemeUtils.themeDialog(binding.root)
|
viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root)
|
||||||
initHeaderDescription()
|
initHeaderDescription()
|
||||||
initItemsVisibility()
|
initItemsVisibility()
|
||||||
initClickListeners()
|
initClickListeners()
|
||||||
|
@ -83,7 +83,7 @@ class MessageActionsDialog(
|
|||||||
setContentView(dialogMessageActionsBinding.root)
|
setContentView(dialogMessageActionsBinding.root)
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
viewThemeUtils.themeDialog(dialogMessageActionsBinding.root)
|
viewThemeUtils.androidViewThemeUtils.themeDialog(dialogMessageActionsBinding.root)
|
||||||
initEmojiBar(hasChatPermission)
|
initEmojiBar(hasChatPermission)
|
||||||
initMenuItemCopy(!message.isDeleted)
|
initMenuItemCopy(!message.isDeleted)
|
||||||
initMenuReplyToMessage(message.replyable && hasChatPermission)
|
initMenuReplyToMessage(message.replyable && hasChatPermission)
|
||||||
|
@ -59,7 +59,7 @@ class ScopeDialog(
|
|||||||
|
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
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) {
|
if (field == ProfileController.Field.DISPLAYNAME || field == ProfileController.Field.EMAIL) {
|
||||||
dialogScopeBinding.scopePrivate.visibility = View.GONE
|
dialogScopeBinding.scopePrivate.visibility = View.GONE
|
||||||
|
@ -242,7 +242,7 @@ class SetStatusDialogFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewThemeUtils.themeDialog(binding.root)
|
viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root)
|
||||||
|
|
||||||
viewThemeUtils.colorMaterialButtonText(binding.clearStatus)
|
viewThemeUtils.colorMaterialButtonText(binding.clearStatus)
|
||||||
viewThemeUtils.colorMaterialButtonPrimaryFilled(binding.setStatus)
|
viewThemeUtils.colorMaterialButtonPrimaryFilled(binding.setStatus)
|
||||||
@ -419,7 +419,7 @@ class SetStatusDialogFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewThemeUtils.colorCardViewBackground(views.first)
|
viewThemeUtils.colorCardViewBackground(views.first)
|
||||||
viewThemeUtils.colorPrimaryTextViewElement(views.second)
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(views.second)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun clearTopStatus() {
|
private fun clearTopStatus() {
|
||||||
|
@ -86,7 +86,7 @@ class ShowReactionsDialog(
|
|||||||
binding = DialogMessageReactionsBinding.inflate(layoutInflater)
|
binding = DialogMessageReactionsBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
viewThemeUtils.themeDialog(binding.root)
|
viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root)
|
||||||
adapter = ReactionsAdapter(this, user)
|
adapter = ReactionsAdapter(this, user)
|
||||||
binding.reactionsList.adapter = adapter
|
binding.reactionsList.adapter = adapter
|
||||||
binding.reactionsList.layoutManager = LinearLayoutManager(context)
|
binding.reactionsList.layoutManager = LinearLayoutManager(context)
|
||||||
|
@ -120,7 +120,7 @@ public class SortingOrderDialogFragment extends DialogFragment implements View.O
|
|||||||
* find all relevant UI elements and set their values.
|
* find all relevant UI elements and set their values.
|
||||||
*/
|
*/
|
||||||
private void setupDialogElements() {
|
private void setupDialogElements() {
|
||||||
viewThemeUtils.themeDialog(binding.root);
|
viewThemeUtils.androidViewThemeUtils.themeDialog(binding.root);
|
||||||
viewThemeUtils.colorMaterialButtonPrimaryBorderless(binding.cancel);
|
viewThemeUtils.colorMaterialButtonPrimaryBorderless(binding.cancel);
|
||||||
|
|
||||||
taggedViews = new View[12];
|
taggedViews = new View[12];
|
||||||
@ -166,7 +166,7 @@ public class SortingOrderDialogFragment extends DialogFragment implements View.O
|
|||||||
viewThemeUtils.colorMaterialButtonText((MaterialButton) view);
|
viewThemeUtils.colorMaterialButtonText((MaterialButton) view);
|
||||||
}
|
}
|
||||||
if (view instanceof TextView) {
|
if (view instanceof TextView) {
|
||||||
viewThemeUtils.colorPrimaryTextViewElement((TextView) view);
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement((TextView) view);
|
||||||
((TextView) view).setTypeface(Typeface.DEFAULT_BOLD);
|
((TextView) view).setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
package com.nextcloud.talk.ui.theme
|
package com.nextcloud.talk.ui.theme
|
||||||
|
|
||||||
import android.annotation.TargetApi
|
import android.annotation.TargetApi
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
@ -32,24 +31,15 @@ import android.graphics.drawable.LayerDrawable
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
import android.view.MenuItem
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
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.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.ProgressBar
|
|
||||||
import android.widget.RadioButton
|
|
||||||
import android.widget.SeekBar
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.appcompat.widget.SearchView.SearchAutoComplete
|
|
||||||
import androidx.appcompat.widget.SwitchCompat
|
import androidx.appcompat.widget.SwitchCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.res.ResourcesCompat
|
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.tabs.TabLayout
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import com.google.android.material.textview.MaterialTextView
|
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.MaterialSchemes
|
||||||
|
import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
|
import com.nextcloud.talk.ui.theme.viewthemeutils.AndroidViewThemeUtils
|
||||||
import com.nextcloud.talk.utils.DisplayUtils
|
import com.nextcloud.talk.utils.DisplayUtils
|
||||||
import com.nextcloud.talk.utils.DrawableUtils
|
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.vanniktech.emoji.EmojiTextView
|
||||||
import com.yarolegovich.mp.MaterialPreferenceCategory
|
import com.yarolegovich.mp.MaterialPreferenceCategory
|
||||||
import com.yarolegovich.mp.MaterialSwitchPreference
|
import com.yarolegovich.mp.MaterialSwitchPreference
|
||||||
@ -85,49 +76,13 @@ import javax.inject.Inject
|
|||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@Suppress("TooManyFunctions")
|
@Suppress("TooManyFunctions")
|
||||||
class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, private val colorUtil: ColorUtil) {
|
class ViewThemeUtils @Inject constructor(
|
||||||
|
schemes: MaterialSchemes,
|
||||||
/**
|
private val colorUtil: ColorUtil,
|
||||||
* Scheme for painting elements
|
@JvmField
|
||||||
*/
|
val androidViewThemeUtils: AndroidViewThemeUtils
|
||||||
fun getScheme(context: Context): Scheme = when {
|
) :
|
||||||
isDarkMode(context) -> schemes.darkScheme
|
ViewThemeUtilsBase(schemes) {
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun colorToolbarOverflowIcon(toolbar: MaterialToolbar) {
|
fun colorToolbarOverflowIcon(toolbar: MaterialToolbar) {
|
||||||
withScheme(toolbar) { scheme ->
|
withScheme(toolbar) { scheme ->
|
||||||
@ -138,7 +93,7 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
|
|||||||
fun themeSearchView(searchView: SearchView) {
|
fun themeSearchView(searchView: SearchView) {
|
||||||
withScheme(searchView) { scheme ->
|
withScheme(searchView) { scheme ->
|
||||||
// hacky as no default way is provided
|
// hacky as no default way is provided
|
||||||
val editText = searchView.findViewById<SearchAutoComplete>(R.id.search_src_text)
|
val editText = searchView.findViewById<SearchView.SearchAutoComplete>(R.id.search_src_text)
|
||||||
val searchPlate = searchView.findViewById<LinearLayout>(R.id.search_plate)
|
val searchPlate = searchView.findViewById<LinearLayout>(R.id.search_plate)
|
||||||
editText.textSize = SEARCH_TEXT_SIZE
|
editText.textSize = SEARCH_TEXT_SIZE
|
||||||
editText.setHintTextColor(scheme.onSurfaceVariant)
|
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) {
|
fun themeFAB(fab: FloatingActionButton) {
|
||||||
withScheme(fab) { scheme ->
|
withScheme(fab) { scheme ->
|
||||||
fab.backgroundTintList = ColorStateList.valueOf(scheme.primaryContainer)
|
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) {
|
fun colorMaterialTextButton(button: MaterialButton) {
|
||||||
withScheme(button) { scheme ->
|
withScheme(button) { scheme ->
|
||||||
button.rippleColor = ColorStateList(
|
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) {
|
fun colorMaterialButtonPrimaryFilled(button: MaterialButton) {
|
||||||
withScheme(button) { scheme ->
|
withScheme(button) { scheme ->
|
||||||
button.backgroundTintList =
|
button.backgroundTintList =
|
||||||
@ -449,11 +262,20 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
|
|||||||
val bubbleDrawable = DisplayUtils.getMessageSelector(
|
val bubbleDrawable = DisplayUtils.getMessageSelector(
|
||||||
bgBubbleColor,
|
bgBubbleColor,
|
||||||
resources.getColor(R.color.transparent),
|
resources.getColor(R.color.transparent),
|
||||||
bgBubbleColor, bubbleResource
|
bgBubbleColor,
|
||||||
|
bubbleResource
|
||||||
)
|
)
|
||||||
ViewCompat.setBackground(bubble, bubbleDrawable)
|
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) {
|
fun themeOutgoingMessageBubble(bubble: ViewGroup, grouped: Boolean, deleted: Boolean) {
|
||||||
withScheme(bubble) { scheme ->
|
withScheme(bubble) { scheme ->
|
||||||
val bgBubbleColor = if (deleted) {
|
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) {
|
fun colorCardViewBackground(card: MaterialCardView) {
|
||||||
withScheme(card) { scheme ->
|
withScheme(card) { scheme ->
|
||||||
card.setCardBackgroundColor(scheme.surfaceVariant)
|
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
|
// TODO split this util into classes depending on framework views vs library views
|
||||||
fun colorPreferenceCategory(category: MaterialPreferenceCategory) {
|
fun colorPreferenceCategory(category: MaterialPreferenceCategory) {
|
||||||
withScheme(category) { scheme ->
|
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) {
|
fun themeSwipeRefreshLayout(swipeRefreshLayout: SwipeRefreshLayout) {
|
||||||
withScheme(swipeRefreshLayout) { scheme ->
|
withScheme(swipeRefreshLayout) { scheme ->
|
||||||
swipeRefreshLayout.setColorSchemeColors(scheme.primary)
|
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) {
|
fun colorTextInputLayout(textInputLayout: TextInputLayout) {
|
||||||
withScheme(textInputLayout) { scheme ->
|
withScheme(textInputLayout) { scheme ->
|
||||||
val errorColor = scheme.onSurfaceVariant
|
val errorColor = scheme.onSurfaceVariant
|
||||||
@ -696,6 +470,11 @@ class ViewThemeUtils @Inject constructor(private val schemes: MaterialSchemes, p
|
|||||||
return drawable
|
return drawable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun colorDrawable(context: Context, drawable: Drawable) {
|
||||||
|
val scheme = getScheme(context)
|
||||||
|
drawable.setTint(scheme.primary)
|
||||||
|
}
|
||||||
|
|
||||||
fun colorChipBackground(chip: Chip) {
|
fun colorChipBackground(chip: Chip) {
|
||||||
withScheme(chip) { scheme ->
|
withScheme(chip) { scheme ->
|
||||||
chip.chipBackgroundColor = ColorStateList.valueOf(scheme.primary)
|
chip.chipBackgroundColor = ColorStateList.valueOf(scheme.primary)
|
||||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
@ -73,7 +73,7 @@ public class MagicUserInputModule extends StandardUserInputModule {
|
|||||||
final Listener<String> listener) {
|
final Listener<String> listener) {
|
||||||
final View view = LayoutInflater.from(context).inflate(R.layout.dialog_edittext, null);
|
final View view = LayoutInflater.from(context).inflate(R.layout.dialog_edittext, null);
|
||||||
final EditText inputField = view.findViewById(R.id.mp_text_input);
|
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 paddingStartEnd = Math.round(view.getResources().getDimension(R.dimen.standard_padding));
|
||||||
int paddingTopBottom = Math.round(view.getResources().getDimension(R.dimen.dialog_padding_top_bottom));
|
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();
|
final Dialog dialog = dialogBuilder.show();
|
||||||
|
|
||||||
TextView button = view.findViewById(R.id.mp_btn_confirm);
|
TextView button = view.findViewById(R.id.mp_btn_confirm);
|
||||||
viewThemeUtils.colorPrimaryTextViewElement(button);
|
viewThemeUtils.androidViewThemeUtils.colorPrimaryTextViewElement(button);
|
||||||
button.setOnClickListener(new View.OnClickListener() {
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user