From 411f2816304cb5075ff0ce653c0ddbeb25e7845d Mon Sep 17 00:00:00 2001 From: A117870935 Date: Mon, 12 Jun 2023 14:24:37 +0530 Subject: [PATCH] NMC-2256: Progress and seek bar customized. NMC-2041: SwipeRefreshLayout Customized. --- .../client/logger/ui/LogsActivity.kt | 4 +- .../android/utils/ProgressBarThemeUtils.kt | 35 ++++++++ .../android/utils/SwipeRefreshThemeUtils.kt | 13 +++ .../authentication/AuthenticatorActivity.java | 1 - .../android/media/MediaControlView.kt | 4 +- .../ui/activity/NotificationsActivity.kt | 7 +- .../ui/activity/UploadListActivity.java | 4 +- .../android/ui/adapter/UploadListAdapter.java | 5 +- .../ui/fragment/ExtendedListFragment.java | 4 +- .../FileDetailActivitiesFragment.java | 6 +- .../ui/fragment/FileDetailFragment.java | 4 +- .../ui/preview/FileDownloadFragment.java | 4 +- .../android/ui/trashbin/TrashbinActivity.kt | 4 +- app/src/main/res/values-night/colors.xml | 64 +++++++++++++ app/src/main/res/values/colors.xml | 89 +++++++++++++++++++ 15 files changed, 235 insertions(+), 13 deletions(-) create mode 100644 app/src/main/java/com/nmc/android/utils/ProgressBarThemeUtils.kt create mode 100644 app/src/main/java/com/nmc/android/utils/SwipeRefreshThemeUtils.kt diff --git a/app/src/main/java/com/nextcloud/client/logger/ui/LogsActivity.kt b/app/src/main/java/com/nextcloud/client/logger/ui/LogsActivity.kt index 642d22ba0fcc..59eb58a84181 100644 --- a/app/src/main/java/com/nextcloud/client/logger/ui/LogsActivity.kt +++ b/app/src/main/java/com/nextcloud/client/logger/ui/LogsActivity.kt @@ -21,6 +21,7 @@ import com.owncloud.android.R import com.owncloud.android.databinding.LogsActivityBinding import com.owncloud.android.ui.activity.ToolbarActivity import com.owncloud.android.utils.theme.ViewThemeUtils +import com.nmc.android.utils.ProgressBarThemeUtils import javax.inject.Inject class LogsActivity : ToolbarActivity() { @@ -55,7 +56,8 @@ class LogsActivity : ToolbarActivity() { } findViewById(R.id.logs_loading_progress).apply { - viewThemeUtils.platform.themeHorizontalProgressBar(this) + //NMC Customization + ProgressBarThemeUtils.themeHorizontalProgressBar(this, resources.getColor(R.color.primary, null)) } logsAdapter = LogsAdapter(this) diff --git a/app/src/main/java/com/nmc/android/utils/ProgressBarThemeUtils.kt b/app/src/main/java/com/nmc/android/utils/ProgressBarThemeUtils.kt new file mode 100644 index 000000000000..4e22fadaf854 --- /dev/null +++ b/app/src/main/java/com/nmc/android/utils/ProgressBarThemeUtils.kt @@ -0,0 +1,35 @@ +/* + * Nextcloud - Android Client + * + * SPDX-FileCopyrightText: 2024 Your Name + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +package com.nmc.android.utils + +import android.widget.ProgressBar +import android.widget.SeekBar +import androidx.annotation.ColorInt +import androidx.core.graphics.BlendModeColorFilterCompat +import androidx.core.graphics.BlendModeCompat + +/** + * theming progress and seek bar for NMC + */ +object ProgressBarThemeUtils { + + @JvmStatic + fun themeHorizontalSeekBar(seekBar: SeekBar, @ColorInt color: Int) { + themeHorizontalProgressBar(seekBar, color) + seekBar.thumb.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_IN) + } + + @JvmStatic + fun themeHorizontalProgressBar(progressBar: ProgressBar?, @ColorInt color: Int) { + progressBar?.indeterminateDrawable?.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_IN) + progressBar?.progressDrawable?.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_IN) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/nmc/android/utils/SwipeRefreshThemeUtils.kt b/app/src/main/java/com/nmc/android/utils/SwipeRefreshThemeUtils.kt new file mode 100644 index 000000000000..aff1a97a32d0 --- /dev/null +++ b/app/src/main/java/com/nmc/android/utils/SwipeRefreshThemeUtils.kt @@ -0,0 +1,13 @@ +package com.nmc.android.utils + +import android.content.Context +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import com.owncloud.android.R + +object SwipeRefreshThemeUtils { + @JvmStatic + fun themeSwipeRefreshLayout(context: Context, swipeRefreshLayout: SwipeRefreshLayout) { + swipeRefreshLayout.setColorSchemeColors(context.resources.getColor(R.color.primary, null)) + swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.refresh_layout_bg_color) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java b/app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java index 7f12948467c5..482d520ab324 100644 --- a/app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -497,7 +497,6 @@ private static String getWebLoginUserAgent() { @SuppressFBWarnings("ANDROID_WEB_VIEW_JAVASCRIPT") @SuppressLint("SetJavaScriptEnabled") private void initWebViewLogin(String baseURL, boolean useGenericUserAgent) { - viewThemeUtils.platform.colorCircularProgressBar(accountSetupWebviewBinding.loginWebviewProgressBar, ColorRole.ON_PRIMARY_CONTAINER); accountSetupWebviewBinding.loginWebview.setVisibility(View.GONE); new WebViewUtil(this).setProxyKKPlus(accountSetupWebviewBinding.loginWebview); diff --git a/app/src/main/java/com/owncloud/android/media/MediaControlView.kt b/app/src/main/java/com/owncloud/android/media/MediaControlView.kt index 217c1c153501..574a6c3a607b 100644 --- a/app/src/main/java/com/owncloud/android/media/MediaControlView.kt +++ b/app/src/main/java/com/owncloud/android/media/MediaControlView.kt @@ -27,6 +27,7 @@ import android.widget.SeekBar import android.widget.SeekBar.OnSeekBarChangeListener import androidx.core.content.ContextCompat import androidx.media3.common.Player +import com.nmc.android.utils.ProgressBarThemeUtils import com.owncloud.android.MainApp import com.owncloud.android.R import com.owncloud.android.databinding.MediaControlBinding @@ -81,7 +82,8 @@ class MediaControlView(context: Context, attrs: AttributeSet?) : binding.rewindBtn.setOnClickListener(this) binding.progressBar.run { - viewThemeUtils.platform.themeHorizontalSeekBar(this) + // NMC Customization + ProgressBarThemeUtils.themeHorizontalSeekBar(this, resources.getColor(R.color.primary, null)) setMax(1000) } diff --git a/app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.kt index 1840ca079c76..7f27b892473e 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.kt @@ -27,6 +27,7 @@ import com.nextcloud.client.network.ClientFactory import com.nextcloud.client.network.ClientFactory.CreationException import com.nextcloud.client.preferences.AppPreferences import com.nextcloud.common.NextcloudClient +import com.nmc.android.utils.SwipeRefreshThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.NotificationsLayoutBinding import com.owncloud.android.datamodel.ArbitraryDataProvider @@ -128,8 +129,10 @@ class NotificationsActivity : AppCompatActivity(), NotificationsContract.View, I } private fun setupContainingList() { - viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingList) - viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingEmpty) + //NMC Customisation + SwipeRefreshThemeUtils.themeSwipeRefreshLayout(this, binding.swipeContainingList); + SwipeRefreshThemeUtils.themeSwipeRefreshLayout(this, binding.swipeContainingEmpty); + binding.swipeContainingList.setOnRefreshListener { setLoadingMessage() binding.swipeContainingList.isRefreshing = true diff --git a/app/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java index f18270acf77d..6821d409790e 100755 --- a/app/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java @@ -30,6 +30,7 @@ import com.nextcloud.client.utils.Throttler; import com.nextcloud.model.WorkerState; import com.nextcloud.model.WorkerStateLiveData; +import com.nmc.android.utils.SwipeRefreshThemeUtils; import com.owncloud.android.R; import com.owncloud.android.databinding.UploadListLayoutBinding; import com.owncloud.android.datamodel.OCFile; @@ -170,7 +171,8 @@ private void setupContent() { binding.list.setLayoutManager(lm); binding.list.setAdapter(uploadListAdapter); - viewThemeUtils.androidx.themeSwipeRefreshLayout(swipeListRefreshLayout); + //NMC Customisation + SwipeRefreshThemeUtils.themeSwipeRefreshLayout(this, swipeListRefreshLayout); swipeListRefreshLayout.setOnRefreshListener(this::refresh); loadItems(); diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java index e4d08e2335d6..af70279cf787 100755 --- a/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java @@ -30,6 +30,7 @@ import com.nextcloud.client.jobs.upload.FileUploadHelper; import com.nextcloud.client.jobs.upload.FileUploadWorker; import com.nextcloud.client.network.ConnectivityService; +import com.nmc.android.utils.ProgressBarThemeUtils; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.databinding.UploadListHeaderBinding; @@ -361,7 +362,9 @@ public void onBindViewHolder(SectionedViewHolder holder, int section, int relati String status = getStatusText(item); switch (item.getUploadStatus()) { case UPLOAD_IN_PROGRESS -> { - viewThemeUtils.platform.themeHorizontalProgressBar(itemViewHolder.binding.uploadProgressBar); + // NMC Customization + ProgressBarThemeUtils.themeHorizontalProgressBar(itemViewHolder.binding.uploadProgressBar, + holder.itemView.getContext().getResources().getColor(R.color.primary, null)); itemViewHolder.binding.uploadProgressBar.setProgress(0); itemViewHolder.binding.uploadProgressBar.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 8922e792958b..69f5ebc4da51 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -46,6 +46,7 @@ import com.nextcloud.client.preferences.AppPreferences; import com.nextcloud.client.preferences.AppPreferencesImpl; import com.nextcloud.utils.extensions.FragmentExtensionsKt; +import com.nmc.android.utils.SwipeRefreshThemeUtils; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.databinding.ListFragmentBinding; @@ -350,7 +351,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, // Pull-down to refresh layout mRefreshListLayout = binding.swipeContainingList; - viewThemeUtils.androidx.themeSwipeRefreshLayout(mRefreshListLayout); + //NMC Customisation + SwipeRefreshThemeUtils.themeSwipeRefreshLayout(requireContext(), mRefreshListLayout); mRefreshListLayout.setOnRefreshListener(this); mSortButton = getActivity().findViewById(R.id.sort_button); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java index 68618877fa33..51b96fee5201 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java @@ -24,6 +24,7 @@ import com.nextcloud.common.NextcloudClient; import com.nextcloud.utils.extensions.BundleExtensionsKt; import com.nextcloud.utils.extensions.FileExtensionsKt; +import com.nmc.android.utils.SwipeRefreshThemeUtils; import com.owncloud.android.R; import com.owncloud.android.databinding.FileDetailsActivitiesFragmentBinding; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -130,8 +131,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, setupView(); - viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingEmpty); - viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingList); + //NMC Customisation + SwipeRefreshThemeUtils.themeSwipeRefreshLayout(requireContext(), binding.swipeContainingEmpty); + SwipeRefreshThemeUtils.themeSwipeRefreshLayout(requireContext(), binding.swipeContainingList); isLoadingActivities = true; fetchAndSetData(-1); diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index edd6262df96a..9602cdb72a46 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -59,6 +59,7 @@ import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.EncryptionUtils; import com.owncloud.android.utils.MimeTypeUtil; +import com.nmc.android.utils.ProgressBarThemeUtils; import com.owncloud.android.utils.theme.ViewThemeUtils; import org.greenrobot.eventbus.EventBus; @@ -256,7 +257,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { if (getFile() != null && user != null) { - viewThemeUtils.platform.themeHorizontalProgressBar(binding.progressBar); + //NMC Customization + ProgressBarThemeUtils.themeHorizontalProgressBar(binding.progressBar, getResources().getColor(R.color.primary, null)); progressListener = new ProgressListener(binding.progressBar); binding.cancelBtn.setOnClickListener(this); binding.favorite.setOnClickListener(this); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java index 3004dce0fd36..c87943afafe3 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java @@ -25,6 +25,7 @@ import com.nextcloud.client.jobs.download.FileDownloadHelper; import com.nextcloud.utils.extensions.BundleExtensionsKt; import com.nextcloud.utils.extensions.FileExtensionsKt; +import com.nmc.android.utils.ProgressBarThemeUtils; import com.owncloud.android.R; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.network.OnDatatransferProgressListener; @@ -139,7 +140,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, mView = inflater.inflate(R.layout.file_download_fragment, container, false); ProgressBar progressBar = mView.findViewById(R.id.progressBar); - viewThemeUtils.platform.themeHorizontalProgressBar(progressBar); + //NMC Customization + ProgressBarThemeUtils.themeHorizontalProgressBar(progressBar, getResources().getColor(R.color.primary, null)); mProgressListener = new ProgressListener(progressBar); (mView.findViewById(R.id.cancelBtn)).setOnClickListener(this); diff --git a/app/src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.kt b/app/src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.kt index aa16d47b8876..bc270dda8b49 100644 --- a/app/src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.kt @@ -34,6 +34,7 @@ import com.nextcloud.client.network.ClientFactory import com.nextcloud.client.preferences.AppPreferences import com.nextcloud.client.utils.Throttler import com.nextcloud.ui.trashbinFileActions.TrashbinFileActionsBottomSheet +import com.nmc.android.utils.SwipeRefreshThemeUtils import com.owncloud.android.R import com.owncloud.android.databinding.TrashbinActivityBinding import com.owncloud.android.datamodel.SyncedFolderProvider @@ -159,7 +160,8 @@ class TrashbinActivity : recyclerView.setHasFooter(true) recyclerView.layoutManager = LinearLayoutManager(this) - viewThemeUtils?.androidx?.themeSwipeRefreshLayout(binding.swipeContainingList) + // NMC Customisation + SwipeRefreshThemeUtils.themeSwipeRefreshLayout(this, binding.swipeContainingList) binding.swipeContainingList.setOnRefreshListener { loadFolder() } viewThemeUtils?.material?.colorMaterialTextButton(findViewById(R.id.sort_button)) 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/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