Browse Source

UI binding can never be null

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 2 years ago
parent
commit
b36195dc9a

+ 45 - 47
app/src/main/java/com/nextcloud/talk/adapters/items/ParticipantItem.java

@@ -196,63 +196,61 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
             holder.binding.videoCallIcon.setVisibility(View.GONE);
         }
 
-        if (holder.binding.secondaryText != null) {
-            String userType = "";
-
-            switch (new EnumParticipantTypeConverter().convertToInt(participant.getType())) {
-                case 1:
-                    //userType = NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_owner);
-                    //break;
-                case 2:
-                case 6: // Guest moderator
+        String userType = "";
+
+        switch (new EnumParticipantTypeConverter().convertToInt(participant.getType())) {
+            case 1:
+                //userType = NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_owner);
+                //break;
+            case 2:
+            case 6: // Guest moderator
+                userType = NextcloudTalkApplication
+                    .Companion
+                    .getSharedApplication()
+                    .getString(R.string.nc_moderator);
+                break;
+            case 3:
+                userType = NextcloudTalkApplication
+                    .Companion
+                    .getSharedApplication()
+                    .getString(R.string.nc_user);
+                if (participant.getCalculatedActorType() == Participant.ActorType.GROUPS) {
                     userType = NextcloudTalkApplication
                         .Companion
                         .getSharedApplication()
-                        .getString(R.string.nc_moderator);
-                    break;
-                case 3:
+                        .getString(R.string.nc_group);
+                }
+                if (participant.getCalculatedActorType() == Participant.ActorType.CIRCLES) {
                     userType = NextcloudTalkApplication
                         .Companion
                         .getSharedApplication()
-                        .getString(R.string.nc_user);
-                    if (participant.getCalculatedActorType() == Participant.ActorType.GROUPS) {
-                        userType = NextcloudTalkApplication
-                            .Companion
-                            .getSharedApplication()
-                            .getString(R.string.nc_group);
-                    }
-                    if (participant.getCalculatedActorType() == Participant.ActorType.CIRCLES) {
-                        userType = NextcloudTalkApplication
-                            .Companion
-                            .getSharedApplication()
-                            .getString(R.string.nc_circle);
-                    }
-                    break;
-                case 4:
-                    userType = NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest);
-                    if (participant.getCalculatedActorType() == Participant.ActorType.EMAILS) {
-                        userType = NextcloudTalkApplication
-                            .Companion
-                            .getSharedApplication()
-                            .getString(R.string.nc_email);
-                    }
-                    break;
-                case 5:
+                        .getString(R.string.nc_circle);
+                }
+                break;
+            case 4:
+                userType = NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest);
+                if (participant.getCalculatedActorType() == Participant.ActorType.EMAILS) {
                     userType = NextcloudTalkApplication
                         .Companion
                         .getSharedApplication()
-                        .getString(R.string.nc_following_link);
-                    break;
-                default:
-                    break;
-            }
+                        .getString(R.string.nc_email);
+                }
+                break;
+            case 5:
+                userType = NextcloudTalkApplication
+                    .Companion
+                    .getSharedApplication()
+                    .getString(R.string.nc_following_link);
+                break;
+            default:
+                break;
+        }
 
-            if (!userType.equals(NextcloudTalkApplication
-                                     .Companion
-                                     .getSharedApplication()
-                                     .getString(R.string.nc_user))) {
-                holder.binding.secondaryText.setText("(" + userType + ")");
-            }
+        if (!userType.equals(NextcloudTalkApplication
+                                 .Companion
+                                 .getSharedApplication()
+                                 .getString(R.string.nc_user))) {
+            holder.binding.secondaryText.setText("(" + userType + ")");
         }
     }