Просмотр исходного кода

Merge pull request #3069 from nextcloud/chore/noid/codeStyle

Further code style improvements
Andy Scherzinger 1 год назад
Родитель
Сommit
0c1b081f50

+ 0 - 1
app/src/androidTest/java/com/nextcloud/talk/ui/LoginIT.java

@@ -38,7 +38,6 @@ import androidx.test.core.app.ActivityScenario;
 import androidx.test.espresso.NoMatchingViewException;
 import androidx.test.espresso.web.webdriver.DriverAtoms;
 import androidx.test.espresso.web.webdriver.Locator;
-import androidx.test.filters.LargeTest;
 
 import static androidx.test.espresso.Espresso.onView;
 import static androidx.test.espresso.action.ViewActions.click;

+ 1 - 3
app/src/main/java/com/nextcloud/talk/adapters/ParticipantDisplayItemNotifier.java

@@ -19,15 +19,13 @@
  */
 package com.nextcloud.talk.adapters;
 
-import com.nextcloud.talk.signaling.SignalingMessageReceiver;
-
 import java.util.ArrayList;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
 /**
  * Helper class to register and notify ParticipantDisplayItem.Observers.
- *
+ * <p>
  * This class is only meant for internal use by ParticipantDisplayItem; observers must register themselves against a
  * ParticipantDisplayItem rather than against a ParticipantDisplayItemNotifier.
  */

+ 3 - 3
app/src/main/java/com/nextcloud/talk/call/CallParticipantModelNotifier.java

@@ -28,12 +28,14 @@ import java.util.List;
 
 /**
  * Helper class to register and notify CallParticipantModel.Observers.
- *
+ * <p>
  * This class is only meant for internal use by CallParticipantModel; observers must register themselves against a
  * CallParticipantModel rather than against a CallParticipantModelNotifier.
  */
 class CallParticipantModelNotifier {
 
+    private final List<CallParticipantModelObserverOn> callParticipantModelObserversOn = new ArrayList<>();
+
     /**
      * Helper class to associate a CallParticipantModel.Observer with a Handler.
      */
@@ -47,8 +49,6 @@ class CallParticipantModelNotifier {
         }
     }
 
