1111import android .text .TextUtils ;
1212import android .view .View ;
1313
14+ import androidx .annotation .ColorInt ;
1415import androidx .annotation .NonNull ;
1516import androidx .core .content .res .ResourcesCompat ;
1617
18+ import com .nextcloud .android .common .ui .theme .utils .ColorRole ;
1719import com .owncloud .android .lib .resources .shares .OCShare ;
1820import com .owncloud .android .lib .resources .shares .ShareType ;
1921
@@ -28,6 +30,8 @@ public class LinkShareViewHolder extends BrandedViewHolder {
2830 private ItemShareLinkShareBinding binding ;
2931 private Context context ;
3032
33+ private BrandingUtil brandingUtil ;
34+
3135 public LinkShareViewHolder (@ NonNull View itemView ) {
3236 super (itemView );
3337 bindBranding ();
@@ -46,8 +50,17 @@ public void bind(OCShare publicShare, ShareeListAdapterListener listener) {
4650 binding .icon .setImageDrawable (ResourcesCompat .getDrawable (context .getResources (),
4751 R .drawable .ic_email ,
4852 null ));
53+ if (publicShare .getLabel () != null && !publicShare .getLabel ().isEmpty ()) {
54+ brandingUtil .platform .colorTextView (binding .name , ColorRole .ON_SURFACE_VARIANT );
55+ binding .label .setText (publicShare .getLabel ());
56+ binding .label .setVisibility (View .VISIBLE );
57+ } else {
58+ brandingUtil .platform .colorTextView (binding .name , ColorRole .ON_SURFACE );
59+ binding .label .setVisibility (View .GONE );
60+ }
4961 binding .copyLink .setVisibility (View .GONE );
5062 } else {
63+ brandingUtil .platform .colorTextView (binding .name , ColorRole .ON_SURFACE );
5164 if (!TextUtils .isEmpty (publicShare .getLabel ())) {
5265 String text = String .format (context .getString (R .string .share_link_with_label ), publicShare .getLabel ());
5366 binding .name .setText (text );
@@ -84,10 +97,11 @@ private void setPermissionName(OCShare publicShare, String permissionName) {
8497
8598 @ Override
8699 public void applyBrand (int color ) {
87- final var util = BrandingUtil .of (color , context );
100+ brandingUtil = BrandingUtil .of (color , context );
88101 if (binding != null ) {
89- util .androidx .colorPrimaryTextViewElement (binding .permissionName );
90- util .platform .colorImageViewBackgroundAndIcon (binding .icon );
102+ brandingUtil .androidx .colorPrimaryTextViewElement (binding .permissionName );
103+ brandingUtil .platform .colorTextView (binding .label , ColorRole .ON_SURFACE );
104+ brandingUtil .platform .colorImageViewBackgroundAndIcon (binding .icon );
91105 }
92106 }
93107}
0 commit comments