mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-26 02:42:16 -05:00
Refactor ConversationSwitcher: onDraw() - May throw ConcurrentModificationException
This commit is contained in:
parent
635b90b5da
commit
84d45c5f5c
@ -20,7 +20,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.yaaic.view;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.yaaic.model.Conversation;
|
||||
import org.yaaic.model.Server;
|
||||
@ -88,15 +88,17 @@ public class ConversationSwitcher extends View
|
||||
return;
|
||||
}
|
||||
|
||||
Collection<Conversation> conversations = server.getConversations();
|
||||
Vector<Conversation> conversations = new Vector<Conversation>(server.getConversations());
|
||||
Conversation conversation;
|
||||
|
||||
int i = 0;
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
int circles = conversations.size();
|
||||
int startX = (width / 2) - (((circles + 1) / 2) * 12);
|
||||
|
||||
for (Conversation conversation : conversations) {
|
||||
for (int i = 0; i < circles; i++) {
|
||||
conversation = conversations.get(i);
|
||||
|
||||
switch (conversation.getStatus()) {
|
||||
case Conversation.STATUS_DEFAULT:
|
||||
paint.setColor(0xFF888888);
|
||||
@ -115,7 +117,6 @@ public class ConversationSwitcher extends View
|
||||
}
|
||||
|
||||
canvas.drawCircle(startX + 12 * i, height / 2, 4, paint);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user