Skip to content

Commit ebb5a50

Browse files
style(sharing): Align sharing screen files files app design
Signed-off-by: Andy Scherzinger <[email protected]>
1 parent f31bf52 commit ebb5a50

File tree

6 files changed

+48
-35
lines changed

6 files changed

+48
-35
lines changed

app/src/main/java/it/niedermann/owncloud/notes/branding/NotesViewThemeUtils.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import androidx.appcompat.widget.SearchView;
3030
import androidx.appcompat.widget.Toolbar;
3131
import androidx.core.content.ContextCompat;
32+
import androidx.core.content.res.ResourcesCompat;
3233
import androidx.core.graphics.drawable.DrawableCompat;
3334

3435
import com.google.android.material.appbar.AppBarLayout;
@@ -213,6 +214,25 @@ public void themeToolbarSearchView(@NonNull SearchView searchView) {
213214
});
214215
}
215216

217+
public void themeInternalLinkIcon(ImageView view) {
218+
withScheme(view, scheme -> {
219+
view
220+
.getBackground()
221+
.setColorFilter(ResourcesCompat.getColor(view.getContext().getResources(),
222+
R.color.nc_grey,
223+
null),
224+
PorterDuff.Mode.SRC_IN);
225+
view
226+
.getDrawable()
227+
.mutate()
228+
.setColorFilter(ResourcesCompat.getColor(view.getContext().getResources(),
229+
R.color.icon_on_nc_grey,
230+
null),
231+
PorterDuff.Mode.SRC_IN);
232+
return view;
233+
});
234+
}
235+
216236
public void themeBackgroundView(View view, Activity activity) {
217237
withScheme(view, scheme -> {
218238
activity.getWindow().getDecorView().setBackgroundColor(dynamicColor.surface().getArgb(scheme));

app/src/main/java/it/niedermann/owncloud/notes/share/adapter/ShareeListAdapter.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import android.view.LayoutInflater;
1212
import android.view.ViewGroup;
1313

14+
import androidx.annotation.ColorInt;
1415
import androidx.annotation.NonNull;
16+
import androidx.core.content.ContextCompat;
1517
import androidx.recyclerview.widget.RecyclerView;
1618

1719
import com.owncloud.android.lib.resources.shares.OCShare;
@@ -22,6 +24,8 @@
2224
import java.util.List;
2325
import java.util.Set;
2426

27+
import it.niedermann.owncloud.notes.R;
28+
import it.niedermann.owncloud.notes.branding.BrandingUtil;
2529
import it.niedermann.owncloud.notes.databinding.ItemAddPublicShareBinding;
2630
import it.niedermann.owncloud.notes.databinding.ItemInternalShareLinkBinding;
2731
import it.niedermann.owncloud.notes.databinding.ItemShareLinkShareBinding;
@@ -43,6 +47,9 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
4347
private final Activity activity;
4448
private List<OCShare> shares;
4549

50+
@ColorInt
51+
private int color;
52+
4653
public ShareeListAdapter(Activity activity,
4754
List<OCShare> shares,
4855
ShareeListAdapterListener listener,
@@ -51,6 +58,7 @@ public ShareeListAdapter(Activity activity,
5158
this.shares = shares;
5259
this.listener = listener;
5360
this.account = account;
61+
this.color = ContextCompat.getColor(activity, R.color.defaultBrand);
5462

5563
sortShares();
5664
setHasStableIds(true);
@@ -91,16 +99,14 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int
9199
activity);
92100
}
93101
case NEW_PUBLIC_LINK -> {
94-
return new NewLinkShareViewHolder(
95-
ItemAddPublicShareBinding.inflate(LayoutInflater.from(activity),
96-
parent,
97-
false)
98-
);
102+
ItemAddPublicShareBinding binding = ItemAddPublicShareBinding.inflate(LayoutInflater.from(activity), parent, false);
103+
BrandingUtil.of(color, parent.getContext()).notes.themeInternalLinkIcon(binding.addNewPublicShareLinkIcon);
104+
return new NewLinkShareViewHolder(binding);
99105
}
100106
case INTERNAL -> {
101-
return new InternalShareViewHolder(
102-
ItemInternalShareLinkBinding.inflate(LayoutInflater.from(activity), parent, false),
103-
activity);
107+
ItemInternalShareLinkBinding binding = ItemInternalShareLinkBinding.inflate(LayoutInflater.from(activity), parent, false);
108+
BrandingUtil.of(color, parent.getContext()).notes.themeInternalLinkIcon(binding.copyInternalLinkIcon);
109+
return new InternalShareViewHolder(binding, activity);
104110
}
105111
default -> {
106112
return new ShareViewHolder(ItemShareShareBinding.inflate(LayoutInflater.from(activity),

app/src/main/java/it/niedermann/owncloud/notes/share/adapter/holder/InternalShareViewHolder.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,6 @@ public InternalShareViewHolder(ItemInternalShareLinkBinding binding, Context con
3535
}
3636

3737
public void bind(OCShare share, ShareeListAdapterListener listener) {
38-
binding.copyInternalLinkIcon
39-
.getBackground()
40-
.setColorFilter(ResourcesCompat.getColor(context.getResources(),
41-
R.color.widget_foreground,
42-
null),
43-
PorterDuff.Mode.SRC_IN);
44-
binding.copyInternalLinkIcon
45-
.getDrawable()
46-
.mutate()
47-
.setColorFilter(ResourcesCompat.getColor(context.getResources(),
48-
R.color.fg_contrast,
49-
null),
50-
PorterDuff.Mode.SRC_IN);
51-
5238
if (share.isFolder()) {
5339
binding.shareInternalLinkText.setText(context.getString(R.string.share_internal_link_to_folder_text));
5440
} else {

app/src/main/res/layout/activity_note_share.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
android:id="@+id/btnShareButton"
9494
android:layout_width="match_parent"
9595
android:layout_height="wrap_content"
96-
style="@style/Widget.MaterialComponents.Button.Icon"
96+
style="@style/Widget.Material3.Button.TextButton"
9797
android:paddingStart="@dimen/spacer_3x"
9898
android:paddingEnd="@dimen/zero"
9999
android:text="@string/note_share_activity_share_note"

app/src/main/res/layout/item_add_public_share.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
android:orientation="horizontal">
1313

1414
<ImageView
15+
android:id="@+id/add_new_public_share_link_icon"
1516
android:layout_width="@dimen/default_icon_size"
1617
android:layout_height="@dimen/default_icon_size"
1718
android:layout_gravity="center_vertical"

app/src/main/res/layout/item_internal_share_link.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@
55
~ SPDX-FileCopyrightText: 2015-2025 Nextcloud GmbH and Nextcloud contributors
66
~ SPDX-License-Identifier: GPL-3.0-or-later
77
-->
8-
<LinearLayout android:id="@+id/copy_internal_container"
9-
android:layout_height="wrap_content"
8+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
9+
xmlns:tools="http://schemas.android.com/tools"
10+
android:id="@+id/copy_internal_container"
1011
android:layout_width="match_parent"
12+
android:layout_height="wrap_content"
13+
android:layout_weight="1"
1114
android:orientation="horizontal"
12-
android:paddingBottom="@dimen/spacer_1x"
13-
android:paddingEnd="@dimen/spacer_2x"
1415
android:paddingStart="@dimen/zero"
1516
android:paddingTop="@dimen/spacer_1x"
16-
android:layout_weight="1"
17-
xmlns:android="http://schemas.android.com/apk/res/android"
18-
xmlns:tools="http://schemas.android.com/tools">
17+
android:paddingEnd="@dimen/spacer_2x"
18+
android:paddingBottom="@dimen/spacer_1x">
1919

2020
<ImageView
21-
android:background="@drawable/round_bgnd"
22-
android:contentDescription="@string/note_share_activity_external_icon_content_description"
2321
android:id="@+id/copy_internal_link_icon"
24-
android:layout_gravity="top"
22+
android:layout_width="@dimen/default_icon_size"
2523
android:layout_height="@dimen/default_icon_size"
26-
android:layout_marginEnd="@dimen/spacer_2x"
24+
android:layout_gravity="top"
2725
android:layout_marginStart="@dimen/spacer_2x"
28-
android:layout_width="@dimen/default_icon_size"
26+
android:layout_marginEnd="@dimen/spacer_2x"
27+
android:background="@drawable/round_bgnd"
28+
android:contentDescription="@string/note_share_activity_external_icon_content_description"
2929
android:padding="@dimen/spacer_1x"
3030
android:src="@drawable/ic_external" />
3131

0 commit comments

Comments
 (0)