Update background for all bottomsheets

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-09-14 15:39:54 +02:00 committed by Álvaro Brey
parent ff9086bc87
commit ea4de13d9f
No known key found for this signature in database
GPG key ID: 2585783189A62105
7 changed files with 36 additions and 20 deletions

View file

@ -34,6 +34,7 @@ import com.owncloud.android.ui.fragment.ProfileBottomSheetDialog;
import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.theme.ThemeColorUtils; import com.owncloud.android.utils.theme.ThemeColorUtils;
import com.owncloud.android.utils.theme.ThemeDrawableUtils; import com.owncloud.android.utils.theme.ThemeDrawableUtils;
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -47,19 +48,22 @@ public class RetrieveHoverCardAsyncTask extends AsyncTask<Void, Void, HoverCard>
private final ClientFactory clientFactory; private final ClientFactory clientFactory;
private final ThemeColorUtils themeColorUtils; private final ThemeColorUtils themeColorUtils;
private final ThemeDrawableUtils themeDrawableUtils; private final ThemeDrawableUtils themeDrawableUtils;
private final ViewThemeUtils viewThemeUtils;
public RetrieveHoverCardAsyncTask(User user, public RetrieveHoverCardAsyncTask(User user,
String userId, String userId,
FragmentActivity activity, FragmentActivity activity,
ClientFactory clientFactory, ClientFactory clientFactory,
ThemeColorUtils themeColorUtils, ThemeColorUtils themeColorUtils,
ThemeDrawableUtils themeDrawableUtils) { ThemeDrawableUtils themeDrawableUtils,
ViewThemeUtils viewThemeUtils) {
this.user = user; this.user = user;
this.userId = userId; this.userId = userId;
this.activityWeakReference = new WeakReference<>(activity); this.activityWeakReference = new WeakReference<>(activity);
this.clientFactory = clientFactory; this.clientFactory = clientFactory;
this.themeColorUtils = themeColorUtils; this.themeColorUtils = themeColorUtils;
this.themeDrawableUtils = themeDrawableUtils; this.themeDrawableUtils = themeDrawableUtils;
this.viewThemeUtils = viewThemeUtils;
} }
@Override @Override
@ -84,7 +88,13 @@ public class RetrieveHoverCardAsyncTask extends AsyncTask<Void, Void, HoverCard>
if (activity != null && activity.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) { if (activity != null && activity.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
if (hoverCard.getActions().size() > 0) { if (hoverCard.getActions().size() > 0) {
new ProfileBottomSheetDialog(activity, user, hoverCard, themeColorUtils, themeDrawableUtils).show(); new ProfileBottomSheetDialog(activity,
user,
hoverCard,
themeColorUtils,
themeDrawableUtils,
viewThemeUtils)
.show();
} else { } else {
DisplayUtils.showSnackMessage(activity, R.string.no_actions); DisplayUtils.showSnackMessage(activity, R.string.no_actions);
} }

View file

@ -311,7 +311,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
@Override @Override
@VisibleForTesting @VisibleForTesting
public void showSharingMenuActionSheet(OCShare share) { public void showSharingMenuActionSheet(OCShare share) {
new FileDetailSharingMenuBottomSheetDialog(fileActivity, this, share).show(); new FileDetailSharingMenuBottomSheetDialog(fileActivity, this, share, viewThemeUtils).show();
} }
/** /**
@ -321,7 +321,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
*/ */
@Override @Override
public void showPermissionsDialog(OCShare share) { public void showPermissionsDialog(OCShare share) {
new QuickSharingPermissionsBottomSheetDialog(fileActivity, this, share).show(); new QuickSharingPermissionsBottomSheetDialog(fileActivity, this, share, viewThemeUtils).show();
} }
/** /**
@ -393,7 +393,8 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
fileActivity, fileActivity,
clientFactory, clientFactory,
themeColorUtils, themeColorUtils,
themeDrawableUtils).execute(); themeDrawableUtils,
viewThemeUtils).execute();
} }
} }

View file

@ -31,6 +31,7 @@ import com.owncloud.android.databinding.FileDetailsSharingMenuBottomSheetFragmen
import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType; import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.ui.activity.FileActivity; import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
/** /**
* File Details Sharing option menus {@link android.app.Dialog} styled as a bottom sheet for main actions. * File Details Sharing option menus {@link android.app.Dialog} styled as a bottom sheet for main actions.
@ -39,13 +40,16 @@ public class FileDetailSharingMenuBottomSheetDialog extends BottomSheetDialog {
private FileDetailsSharingMenuBottomSheetFragmentBinding binding; private FileDetailsSharingMenuBottomSheetFragmentBinding binding;
private final FileDetailsSharingMenuBottomSheetActions actions; private final FileDetailsSharingMenuBottomSheetActions actions;
private final OCShare ocShare; private final OCShare ocShare;
private final ViewThemeUtils viewThemeUtils;
public FileDetailSharingMenuBottomSheetDialog(FileActivity fileActivity, public FileDetailSharingMenuBottomSheetDialog(FileActivity fileActivity,
FileDetailsSharingMenuBottomSheetActions actions, FileDetailsSharingMenuBottomSheetActions actions,
OCShare ocShare) { OCShare ocShare,
ViewThemeUtils viewThemeUtils) {
super(fileActivity); super(fileActivity);
this.actions = actions; this.actions = actions;
this.ocShare = ocShare; this.ocShare = ocShare;
this.viewThemeUtils = viewThemeUtils;
} }
@Override @Override
@ -58,6 +62,8 @@ public class FileDetailSharingMenuBottomSheetDialog extends BottomSheetDialog {
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} }
viewThemeUtils.platform.themeDialog(binding.getRoot());
updateUI(); updateUI();
setupClickListener(); setupClickListener();

View file

@ -42,13 +42,9 @@ import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.ui.activity.AppScanActivity; import com.owncloud.android.ui.activity.AppScanActivity;
import com.owncloud.android.ui.activity.FileActivity; import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.utils.MimeTypeUtil; import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.theme.ThemeColorUtils;
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
import com.owncloud.android.utils.theme.ThemeUtils; import com.owncloud.android.utils.theme.ThemeUtils;
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils; import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
import javax.inject.Inject;
/** /**
* FAB menu {@link android.app.Dialog} styled as a bottom sheet for main actions. * FAB menu {@link android.app.Dialog} styled as a bottom sheet for main actions.
*/ */
@ -60,9 +56,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
private final DeviceInfo deviceInfo; private final DeviceInfo deviceInfo;
private final User user; private final User user;
private final OCFile file; private final OCFile file;
private final ThemeColorUtils themeColorUtils;
private final ThemeUtils themeUtils; private final ThemeUtils themeUtils;
private final ThemeDrawableUtils themeDrawableUtils;
private final ViewThemeUtils viewThemeUtils; private final ViewThemeUtils viewThemeUtils;
@ -71,9 +65,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
DeviceInfo deviceInfo, DeviceInfo deviceInfo,
User user, User user,
OCFile file, OCFile file,
ThemeColorUtils themeColorUtils,
ThemeUtils themeUtils, ThemeUtils themeUtils,
ThemeDrawableUtils themeDrawableUtils,
ViewThemeUtils viewThemeUtils) { ViewThemeUtils viewThemeUtils) {
super(fileActivity); super(fileActivity);
this.actions = actions; this.actions = actions;
@ -81,9 +73,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
this.deviceInfo = deviceInfo; this.deviceInfo = deviceInfo;
this.user = user; this.user = user;
this.file = file; this.file = file;
this.themeColorUtils = themeColorUtils;
this.themeUtils = themeUtils; this.themeUtils = themeUtils;
this.themeDrawableUtils = themeDrawableUtils;
this.viewThemeUtils = viewThemeUtils; this.viewThemeUtils = viewThemeUtils;
} }

