Skip to content

Commit

Permalink
Progress and seek bar customized.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Sep 25, 2024
1 parent 985d4c2 commit 5926e64
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.ui.utils.ProgressBarThemeUtils
import javax.inject.Inject

class LogsActivity : ToolbarActivity() {
Expand Down Expand Up @@ -55,7 +56,8 @@ class LogsActivity : ToolbarActivity() {
}

findViewById<ProgressBar>(R.id.logs_loading_progress).apply {
viewThemeUtils.platform.themeHorizontalProgressBar(this)
//NMC Customization
ProgressBarThemeUtils.themeHorizontalProgressBar(this, resources.getColor(R.color.primary, null))
}

logsAdapter = LogsAdapter(this)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import android.widget.MediaController.MediaPlayerControl
import android.widget.SeekBar
import android.widget.SeekBar.OnSeekBarChangeListener
import androidx.core.content.ContextCompat
import com.nmc.android.ui.utils.ProgressBarThemeUtils
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.databinding.MediaControlBinding
Expand Down Expand Up @@ -85,7 +86,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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.ui.utils.ProgressBarThemeUtils;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.databinding.UploadListHeaderBinding;
Expand Down Expand Up @@ -345,7 +346,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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,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;
Expand Down Expand Up @@ -255,7 +256,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.ui.utils.ProgressBarThemeUtils;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5926e64

Please sign in to comment.