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

View file

@ -311,7 +311,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
@Override
@VisibleForTesting
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
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,
clientFactory,
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.ShareType;
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.
@ -39,13 +40,16 @@ public class FileDetailSharingMenuBottomSheetDialog extends BottomSheetDialog {
private FileDetailsSharingMenuBottomSheetFragmentBinding binding;
private final FileDetailsSharingMenuBottomSheetActions actions;
private final OCShare ocShare;
private final ViewThemeUtils viewThemeUtils;
public FileDetailSharingMenuBottomSheetDialog(FileActivity fileActivity,
FileDetailsSharingMenuBottomSheetActions actions,
OCShare ocShare) {
OCShare ocShare,
ViewThemeUtils viewThemeUtils) {
super(fileActivity);
this.actions = actions;
this.ocShare = ocShare;
this.viewThemeUtils = viewThemeUtils;
}
@Override
@ -58,6 +62,8 @@ public class FileDetailSharingMenuBottomSheetDialog extends BottomSheetDialog {
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
viewThemeUtils.platform.themeDialog(binding.getRoot());
updateUI();
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.FileActivity;
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.newm3.ViewThemeUtils;
import javax.inject.Inject;
/**
* 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 User user;
private final OCFile file;
private final ThemeColorUtils themeColorUtils;
private final ThemeUtils themeUtils;
private final ThemeDrawableUtils themeDrawableUtils;
private final ViewThemeUtils viewThemeUtils;
@ -71,9 +65,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
DeviceInfo deviceInfo,
User user,
OCFile file,
ThemeColorUtils themeColorUtils,
ThemeUtils themeUtils,
ThemeDrawableUtils themeDrawableUtils,
ViewThemeUtils viewThemeUtils) {
super(fileActivity);
this.actions = actions;
@ -81,9 +73,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog implements In
this.deviceInfo = deviceInfo;
this.user = user;
this.file = file;
this.themeColorUtils = themeColorUtils;
this.themeUtils = themeUtils;
this.themeDrawableUtils = themeDrawableUtils;
this.viewThemeUtils = viewThemeUtils;
}

View file

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

View file

@ -41,6 +41,7 @@ import com.owncloud.android.databinding.ProfileBottomSheetFragmentBinding
import com.owncloud.android.utils.DisplayUtils
import com.owncloud.android.utils.theme.ThemeColorUtils
import com.owncloud.android.utils.theme.ThemeDrawableUtils
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
/**
* Show actions of an user
@ -50,7 +51,8 @@ class ProfileBottomSheetDialog(
private val user: User,
private val hoverCard: HoverCard,
private val themeColorUtils: ThemeColorUtils,
private val themeDrawableUtils: ThemeDrawableUtils
private val themeDrawableUtils: ThemeDrawableUtils,
private val viewThemeUtils: ViewThemeUtils
) : BottomSheetDialog(fileActivity), DisplayUtils.AvatarGenerationListener {
private var _binding: ProfileBottomSheetFragmentBinding? = null
@ -64,6 +66,9 @@ class ProfileBottomSheetDialog(
if (window != null) {
window!!.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
viewThemeUtils.platform.themeDialog(binding.root)
val primaryColor = themeColorUtils.primaryColor(context, true)
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.adapter.QuickSharingPermissionsAdapter;
import com.owncloud.android.ui.fragment.util.SharingMenuHelper;
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
import java.util.ArrayList;
import java.util.List;
@ -53,14 +54,17 @@ public class QuickSharingPermissionsBottomSheetDialog extends BottomSheetDialog
private final QuickPermissionSharingBottomSheetActions actions;
private final FileActivity fileActivity;
private final OCShare ocShare;
private final ViewThemeUtils viewThemeUtils;
public QuickSharingPermissionsBottomSheetDialog(FileActivity fileActivity,
QuickPermissionSharingBottomSheetActions actions,
OCShare ocShare) {
OCShare ocShare,
ViewThemeUtils viewThemeUtils) {
super(fileActivity);
this.actions = actions;
this.ocShare = ocShare;
this.fileActivity = fileActivity;
this.viewThemeUtils = viewThemeUtils;
}
@Override
@ -73,6 +77,8 @@ public class QuickSharingPermissionsBottomSheetDialog extends BottomSheetDialog
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
viewThemeUtils.platform.themeDialog(binding.getRoot());
setUpRecyclerView();
setOnShowListener(d ->
BottomSheetBehavior.from((View) binding.getRoot().getParent())