From cbbcfc86daf307ee5137d9fb6a2a98458d7061fc 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 | 14 +- .../android/ui/adapter/StoragePathAdapter.kt | 1 - .../android/ui/dialog/AccountRemovalDialog.kt | 141 ++---------------- ...ooseRichDocumentsTemplateDialogFragment.kt | 12 +- .../ui/dialog/ChooseTemplateDialogFragment.kt | 14 +- .../ui/dialog/ConfirmationDialogFragment.kt | 29 +--- .../ui/dialog/CreateFolderDialogFragment.kt | 11 +- .../ExpirationDatePickerDialogFragment.kt | 31 ++-- .../ui/dialog/IndeterminateProgressDialog.kt | 6 +- .../android/ui/dialog/LoadingDialog.kt | 10 +- .../LocalStoragePathPickerDialogFragment.kt | 16 +- .../ui/dialog/RemoveFilesDialogFragment.kt | 24 +-- .../ui/dialog/RenameFileDialogFragment.kt | 11 +- .../dialog/RenamePublicShareDialogFragment.kt | 23 +-- .../android/ui/dialog/ShareLinkToDialog.kt | 7 +- .../ui/dialog/SharePasswordDialogFragment.kt | 49 +++--- .../ui/dialog/SortingOrderDialogFragment.kt | 4 +- .../ui/dialog/SslUntrustedCertDialog.kt | 4 +- .../dialog/StoragePermissionDialogFragment.kt | 21 +-- .../SyncedFolderPreferencesDialogFragment.kt | 14 +- .../SetupEncryptionDialogFragment.kt | 28 +--- .../fragment/contactsbackup/BackupFragment.kt | 1 + .../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/passcodelock.xml | 1 + 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-de/strings.xml | 1 + app/src/main/res/values-night/colors.xml | 64 ++++++++ app/src/main/res/values-night/themes.xml | 2 + app/src/main/res/values/colors.xml | 89 +++++++++++ app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/styles.xml | 47 +++++- app/src/main/res/values/themes.xml | 2 + 38 files changed, 372 insertions(+), 355 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 23486394a2ca..cffa6c6f0c22 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 @@ -33,6 +33,7 @@ import com.nextcloud.client.jobs.NotificationWork import com.nextcloud.client.jobs.upload.FileUploadWorker import com.nextcloud.client.preferences.AppPreferences import com.nextcloud.client.preferences.SubFolderRule +import com.nmc.android.utils.DialogThemeUtils import com.nextcloud.utils.extensions.getParcelableArgument import com.nextcloud.utils.extensions.isDialogFragmentReady import com.owncloud.android.BuildConfig @@ -821,7 +822,7 @@ class SyncedFoldersActivity : private fun showBatteryOptimizationInfo() { if (powerManagementService.isPowerSavingExclusionAvailable || checkIfBatteryOptimizationEnabled()) { - val alertDialogBuilder = MaterialAlertDialogBuilder(this, R.style.Theme_ownCloud_Dialog) + val alertDialogBuilder = MaterialAlertDialogBuilder(this) .setTitle(getString(R.string.battery_optimization_title)) .setMessage(getString(R.string.battery_optimization_message)) .setPositiveButton(getString(R.string.battery_optimization_disable)) { _, _ -> @@ -837,12 +838,13 @@ class SyncedFoldersActivity : } .setNeutralButton(getString(R.string.battery_optimization_close)) { dialog, _ -> dialog.dismiss() } .setIcon(R.drawable.ic_battery_alert) + + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(this, alertDialogBuilder) + 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 7f37a9a216ef..96f48089d077 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 @@ -31,7 +31,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 e42f1b7c626f..595a0f2696ab 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 @@ -9,27 +9,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 @@ -38,136 +32,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 - 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.kt b/app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.kt index b3b5eac4cfe4..c517efb1ce15 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.kt @@ -28,6 +28,7 @@ import com.nextcloud.client.network.ClientFactory import com.nextcloud.client.network.ClientFactory.CreationException import com.nextcloud.utils.extensions.getParcelableArgument import com.nextcloud.utils.fileNameValidator.FileNameValidator +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.MainApp import com.owncloud.android.R import com.owncloud.android.databinding.ChooseTemplateBinding @@ -99,15 +100,9 @@ class ChooseRichDocumentsTemplateDialogFragment : alertDialog?.let { positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as? MaterialButton positiveButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(it) it.setOnClickListener(this) it.isEnabled = false } - - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as? MaterialButton - negativeButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton) - } } checkEnablingCreateButton() @@ -131,7 +126,6 @@ class ChooseRichDocumentsTemplateDialogFragment : initClient() initFilenames(arguments) - viewThemeUtils.material.colorTextInputLayout(binding.filenameContainer) val type = Type.valueOf(arguments.getString(ARG_TYPE) ?: "") FetchTemplateTask(this, client).execute(type) @@ -194,8 +188,8 @@ class ChooseRichDocumentsTemplateDialogFragment : .setNegativeButton(R.string.common_cancel, null) .setTitle(titleTextId) - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(activity, builder) - + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(activity, builder) return builder } 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 34740ce9604e..d13ede180601 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 @@ -33,6 +33,7 @@ import com.nextcloud.client.network.ClientFactory import com.nextcloud.client.network.ClientFactory.CreationException import com.nextcloud.utils.extensions.getParcelableArgument import com.nextcloud.utils.fileNameValidator.FileNameValidator +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.MainApp import com.owncloud.android.R import com.owncloud.android.databinding.ChooseTemplateBinding @@ -90,14 +91,8 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem super.onStart() val alertDialog = dialog as AlertDialog - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as? MaterialButton - negativeButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton) - } - val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as? MaterialButton positiveButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton) positiveButton.setOnClickListener(this) positiveButton.isEnabled = false positiveButton.isClickable = false @@ -130,10 +125,6 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem val inflater = requireActivity().layoutInflater _binding = ChooseTemplateBinding.inflate(inflater, null, false) - viewThemeUtils.material.colorTextInputLayout( - binding.filenameContainer - ) - binding.filename.addTextChangedListener(object : TextWatcher { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) = Unit override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) = Unit @@ -162,7 +153,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 8fcc9b52603e..7126bd1ae782 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 @@ -14,11 +14,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 @@ -30,29 +29,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 } @@ -98,7 +74,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 068d8e489592..3e827d4e9180 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 @@ -26,6 +26,7 @@ import com.nextcloud.client.account.CurrentAccountProvider import com.nextcloud.client.di.Injectable import com.nextcloud.utils.extensions.getParcelableArgument import com.nextcloud.utils.fileNameValidator.FileNameValidator +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.EditBoxDialogBinding import com.owncloud.android.datamodel.FileDataStorageManager @@ -74,12 +75,6 @@ class CreateFolderDialogFragment : DialogFragment(), DialogInterface.OnClickList positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE) as? MaterialButton positiveButton?.let { it.isEnabled = false - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(it) - } - - val negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE) as? MaterialButton - negativeButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(it) } } } @@ -98,7 +93,6 @@ class CreateFolderDialogFragment : DialogFragment(), DialogInterface.OnClickList binding = EditBoxDialogBinding.inflate(inflater, null, false) binding.userInput.setText(R.string.empty) - viewThemeUtils.material.colorTextInputLayout(binding.userInputContainer) val parentFolder = requireArguments().getParcelableArgument(ARG_PARENT_FOLDER, OCFile::class.java) @@ -117,7 +111,8 @@ class CreateFolderDialogFragment : DialogFragment(), DialogInterface.OnClickList }) val builder = buildMaterialAlertDialog(binding.root) - 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 b5baded8ed3b..7f6e3ae80dcf 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 @@ -50,18 +50,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 f5921a39a9e5..b17ff23ab83c 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 @@ -37,7 +37,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 ed179977f7af..3f129320c447 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 @@ -8,13 +8,15 @@ */ 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 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 @@ -41,11 +43,11 @@ 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) - return binding.root } 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 bc8de2411c22..8fec7365dd4b 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 @@ -13,9 +13,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 @@ -38,17 +38,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 " + @@ -70,7 +59,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.kt b/app/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.kt index a1c032ca4f8c..c5f1dc66c6c4 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.kt @@ -14,8 +14,6 @@ package com.owncloud.android.ui.dialog import android.app.Dialog import android.os.Bundle import android.view.ActionMode -import androidx.appcompat.app.AlertDialog -import com.google.android.material.button.MaterialButton import com.nextcloud.client.di.Injectable import com.owncloud.android.R import com.owncloud.android.datamodel.OCFile @@ -30,26 +28,8 @@ class RemoveFilesDialogFragment : ConfirmationDialogFragment(), ConfirmationDial private var mTargetFiles: Collection? = null private var actionMode: ActionMode? = null - override fun onStart() { - super.onStart() - - val alertDialog = dialog as AlertDialog? ?: return - - val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as? MaterialButton - positiveButton?.let { - viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(positiveButton) - } - - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as? MaterialButton - negativeButton?.let { - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(negativeButton) - } - - val neutralButton = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL) as? MaterialButton - neutralButton?.let { - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(neutralButton) - } - } + @Inject + lateinit var fileDataStorageManager: FileDataStorageManager override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val dialog = super.onCreateDialog(savedInstanceState) diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.kt index 1eb42b72b65a..8b2e07ee7d4b 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.kt @@ -26,6 +26,7 @@ import com.nextcloud.client.di.Injectable import com.nextcloud.utils.extensions.getParcelableArgument import com.nextcloud.utils.fileNameValidator.FileNameValidator.isFileHidden import com.nextcloud.utils.fileNameValidator.FileNameValidator.checkFileName +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.EditBoxDialogBinding import com.owncloud.android.datamodel.FileDataStorageManager @@ -77,7 +78,6 @@ class RenameFileDialogFragment : DialogFragment(), DialogInterface.OnClickListen val currentName = mTargetFile?.fileName binding.userInput.setText(currentName) - viewThemeUtils.material.colorTextInputLayout(binding.userInputContainer) val extensionStart = if (mTargetFile?.isFolder == true) -1 else currentName?.lastIndexOf('.') val selectionEnd = if ((extensionStart ?: -1) >= 0) extensionStart else currentName?.length if (selectionEnd != null) { @@ -96,7 +96,8 @@ class RenameFileDialogFragment : DialogFragment(), DialogInterface.OnClickListen val builder = buildMaterialAlertDialog(binding.root) - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInputContainer.context, builder) + // NMC Customization + DialogThemeUtils.colorMaterialAlertDialogBackground(binding.userInputContainer.context, builder) return builder.create() } @@ -118,12 +119,6 @@ class RenameFileDialogFragment : DialogFragment(), DialogInterface.OnClickListen if (alertDialog != null) { positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton - - positiveButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(it) - } - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton) } } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.kt index 845d8748b217..cb186a189a1f 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/RenamePublicShareDialogFragment.kt @@ -14,10 +14,10 @@ import android.text.TextUtils 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.di.Injectable import com.nextcloud.utils.extensions.getParcelableArgument +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 @@ -40,23 +40,6 @@ class RenamePublicShareDialogFragment : DialogFragment(), DialogInterface.OnClic private lateinit var binding: EditBoxDialogBinding private var publicShare: OCShare? = null - override fun onStart() { - super.onStart() - - val alertDialog = dialog as AlertDialog? ?: return - - val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as? MaterialButton - val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as? MaterialButton - - positiveButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton) - } - - negativeButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton) - } - } - override fun onResume() { super.onResume() keyboardUtils.showKeyboardForEditText(requireDialog().window, binding.userInput) @@ -69,7 +52,6 @@ class RenamePublicShareDialogFragment : DialogFragment(), DialogInterface.OnClic binding = EditBoxDialogBinding.inflate(inflater, null, false) val view: View = binding.root - viewThemeUtils.material.colorTextInputLayout(binding.userInputContainer) binding.userInput.setText(publicShare?.label) val builder = MaterialAlertDialogBuilder(view.context) @@ -78,7 +60,8 @@ class RenamePublicShareDialogFragment : DialogFragment(), DialogInterface.OnClic .setNegativeButton(R.string.common_cancel, this) .setTitle(R.string.public_share_name) - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInput.context, builder) + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(binding.userInput.context, builder) return builder.create() } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.kt b/app/src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.kt index 5a8483f59f02..3c3e355d435c 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.kt @@ -27,6 +27,7 @@ import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.utils.extensions.getParcelableArgument +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 @@ -85,7 +86,7 @@ class ShareLinkToDialog : DialogFragment() { R.string.activity_chooser_title } - return MaterialAlertDialogBuilder(requireActivity()) + val builder = MaterialAlertDialogBuilder(requireActivity()) .setTitle(titleId) .setAdapter(mAdapter) { _, which -> // Add the information of the chosen activity to the intent to send @@ -98,7 +99,9 @@ class ShareLinkToDialog : DialogFragment() { mIntent?.setComponent(name) activity?.startActivity(mIntent) } - .create() + // NMC Customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireContext(), builder) + return builder.create() } internal inner class ActivityAdapter( 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 2c73b3a92d58..ea58b0119fd3 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 @@ -16,12 +16,12 @@ import android.content.DialogInterface 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.nextcloud.utils.extensions.getParcelableArgument +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.PasswordDialogBinding import com.owncloud.android.datamodel.OCFile @@ -59,38 +59,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() } } } @@ -113,7 +98,6 @@ class SharePasswordDialogFragment : DialogFragment(), Injectable { // Setup layout binding?.sharePassword?.setText(R.string.empty) - viewThemeUtils?.material?.colorTextInputLayout(binding!!.sharePasswordContainer) val neutralButtonTextId: Int val title: Int @@ -137,7 +121,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 8a593cabf541..a2e7c909c0e9 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 @@ -15,6 +15,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 @@ -78,7 +79,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.kt b/app/src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.kt index 76bd0aaea843..22ce883e96d6 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.kt @@ -23,6 +23,7 @@ import android.widget.Button 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.SslUntrustedCertLayoutBinding import com.owncloud.android.lib.common.network.CertificateCombinedException @@ -103,7 +104,8 @@ open class SslUntrustedCertDialog : DialogFragment(), Injectable { setView(layoutBinding.getRoot()) } - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireContext(), builder) + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireContext(), builder) return builder.create().apply { 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 220f28edd680..65ddb9cf4050 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 @@ -12,12 +12,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 @@ -43,22 +43,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 @@ -86,7 +70,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 aba0d565d8f6..b0f905867662 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 @@ -19,6 +19,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 @@ -95,7 +96,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() } @@ -154,10 +156,6 @@ class SyncedFolderPreferencesDialogFragment : DialogFragment(), Injectable { binding.settingInstantUploadPathUseSubfoldersCheckbox, binding.settingInstantUploadExcludeHiddenCheckbox ) - - viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(binding.btnPositive) - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(binding.btnNegative) - viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(binding.btnNeutral) } private fun setButtonOrder(binding: SyncedFoldersSettingsLayoutBinding) { @@ -416,7 +414,8 @@ class SyncedFolderPreferencesDialogFragment : DialogFragment(), Injectable { } behaviourDialogShown = true - viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireActivity(), builder) + //NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireActivity(), builder) behaviourDialog = builder.create() behaviourDialog?.show() @@ -435,7 +434,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/dialog/setupEncryption/SetupEncryptionDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/setupEncryption/SetupEncryptionDialogFragment.kt index becfda347fa9..c46c62ae0b16 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/setupEncryption/SetupEncryptionDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/setupEncryption/SetupEncryptionDialogFragment.kt @@ -24,6 +24,7 @@ import com.nextcloud.client.account.User import com.nextcloud.client.di.Injectable import com.nextcloud.client.network.ClientFactory import com.nextcloud.utils.extensions.getParcelableArgument +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.SetupEncryptionDialogBinding import com.owncloud.android.datamodel.ArbitraryDataProvider @@ -81,15 +82,8 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { val alertDialog = dialog as AlertDialog? if (alertDialog != null) { - positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as? MaterialButton? - positiveButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryTonal(it) - } - - negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as? MaterialButton? - negativeButton?.let { - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(it) - } + positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton? + negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton? } } @@ -113,11 +107,9 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { val inflater = requireActivity().layoutInflater binding = SetupEncryptionDialogBinding.inflate(inflater, null, false) - // Setup layout - viewThemeUtils.material.colorTextInputLayout(binding.encryptionPasswordInputContainer) - val builder = buildMaterialAlertDialog(binding.root) - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(requireContext(), builder) + // NMC customization + DialogThemeUtils.colorMaterialAlertDialogBackground(requireContext(), builder) return builder.create().apply { setCanceledOnTouchOutside(false) setOnShowListener { dialog1: DialogInterface -> @@ -501,7 +493,6 @@ 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 @@ -509,12 +500,6 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { positiveButton?.visibility = View.VISIBLE negativeButton?.visibility = View.VISIBLE - positiveButton?.let { positiveButton -> - negativeButton?.let { negativeButton -> - viewThemeUtils.platform.colorTextButtons(positiveButton, negativeButton) - } - } - keyResult = KEY_GENERATE } @@ -532,9 +517,6 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable { positiveButton?.setText(R.string.end_to_end_encryption_dialog_close) positiveButton?.visibility = View.VISIBLE - positiveButton?.let { - viewThemeUtils.platform.colorTextButtons(it) - } } @VisibleForTesting 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 52e7d03b695b..65d6b5c0cf81 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 @@ -515,6 +515,7 @@ class BackupFragment : FileFragment(), OnDateSetListener, Injectable { datePickerDialog = DatePickerDialog( contactsPreferenceActivity, + R.style.FallbackDatePickerDialogTheme, this, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 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 524b1912bde4..6746603f29da 100644 --- a/app/src/main/res/layout/choose_template.xml +++ b/app/src/main/res/layout/choose_template.xml @@ -36,6 +36,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/passcodelock.xml b/app/src/main/res/layout/passcodelock.xml index 122799f941c6..5a6b32baffe2 100644 --- a/app/src/main/res/layout/passcodelock.xml +++ b/app/src/main/res/layout/passcodelock.xml @@ -22,6 +22,7 @@ android:layout_gravity="center" android:layout_margin="@dimen/standard_double_margin" card_view:strokeWidth="0dp" + card_view:cardBackgroundColor="@color/alert_bg_color" card_view:cardCornerRadius="16dp" card_view:cardElevation="@dimen/dialog_elevation"> diff --git a/app/src/main/res/layout/password_dialog.xml b/app/src/main/res/layout/password_dialog.xml index 81721b41455b..cf874782cb10 100644 --- a/app/src/main/res/layout/password_dialog.xml +++ b/app/src/main/res/layout/password_dialog.xml @@ -22,7 +22,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 66a8403fe7dd..7d4b91d07846 100644 --- a/app/src/main/res/layout/setup_encryption_dialog.xml +++ b/app/src/main/res/layout/setup_encryption_dialog.xml @@ -49,6 +49,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 2b506d49cede..cc545e08dc8d 100644 --- a/app/src/main/res/layout/storage_path_item.xml +++ b/app/src/main/res/layout/storage_path_item.xml @@ -15,6 +15,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 ca1e0bacb223..9df0a6e256b7 100755 --- a/app/src/main/res/layout/upload_file_dialog.xml +++ b/app/src/main/res/layout/upload_file_dialog.xml @@ -34,6 +34,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-de/strings.xml b/app/src/main/res/values-de/strings.xml index 947a61daeb76..102179c9092a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -219,6 +219,7 @@ Zu sichernde Daten Zugangsdaten falsch Benutzerkonto löschen + Konto %s und alle lokalen Dateien löschen?\n\nLöschung kann nicht rückgängig gemacht werden. Einträgen entfernen Link löschen Auswahl aufheben diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 1ce3f0da4f73..2f79b79712ed 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -36,4 +36,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-night/themes.xml b/app/src/main/res/values-night/themes.xml index 19b3ce692520..a35b19c79d66 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -10,6 +10,8 @@ + + + + + + +