From 43b284923d03be9ada9050a82d3290e02eec4b86 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 | 10 +- .../LocalStoragePathPickerDialogFragment.kt | 16 +- .../ui/dialog/RemoveFilesDialogFragment.java | 21 --- .../ui/dialog/RenameFileDialogFragment.java | 9 +- .../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.kt | 4 +- .../dialog/StoragePermissionDialogFragment.kt | 21 +-- .../SyncedFolderPreferencesDialogFragment.kt | 14 +- .../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 | 33 +++- app/src/main/res/values/themes.xml | 2 + 38 files changed, 348 insertions(+), 336 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 c11ce5bcb7d4..c390db7f47f1 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 @@ -835,11 +835,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 374083ce4c5d..0266e62134d7 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 e04d85944095..bf28647cb352 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 - 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 b910dee305f3..1c1d4bb303e3 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 @@ -31,6 +31,7 @@ import com.nextcloud.client.di.Injectable; import com.nextcloud.client.network.ClientFactory; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nmc.android.utils.DialogThemeUtils; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.databinding.ChooseTemplateBinding; @@ -117,17 +118,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(); } @@ -169,8 +162,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); @@ -210,7 +201,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 0329717c61d6..0a3119541bc8 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 @@ -30,6 +30,7 @@ import com.nextcloud.client.di.Injectable import com.nextcloud.client.network.ClientFactory import com.nextcloud.client.network.ClientFactory.CreationException import com.nextcloud.utils.extensions.getParcelableArgument +import com.nmc.android.utils.DialogThemeUtils import com.owncloud.android.MainApp import com.owncloud.android.R import com.owncloud.android.databinding.ChooseTemplateBinding @@ -91,10 +92,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 @@ -129,10 +126,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 @@ -166,7 +159,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 461e0c5aa5c0..39b8e545733f 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 958d231cda10..02a01b4b6d15 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 @@ -25,6 +25,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.common.collect.Sets 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.datamodel.FileDataStorageManager @@ -69,10 +70,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) } } @@ -93,7 +90,6 @@ class CreateFolderDialogFragment : DialogFragment(), DialogInterface.OnClickList // Setup layout binding.userInput.setText("") - viewThemeUtils?.material?.colorTextInputLayout(binding.userInputContainer) val parentFolder = requireArguments().getParcelableArgument(ARG_PARENT_FOLDER, OCFile::class.java) @@ -142,7 +138,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 e43b325af5de..ba9c9de60b90 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 1d7534219358..c2fe32014f95 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 5eede7d3fdcf..a8e6cdc72cf7 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 52e02a085205..da28db70d8b8 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.java b/app/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java index e8ec640f96a3..5c4c03584b2e 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 @@ -26,7 +26,6 @@ import java.util.Collection; import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; /** * Dialog requiring confirmation before removing a collection of given OCFiles. @@ -119,26 +118,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 8572166cef0c..2834f1a6831e 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 @@ -24,6 +24,7 @@ import com.google.common.collect.Sets; import com.nextcloud.client.di.Injectable; import com.nextcloud.utils.extensions.BundleExtensionsKt; +import com.nmc.android.utils.DialogThemeUtils; import com.owncloud.android.R; import com.owncloud.android.databinding.EditBoxDialogBinding; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -102,7 +103,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); @@ -121,7 +121,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { // Build the dialog MaterialAlertDialogBuilder builder = buildMaterialAlertDialog(view); - viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInputContainer.getContext(), builder); + // NMC Customization + DialogThemeUtils.INSTANCE.colorMaterialAlertDialogBackground(requireContext(), builder); return builder.create(); } @@ -143,10 +144,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 f01ef6cb9b6a..06dca3c627b3 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 @@ -18,6 +18,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.nextcloud.client.di.Injectable; import com.nextcloud.utils.extensions.BundleExtensionsKt; +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; @@ -54,20 +55,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(); @@ -85,7 +72,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 @@ -95,7 +81,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 bce0ba7b27d2..08e14eba3f33 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 @@ -28,6 +28,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.nextcloud.client.account.User 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.SetupEncryptionDialogBinding import com.owncloud.android.datamodel.ArbitraryDataProvider @@ -79,14 +80,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!!) - } } } @@ -110,9 +103,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) } @@ -125,7 +115,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) @@ -487,13 +478,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 } @@ -511,10 +500,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 0ed3cf12344b..0f447cddad39 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 @@ -27,6 +27,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.nextcloud.utils.extensions.BundleExtensionsKt; +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; @@ -133,6 +134,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 a7f8a5cb84b7..9b2ac391a6a1 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("") - 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 fbf786da5622..494e22fc112c 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 2324713791f1..3ef8c5000120 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 0d2984c16348..660f87b6a5b3 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 950dbe0a69d1..b59c30ce8ebc 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/fragment/contactsbackup/BackupFragment.kt b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.kt index 475593fff575..3fbc29045f89 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 70808a08f94e..a91d4e713615 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 59096d647ea9..d035caa8b633 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 3a88e107767e..384c623d1264 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 d1cf2b6d9bff..cb45683753c8 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 09ec001fed3f..eb4dc700009e 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 fc25c06767c2..8c972d054d2c 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 6006d82ab53b..a8383f6d6d22 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -216,6 +216,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 e9c749b86943..76e4e05ca495 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 e8e9719ea7a9..0059c8935ea6 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -10,6 +10,8 @@ + + + + + + +