From 70565acc655672da9cf2658e1a650cf77be0cfb6 Mon Sep 17 00:00:00 2001 From: A117870935 Date: Mon, 12 Jun 2023 14:24:37 +0530 Subject: [PATCH] Progress and seek bar customized. --- .../client/logger/ui/LogsActivity.kt | 4 ++- .../android/ui/utils/ProgressBarThemeUtils.kt | 28 +++++++++++++++++++ .../android/media/MediaControlView.java | 4 ++- .../android/ui/adapter/UploadListAdapter.java | 5 +++- .../ui/fragment/FileDetailFragment.java | 4 ++- .../ui/preview/FileDownloadFragment.java | 4 ++- 6 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 app/src/main/java/com/nmc/android/ui/utils/ProgressBarThemeUtils.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 183b8fe00600..2bdd352884c3 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 @@ -34,6 +34,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.ui.utils.ProgressBarThemeUtils import javax.inject.Inject class LogsActivity : ToolbarActivity() { @@ -68,7 +69,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/ui/utils/ProgressBarThemeUtils.kt b/app/src/main/java/com/nmc/android/ui/utils/ProgressBarThemeUtils.kt new file mode 100644 index 000000000000..ea274bb68c3a --- /dev/null +++ b/app/src/main/java/com/nmc/android/ui/utils/ProgressBarThemeUtils.kt @@ -0,0 +1,28 @@ +package com.nmc.android.ui.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/owncloud/android/media/MediaControlView.java b/app/src/main/java/com/owncloud/android/media/MediaControlView.java index bd5e0bca930e..9622c2d1d1cf 100644 --- a/app/src/main/java/com/owncloud/android/media/MediaControlView.java +++ b/app/src/main/java/com/owncloud/android/media/MediaControlView.java @@ -35,6 +35,7 @@ import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; +import com.nmc.android.ui.utils.ProgressBarThemeUtils; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.databinding.MediaControlBinding; @@ -108,7 +109,8 @@ private void initControllerView() { binding.rewindBtn.setOnClickListener(this); - viewThemeUtils.platform.themeHorizontalSeekBar(binding.progressBar); + //NMC Customization + ProgressBarThemeUtils.themeHorizontalSeekBar(binding.progressBar, getResources().getColor(R.color.primary, null)); binding.progressBar.setOnSeekBarChangeListener(this); binding.progressBar.setMax(1000); } 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 0298ef49bc0e..a8891aee4b15 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 @@ -44,6 +44,7 @@ import com.nextcloud.client.device.PowerManagementService; import com.nextcloud.client.network.ConnectivityService; import com.nextcloud.java.util.Optional; +import com.nmc.android.ui.utils.ProgressBarThemeUtils; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.databinding.UploadListHeaderBinding; @@ -271,7 +272,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/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index 76b5393ecf4c..31f307891268 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 @@ -74,6 +74,7 @@ import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.EncryptionUtils; import com.owncloud.android.utils.MimeTypeUtil; +import com.nmc.android.ui.utils.ProgressBarThemeUtils; import com.owncloud.android.utils.theme.ViewThemeUtils; import org.greenrobot.eventbus.EventBus; @@ -257,7 +258,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 ffca7c685a83..907041a9eb50 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 @@ -29,6 +29,7 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.di.Injectable; +import com.nmc.android.ui.utils.ProgressBarThemeUtils; import com.owncloud.android.R; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.network.OnDatatransferProgressListener; @@ -143,7 +144,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);