View file

@ -62,9 +62,7 @@ class OCFileListBottomSheetDialogFragment(
deviceInfo, deviceInfo,
user, user,
file, file,
themeColorUtils,
themeUtils, themeUtils,
themeDrawableUtils,
viewThemeUtils viewThemeUtils
) )
} }

View file

@ -41,6 +41,7 @@ import com.owncloud.android.databinding.ProfileBottomSheetFragmentBinding
import com.owncloud.android.utils.DisplayUtils import com.owncloud.android.utils.DisplayUtils
import com.owncloud.android.utils.theme.ThemeColorUtils import com.owncloud.android.utils.theme.ThemeColorUtils
import com.owncloud.android.utils.theme.ThemeDrawableUtils import com.owncloud.android.utils.theme.ThemeDrawableUtils
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
/** /**
* Show actions of an user * Show actions of an user
@ -50,7 +51,8 @@ class ProfileBottomSheetDialog(
private val user: User, private val user: User,
private val hoverCard: HoverCard, private val hoverCard: HoverCard,
private val themeColorUtils: ThemeColorUtils, private val themeColorUtils: ThemeColorUtils,
private val themeDrawableUtils: ThemeDrawableUtils private val themeDrawableUtils: ThemeDrawableUtils,
private val viewThemeUtils: ViewThemeUtils
) : BottomSheetDialog(fileActivity), DisplayUtils.AvatarGenerationListener { ) : BottomSheetDialog(fileActivity), DisplayUtils.AvatarGenerationListener {
private var _binding: ProfileBottomSheetFragmentBinding? = null private var _binding: ProfileBottomSheetFragmentBinding? = null
@ -64,6 +66,9 @@ class ProfileBottomSheetDialog(
if (window != null) { if (window != null) {
window!!.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) window!!.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
} }
viewThemeUtils.platform.themeDialog(binding.root)
val primaryColor = themeColorUtils.primaryColor(context, true) val primaryColor = themeColorUtils.primaryColor(context, true)
binding.icon.tag = hoverCard.userId binding.icon.tag = hoverCard.userId

View file

@ -34,6 +34,7 @@ import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.ui.activity.FileActivity; import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.adapter.QuickSharingPermissionsAdapter; import com.owncloud.android.ui.adapter.QuickSharingPermissionsAdapter;
import com.owncloud.android.ui.fragment.util.SharingMenuHelper; import com.owncloud.android.ui.fragment.util.SharingMenuHelper;
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -53,14 +54,17 @@ public class QuickSharingPermissionsBottomSheetDialog extends BottomSheetDialog
private final QuickPermissionSharingBottomSheetActions actions; private final QuickPermissionSharingBottomSheetActions actions;
private final FileActivity fileActivity; private final FileActivity fileActivity;
private final OCShare ocShare; private final OCShare ocShare;
private final ViewThemeUtils viewThemeUtils;
public QuickSharingPermissionsBottomSheetDialog(FileActivity fileActivity, public QuickSharingPermissionsBottomSheetDialog(FileActivity fileActivity,
QuickPermissionSharingBottomSheetActions actions, QuickPermissionSharingBottomSheetActions actions,
OCShare ocShare) { OCShare ocShare,
ViewThemeUtils viewThemeUtils) {
super(fileActivity); super(fileActivity);
this.actions = actions; this.actions = actions;
this.ocShare = ocShare; this.ocShare = ocShare;
this.fileActivity = fileActivity; this.fileActivity = fileActivity;
this.viewThemeUtils = viewThemeUtils;
} }
@Override @Override
@ -73,6 +77,8 @@ public class QuickSharingPermissionsBottomSheetDialog extends BottomSheetDialog
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} }
viewThemeUtils.platform.themeDialog(binding.getRoot());
setUpRecyclerView(); setUpRecyclerView();
setOnShowListener(d -> setOnShowListener(d ->
BottomSheetBehavior.from((View) binding.getRoot().getParent()) BottomSheetBehavior.from((View) binding.getRoot().getParent())