From 7f46ceca092897dc1594c9d1f83ee846fbded5bd Mon Sep 17 00:00:00 2001 From: A117870935 Date: Sat, 13 May 2023 23:30:49 +0530 Subject: [PATCH] Customized dialog theme. --- .../com/nmc/android/utils/DialogThemeUtils.kt | 30 ++++ .../ui/activity/SyncedFoldersActivity.kt | 7 +- .../android/ui/adapter/StoragePathAdapter.kt | 1 - .../android/ui/dialog/AccountRemovalDialog.kt | 141 ++---------------- ...seRichDocumentsTemplateDialogFragment.java | 14 +- .../ui/dialog/ChooseTemplateDialogFragment.kt | 12 +- .../ui/dialog/ConfirmationDialogFragment.kt | 29 +--- .../ui/dialog/CreateFolderDialogFragment.kt | 9 +- .../ExpirationDatePickerDialogFragment.kt | 31 ++-- .../ui/dialog/IndeterminateProgressDialog.kt | 6 +- .../android/ui/dialog/LoadingDialog.kt | 7 +- .../LocalStoragePathPickerDialogFragment.kt | 16 +- .../ui/dialog/RemoveFilesDialogFragment.java | 21 --- .../ui/dialog/RenameFileDialogFragment.java | 5 - .../RenamePublicShareDialogFragment.java | 19 +-- .../dialog/SetupEncryptionDialogFragment.kt | 21 +-- .../android/ui/dialog/ShareLinkToDialog.java | 3 + .../ui/dialog/SharePasswordDialogFragment.kt | 49 +++--- .../ui/dialog/SortingOrderDialogFragment.kt | 4 +- .../ui/dialog/SslUntrustedCertDialog.java | 4 +- .../dialog/StoragePermissionDialogFragment.kt | 21 +-- .../SyncedFolderPreferencesDialogFragment.kt | 14 +- .../fragment/contactsbackup/BackupFragment.kt | 2 +- .../res/color/dialog_positive_btn_color.xml | 5 + app/src/main/res/layout/choose_template.xml | 3 + app/src/main/res/layout/edit_box_dialog.xml | 2 + app/src/main/res/layout/password_dialog.xml | 3 + .../res/layout/setup_encryption_dialog.xml | 2 + app/src/main/res/layout/storage_path_item.xml | 2 + .../main/res/layout/upload_file_dialog.xml | 2 + app/src/main/res/values-night/colors.xml | 64 ++++++++ app/src/main/res/values/colors.xml | 89 +++++++++++ app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/styles.xml | 35 ++++- 34 files changed, 341 insertions(+), 333 deletions(-) create mode 100644 app/src/main/java/com/nmc/android/utils/DialogThemeUtils.kt create mode 100644 app/src/main/res/color/dialog_positive_btn_color.xml diff --git a/app/src/main/java/com/nmc/android/utils/DialogThemeUtils.kt b/app/src/main/java/com/nmc/android/utils/DialogThemeUtils.kt new file mode 100644 index 000000000000..1d2147e6c318 --- /dev/null +++ b/app/src/main/java/com/nmc/android/utils/DialogThemeUtils.kt @@ -0,0 +1,30 @@ +package com.nmc.android.utils + +import android.content.Context +import android.content.res.ColorStateList +import android.os.Build +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import com.google.android.material.shape.MaterialShapeDrawable +import com.owncloud.android.R + +object DialogThemeUtils { + fun colorMaterialAlertDialogBackground(context: Context, dialogBuilder: MaterialAlertDialogBuilder) { + val materialShapeDrawable = MaterialShapeDrawable( + context, + null, + R.attr.alertDialogStyle, + R.style.MaterialAlertDialog_MaterialComponents + ) + materialShapeDrawable.initializeElevationOverlay(context) + materialShapeDrawable.fillColor = + ColorStateList.valueOf(context.resources.getColor(R.color.alert_bg_color, null)) + + // dialogCornerRadius first appeared in Android Pie + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + val radius: Float = + context.resources.getDimension(com.nextcloud.android.common.ui.R.dimen.dialogBorderRadius) + materialShapeDrawable.setCornerSize(radius) + } + dialogBuilder.background = materialShapeDrawable + } +} \ No newline at end of file diff --git a/app/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.kt index 3b5b5e313dda..9e7ebe3b7e14 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.kt @@ -824,11 +824,8 @@ class SyncedFoldersActivity : .setNeutralButton(getString(R.string.battery_optimization_close)) { dialog, _ -> dialog.dismiss() } .setIcon(R.drawable.ic_battery_alert) if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) { - val alertDialog = alertDialogBuilder.show() - viewThemeUtils.platform.colorTextButtons( - alertDialog.getButton(AlertDialog.BUTTON_POSITIVE), - alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL) - ) + //NMC Customization + alertDialogBuilder.show() } } } diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/StoragePathAdapter.kt b/app/src/main/java/com/owncloud/android/ui/adapter/StoragePathAdapter.kt index 968a6a2cf2a7..3f918a140d3c 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/StoragePathAdapter.kt +++ b/app/src/main/java/com/owncloud/android/ui/adapter/StoragePathAdapter.kt @@ -44,7 +44,6 @@ class StoragePathAdapter( val storagePathItem = pathList[position] holder.binding.btnStoragePath.setIconResource(storagePathItem.icon) holder.binding.btnStoragePath.text = storagePathItem.name - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(holder.binding.btnStoragePath) } } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/AccountRemovalDialog.kt b/app/src/main/java/com/owncloud/android/ui/dialog/AccountRemovalDialog.kt index 8498dbf7d11d..599bbde34594 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/AccountRemovalDialog.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/AccountRemovalDialog.kt @@ -24,27 +24,21 @@ package com.owncloud.android.ui.dialog import android.app.Dialog -import android.graphics.drawable.Drawable +import android.content.DialogInterface import android.os.Bundle -import android.view.View -import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment -import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.account.User -import com.nextcloud.client.account.UserAccountManager import com.nextcloud.client.di.Injectable import com.nextcloud.client.jobs.BackgroundJobManager import com.nextcloud.utils.extensions.getParcelableArgument +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R -import com.owncloud.android.databinding.AccountRemovalDialogBinding -import com.owncloud.android.datamodel.FileDataStorageManager -import com.owncloud.android.utils.DisplayUtils -import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener import com.owncloud.android.utils.theme.ViewThemeUtils import javax.inject.Inject -class AccountRemovalDialog : DialogFragment(), AvatarGenerationListener, Injectable { +// NMC Customization: We don't need two option for logout. On logout directly logout the user locally from the app +class AccountRemovalDialog : DialogFragment(), Injectable { @Inject lateinit var backgroundJobManager: BackgroundJobManager @@ -53,136 +47,33 @@ class AccountRemovalDialog : DialogFragment(), AvatarGenerationListener, Injecta lateinit var viewThemeUtils: ViewThemeUtils private var user: User? = null - private lateinit var alertDialog: AlertDialog - private var _binding: AccountRemovalDialogBinding? = null - private val binding get() = _binding!! override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) user = requireArguments().getParcelableArgument(KEY_USER, User::class.java) } - override fun onStart() { - super.onStart() - - // disable positive button and apply theming - alertDialog = dialog as AlertDialog - alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false - - viewThemeUtils.platform.themeRadioButton(binding.radioLocalRemove) - viewThemeUtils.platform.themeRadioButton(binding.radioRequestDeletion) - viewThemeUtils.material.colorMaterialButtonPrimaryTonal( - alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton - ) - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless( - alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton - ) - - binding.userName.text = UserAccountManager.getDisplayName(user) - binding.account.text = user?.let { DisplayUtils.convertIdn(it.accountName, false) } - } - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - _binding = AccountRemovalDialogBinding.inflate(layoutInflater) - - // start avatar generation - setAvatar() - - // hide second option when plug-in isn't installed - if (hasDropAccount()) { - binding.requestDeletion.visibility = View.VISIBLE - } - - val builder = - MaterialAlertDialogBuilder(requireActivity()) - .setTitle(R.string.delete_account) - .setView(binding.root) - .setNegativeButton(R.string.common_cancel) { _, _ -> } - .setPositiveButton(R.string.delete_account) { _, _ -> removeAccount() } - - // allow selection by clicking on list element - binding.localRemove.setOnClickListener { - binding.radioLocalRemove.performClick() - } - binding.requestDeletion.setOnClickListener { - binding.radioRequestDeletion.performClick() - } - - // set listeners for custom radio button list - binding.radioLocalRemove.setOnClickListener { - binding.radioRequestDeletion.isChecked = false - alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).apply { - text = getText(R.string.delete_account) - isEnabled = true - } - } - binding.radioRequestDeletion.setOnClickListener { - binding.radioLocalRemove.isChecked = false - alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).apply { - text = getString(R.string.request_account_deletion_button) - isEnabled = true + val builder = MaterialAlertDialogBuilder(requireActivity()) + .setTitle(R.string.delete_account) + .setMessage(resources.getString(R.string.delete_account_warning, user!!.accountName)) + .setIcon(R.drawable.ic_warning) + .setPositiveButton(R.string.common_ok) { _: DialogInterface?, _: Int -> + backgroundJobManager.startAccountRemovalJob( + user!!.accountName, + false + ) } - } + .setNegativeButton(R.string.common_cancel, null) - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(requireActivity(), builder) + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireActivity(), builder) return builder.create() } - /** - * Get value of `drop-account` capability. - */ - private fun hasDropAccount(): Boolean { - val capability = FileDataStorageManager(user, context?.contentResolver).getCapability(user) - return capability.dropAccount.isTrue - } - - /** - * Start removal of account. Depending on which option is checked, either a browser will open to request deletion, - * or the local account will be removed immediately. - */ - private fun removeAccount() { - user?.let { user -> - if (binding.radioRequestDeletion.isChecked) { - DisplayUtils.startLinkIntent(activity, user.server.uri.toString() + DROP_ACCOUNT_URI) - } else { - backgroundJobManager.startAccountRemovalJob(user.accountName, false) - } - } - } - - /** - * Start avatar generation. - */ - private fun setAvatar() { - try { - val imageView = binding.userIcon - imageView.tag = user!!.accountName - DisplayUtils.setAvatar( - user!!, - this, - resources.getDimension(R.dimen.list_item_avatar_icon_radius), - resources, - imageView, - context - ) - } catch (_: Exception) { - } - } - - override fun avatarGenerated(avatarDrawable: Drawable?, callContext: Any?) { - avatarDrawable?.let { - binding.userIcon.setImageDrawable(it) - } - } - - override fun shouldCallGeneratedCallback(tag: String?, callContext: Any?): Boolean { - return binding.userIcon.tag == tag - } - companion object { private const val KEY_USER = "USER" - private const val DROP_ACCOUNT_URI = "/settings/user/drop_account" @JvmStatic fun newInstance(user: User) = AccountRemovalDialog().apply { diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java b/app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java index b62576fd822c..1e6010fadce9 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java @@ -42,6 +42,7 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.di.Injectable; import com.nextcloud.client.network.ClientFactory; +import com.nmc.android.utils.DialogThemeUtils; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.databinding.ChooseTemplateBinding; @@ -129,17 +130,9 @@ public void onStart() { if (alertDialog != null) { positiveButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton); - - MaterialButton negativeButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE); - if (negativeButton != null) { - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton); - } - positiveButton.setOnClickListener(this); positiveButton.setEnabled(false); } - checkEnablingCreateButton(); } @@ -181,8 +174,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { binding = ChooseTemplateBinding.inflate(inflater, null, false); View view = binding.getRoot(); - viewThemeUtils.material.colorTextInputLayout(binding.filenameContainer); - Type type = Type.valueOf(arguments.getString(ARG_TYPE)); new FetchTemplateTask(this, client).execute(type); @@ -222,7 +213,8 @@ public void afterTextChanged(Editable s) { .setNegativeButton(R.string.common_cancel, null) .setTitle(titleTextId); - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(activity, builder); + //NMC customization + DialogThemeUtils.INSTANCE.colorMaterialAlertDialogBackground(activity, builder); return builder.create(); } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt index b56513207ae2..c13ece2eaee1 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt @@ -44,6 +44,7 @@ import com.nextcloud.client.account.User import com.nextcloud.client.di.Injectable import com.nextcloud.client.network.ClientFactory import com.nextcloud.client.network.ClientFactory.CreationException +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.MainApp import com.owncloud.android.R import com.owncloud.android.databinding.ChooseTemplateBinding @@ -105,10 +106,6 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem val alertDialog = dialog as AlertDialog val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton) - - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton) positiveButton.setOnClickListener(this) positiveButton.isEnabled = false @@ -143,10 +140,6 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem _binding = ChooseTemplateBinding.inflate(inflater, null, false) val view: View = binding.root - viewThemeUtils.material.colorTextInputLayout( - binding.filenameContainer - ) - binding.filename.addTextChangedListener(object : TextWatcher { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) = Unit @@ -180,7 +173,8 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem .setNegativeButton(R.string.common_cancel, null) .setTitle(title) - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.list.context, builder) + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(binding.list.context, builder) return builder.create() } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.kt index d0fd56c1e0dd..1d19942fc244 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.kt @@ -20,11 +20,10 @@ import android.R import android.app.Dialog import android.content.DialogInterface import android.os.Bundle -import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment -import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.di.Injectable +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.utils.theme.ViewThemeUtils import javax.inject.Inject @@ -36,29 +35,6 @@ open class ConfirmationDialogFragment : DialogFragment(), Injectable { private var mListener: ConfirmationDialogFragmentListener? = null - override fun onStart() { - super.onStart() - - val alertDialog = dialog as AlertDialog? - - if (alertDialog != null) { - val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton? - if (positiveButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(positiveButton) - } - - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton? - if (negativeButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(negativeButton) - } - - val neutralButton = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL) as MaterialButton? - if (neutralButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(neutralButton) - } - } - } - fun setOnConfirmationListener(listener: ConfirmationDialogFragmentListener?) { mListener = listener } @@ -104,7 +80,8 @@ open class ConfirmationDialogFragment : DialogFragment(), Injectable { } } - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireActivity(), builder) + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireActivity(), builder) return builder.create() } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.kt index 70c4e0c6b987..aace3956d5c2 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.kt @@ -33,6 +33,7 @@ import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.common.collect.Sets import com.nextcloud.client.di.Injectable +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.EditBoxDialogBinding import com.owncloud.android.datamodel.FileDataStorageManager @@ -77,10 +78,6 @@ class CreateFolderDialogFragment : DialogFragment(), DialogInterface.OnClickList if (dialog is AlertDialog) { positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton - val negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton - - viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(positiveButton!!) - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(negativeButton) } } @@ -101,7 +98,6 @@ class CreateFolderDialogFragment : DialogFragment(), DialogInterface.OnClickList // Setup layout binding.userInput.setText("") - viewThemeUtils?.material?.colorTextInputLayout(binding.userInputContainer) val parentFolder = requireArguments().getParcelable(ARG_PARENT_FOLDER) @@ -150,7 +146,8 @@ class CreateFolderDialogFragment : DialogFragment(), DialogInterface.OnClickList // Build the dialog val builder = buildMaterialAlertDialog(view) - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(binding.userInputContainer.context, builder) + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(binding.userInputContainer.context, builder) return builder.create() } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.kt index 22223b199004..adbb61a16db6 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.kt @@ -60,18 +60,25 @@ class ExpirationDatePickerDialogFragment : DialogFragment(), OnDateSetListener, if (currentDialog != null) { val dialog = currentDialog as DatePickerDialog - val positiveButton = dialog.getButton(DatePickerDialog.BUTTON_POSITIVE) as MaterialButton? - if (positiveButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(positiveButton) - } - val negativeButton = dialog.getButton(DatePickerDialog.BUTTON_NEGATIVE) as MaterialButton? - if (negativeButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(negativeButton) - } - val neutralButton = dialog.getButton(DatePickerDialog.BUTTON_NEUTRAL) as MaterialButton? - if (neutralButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(neutralButton) - } + // NMC Customization + (dialog.getButton(DatePickerDialog.BUTTON_POSITIVE) as MaterialButton?)?.setTextColor( + resources.getColor( + R.color.primary, + null + ) + ) + (dialog.getButton(DatePickerDialog.BUTTON_NEGATIVE) as MaterialButton?)?.setTextColor( + resources.getColor( + R.color.text_color, + null + ) + ) + (dialog.getButton(DatePickerDialog.BUTTON_NEUTRAL) as MaterialButton?)?.setTextColor( + resources.getColor( + R.color.text_color, + null + ) + ) } } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.kt b/app/src/main/java/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.kt index 4722796e9c57..8dab7d6060cd 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.kt @@ -48,7 +48,11 @@ class IndeterminateProgressDialog : DialogFragment(), Injectable { progressDialog.isIndeterminate = true progressDialog.setOnShowListener { val v = progressDialog.findViewById(android.R.id.progress) - viewThemeUtils?.platform?.tintDrawable(requireContext(), v.indeterminateDrawable) + // NMC Customization + viewThemeUtils?.platform?.colorDrawable( + v.indeterminateDrawable, + requireContext().resources.getColor(R.color.white, null) + ) } // / set message diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.kt b/app/src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.kt index a1854907e9bb..89e07cedff75 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.kt @@ -18,6 +18,8 @@ */ package com.owncloud.android.ui.dialog +import android.graphics.PorterDuff +import android.graphics.PorterDuffColorFilter import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -25,6 +27,7 @@ import android.view.ViewGroup import androidx.fragment.app.DialogFragment import com.nextcloud.android.common.ui.theme.utils.ColorRole import com.nextcloud.client.di.Injectable +import com.owncloud.android.R import com.owncloud.android.databinding.LoadingDialogBinding import com.owncloud.android.utils.theme.ViewThemeUtils import javax.inject.Inject @@ -51,7 +54,9 @@ class LoadingDialog : DialogFragment(), Injectable { val loadingDrawable = binding.loadingBar.indeterminateDrawable if (loadingDrawable != null) { - viewThemeUtils?.platform?.tintDrawable(requireContext(), loadingDrawable) + // NMC Customisation + loadingDrawable.colorFilter = + PorterDuffColorFilter(resources.getColor(R.color.primary, null), PorterDuff.Mode.SRC_IN) } viewThemeUtils?.platform?.colorViewBackground(binding.loadingLayout, ColorRole.SURFACE) diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/LocalStoragePathPickerDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/LocalStoragePathPickerDialogFragment.kt index 54a2baf1b38c..9c4dfea7e002 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/LocalStoragePathPickerDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/LocalStoragePathPickerDialogFragment.kt @@ -26,9 +26,9 @@ import android.os.Environment import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment import androidx.recyclerview.widget.LinearLayoutManager -import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.di.Injectable +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.StoragePathDialogBinding import com.owncloud.android.ui.adapter.StoragePathAdapter @@ -51,17 +51,6 @@ class LocalStoragePathPickerDialogFragment : private lateinit var binding: StoragePathDialogBinding - override fun onStart() { - super.onStart() - - val alertDialog = dialog as AlertDialog? - - val positiveButton = alertDialog?.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton? - positiveButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton) - } - } - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { require(activity is StoragePathAdapterListener) { "Calling activity must implement " + @@ -83,7 +72,8 @@ class LocalStoragePathPickerDialogFragment : .setPositiveButton(R.string.common_cancel, this) .setTitle(R.string.storage_choose_location) - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(requireContext(), builder) + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireContext(), builder) return builder.create() } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java b/app/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java index 087ff25035f8..44f1a73eaafe 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java @@ -34,7 +34,6 @@ import java.util.Collection; import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; /** * Dialog requiring confirmation before removing a collection of given OCFiles. @@ -130,26 +129,6 @@ public static RemoveFilesDialogFragment newInstance(OCFile file) { return newInstance(list); } - @Override - public void onStart() { - super.onStart(); - - AlertDialog alertDialog = (AlertDialog) getDialog(); - - if (alertDialog != null) { - MaterialButton positiveButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton); - - MaterialButton negativeButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE); - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton); - - MaterialButton neutralButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL); - if (neutralButton != null) { - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(neutralButton); - } - } - } - @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java b/app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java index 9ef67baeb63f..aa15102c60d4 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java @@ -119,7 +119,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { // Setup layout String currentName = mTargetFile.getFileName(); binding.userInput.setText(currentName); - viewThemeUtils.material.colorTextInputLayout(binding.userInputContainer); int extensionStart = mTargetFile.isFolder() ? -1 : currentName.lastIndexOf('.'); int selectionEnd = extensionStart >= 0 ? extensionStart : currentName.length(); binding.userInput.setSelection(0, selectionEnd); @@ -160,10 +159,6 @@ private void initAlertDialog() { if (alertDialog != null) { positiveButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); - MaterialButton negativeButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE); - - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton); - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton); } } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.java b/app/src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.java index 7973b93fafe0..d61228d693c1 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.java @@ -31,6 +31,7 @@ import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.nextcloud.client.di.Injectable; +import com.nmc.android.utils.DialogThemeUtils; import com.owncloud.android.R; import com.owncloud.android.databinding.EditBoxDialogBinding; import com.owncloud.android.lib.resources.shares.OCShare; @@ -67,20 +68,6 @@ public static RenamePublicShareDialogFragment newInstance(OCShare share) { return frag; } - @Override - public void onStart() { - super.onStart(); - - AlertDialog alertDialog = (AlertDialog) getDialog(); - - if (alertDialog != null) { - MaterialButton positiveButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); - MaterialButton negativeButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE); - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton); - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton); - } - } - @Override public void onResume() { super.onResume(); @@ -98,7 +85,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { View view = binding.getRoot(); // Setup layout - viewThemeUtils.material.colorTextInputLayout(binding.userInputContainer); binding.userInput.setText(publicShare.getLabel()); // Build the dialog @@ -108,7 +94,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { .setNegativeButton(R.string.common_cancel, this) .setTitle(R.string.public_share_name); - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInput.getContext(), builder); + //NMC customization + DialogThemeUtils.INSTANCE.colorMaterialAlertDialogBackground(binding.userInput.getContext(), builder); return builder.create(); } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.kt index c78f4ed7716e..44b673e28084 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.kt @@ -39,6 +39,7 @@ import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.account.User import com.nextcloud.client.di.Injectable +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.SetupEncryptionDialogBinding import com.owncloud.android.datamodel.ArbitraryDataProvider @@ -90,14 +91,6 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { if (alertDialog != null) { positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton? negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton? - - if (positiveButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(positiveButton!!) - } - - if (negativeButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(negativeButton!!) - } } } @@ -126,9 +119,6 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { val inflater = requireActivity().layoutInflater binding = SetupEncryptionDialogBinding.inflate(inflater, null, false) - // Setup layout - viewThemeUtils?.material?.colorTextInputLayout(binding.encryptionPasswordInputContainer) - return createDialog(binding.root) } @@ -141,7 +131,8 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { .setNegativeButton(R.string.common_cancel) { dialog: DialogInterface, _: Int -> dialog.cancel() } .setTitle(R.string.end_to_end_encryption_title) - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(v.context, builder) + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(v.context, builder) val dialog: Dialog = builder.create() dialog.setCanceledOnTouchOutside(false) @@ -494,13 +485,11 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { } requireDialog().setTitle(R.string.end_to_end_encryption_passphrase_title) binding.encryptionStatus.setText(R.string.end_to_end_encryption_keywords_description) - viewThemeUtils!!.material.colorTextInputLayout(binding.encryptionPasswordInputContainer) binding.encryptionPassphrase.text = generateMnemonicString(true) binding.encryptionPassphrase.visibility = View.VISIBLE positiveButton!!.setText(R.string.end_to_end_encryption_confirm_button) positiveButton!!.visibility = View.VISIBLE negativeButton!!.visibility = View.VISIBLE - viewThemeUtils!!.platform.colorTextButtons(positiveButton!!, negativeButton!!) keyResult = KEY_GENERATE } @@ -518,10 +507,6 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { positiveButton?.setText(R.string.end_to_end_encryption_dialog_close) positiveButton?.visibility = View.VISIBLE - - if (positiveButton != null) { - viewThemeUtils?.platform?.colorTextButtons(positiveButton!!) - } } @VisibleForTesting diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.java b/app/src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.java index 6f55e0004f01..9f2f8be951f9 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.java +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.java @@ -37,6 +37,7 @@ import android.widget.TextView; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.nmc.android.utils.DialogThemeUtils; import com.owncloud.android.R; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.ui.activity.CopyToClipboardActivity; @@ -143,6 +144,8 @@ public void onClick(DialogInterface dialog, int which) { getActivity().startActivity(mIntent); } }); + // NMC Customization + DialogThemeUtils.INSTANCE.colorMaterialAlertDialogBackground(requireContext(), builder); return builder.create(); } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.kt index 6f7cdd08705b..3dbc21473bd4 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.kt @@ -26,11 +26,11 @@ import android.os.Build import android.os.Bundle import android.text.TextUtils import androidx.appcompat.app.AlertDialog -import androidx.core.content.ContextCompat import androidx.fragment.app.DialogFragment import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.di.Injectable +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.PasswordDialogBinding import com.owncloud.android.datamodel.OCFile @@ -68,38 +68,23 @@ class SharePasswordDialogFragment : DialogFragment(), Injectable { val alertDialog = dialog as AlertDialog? if (alertDialog != null) { - val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton? - if (positiveButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(positiveButton) - positiveButton.setOnClickListener { - val sharePassword = binding?.sharePassword?.text - - if (sharePassword != null) { - val password = sharePassword.toString() - if (!askForPassword && TextUtils.isEmpty(password)) { - DisplayUtils.showSnackMessage(binding?.root, R.string.share_link_empty_password) - return@setOnClickListener - } - if (share == null) { - setPassword(createShare, file, password) - } else { - setPassword(share!!, password) - } + (alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton?)?.setOnClickListener { + val sharePassword = binding?.sharePassword?.text + + if (sharePassword != null) { + val password = sharePassword.toString() + if (!askForPassword && TextUtils.isEmpty(password)) { + DisplayUtils.showSnackMessage(binding?.root, R.string.share_link_empty_password) + return@setOnClickListener + } + if (share == null) { + setPassword(createShare, file, password) + } else { + setPassword(share!!, password) } - - alertDialog.dismiss() } - } - - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton? - if (negativeButton != null) { - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(negativeButton) - } - val neutralButton = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL) as MaterialButton? - if (neutralButton != null) { - val warningColorId = ContextCompat.getColor(requireContext(), R.color.highlight_textColor_Warning) - viewThemeUtils?.platform?.colorTextButtons(warningColorId, neutralButton) + alertDialog.dismiss() } } } @@ -133,7 +118,6 @@ class SharePasswordDialogFragment : DialogFragment(), Injectable { // Setup layout binding?.sharePassword?.setText("") - viewThemeUtils?.material?.colorTextInputLayout(binding!!.sharePasswordContainer) val neutralButtonTextId: Int val title: Int @@ -157,7 +141,8 @@ class SharePasswordDialogFragment : DialogFragment(), Injectable { } .setTitle(title) - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireContext(), builder) + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireContext(), builder) return builder.create() } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.kt index 3c1a84871e10..066b2c5b80d5 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.kt @@ -26,6 +26,7 @@ import android.view.View import androidx.fragment.app.DialogFragment import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.di.Injectable +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.SortingOrderFragmentBinding import com.owncloud.android.lib.common.utils.Log_OC @@ -89,7 +90,8 @@ class SortingOrderDialogFragment : DialogFragment(), Injectable { val builder = MaterialAlertDialogBuilder(requireContext()) builder.setView(binding?.root) - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireContext(), builder) + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireContext(), builder) return builder.create() } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.java b/app/src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.java index 1fa774010c24..24b468135e41 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.java +++ b/app/src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.java @@ -32,6 +32,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.nextcloud.client.di.Injectable; +import com.nmc.android.utils.DialogThemeUtils; import com.owncloud.android.R; import com.owncloud.android.databinding.SslUntrustedCertLayoutBinding; import com.owncloud.android.lib.common.network.CertificateCombinedException; @@ -162,7 +163,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(binding.getRoot().getContext()); builder.setView(binding.getRoot()); - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.getRoot().getContext(), builder); + //NMC customization + DialogThemeUtils.INSTANCE.colorMaterialAlertDialogBackground(binding.getRoot().getContext(), builder); final Dialog dialog = builder.create(); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/StoragePermissionDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/StoragePermissionDialogFragment.kt index d2b179e66628..7d2cf204948c 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/StoragePermissionDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/StoragePermissionDialogFragment.kt @@ -25,12 +25,12 @@ import android.os.Build import android.os.Bundle import android.os.Parcelable import androidx.annotation.RequiresApi -import androidx.appcompat.app.AlertDialog import androidx.core.os.bundleOf import androidx.fragment.app.DialogFragment import com.google.android.material.button.MaterialButton import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.di.Injectable +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.utils.theme.ViewThemeUtils import kotlinx.parcelize.Parcelize @@ -56,22 +56,6 @@ class StoragePermissionDialogFragment : DialogFragment(), Injectable { } } - override fun onStart() { - super.onStart() - dialog?.let { - val alertDialog = it as AlertDialog - - val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton) - - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton) - - val neutralButton = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL) as MaterialButton - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(neutralButton) - } - } - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val title = when { permissionRequired -> R.string.file_management_permission @@ -99,7 +83,8 @@ class StoragePermissionDialogFragment : DialogFragment(), Injectable { dismiss() } - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(requireContext(), dialogBuilder) + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireContext(), dialogBuilder) return dialogBuilder.create() } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.kt index 01672938757d..908e51cde4f1 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.kt @@ -33,6 +33,7 @@ import android.view.View import android.widget.AdapterView import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment +import com.nmc.android.utils.DialogThemeUtils import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.di.Injectable import com.nextcloud.client.preferences.SubFolderRule @@ -113,7 +114,8 @@ class SyncedFolderPreferencesDialogFragment : DialogFragment(), Injectable { val builder = MaterialAlertDialogBuilder(requireContext()) builder.setView(binding!!.getRoot()) - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireContext(), builder) + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireContext(), builder) return builder.create() } @@ -163,10 +165,6 @@ class SyncedFolderPreferencesDialogFragment : DialogFragment(), Injectable { binding.settingInstantUploadExistingCheckbox, binding.settingInstantUploadPathUseSubfoldersCheckbox ) - - viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(binding.btnPositive) - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(binding.btnNegative) - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(binding.btnNeutral) } private fun setButtonOrder(binding: SyncedFoldersSettingsLayoutBinding) { @@ -415,7 +413,8 @@ class SyncedFolderPreferencesDialogFragment : DialogFragment(), Injectable { } behaviourDialogShown = true - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireActivity(), builder) + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireActivity(), builder) behaviourDialog = builder.create() behaviourDialog?.show() @@ -434,7 +433,8 @@ class SyncedFolderPreferencesDialogFragment : DialogFragment(), Injectable { nameCollisionPolicyDialogShown = true - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireActivity(), builder) + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireActivity(), builder) behaviourDialog = builder.create() behaviourDialog?.show() } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.kt b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.kt index e216bacaed7d..ad60389ee085 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.kt @@ -583,7 +583,7 @@ class BackupFragment : FileFragment(), OnDateSetListener, Injectable { day = savedDate.day } if (backupFiles.size > 0 && backupFiles[backupFiles.size - 1] != null) { - datePickerDialog = DatePickerDialog(contactsPreferenceActivity, this, year, month, day) + datePickerDialog = DatePickerDialog(contactsPreferenceActivity, R.style.FallbackDatePickerDialogTheme, this, year, month, day) datePickerDialog?.datePicker?.maxDate = backupFiles[backupFiles.size - 1]!! .modificationTimestamp datePickerDialog?.datePicker?.minDate = backupFiles[0]!!.modificationTimestamp diff --git a/app/src/main/res/color/dialog_positive_btn_color.xml b/app/src/main/res/color/dialog_positive_btn_color.xml new file mode 100644 index 000000000000..5913e0da1a1d --- /dev/null +++ b/app/src/main/res/color/dialog_positive_btn_color.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/choose_template.xml b/app/src/main/res/layout/choose_template.xml index b8599fb389c1..787f761c10c0 100644 --- a/app/src/main/res/layout/choose_template.xml +++ b/app/src/main/res/layout/choose_template.xml @@ -50,6 +50,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/filename_hint" + android:theme="@style/TextInputLayoutInputWarning" android:paddingTop="@dimen/standard_padding"> diff --git a/app/src/main/res/layout/password_dialog.xml b/app/src/main/res/layout/password_dialog.xml index 81e7f3f17c55..7ace039cfe1b 100644 --- a/app/src/main/res/layout/password_dialog.xml +++ b/app/src/main/res/layout/password_dialog.xml @@ -35,7 +35,10 @@ android:layout_height="wrap_content" android:autofillHints="password" android:ems="10" + android:backgroundTint="@color/secondary_text_color" android:gravity="top" + android:textColorHint="@color/bg_fallback_highlight" + android:textColorHighlight="@color/et_highlight_color" android:inputType="textPassword"> diff --git a/app/src/main/res/layout/setup_encryption_dialog.xml b/app/src/main/res/layout/setup_encryption_dialog.xml index 733b7a8b14d4..acb83278abeb 100644 --- a/app/src/main/res/layout/setup_encryption_dialog.xml +++ b/app/src/main/res/layout/setup_encryption_dialog.xml @@ -60,6 +60,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:autofillHints="password" + android:backgroundTint="@color/secondary_text_color" + android:textColorHighlight="@color/et_highlight_color" android:ems="10" android:inputType="textPassword" android:textCursorDrawable="@null" /> diff --git a/app/src/main/res/layout/storage_path_item.xml b/app/src/main/res/layout/storage_path_item.xml index 5a7cfeba0b28..5a3fff92ae63 100644 --- a/app/src/main/res/layout/storage_path_item.xml +++ b/app/src/main/res/layout/storage_path_item.xml @@ -26,6 +26,8 @@ android:gravity="center|start" android:paddingBottom="@dimen/standard_half_padding" android:text="@string/menu_item_sort_by_name_z_a" + android:textColor="@color/text_color" app:icon="@drawable/ic_user" app:iconPadding="@dimen/standard_padding" + app:iconTint="@color/text_color" tools:text="DCIM" /> diff --git a/app/src/main/res/layout/upload_file_dialog.xml b/app/src/main/res/layout/upload_file_dialog.xml index 04e1a783b773..e0f19eeb47ec 100755 --- a/app/src/main/res/layout/upload_file_dialog.xml +++ b/app/src/main/res/layout/upload_file_dialog.xml @@ -45,6 +45,8 @@ android:layout_height="wrap_content" android:ems="10" android:gravity="top" + android:backgroundTint="@color/secondary_text_color" + android:textColorHighlight="@color/et_highlight_color" android:importantForAutofill="no" android:inputType="textNoSuggestions|textCapSentences" android:scrollbars="vertical"> diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 08bf64d552ad..e926fdcc432f 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -48,4 +48,68 @@ #1E1E1E @android:color/white + + + #FFFFFF + @color/grey_30 + @color/grey_30 + #CCCCCC + @color/grey_70 + @color/grey_80 + #2D2D2D + @color/grey_70 + @color/grey_70 + + + @color/grey_80 + @color/grey_0 + + + @color/grey_80 + @color/grey_0 + + + @color/grey_60 + @color/grey_0 + @color/grey_0 + @color/grey_30 + #FFFFFF + @color/grey_30 + @color/grey_80 + #FFFFFF + + + @color/grey_80 + @color/grey_30 + @color/grey_0 + + + @color/grey_80 + @color/grey_0 + @color/grey_80 + + + @color/grey_70 + @color/grey_60 + + + @color/grey_70 + @color/grey_70 + + + #FFFFFF + @color/grey_30 + @color/grey_0 + @color/grey_0 + @color/grey_0 + @color/grey_0 + @color/grey_60 + @color/grey_0 + #FFFFFF + + + #121212 + @color/grey_0 + @color/grey_80 + @color/grey_80 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index d72d9d458f83..fc26c96103fd 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -80,4 +80,93 @@ @android:color/white #666666 #A5A5A5 + + + #191919 + @color/primary + #191919 + #191919 + @color/grey_30 + @android:color/white + #FFFFFF + @color/grey_0 + #CCCCCC + #77c4ff + #B3FFFFFF + @color/grey_10 + + + #101010 + #F2F2F2 + #E5E5E5 + #B2B2B2 + #666666 + #4C4C4C + #333333 + + + @color/design_snackbar_background_color + @color/white + + + #FFFFFF + #191919 + + + @color/grey_0 + #191919 + @color/primary + #191919 + @color/primary + @color/grey_30 + @color/white + #191919 + + + #FFFFFF + #191919 + #191919 + + + #FFFFFF + #191919 + #FFFFFF + + + @color/primary + #F399C7 + #FFFFFF + @color/grey_30 + @color/grey_10 + @color/grey_0 + + + @color/primary + @color/grey_30 + @color/grey_30 + #CCCCCC + + + #191919 + @color/grey_30 + #191919 + #191919 + #191919 + #191919 + @color/grey_30 + #191919 + #000000 + #191919 + #F6E5EB + #C16F81 + #0D39DF + #0099ff + + + @color/grey_0 + #191919 + @color/grey_0 + @color/grey_30 + #77b6bb + #5077b6bb diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 28a810398b61..f65d0e980f9e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -135,6 +135,7 @@ Request deletion Request permanent deletion of account by service provider Remove account + Remove account %s and delete all local files?\n\nDeletion cannot be undone. Avatar Active user Upload from… diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index ec14ded2e15b..5b32869e6f58 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -26,6 +26,8 @@ @style/App.ActionMode @style/ownCloud.AlertDialog @style/ownCloud.AlertDialog + + @style/ownCloud.AlertDialog @color/text_color @color/secondary_text_color @color/secondary_text_color @@ -110,6 +112,8 @@ + + + + + + +