From 37d096e5f9dc70a9e92861ee5e7987ff254f5c93 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 22 Dec 2025 10:42:59 +0100 Subject: [PATCH 1/7] style(sharing): Make share UI M3 themed Signed-off-by: Andy Scherzinger --- .../notes/branding/NotesViewThemeUtils.java | 10 ++---- .../share/adapter/ShareeListAdapter.java | 35 +++++++++++-------- .../adapter/holder/LinkShareViewHolder.java | 5 --- .../holder/NewLinkShareViewHolder.java | 2 +- .../share/adapter/holder/ShareViewHolder.java | 17 +++++++-- .../notes/share/repository/ShareRepository.kt | 34 +++++++----------- app/src/main/res/drawable/ic_content_copy.xml | 2 +- .../main/res/drawable/ic_dots_vertical.xml | 2 +- .../main/res/layout/item_add_public_share.xml | 18 ++++++---- .../res/layout/item_internal_share_link.xml | 1 - .../main/res/layout/item_share_link_share.xml | 31 ++++++++-------- app/src/main/res/layout/item_share_share.xml | 13 ++++--- app/src/main/res/values/styles.xml | 10 ++++++ 13 files changed, 100 insertions(+), 80 deletions(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/branding/NotesViewThemeUtils.java b/app/src/main/java/it/niedermann/owncloud/notes/branding/NotesViewThemeUtils.java index 6112b4962..59f9d4251 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/branding/NotesViewThemeUtils.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/branding/NotesViewThemeUtils.java @@ -224,17 +224,11 @@ public void themeInternalLinkIcon(ImageView view) { withScheme(view, scheme -> { view .getBackground() - .setColorFilter(ResourcesCompat.getColor(view.getContext().getResources(), - R.color.nc_grey, - null), - PorterDuff.Mode.SRC_IN); + .setColorFilter(dynamicColor.surfaceContainerHigh().getArgb(scheme), PorterDuff.Mode.SRC_IN); view .getDrawable() .mutate() - .setColorFilter(ResourcesCompat.getColor(view.getContext().getResources(), - R.color.icon_on_nc_grey, - null), - PorterDuff.Mode.SRC_IN); + .setColorFilter(dynamicColor.onSurface().getArgb(scheme), PorterDuff.Mode.SRC_IN); return view; }); } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/ShareeListAdapter.java b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/ShareeListAdapter.java index a22bce23c..3c45dbd63 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/ShareeListAdapter.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/ShareeListAdapter.java @@ -16,6 +16,7 @@ import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; +import com.nextcloud.android.common.ui.theme.utils.ColorRole; import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.lib.resources.shares.ShareType; @@ -90,30 +91,36 @@ public int getItemViewType(int position) { @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + BrandingUtil brandingUtil = BrandingUtil.of(color, parent.getContext()); + LayoutInflater layoutInflater = LayoutInflater.from(activity); switch (ShareType.fromValue(viewType)) { case PUBLIC_LINK, EMAIL -> { - return new LinkShareViewHolder( - ItemShareLinkShareBinding.inflate(LayoutInflater.from(activity), - parent, - false), - activity); + ItemShareLinkShareBinding binding = ItemShareLinkShareBinding.inflate( + layoutInflater, parent, false); + brandingUtil.platform.colorTextView(binding.name, ColorRole.ON_SURFACE); + brandingUtil.platform.colorTextView(binding.subline, ColorRole.ON_SURFACE_VARIANT); + return new LinkShareViewHolder(binding, activity); } case NEW_PUBLIC_LINK -> { - ItemAddPublicShareBinding binding = ItemAddPublicShareBinding.inflate(LayoutInflater.from(activity), parent, false); - BrandingUtil.of(color, parent.getContext()).notes.themeInternalLinkIcon(binding.addNewPublicShareLinkIcon); + ItemAddPublicShareBinding binding = ItemAddPublicShareBinding.inflate( + layoutInflater, parent, false); + brandingUtil.notes.themeInternalLinkIcon(binding.addNewPublicShareLinkIcon); + brandingUtil.platform.colorTextView(binding.addNewPublicShareLinkText, ColorRole.ON_SURFACE); return new NewLinkShareViewHolder(binding); } case INTERNAL -> { - ItemInternalShareLinkBinding binding = ItemInternalShareLinkBinding.inflate(LayoutInflater.from(activity), parent, false); - BrandingUtil.of(color, parent.getContext()).notes.themeInternalLinkIcon(binding.copyInternalLinkIcon); + ItemInternalShareLinkBinding binding = ItemInternalShareLinkBinding.inflate( + layoutInflater, parent, false); + brandingUtil.notes.themeInternalLinkIcon(binding.copyInternalLinkIcon); + brandingUtil.platform.colorTextView(binding.shareInternalLink, ColorRole.ON_SURFACE); + brandingUtil.platform.colorTextView(binding.shareInternalLinkText, ColorRole.ON_SURFACE_VARIANT); return new InternalShareViewHolder(binding, activity); } default -> { - return new ShareViewHolder(ItemShareShareBinding.inflate(LayoutInflater.from(activity), - parent, - false), - account, - activity); + ItemShareShareBinding binding = ItemShareShareBinding.inflate( + layoutInflater, parent, false); + brandingUtil.platform.colorTextView(binding.name, ColorRole.ON_SURFACE); + return new ShareViewHolder(binding, account, activity); } } } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/LinkShareViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/LinkShareViewHolder.java index 517f88cdc..a1cba2e72 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/LinkShareViewHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/LinkShareViewHolder.java @@ -47,11 +47,6 @@ public void bind(OCShare publicShare, ShareeListAdapterListener listener) { R.drawable.ic_email, null)); binding.copyLink.setVisibility(View.GONE); - - binding.icon.getBackground().setColorFilter(context.getResources().getColor(R.color.nc_grey), - PorterDuff.Mode.SRC_IN); - binding.icon.getDrawable().mutate().setColorFilter(context.getResources().getColor(R.color.icon_on_nc_grey), - PorterDuff.Mode.SRC_IN); } else { if (!TextUtils.isEmpty(publicShare.getLabel())) { String text = String.format(context.getString(R.string.share_link_with_label), publicShare.getLabel()); diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/NewLinkShareViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/NewLinkShareViewHolder.java index 061ce22c1..1445614c2 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/NewLinkShareViewHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/NewLinkShareViewHolder.java @@ -27,6 +27,6 @@ public NewLinkShareViewHolder(ItemAddPublicShareBinding binding) { } public void bind(ShareeListAdapterListener listener) { - binding.addNewPublicShareLink.setOnClickListener(v -> listener.createPublicShareLink()); + binding.addNewPublicShareLinkPlus.setOnClickListener(v -> listener.createPublicShareLink()); } } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/ShareViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/ShareViewHolder.java index 17ef76ca5..17548cf05 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/ShareViewHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/ShareViewHolder.java @@ -18,6 +18,8 @@ import com.owncloud.android.lib.resources.shares.OCShare; import it.niedermann.owncloud.notes.R; +import it.niedermann.owncloud.notes.branding.BrandedViewHolder; +import it.niedermann.owncloud.notes.branding.BrandingUtil; import it.niedermann.owncloud.notes.databinding.ItemShareShareBinding; import it.niedermann.owncloud.notes.persistence.entity.Account; import it.niedermann.owncloud.notes.share.helper.AvatarLoader; @@ -25,13 +27,14 @@ import it.niedermann.owncloud.notes.share.listener.ShareeListAdapterListener; import it.niedermann.owncloud.notes.shared.util.FilesSpecificViewThemeUtils; -public class ShareViewHolder extends RecyclerView.ViewHolder { +public class ShareViewHolder extends BrandedViewHolder { private ItemShareShareBinding binding; private Account account; private Context context; public ShareViewHolder(@NonNull View itemView) { super(itemView); + bindBranding(); } public ShareViewHolder(ItemShareShareBinding binding, @@ -41,6 +44,7 @@ public ShareViewHolder(ItemShareShareBinding binding, this.binding = binding; this.account = account; this.context = context; + bindBranding(); } public void bind(OCShare share, ShareeListAdapterListener listener) { @@ -92,7 +96,7 @@ public void bind(OCShare share, ShareeListAdapterListener listener) { if (accountName.equalsIgnoreCase(share.getShareWith()) || accountName.equalsIgnoreCase(share.getUserId())) { binding.overflowMenu.setVisibility(View.VISIBLE); - + String permissionName = SharingMenuHelper.getPermissionName(context, share); setPermissionName(permissionName); @@ -120,4 +124,13 @@ private void setImage(ImageView avatar, String name, @DrawableRes int fallback) avatar.setImageResource(fallback); } } + + @Override + public void applyBrand(int color) { + final var util = BrandingUtil.of(color, context); + if (binding != null) { + util.androidx.colorPrimaryTextViewElement(binding.permissionName); + util.platform.colorImageViewBackgroundAndIcon(binding.icon); + } + } } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt b/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt index f3c0f678e..9e03f17dd 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt @@ -37,17 +37,14 @@ import it.niedermann.owncloud.notes.shared.util.extensions.toExpirationDateStrin import org.json.JSONObject import java.util.Date -class ShareRepository( - private val applicationContext: Context, - private val account: SingleSignOnAccount -) { +class ShareRepository(private val applicationContext: Context, private val account: SingleSignOnAccount) { private val tag = "ShareRepository" private val gson = Gson() private val apiProvider: ApiProvider by lazy { ApiProvider.getInstance() } private val notesRepository: NotesRepository by lazy { NotesRepository.getInstance( - applicationContext, + applicationContext ) } @@ -61,7 +58,13 @@ class ShareRepository( val notesPathResponseResult = getNotesPathResponseResult() ?: return null val notesPath = notesPathResponseResult.notesPath val notesSuffix = notesPathResponseResult.fileSuffix - return StringConstants.PATH + notesPath + StringConstants.PATH + note.title + notesSuffix + return if (note.category.isEmpty()) { + StringConstants.PATH + notesPath + StringConstants.PATH + note.title + notesSuffix + } else { + StringConstants.PATH + notesPath + StringConstants.PATH + note.category + StringConstants.PATH + + note.title + + notesSuffix + } } fun getShareEntitiesForSpecificNote(note: Note): List { @@ -135,11 +138,7 @@ class ShareRepository( private fun LinkedTreeMap<*, *>.getList(key: String): ArrayList<*>? = this[key] as? ArrayList<*> - fun getSharees( - searchString: String, - page: Int, - perPage: Int - ): ArrayList { + fun getSharees(searchString: String, page: Int, perPage: Int): ArrayList { val shareAPI = apiProvider.getShareAPI(applicationContext, account) val call = shareAPI.getSharees( search = searchString, @@ -299,7 +298,6 @@ class ShareRepository( val call = shareAPI.removeShare(share.id) val response = call.execute() if (response.isSuccessful) { - if (share.shareType != null && share.shareType == ShareType.PUBLIC_LINK) { note.setIsShared(false) updateNote(note) @@ -316,16 +314,13 @@ class ShareRepository( } } - fun updateShare( - shareId: Long, - requestBody: UpdateShareRequest - ): ApiResult?> { + fun updateShare(shareId: Long, requestBody: UpdateShareRequest): ApiResult?> { val shareAPI = apiProvider.getShareAPI(applicationContext, account) val call = shareAPI.updateShare(shareId, requestBody) val response = call.execute() return try { if (response.isSuccessful) { - Log_OC.d(tag, "Share updated successfully: ${response.body().toString()}") + Log_OC.d(tag, "Share updated successfully: ${response.body()}") ApiResult.Success( data = response.body(), message = applicationContext.getString(R.string.note_share_created) @@ -396,10 +391,7 @@ class ShareRepository( } } - fun updateSharePermission( - shareId: Long, - permissions: Int? = null, - ): ApiResult?> { + fun updateSharePermission(shareId: Long, permissions: Int? = null): ApiResult?> { val shareAPI = apiProvider.getShareAPI(applicationContext, account) val requestBody = UpdateSharePermissionRequest(permissions = permissions) diff --git a/app/src/main/res/drawable/ic_content_copy.xml b/app/src/main/res/drawable/ic_content_copy.xml index a2b6c8e58..2721185e8 100644 --- a/app/src/main/res/drawable/ic_content_copy.xml +++ b/app/src/main/res/drawable/ic_content_copy.xml @@ -9,5 +9,5 @@ android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"> - + diff --git a/app/src/main/res/drawable/ic_dots_vertical.xml b/app/src/main/res/drawable/ic_dots_vertical.xml index 5c2616239..658420bd5 100644 --- a/app/src/main/res/drawable/ic_dots_vertical.xml +++ b/app/src/main/res/drawable/ic_dots_vertical.xml @@ -11,5 +11,5 @@ android:viewportHeight="24"> + android:fillColor="@color/icon_color_default"/> diff --git a/app/src/main/res/layout/item_add_public_share.xml b/app/src/main/res/layout/item_add_public_share.xml index 13434b0b3..faf08c350 100644 --- a/app/src/main/res/layout/item_add_public_share.xml +++ b/app/src/main/res/layout/item_add_public_share.xml @@ -6,6 +6,7 @@ ~ SPDX-License-Identifier: GPL-3.0-or-later --> - + app:cornerRadius="@dimen/iconized_single_line_item_icon_size" + app:icon="@drawable/ic_plus" + app:iconSize="@dimen/iconized_single_line_item_icon_size" + app:iconTint="@color/icon_color_default" /> diff --git a/app/src/main/res/layout/item_internal_share_link.xml b/app/src/main/res/layout/item_internal_share_link.xml index e1431c634..c6ee206a7 100644 --- a/app/src/main/res/layout/item_internal_share_link.xml +++ b/app/src/main/res/layout/item_internal_share_link.xml @@ -32,7 +32,6 @@ - + app:cornerRadius="@dimen/iconized_single_line_item_icon_size" + app:icon="@drawable/ic_content_copy" + app:iconSize="@dimen/iconized_single_line_item_icon_size" + app:iconTint="@color/icon_color_default" /> - + app:cornerRadius="@dimen/iconized_single_line_item_icon_size" + app:icon="@drawable/ic_dots_vertical" + app:iconSize="@dimen/iconized_single_line_item_icon_size" + app:iconTint="@color/icon_color_default" /> diff --git a/app/src/main/res/layout/item_share_share.xml b/app/src/main/res/layout/item_share_share.xml index bf9e067d8..81a15541e 100644 --- a/app/src/main/res/layout/item_share_share.xml +++ b/app/src/main/res/layout/item_share_share.xml @@ -63,12 +63,15 @@ tools:text="View only" /> - + app:cornerRadius="@dimen/iconized_single_line_item_icon_size" + app:icon="@drawable/ic_dots_vertical" + app:iconSize="@dimen/iconized_single_line_item_icon_size" + app:iconTint="@color/icon_color_default" /> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 66c2c59d8..18cbdbb2c 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -151,4 +151,14 @@ sans bold + + \ No newline at end of file From 377935c660a50510e14dae3676457b71e06f4ffb Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 22 Dec 2025 10:47:20 +0100 Subject: [PATCH 2/7] fix(share): use user name to check visibility of share item Signed-off-by: Andy Scherzinger --- .../notes/share/adapter/holder/ShareViewHolder.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/ShareViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/ShareViewHolder.java index 17548cf05..afdfc217d 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/ShareViewHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/ShareViewHolder.java @@ -48,7 +48,7 @@ public ShareViewHolder(ItemShareShareBinding binding, } public void bind(OCShare share, ShareeListAdapterListener listener) { - String accountName = account.getDisplayName(); + String accountUserName = account.getUserName(); String name = share.getSharedWithDisplayName(); binding.icon.setTag(null); final var shareType = share.getShareType(); @@ -89,14 +89,10 @@ public void bind(OCShare share, ShareeListAdapterListener listener) { binding.name.setText(name); - if (accountName == null) { - binding.overflowMenu.setVisibility(View.GONE); - return; - } - - if (accountName.equalsIgnoreCase(share.getShareWith()) || accountName.equalsIgnoreCase(share.getUserId())) { + if (accountUserName.equalsIgnoreCase(share.getShareWith()) || + accountUserName.equalsIgnoreCase(share.getUserId())) { binding.overflowMenu.setVisibility(View.VISIBLE); - + String permissionName = SharingMenuHelper.getPermissionName(context, share); setPermissionName(permissionName); From 22eb11476d33b921a593de06faef6154aa233aaa Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 22 Dec 2025 10:56:35 +0100 Subject: [PATCH 3/7] chore: Add empty line at EOF Signed-off-by: Andy Scherzinger --- app/src/main/res/values/styles.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 18cbdbb2c..6a54a76aa 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -161,4 +161,4 @@ textStart 0dp - \ No newline at end of file + From 4da3d1d2bfcef96a8869c3913b2fa0ee17c49995 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 22 Dec 2025 11:09:09 +0100 Subject: [PATCH 4/7] docs: Add method docs Signed-off-by: Andy Scherzinger --- .../notes/share/repository/ShareRepository.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt b/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt index 9e03f17dd..864aa6583 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt @@ -231,6 +231,13 @@ class ShareRepository(private val applicationContext: Context, private val accou ) } + /** + * Fetches all shares for the given file or folder identified by its remote ID. + * + * @param remoteId The remote file ID on the server for which to retrieve shares. + * @return A list of [OCShare] objects if the request is successful, or `null` if the request fails or an exception + * occurs. + */ fun getShares(remoteId: Long): List? { val shareAPI = apiProvider.getShareAPI(applicationContext, account) val call = shareAPI.getShares(remoteId) @@ -314,6 +321,13 @@ class ShareRepository(private val applicationContext: Context, private val accou } } + /** + * Updates an existing share. + * + * @param shareId The id of the share to update. + * @param requestBody The [UpdateShareRequest] containing the new share attributes. + * @return An [ApiResult] with the server response [OcsResponse] on success, or an error result on failure. + */ fun updateShare(shareId: Long, requestBody: UpdateShareRequest): ApiResult?> { val shareAPI = apiProvider.getShareAPI(applicationContext, account) val call = shareAPI.updateShare(shareId, requestBody) @@ -391,6 +405,14 @@ class ShareRepository(private val applicationContext: Context, private val accou } } + /** + * Updates the permissions for an existing share. + * + * @param shareId The id of the share to update. + * @param permissions The new permission level to set + * @return An [ApiResult] containing the server response [OcsResponse] with the updated share details on success, + * or an error message on failure. + */ fun updateSharePermission(shareId: Long, permissions: Int? = null): ApiResult?> { val shareAPI = apiProvider.getShareAPI(applicationContext, account) val requestBody = UpdateSharePermissionRequest(permissions = permissions) From 4accc4ec1c93c5ef85c87c04b5116877b415ac13 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 22 Dec 2025 11:43:44 +0100 Subject: [PATCH 5/7] style(share): Add proper toolbar Signed-off-by: Andy Scherzinger --- .../notes/share/NoteShareActivity.java | 17 ++++++-- .../main/res/layout/activity_note_share.xml | 40 ++++++++++++++++++- app/src/main/res/values/strings.xml | 1 + 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/NoteShareActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/share/NoteShareActivity.java index 1f72321d4..761280000 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/NoteShareActivity.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/NoteShareActivity.java @@ -108,6 +108,8 @@ public void onCreate(@Nullable Bundle savedInstanceState) { executorService = Executors.newSingleThreadScheduledExecutor(); binding = ActivityNoteShareBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); + setSupportActionBar(binding.toolbar); + binding.toolbar.setNavigationOnClickListener(v -> backPressed()); registerResultLauncher(); initializeArguments(); initializeOnBackPressedDispatcher(); @@ -127,14 +129,18 @@ private void initializeOnBackPressedDispatcher() { getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) { @Override public void handleOnBackPressed() { - Intent intent = new Intent(NoteShareActivity.this, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - finish(); + backPressed(); } }); } + private void backPressed() { + Intent intent = new Intent(NoteShareActivity.this, MainActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + finish(); + } + private void initializeArguments() { Bundle bundler = getIntent().getExtras(); note = BundleExtensionsKt.getSerializableArgument(bundler, ARG_NOTE, Note.class); @@ -156,6 +162,8 @@ private void initializeArguments() { repository.getSharesForNotesAndSaveShareEntities(); runOnUiThread(() -> { + binding.title.setText(R.string.activity_sharing_title); + binding.fileName.setText(note.getTitle()); binding.searchContainer.setVisibility(View.VISIBLE); binding.sharesList.setVisibility(View.VISIBLE); binding.sharesList.setAdapter(new ShareeListAdapter(this, new ArrayList<>(), this, account)); @@ -798,6 +806,7 @@ private void updateShare(OCShare share) { public void applyBrand(int color) { final var util = BrandingUtil.of(color, this); util.platform.themeStatusBar(this); + util.material.themeToolbar(binding.toolbar); util.androidx.themeToolbarSearchView(binding.searchView); util.platform.colorCircularProgressBar(binding.loadingLayoutIndicator, ColorRole.PRIMARY); util.platform.themeHorizontalProgressBar(binding.progressBar); diff --git a/app/src/main/res/layout/activity_note_share.xml b/app/src/main/res/layout/activity_note_share.xml index 49ad324a7..3ba0f7a79 100644 --- a/app/src/main/res/layout/activity_note_share.xml +++ b/app/src/main/res/layout/activity_note_share.xml @@ -11,8 +11,7 @@ android:id="@+id/shareContainer" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" - android:paddingTop="@dimen/spacer_1hx"> + android:orientation="vertical"> + + + + + + + + + + + + Nextcloud Talk More Nextcloud Apps More + Sharing From d8eccaf60fa25fd79a2decd04710b1ab2de6a53d Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 22 Dec 2025 12:05:10 +0100 Subject: [PATCH 6/7] docs: Add method documentation .... to make codacy happy Signed-off-by: Andy Scherzinger --- .../owncloud/notes/share/repository/ShareRepository.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt b/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt index 864aa6583..f9be06f2e 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt @@ -138,6 +138,16 @@ class ShareRepository(private val applicationContext: Context, private val accou private fun LinkedTreeMap<*, *>.getList(key: String): ArrayList<*>? = this[key] as? ArrayList<*> + /** + * Searches for potential share recipients (sharees). + * + * Queries the server for users, groups, remotes, emails, circles, and rooms that match the provided criteria. + * + * @param searchString Query string. + * @param page Page number for paginated results. + * @param perPage Number of results to return per page. + * @return [ArrayList] of [JSONObject]s representing the share recipients. + */ fun getSharees(searchString: String, page: Int, perPage: Int): ArrayList { val shareAPI = apiProvider.getShareAPI(applicationContext, account) val call = shareAPI.getSharees( From 55d9ac85c31fc5566509d34394c71ca017fda108 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 22 Dec 2025 12:39:39 +0100 Subject: [PATCH 7/7] style(share-item): Optimize share item layouts in height and text/icon alignment and add label for mail links Signed-off-by: Andy Scherzinger --- .../adapter/holder/LinkShareViewHolder.java | 20 ++++++++++++++++--- .../main/res/layout/item_share_link_share.xml | 17 ++++++++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/LinkShareViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/LinkShareViewHolder.java index a1cba2e72..3960649b9 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/LinkShareViewHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/LinkShareViewHolder.java @@ -11,9 +11,11 @@ import android.text.TextUtils; import android.view.View; +import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.core.content.res.ResourcesCompat; +import com.nextcloud.android.common.ui.theme.utils.ColorRole; import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.lib.resources.shares.ShareType; @@ -28,6 +30,8 @@ public class LinkShareViewHolder extends BrandedViewHolder { private ItemShareLinkShareBinding binding; private Context context; + private BrandingUtil brandingUtil; + public LinkShareViewHolder(@NonNull View itemView) { super(itemView); bindBranding(); @@ -46,8 +50,17 @@ public void bind(OCShare publicShare, ShareeListAdapterListener listener) { binding.icon.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_email, null)); + if (publicShare.getLabel() != null && !publicShare.getLabel().isEmpty()) { + brandingUtil.platform.colorTextView(binding.name, ColorRole.ON_SURFACE_VARIANT); + binding.label.setText(publicShare.getLabel()); + binding.label.setVisibility(View.VISIBLE); + } else { + brandingUtil.platform.colorTextView(binding.name, ColorRole.ON_SURFACE); + binding.label.setVisibility(View.GONE); + } binding.copyLink.setVisibility(View.GONE); } else { + brandingUtil.platform.colorTextView(binding.name, ColorRole.ON_SURFACE); if (!TextUtils.isEmpty(publicShare.getLabel())) { String text = String.format(context.getString(R.string.share_link_with_label), publicShare.getLabel()); binding.name.setText(text); @@ -84,10 +97,11 @@ private void setPermissionName(OCShare publicShare, String permissionName) { @Override public void applyBrand(int color) { - final var util = BrandingUtil.of(color, context); + brandingUtil = BrandingUtil.of(color, context); if (binding != null) { - util.androidx.colorPrimaryTextViewElement(binding.permissionName); - util.platform.colorImageViewBackgroundAndIcon(binding.icon); + brandingUtil.androidx.colorPrimaryTextViewElement(binding.permissionName); + brandingUtil.platform.colorTextView(binding.label, ColorRole.ON_SURFACE); + brandingUtil.platform.colorImageViewBackgroundAndIcon(binding.icon); } } } diff --git a/app/src/main/res/layout/item_share_link_share.xml b/app/src/main/res/layout/item_share_link_share.xml index eda94fcb5..d8933d91d 100644 --- a/app/src/main/res/layout/item_share_link_share.xml +++ b/app/src/main/res/layout/item_share_link_share.xml @@ -11,15 +11,15 @@ android:id="@+id/share_by_link_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="@dimen/sharee_list_item_size" + android:layout_marginVertical="@dimen/spacer_1x" android:orientation="horizontal"> + +