From 9a5bf130fdfff75f21f7e49375a53411e181e61b Mon Sep 17 00:00:00 2001 From: Jonas Mayer Date: Mon, 12 Feb 2024 16:23:46 +0100 Subject: [PATCH] push so alper can help me Signed-off-by: Jonas Mayer --- .../ui/activity/UploadListActivity.java | 42 +++++++++++++------ app/src/main/res/drawable/ic_pause.xml | 9 ++++ 2 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 app/src/main/res/drawable/ic_pause.xml 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 eeb2c1c6de..50c38e36c2 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 @@ -29,6 +29,9 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; @@ -57,11 +60,16 @@ import com.owncloud.android.operations.CheckCurrentCredentialsOperation; import com.owncloud.android.ui.adapter.UploadListAdapter; import com.owncloud.android.ui.decoration.MediaGridItemDecoration; import com.owncloud.android.utils.DisplayUtils; +import com.owncloud.android.utils.DrawableUtil; import com.owncloud.android.utils.FilesSyncHelper; import com.owncloud.android.utils.theme.ViewThemeUtils; import javax.inject.Inject; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.core.content.res.ResourcesCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.recyclerview.widget.GridLayoutManager; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; @@ -275,20 +283,28 @@ public class UploadListActivity extends FileActivity { @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") private void updateGlobalPauseIcon(MenuItem pauseMenuItem) { - if (pauseMenuItem.getItemId() == R.id.action_toggle_global_pause) { - if (preferences.getGlobalUploadPaused()) { - pauseMenuItem.setIcon(android.R.drawable.ic_media_play); - pauseMenuItem.setTitle(getApplicationContext().getString( - R.string.upload_action_global_upload_resume - )); - } else { - pauseMenuItem.setIcon(android.R.drawable.ic_media_pause); - pauseMenuItem.setTitle(getApplicationContext().getString( - R.string.upload_action_global_upload_pause - )); - } - + if (pauseMenuItem.getItemId() != R.id.action_toggle_global_pause) { + return; } + + int iconId; + String title; + if (preferences.getGlobalUploadPaused()) { + iconId = R.drawable.ic_play_arrow; + title = getString(R.string.upload_action_global_upload_resume); + } else { + iconId = R.drawable.ic_pause; + title = getString(R.string.upload_action_global_upload_pause); + } + /* + DrawableUtil drawableUtil = new DrawableUtil(); + Drawable iconDrawable = AppCompatResources.getDrawable(this, iconId); + assert iconDrawable != null; + iconDrawable = drawableUtil.changeColor(iconDrawable, R.color.dark_background_text_color); + */ + + pauseMenuItem.setIcon(iconId); + pauseMenuItem.setTitle(title); } @SuppressLint("NotifyDataSetChanged") diff --git a/app/src/main/res/drawable/ic_pause.xml b/app/src/main/res/drawable/ic_pause.xml new file mode 100644 index 0000000000..2f8d6bb2e5 --- /dev/null +++ b/app/src/main/res/drawable/ic_pause.xml @@ -0,0 +1,9 @@ + + +