Skip to content

Commit

Permalink
NMC-2256: Progress and seek bar customized.
Browse files Browse the repository at this point in the history
NMC-2041: SwipeRefreshLayout Customized.
  • Loading branch information
surinder-tsys committed Sep 25, 2024
1 parent 4ecdf79 commit 4d2072a
Show file tree
Hide file tree
Showing 14 changed files with 235 additions and 13 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.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
35 changes: 35 additions & 0 deletions app/src/main/java/com/nmc/android/utils/ProgressBarThemeUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2024 Your Name <your@email.com>
* 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)
}
}
13 changes: 13 additions & 0 deletions app/src/main/java/com/nmc/android/utils/SwipeRefreshThemeUtils.kt
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.jobs.NotificationWork
import com.nextcloud.client.network.ClientFactory.CreationException
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
Expand Down Expand Up @@ -77,8 +78,10 @@ class NotificationsActivity : DrawerActivity(), NotificationsContract.View {
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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;
Expand Down Expand Up @@ -178,7 +179,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();
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.utils.ProgressBarThemeUtils;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.databinding.UploadListHeaderBinding;
Expand All @@ -56,7 +57,6 @@

import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -345,7 +345,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 @@ -45,6 +45,7 @@
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nmc.android.utils.SwipeRefreshThemeUtils;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.databinding.ListFragmentBinding;
Expand Down Expand Up @@ -348,7 +349,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
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.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.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
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.nextcloud.client.account.CurrentAccountProvider
import com.nextcloud.client.di.Injectable
import com.nextcloud.client.network.ClientFactory
import com.nextcloud.client.preferences.AppPreferences
import com.nmc.android.utils.SwipeRefreshThemeUtils
import com.owncloud.android.R
import com.owncloud.android.databinding.TrashbinActivityBinding
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile
Expand Down Expand Up @@ -144,7 +145,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))

Expand Down
64 changes: 64 additions & 0 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,68 @@
<!-- App bar -->
<color name="appbar">#1E1E1E</color>
<color name="fontAppbar">@android:color/white</color>

<!-- NMC Colors -->
<color name="icon_color">#FFFFFF</color>
<color name="sort_text_color">@color/grey_30</color>
<color name="list_icon_color">@color/grey_30</color>
<color name="warning_icon_color">#CCCCCC</color>
<color name="divider_color">@color/grey_70</color>
<color name="spinner_bg_color">@color/grey_80</color>
<color name="refresh_layout_bg_color">#2D2D2D</color>
<color name="primary_button_disabled_color">@color/grey_70</color>
<color name="toolbar_divider_color">@color/grey_70</color>

<!-- Snackbar Colors -->
<color name="snackbar_bg_color">@color/grey_80</color>
<color name="snackbar_txt_color">@color/grey_0</color>

<!-- Alert Dialog Colors -->
<color name="alert_bg_color">@color/grey_80</color>
<color name="alert_txt_color">@color/grey_0</color>

<!-- NavigationView colors -->
<color name="nav_selected_bg_color">@color/grey_60</color>
<color name="nav_txt_unselected_color">@color/grey_0</color>
<color name="nav_txt_selected_color">@color/grey_0</color>
<color name="nav_icon_unselected_color">@color/grey_30</color>
<color name="nav_icon_selected_color">#FFFFFF</color>
<color name="nav_divider_color">@color/grey_30</color>
<color name="nav_bg_color">@color/grey_80</color>
<color name="drawer_quota_txt_color">#FFFFFF</color>

<!-- Bottom Sheet Colors -->
<color name="bottom_sheet_bg_color">@color/grey_80</color>
<color name="bottom_sheet_icon_color">@color/grey_30</color>
<color name="bottom_sheet_txt_color">@color/grey_0</color>

<!-- Popup Menu Colors -->
<color name="popup_menu_bg">@color/grey_80</color>
<color name="popup_menu_txt_color">@color/grey_0</color>
<color name="overflow_bg_color">@color/grey_80</color>

<!-- Switch Compat Colors -->
<color name="switch_thumb_disabled">@color/grey_70</color>
<color name="switch_track_disabled">@color/grey_60</color>

<!-- Checkbox Colors -->
<color name="checkbox_checked_disabled">@color/grey_70</color>
<color name="checkbox_unchecked_disabled">@color/grey_70</color>

<!-- Share Colors -->
<color name="share_title_txt_color">#FFFFFF</color>
<color name="share_subtitle_txt_color">@color/grey_30</color>
<color name="share_info_txt_color">@color/grey_0</color>
<color name="share_search_border_color">@color/grey_0</color>
<color name="share_btn_txt_color">@color/grey_0</color>
<color name="share_list_item_txt_color">@color/grey_0</color>
<color name="share_disabled_txt_color">@color/grey_60</color>
<color name="share_txt_color">@color/grey_0</color>
<color name="share_et_divider">#FFFFFF</color>

<!-- Scan Colors -->
<color name="scan_doc_bg_color">#121212</color>
<color name="scan_text_color">@color/grey_0</color>
<color name="scan_edit_bottom_color">@color/grey_80</color>
<color name="scan_count_bg_color">@color/grey_80</color>
</resources>
Loading

0 comments on commit 4d2072a

Please sign in to comment.