diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingVoiceMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingVoiceMessageViewHolder.kt index 553f0c9c1..75757c896 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingVoiceMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingVoiceMessageViewHolder.kt @@ -96,6 +96,7 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message updateDownloadState(message) binding.seekbar.max = message.voiceMessageDuration viewThemeUtils.themeHorizontalSeekBar(binding.seekbar) + viewThemeUtils.colorCircularProgressBarOnSurfaceVariant(binding.progressBar) if (message.isPlayingVoiceMessage) { showPlayButton() diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingVoiceMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingVoiceMessageViewHolder.kt index 1148f1e70..44e781d7a 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingVoiceMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingVoiceMessageViewHolder.kt @@ -97,6 +97,7 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders updateDownloadState(message) binding.seekbar.max = message.voiceMessageDuration viewThemeUtils.themeHorizontalSeekBar(binding.seekbar) + viewThemeUtils.colorCircularProgressBarOnSurfaceVariant(binding.progressBar) handleIsPlayingVoiceMessageState(message) 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 59e82d425..43602e232 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt @@ -231,6 +231,8 @@ class ConversationInfoController(args: Bundle) : } binding.addParticipantsAction.visibility = View.GONE + + viewThemeUtils.colorCircularProgressBar(binding.progressBar) } private fun setupWebinaryView() { 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 806a85299..f903aab9c 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.kt @@ -957,13 +957,16 @@ class SettingsController : NewBaseController(R.layout.controller_settings) { }) phoneNumberInputLayout.addView(phoneNumberField) phoneNumberLayoutWrapper.addView(phoneNumberInputLayout) - val dialog = AlertDialog.Builder((activity)!!) + val dialogBuilder = MaterialAlertDialogBuilder(phoneNumberInputLayout.context) .setTitle(R.string.nc_settings_phone_book_integration_phone_number_dialog_title) .setMessage(R.string.nc_settings_phone_book_integration_phone_number_dialog_description) .setView(phoneNumberLayoutWrapper) .setPositiveButton(context!!.resources.getString(R.string.nc_common_set), null) .setNegativeButton(context!!.resources.getString(R.string.nc_common_skip), null) - .create() + + viewThemeUtils.colorMaterialAlertDialogBackground(phoneNumberInputLayout.context, dialogBuilder) + + val dialog = dialogBuilder.create() dialog.setOnShowListener(object : OnShowListener { override fun onShow(dialogInterface: DialogInterface) { val button = dialog.getButton(AlertDialog.BUTTON_POSITIVE) @@ -974,7 +977,13 @@ class SettingsController : NewBaseController(R.layout.controller_settings) { }) } }) + dialog.show() + + viewThemeUtils.colorTextButtons( + dialog.getButton(AlertDialog.BUTTON_POSITIVE), + dialog.getButton(AlertDialog.BUTTON_NEGATIVE) + ) } private fun setPhoneNumber(textInputLayout: TextInputLayout, dialog: AlertDialog) { 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 db94f4074..89f9402af 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,6 +117,8 @@ class OperationsMenuController(args: Bundle) : NewBaseController( sharedApplication!!.componentApplication.inject(this) currentUser = userManager.currentUser.blockingGet() + viewThemeUtils.colorCircularProgressBar(binding.progressBar) + if (!TextUtils.isEmpty(callUrl) && callUrl.contains("/call")) { conversationToken = callUrl.substring(callUrl.lastIndexOf("/") + 1) if (callUrl.contains("/index.php")) { diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionViewHolder.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionViewHolder.kt index 8e3016fb4..f970d0f68 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionViewHolder.kt @@ -50,7 +50,7 @@ class PollCreateOptionViewHolder( } binding.pollOptionTextEdit.setText(pollCreateOptionItem.pollOption) - viewThemeUtils.colorEditText(binding.pollOptionTextEdit) + viewThemeUtils.colorTextInputLayout(binding.pollOptionTextInputLayout) if (focus) { itemsListener.requestFocus(binding.pollOptionTextEdit) diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultHeaderViewHolder.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultHeaderViewHolder.kt index f08cb68cf..3595471ca 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultHeaderViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultHeaderViewHolder.kt @@ -41,6 +41,9 @@ class PollResultHeaderViewHolder( binding.pollOptionText.text = item.name binding.pollOptionPercentText.text = "${item.percent}%" + viewThemeUtils.colorDialogSupportingText(binding.pollOptionText) + viewThemeUtils.colorDialogSupportingText(binding.pollOptionPercentText) + if (item.selfVoted) { binding.pollOptionText.setTypeface(null, Typeface.BOLD) binding.pollOptionPercentText.setTypeface(null, Typeface.BOLD) diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVoterViewHolder.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVoterViewHolder.kt index 543591302..781b10e8c 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVoterViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVoterViewHolder.kt @@ -29,12 +29,14 @@ import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.data.user.model.User import com.nextcloud.talk.databinding.PollResultVoterItemBinding import com.nextcloud.talk.polls.model.PollDetails +import com.nextcloud.talk.ui.theme.ViewThemeUtils import com.nextcloud.talk.utils.ApiUtils import com.nextcloud.talk.utils.DisplayUtils class PollResultVoterViewHolder( private val user: User, - override val binding: PollResultVoterItemBinding + override val binding: PollResultVoterItemBinding, + private val viewThemeUtils: ViewThemeUtils ) : PollResultViewHolder(binding) { @SuppressLint("SetTextI18n") @@ -45,6 +47,7 @@ class PollResultVoterViewHolder( binding.pollVoterName.text = item.details.actorDisplayName binding.pollVoterAvatar.controller = getAvatarDraweeController(item.details) + viewThemeUtils.colorDialogSupportingText(binding.pollVoterName) } private fun getAvatarDraweeController(pollDetail: PollDetails): DraweeController? { diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultsAdapter.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultsAdapter.kt index df600fd37..cbc71da83 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultsAdapter.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultsAdapter.kt @@ -52,7 +52,7 @@ class PollResultsAdapter( LayoutInflater.from(parent.context), parent, false ) - viewHolder = PollResultVoterViewHolder(user, itemBinding) + viewHolder = PollResultVoterViewHolder(user, itemBinding, viewThemeUtils) } PollResultVotersOverviewItem.VIEW_TYPE -> { val itemBinding = PollResultVotersOverviewItemBinding.inflate( 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 abab454d5..3b87d924d 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 @@ -31,11 +31,11 @@ import android.view.View import android.view.ViewGroup import android.widget.EditText import android.widget.Toast -import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import autodagger.AutoInjector +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.talk.R import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.databinding.DialogPollCreateBinding @@ -73,9 +73,11 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { binding = DialogPollCreateBinding.inflate(LayoutInflater.from(context)) - return AlertDialog.Builder(requireContext()) + val dialogBuilder = MaterialAlertDialogBuilder(binding.root.context) .setView(binding.root) - .create() + viewThemeUtils.colorMaterialAlertDialogBackground(binding.root.context, dialogBuilder) + + return dialogBuilder.create() } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { @@ -103,10 +105,9 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener viewThemeUtils.colorPrimaryTextViewElement(binding.pollOptions) viewThemeUtils.colorPrimaryTextViewElement(binding.pollSettings) - viewThemeUtils.colorEditText(binding.pollCreateQuestionTextEdit) + viewThemeUtils.colorTextInputLayout(binding.pollCreateQuestionTextInputLayout) viewThemeUtils.colorMaterialButtonText(binding.pollAddOptionsItem) - // TODO button also needs a disabled state handling for colors viewThemeUtils.colorMaterialButtonText(binding.pollDismiss) viewThemeUtils.colorMaterialButtonPrimaryFilled(binding.pollCreateButton) 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 77b46f8aa..785669cd8 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 @@ -29,12 +29,17 @@ import androidx.fragment.app.Fragment import autodagger.AutoInjector import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.databinding.DialogPollLoadingBinding +import com.nextcloud.talk.ui.theme.ViewThemeUtils +import javax.inject.Inject @AutoInjector(NextcloudTalkApplication::class) class PollLoadingFragment : Fragment() { private lateinit var binding: DialogPollLoadingBinding + @Inject + lateinit var viewThemeUtils: ViewThemeUtils + var fragmentHeight = 0 override fun onCreate(savedInstanceState: Bundle?) { @@ -50,6 +55,7 @@ class PollLoadingFragment : Fragment() { ): View { binding = DialogPollLoadingBinding.inflate(inflater, container, false) binding.root.layoutParams.height = fragmentHeight + viewThemeUtils.colorCircularProgressBar(binding.pollLoadingProgressbar) return binding.root } diff --git a/app/src/main/java/com/nextcloud/talk/polls/ui/PollMainDialogFragment.kt b/app/src/main/java/com/nextcloud/talk/polls/ui/PollMainDialogFragment.kt index f775746ff..fe5fb3268 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/ui/PollMainDialogFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/ui/PollMainDialogFragment.kt @@ -26,16 +26,17 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.appcompat.app.AlertDialog import androidx.core.os.bundleOf import androidx.fragment.app.DialogFragment import androidx.lifecycle.ViewModelProvider import autodagger.AutoInjector +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.talk.R import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.data.user.model.User import com.nextcloud.talk.databinding.DialogPollMainBinding import com.nextcloud.talk.polls.viewmodels.PollMainViewModel +import com.nextcloud.talk.ui.theme.ViewThemeUtils import javax.inject.Inject @AutoInjector(NextcloudTalkApplication::class) @@ -44,6 +45,9 @@ class PollMainDialogFragment : DialogFragment() { @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @Inject + lateinit var viewThemeUtils: ViewThemeUtils + private lateinit var binding: DialogPollMainBinding private lateinit var viewModel: PollMainViewModel @@ -66,11 +70,15 @@ class PollMainDialogFragment : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { binding = DialogPollMainBinding.inflate(LayoutInflater.from(context)) - val dialog = AlertDialog.Builder(requireContext()) - .setView(binding.root) - .create() + val dialogBuilder = MaterialAlertDialogBuilder(binding.root.context).setView(binding.root) + + viewThemeUtils.colorMaterialAlertDialogBackground(binding.root.context, dialogBuilder) + + val dialog = dialogBuilder.create() binding.messagePollTitle.text = viewModel.pollTitle + viewThemeUtils.colorDialogHeadline(binding.messagePollTitle) + viewThemeUtils.colorDialogIcon(binding.messagePollIcon) return dialog } @@ -135,6 +143,7 @@ class PollMainDialogFragment : DialogFragment() { private fun initVotersAmount(showVotersAmount: Boolean, numVoters: Int, showResultSubtitle: Boolean) { if (showVotersAmount) { + viewThemeUtils.colorDialogSupportingText(binding.pollVotesAmount) binding.pollVotesAmount.visibility = View.VISIBLE binding.pollVotesAmount.text = resources.getQuantityString( R.plurals.polls_amount_voters, @@ -146,6 +155,7 @@ class PollMainDialogFragment : DialogFragment() { } if (showResultSubtitle) { + viewThemeUtils.colorDialogSupportingText(binding.pollResultsSubtitle) binding.pollResultsSubtitle.visibility = View.VISIBLE binding.pollResultsSubtitleSeperator.visibility = View.VISIBLE } else { 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 a5fc24cbd..6264aa5ec 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 @@ -31,6 +31,7 @@ import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import autodagger.AutoInjector +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.talk.R import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.databinding.DialogPollResultsBinding @@ -123,14 +124,25 @@ class PollResultsFragment : Fragment(), PollResultItemClickListener { if (showEndPollButton) { binding.pollResultsEndPollButton.visibility = View.VISIBLE binding.pollResultsEndPollButton.setOnClickListener { - AlertDialog.Builder(requireContext()) + val dialogBuilder = MaterialAlertDialogBuilder(binding.pollResultsEndPollButton.context) .setTitle(R.string.polls_end_poll) .setMessage(R.string.polls_end_poll_confirm) .setPositiveButton(R.string.polls_end_poll) { _, _ -> parentViewModel.endPoll() } .setNegativeButton(R.string.nc_cancel, null) - .show() + + viewThemeUtils.colorMaterialAlertDialogBackground( + binding.pollResultsEndPollButton.context, + dialogBuilder + ) + + val dialog = dialogBuilder.show() + + viewThemeUtils.colorTextButtons( + dialog.getButton(AlertDialog.BUTTON_POSITIVE), + dialog.getButton(AlertDialog.BUTTON_NEGATIVE) + ) } } else { binding.pollResultsEndPollButton.visibility = View.GONE 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 d990c0424..0dde5d01b 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 @@ -37,6 +37,7 @@ import androidx.appcompat.app.AlertDialog import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider import autodagger.AutoInjector +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.talk.R import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.databinding.DialogPollVoteBinding @@ -206,14 +207,25 @@ class PollVoteFragment : Fragment() { if (showEndPollButton) { binding.pollVoteEndPollButton.visibility = View.VISIBLE binding.pollVoteEndPollButton.setOnClickListener { - AlertDialog.Builder(requireContext()) + val dialogBuilder = MaterialAlertDialogBuilder(binding.pollVoteEndPollButton.context) .setTitle(R.string.polls_end_poll) .setMessage(R.string.polls_end_poll_confirm) .setPositiveButton(R.string.polls_end_poll) { _, _ -> parentViewModel.endPoll() } .setNegativeButton(R.string.nc_cancel, null) - .show() + + viewThemeUtils.colorMaterialAlertDialogBackground( + binding.pollVoteEndPollButton.context, + dialogBuilder + ) + + val dialog = dialogBuilder.show() + + viewThemeUtils.colorTextButtons( + dialog.getButton(AlertDialog.BUTTON_POSITIVE), + dialog.getButton(AlertDialog.BUTTON_NEGATIVE) + ) } } else { binding.pollVoteEndPollButton.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 0157e7871..65e016d33 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 @@ -36,13 +36,13 @@ import android.widget.AdapterView.OnItemSelectedListener import android.widget.ArrayAdapter import android.widget.ImageView import android.widget.TextView -import androidx.appcompat.app.AlertDialog import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.DialogFragment import androidx.recyclerview.widget.LinearLayoutManager import autodagger.AutoInjector import com.bluelinelabs.logansquare.LoganSquare import com.google.android.material.card.MaterialCardView +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.talk.R import com.nextcloud.talk.adapters.PredefinedStatusClickListener import com.nextcloud.talk.adapters.PredefinedStatusListAdapter @@ -166,9 +166,10 @@ class SetStatusDialogFragment : override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { binding = DialogSetStatusBinding.inflate(LayoutInflater.from(context)) - return AlertDialog.Builder(requireContext()) - .setView(binding.root) - .create() + val dialogBuilder = MaterialAlertDialogBuilder(binding.root.context).setView(binding.root) + viewThemeUtils.colorMaterialAlertDialogBackground(binding.root.context, dialogBuilder) + + return dialogBuilder.create() } @SuppressLint("DefaultLocale") 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 907fa8164..2e9396244 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 @@ -498,6 +498,12 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private } } + 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 -> @@ -782,6 +788,24 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private } } + fun colorDialogHeadline(textView: TextView) { + withScheme(textView) { scheme -> + textView.setTextColor(scheme.onSurface) + } + } + + fun colorDialogSupportingText(textView: TextView) { + withScheme(textView) { scheme -> + textView.setTextColor(scheme.onSurfaceVariant) + } + } + + fun colorDialogIcon(icon: ImageView) { + withScheme(icon) { scheme -> + icon.setColorFilter(scheme.secondary) + } + } + companion object { private val THEMEABLE_PLACEHOLDER_IDS = listOf( R.drawable.ic_mimetype_package_x_generic, 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 d33dd52c5..3fa5fc4ca 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 @@ -28,22 +28,30 @@ import android.view.LayoutInflater; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.EditText; -import androidx.appcompat.app.AlertDialog; -import autodagger.AutoInjector; +import android.widget.TextView; + +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.nextcloud.talk.R; import com.nextcloud.talk.application.NextcloudTalkApplication; +import com.nextcloud.talk.ui.theme.ViewThemeUtils; import com.yarolegovich.mp.io.StandardUserInputModule; -import javax.inject.Inject; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + +import autodagger.AutoInjector; + @AutoInjector(NextcloudTalkApplication.class) public class MagicUserInputModule extends StandardUserInputModule { @Inject AppPreferences appPreferences; + @Inject + ViewThemeUtils viewThemeUtils; + private List keysWithIntegerInput = new ArrayList<>(); public MagicUserInputModule(Context context) { @@ -65,6 +73,11 @@ 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); + + int paddingStartEnd = Math.round(view.getResources().getDimension(R.dimen.standard_padding)); + int paddingTopBottom = Math.round(view.getResources().getDimension(R.dimen.dialog_padding_top_bottom)); + view.setPadding(paddingStartEnd, paddingTopBottom, paddingStartEnd, paddingTopBottom); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && appPreferences.getIsKeyboardIncognito()) { inputField.setImeOptions(inputField.getImeOptions() | EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING); @@ -79,11 +92,17 @@ public class MagicUserInputModule extends StandardUserInputModule { inputField.setInputType(InputType.TYPE_CLASS_NUMBER); } - final Dialog dialog = new AlertDialog.Builder(context) - .setTitle(title) - .setView(view) - .show(); - view.findViewById(R.id.mp_btn_confirm).setOnClickListener(new View.OnClickListener() { + final MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(view.getContext()) + .setTitle(title) + .setView(view); + + viewThemeUtils.colorMaterialAlertDialogBackground(view.getContext(), dialogBuilder); + + final Dialog dialog = dialogBuilder.show(); + + TextView button = view.findViewById(R.id.mp_btn_confirm); + viewThemeUtils.colorPrimaryTextViewElement(button); + button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onInput(inputField.getText().toString()); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c83a17e8a..55fab6b8a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -115,17 +115,6 @@ app:iconSize="@dimen/avatar_size_app_bar" tools:visibility="gone" /> - - @@ -144,16 +133,6 @@ app:titleTextColor="@color/fontAppbar" tools:title="@string/nc_app_product_name"> - - diff --git a/app/src/main/res/layout/dialog_poll_loading.xml b/app/src/main/res/layout/dialog_poll_loading.xml index 07e00ecd0..d98309513 100644 --- a/app/src/main/res/layout/dialog_poll_loading.xml +++ b/app/src/main/res/layout/dialog_poll_loading.xml @@ -26,6 +26,7 @@ tools:background="@color/white"> diff --git a/app/src/main/res/layout/search_layout.xml b/app/src/main/res/layout/search_layout.xml index 13e48d9de..983294c14 100644 --- a/app/src/main/res/layout/search_layout.xml +++ b/app/src/main/res/layout/search_layout.xml @@ -104,17 +104,6 @@ app:iconSize="@dimen/avatar_size_app_bar" tools:visibility="visible" /> - -