-    private final List<CallParticipantModelObserverOn> callParticipantModelObserversOn = new ArrayList<>();
-
     public synchronized void addObserver(CallParticipantModel.Observer observer, Handler handler) {
         if (observer == null) {
             throw new IllegalArgumentException("CallParticipantModel.Observer can not be null");

+ 3 - 3
app/src/main/java/com/nextcloud/talk/signaling/CallParticipantMessageNotifier.java

@@ -25,12 +25,14 @@ import java.util.List;
 
 /**
  * Helper class to register and notify CallParticipantMessageListeners.
- *
+ * <p>
  * This class is only meant for internal use by SignalingMessageReceiver; listeners must register themselves against
  * a SignalingMessageReceiver rather than against a CallParticipantMessageNotifier.
  */
 class CallParticipantMessageNotifier {
 
+    private final List<CallParticipantMessageListenerFrom> callParticipantMessageListenersFrom = new ArrayList<>();
+
     /**
      * Helper class to associate a CallParticipantMessageListener with a session ID.
      */
@@ -45,8 +47,6 @@ class CallParticipantMessageNotifier {
         }
     }
 
-    private final List<CallParticipantMessageListenerFrom> callParticipantMessageListenersFrom = new ArrayList<>();
-
     public synchronized void addListener(SignalingMessageReceiver.CallParticipantMessageListener listener, String sessionId) {
         if (listener == null) {
             throw new IllegalArgumentException("CallParticipantMessageListener can not be null");

+ 3 - 3
app/src/main/java/com/nextcloud/talk/signaling/WebRtcMessageNotifier.java

@@ -25,12 +25,14 @@ import java.util.List;
 
 /**
  * Helper class to register and notify WebRtcMessageListeners.
- *
+ * <p>
  * This class is only meant for internal use by SignalingMessageReceiver; listeners must register themselves against
  * a SignalingMessageReceiver rather than against a WebRtcMessageNotifier.
  */
 class WebRtcMessageNotifier {
 
+    private final List<WebRtcMessageListenerFrom> webRtcMessageListenersFrom = new ArrayList<>();
+
     /**
      * Helper class to associate a WebRtcMessageListener with a session ID and room type.
      */
@@ -48,8 +50,6 @@ class WebRtcMessageNotifier {
         }
     }
 
-    private final List<WebRtcMessageListenerFrom> webRtcMessageListenersFrom = new ArrayList<>();
-
     public synchronized void addListener(SignalingMessageReceiver.WebRtcMessageListener listener, String sessionId, String roomType) {
         if (listener == null) {
             throw new IllegalArgumentException("WebRtcMessageListener can not be null");

+ 0 - 1
app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java

@@ -98,7 +98,6 @@ import static com.nextcloud.talk.utils.FileSortOrder.sort_z_to_a_id;
 
 public class DisplayUtils {
 
-    private static final String TAG = "DisplayUtils";
     private static final int INDEX_LUMINATION = 2;
     private static final double MAX_LIGHTNESS = 0.92;
 

+ 9 - 9
app/src/test/java/com/nextcloud/talk/call/CallParticipantListExternalSignalingTest.java

@@ -66,6 +66,15 @@ public class CallParticipantListExternalSignalingTest {
     private Collection<Participant> expectedLeft;
     private Collection<Participant> expectedUnchanged;
 
+    // The order of the left participants in some tests depends on how they are internally sorted by the map, so the
+    // list of left participants needs to be checked ignoring the sorting (or, rather, sorting by session ID as in
+    // expectedLeft).
+    // Other tests can just relay on the not guaranteed, but known internal sorting of the elements.
+    private final ArgumentMatcher<List<Participant>> matchesExpectedLeftIgnoringOrder = left -> {
+        Collections.sort(left, Comparator.comparing(Participant::getSessionId));
+        return expectedLeft.equals(left);
+    };
+
     private static class ParticipantsUpdateParticipantBuilder {
         private Participant newUser(long inCall, long lastPing, String sessionId, Participant.ParticipantType type,
                                     String userId) {
@@ -90,15 +99,6 @@ public class CallParticipantListExternalSignalingTest {
         }
     }
 
-    // The order of the left participants in some tests depends on how they are internally sorted by the map, so the
-    // list of left participants needs to be checked ignoring the sorting (or, rather, sorting by session ID as in
-    // expectedLeft).
-    // Other tests can just relay on the not guaranteed, but known internal sorting of the elements.
-    private final ArgumentMatcher<List<Participant>> matchesExpectedLeftIgnoringOrder = left -> {
-        Collections.sort(left, Comparator.comparing(Participant::getSessionId));
-        return expectedLeft.equals(left);
-    };
-
     @Before
     public void setUp() {
         SignalingMessageReceiver mockedSignalingMessageReceiver = mock(SignalingMessageReceiver.class);

+ 13 - 11
app/src/test/java/com/nextcloud/talk/call/CallParticipantListInternalSignalingTest.java

@@ -58,6 +58,15 @@ public class CallParticipantListInternalSignalingTest {
     private Collection<Participant> expectedLeft;
     private Collection<Participant> expectedUnchanged;
 
+    // The order of the left participants in some tests depends on how they are internally sorted by the map, so the
+    // list of left participants needs to be checked ignoring the sorting (or, rather, sorting by session ID as in
+    // expectedLeft).
+    // Other tests can just relay on the not guaranteed, but known internal sorting of the elements.
+    private final ArgumentMatcher<List<Participant>> matchesExpectedLeftIgnoringOrder = left -> {
+        Collections.sort(left, Comparator.comparing(Participant::getSessionId));
+        return expectedLeft.equals(left);
+    };
+
     private static class UsersInRoomParticipantBuilder {
         private Participant newUser(long inCall, long lastPing, String sessionId, String userId) {
             Participant participant = new Participant();
@@ -79,15 +88,6 @@ public class CallParticipantListInternalSignalingTest {
         }
     }
 
-    // The order of the left participants in some tests depends on how they are internally sorted by the map, so the
-    // list of left participants needs to be checked ignoring the sorting (or, rather, sorting by session ID as in
-    // expectedLeft).
-    // Other tests can just relay on the not guaranteed, but known internal sorting of the elements.
-    private final ArgumentMatcher<List<Participant>> matchesExpectedLeftIgnoringOrder = left -> {
-        Collections.sort(left, Comparator.comparing(Participant::getSessionId));
-        return expectedLeft.equals(left);
-    };
-
     @Before
     public void setUp() {
         SignalingMessageReceiver mockedSignalingMessageReceiver = mock(SignalingMessageReceiver.class);
@@ -529,7 +529,9 @@ public class CallParticipantListInternalSignalingTest {
         // Last ping is not seen as changed, even if it did.
         expectedUnchanged.add(builder.newUser(IN_CALL | WITH_AUDIO, 42, "theSessionId9", "theUserId9"));
 
-        verify(mockedCallParticipantListObserver).onCallParticipantsChanged(eq(expectedJoined), eq(expectedUpdated),
-                                                                            argThat(matchesExpectedLeftIgnoringOrder), eq(expectedUnchanged));
+        verify(mockedCallParticipantListObserver).onCallParticipantsChanged(eq(expectedJoined),
+                                                                            eq(expectedUpdated),
+                                                                            argThat(matchesExpectedLeftIgnoringOrder),
+                                                                            eq(expectedUnchanged));
     }
 }