diff --git a/app/src/main/java/com/nmc/android/utils/FabThemeUtils.kt b/app/src/main/java/com/nmc/android/utils/FabThemeUtils.kt new file mode 100644 index 000000000000..a8662285ea47 --- /dev/null +++ b/app/src/main/java/com/nmc/android/utils/FabThemeUtils.kt @@ -0,0 +1,40 @@ +package com.nmc.android.utils + +import android.content.Context +import android.content.res.ColorStateList +import android.graphics.Color +import com.google.android.material.floatingactionbutton.FloatingActionButton +import com.owncloud.android.R + +object FabThemeUtils { + @JvmStatic + fun colorFloatingActionButton( + context: Context, + button: FloatingActionButton + ) { + val primaryColor = context.resources.getColor(R.color.primary, null) + val disableColor = context.resources.getColor(R.color.grey_0, null) + + val bgStates = arrayOf( + intArrayOf(android.R.attr.state_enabled), + intArrayOf(-android.R.attr.state_enabled), + ) + val bgColors = intArrayOf( + primaryColor, + disableColor + ) + + button.backgroundTintList = ColorStateList(bgStates, bgColors) + + val imageStates = arrayOf( + intArrayOf(android.R.attr.state_enabled), + intArrayOf(-android.R.attr.state_enabled), + ) + val imageColors = intArrayOf( + Color.WHITE, + disableColor + ) + + button.imageTintList = ColorStateList(imageStates, imageColors) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java b/app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java index c21c2596bbb9..34672241680f 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java @@ -85,7 +85,6 @@ public void onUrlLoaded(String loadedUrl) { R.string.timeout_richDocuments, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.common_cancel, v -> closeView()); - viewThemeUtils.material.themeSnackbar(snackbar); setLoadingSnackbar(snackbar); snackbar.show(); } diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java index 8f3faef62125..16a3e7ee7b27 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java @@ -724,7 +724,6 @@ public static void copyAndShareFileLink(FileActivity activity, Snackbar snackbar = Snackbar.make(activity.findViewById(android.R.id.content), R.string.clipboard_text_copied, Snackbar.LENGTH_LONG) .setAction(R.string.share, v -> showShareLinkDialog(activity, file, link)); - viewThemeUtils.material.themeSnackbar(snackbar); snackbar.show(); } } @@ -794,7 +793,6 @@ private void onUpdateShareInformation(RemoteOperationResult result, @StringRes i snackbar = Snackbar.make(sharingFragment.getView(), result.getMessage(), Snackbar.LENGTH_LONG); } - viewThemeUtils.material.themeSnackbar(snackbar); snackbar.show(); } } @@ -871,7 +869,6 @@ private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation ope operation, getResources()), Snackbar.LENGTH_LONG); - viewThemeUtils.material.themeSnackbar(snackbar); snackbar.show(); } } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 812974d98083..ce426e81c948 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -56,6 +56,7 @@ import com.nextcloud.common.NextcloudClient; import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.utils.EditorUtils; +import com.nmc.android.utils.FabThemeUtils; import com.nextcloud.utils.ShortcutUtil; import com.nextcloud.utils.extensions.BundleExtensionsKt; import com.nextcloud.utils.extensions.FileExtensionsKt; @@ -337,7 +338,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, if (mFabMain != null) { // is not available in FolderPickerActivity - viewThemeUtils.material.themeFAB(mFabMain); + //NMC customization + FabThemeUtils.colorFloatingActionButton(requireContext(), mFabMain); } Log_OC.i(TAG, "onCreateView() end"); @@ -489,7 +491,8 @@ public void registerFabListener() { if (mFabMain != null) { // is not available in FolderPickerActivity - viewThemeUtils.material.themeFAB(mFabMain); + //NMC customization + FabThemeUtils.colorFloatingActionButton(requireContext(), mFabMain); mFabMain.setOnClickListener(v -> { final OCFileListBottomSheetDialog dialog = new OCFileListBottomSheetDialog(activity, @@ -2177,7 +2180,8 @@ public void setFabVisible(final boolean visible) { getActivity().runOnUiThread(() -> { if (visible) { mFabMain.show(); - viewThemeUtils.material.themeFAB(mFabMain); + //NMC customization + FabThemeUtils.colorFloatingActionButton(requireContext(), mFabMain); } else { mFabMain.hide(); } @@ -2227,10 +2231,12 @@ public void setFabEnabled(final boolean enabled) { getActivity().runOnUiThread(() -> { if (enabled) { mFabMain.setEnabled(true); - viewThemeUtils.material.themeFAB(mFabMain); + //NMC customization + FabThemeUtils.colorFloatingActionButton(requireContext(), mFabMain); } else { mFabMain.setEnabled(false); - viewThemeUtils.material.themeFAB(mFabMain); + //NMC customization + FabThemeUtils.colorFloatingActionButton(requireContext(), mFabMain); } }); } diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java index b9aa3f092a5f..9dcd02cd2fbc 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java @@ -19,6 +19,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.nextcloud.android.lib.richWorkspace.RichWorkspaceDirectEditingRemoteOperation; import com.nextcloud.utils.extensions.FileExtensionsKt; +import com.nmc.android.utils.FabThemeUtils; import com.owncloud.android.R; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.ui.activity.FileDisplayActivity; @@ -85,7 +86,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, fabMain.setOnClickListener(v -> edit()); fabMain.setImageResource(R.drawable.ic_edit); - viewThemeUtils.material.themeFAB(fabMain); + //NMC customization + FabThemeUtils.colorFloatingActionButton(requireActivity(), fabMain); return view; } diff --git a/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt b/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt index 71c2217d5fde..e40cce3006ae 100644 --- a/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt +++ b/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt @@ -178,7 +178,7 @@ object PermissionUtil { Snackbar.LENGTH_INDEFINITE ).setAction(R.string.common_ok) { doRequest() - }.also { viewThemeUtils.material.themeSnackbar(it) }.show() + }.show() } else { // No explanation needed, request the permission. doRequest() diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 8972d2bb6716..6488018f11a5 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -38,4 +38,68 @@ @android:color/white #101418 + + + #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..eb839d0b746f 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -19,6 +19,10 @@ false true true + + @style/SnackBarBackgroundStyle + @style/SnackBarActionButtonStyle + @style/SnackBarTextViewStyle @style/Widget.App.TextInputLayout @style/Nextcloud.Widget.PopupMenu @style/ThemeOverlay.App.BottomSheetDialog diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e0da603d4f8a..66637ab603ae 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -78,4 +78,93 @@ #A5A5A5 #F7F9FF + + + #191919 + @color/primary + #191919 + #191919 + @color/grey_30 + @android:color/white + #FFFFFF + @color/grey_0 + #CCCCCC + #77c4ff + #B3FFFFFF + @color/grey_10 + + + #101010 + #F2F2F2 + #E5E5E5 + #B2B2B2 + #666666 + #4C4C4C + #333333 + + + @color/design_snackbar_background_color + @color/white + + + #FFFFFF + #191919 + + + @color/grey_0 + #191919 + @color/primary + #191919 + @color/primary + @color/grey_30 + @color/white + #191919 + + + #FFFFFF + #191919 + #191919 + + + #FFFFFF + #191919 + #FFFFFF + + + @color/primary + #F399C7 + #FFFFFF + @color/grey_30 + @color/grey_10 + @color/grey_0 + + + @color/primary + @color/grey_30 + @color/grey_30 + #CCCCCC + + + #191919 + @color/grey_30 + #191919 + #191919 + #191919 + #191919 + @color/grey_30 + #191919 + #000000 + #191919 + #F6E5EB + #C16F81 + #0D39DF + #0099ff + + + @color/grey_0 + #191919 + @color/grey_0 + @color/grey_30 + #77b6bb + #5077b6bb diff --git a/app/src/main/res/values/nmc_snackbar_styles.xml b/app/src/main/res/values/nmc_snackbar_styles.xml new file mode 100644 index 000000000000..23aadc577694 --- /dev/null +++ b/app/src/main/res/values/nmc_snackbar_styles.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 08ebf4b5f8c7..28413ddad479 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -27,6 +27,10 @@ @color/primary_dark @color/secondary_text_color @style/ownCloud.SearchView + + @style/SnackBarBackgroundStyle + @style/SnackBarActionButtonStyle + @style/SnackBarTextViewStyle @color/action_mode_background @style/FallbackDatePickerDialogTheme @color/bg_default @@ -45,6 +49,10 @@ @color/bg_default @color/secondary_text_color @style/FallbackTheming.Dialog + + @style/SnackBarBackgroundStyle + @style/SnackBarActionButtonStyle + @style/SnackBarTextViewStyle @color/action_mode_background @style/FallbackDatePickerDialogTheme @color/bg_default @@ -279,6 +287,10 @@