1111import android .view .View ;
1212import android .widget .ImageView ;
1313
14+ import androidx .annotation .ColorInt ;
1415import androidx .annotation .DrawableRes ;
1516import androidx .annotation .NonNull ;
16- import androidx .recyclerview .widget .RecyclerView ;
1717
1818import com .owncloud .android .lib .resources .shares .OCShare ;
1919
@@ -31,6 +31,8 @@ public class ShareViewHolder extends BrandedViewHolder {
3131 private ItemShareShareBinding binding ;
3232 private Account account ;
3333 private Context context ;
34+ @ ColorInt
35+ private int color ;
3436
3537 public ShareViewHolder (@ NonNull View itemView ) {
3638 super (itemView );
@@ -62,28 +64,34 @@ public void bind(OCShare share, ShareeListAdapterListener listener) {
6264 case GROUP :
6365 name = context .getString (R .string .share_group_clarification , name );
6466 viewThemeUtils .createAvatar (share .getShareType (), binding .icon , context );
67+ BrandingUtil .of (color , context ).platform .colorImageViewBackgroundAndIcon (binding .icon );
6568 break ;
6669 case ROOM :
6770 name = context .getString (R .string .share_room_clarification , name );
6871 viewThemeUtils .createAvatar (share .getShareType (), binding .icon , context );
72+ BrandingUtil .of (color , context ).platform .colorImageViewBackgroundAndIcon (binding .icon );
6973 break ;
7074 case CIRCLE :
7175 viewThemeUtils .createAvatar (share .getShareType (), binding .icon , context );
76+ BrandingUtil .of (color , context ).platform .colorImageViewBackgroundAndIcon (binding .icon );
7277 break ;
7378 case FEDERATED :
7479 name = context .getString (R .string .share_remote_clarification , name );
75- setImage (binding .icon , share .getSharedWithDisplayName (), R .drawable .ic_account_circle_grey_24dp );
80+ setImage (binding .icon , share .getShareWith (), R .drawable .ic_account_circle_grey_24dp );
81+ BrandingUtil .of (color , context ).platform .colorImageViewBackgroundAndIcon (binding .icon );
7682 break ;
7783 case USER :
7884 binding .icon .setTag (share .getShareWith ());
7985
80- if (share .getSharedWithDisplayName () != null ) {
81- AvatarLoader .INSTANCE .load (context , binding .icon , account , share .getSharedWithDisplayName ());
86+ if (share .getShareWith () != null ) {
87+ AvatarLoader .INSTANCE .load (context , binding .icon , account , share .getShareWith ());
8288 }
8389
8490 // binding.icon.setOnClickListener(v -> listener.showProfileBottomSheet(user, share.getShareWith()));
91+ break ;
8592 default :
8693 setImage (binding .icon , name , R .drawable .ic_account_circle_grey_24dp );
94+ BrandingUtil .of (color , context ).platform .colorImageViewBackgroundAndIcon (binding .icon );
8795 break ;
8896 }
8997
@@ -123,10 +131,10 @@ private void setImage(ImageView avatar, String name, @DrawableRes int fallback)
123131
124132 @ Override
125133 public void applyBrand (int color ) {
126- final var util = BrandingUtil .of (color , context );
134+ this .color = color ;
135+ final var util = BrandingUtil .of (this .color , context );
127136 if (binding != null ) {
128137 util .androidx .colorPrimaryTextViewElement (binding .permissionName );
129- util .platform .colorImageViewBackgroundAndIcon (binding .icon );
130138 }
131139 }
132140}
0 commit comments