1
0
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:
Sebastian Kaspari 2011-03-06 14:21:46 +01:00
parent 635b90b5da
commit 84d45c5f5c

View File

@ -20,7 +20,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.yaaic.view; package org.yaaic.view;
import java.util.Collection; import java.util.Vector;
import org.yaaic.model.Conversation; import org.yaaic.model.Conversation;
import org.yaaic.model.Server; import org.yaaic.model.Server;
@ -88,15 +88,17 @@ public class ConversationSwitcher extends View
return; return;
} }
Collection<Conversation> conversations = server.getConversations(); Vector<Conversation> conversations = new Vector<Conversation>(server.getConversations());
Conversation conversation;
int i = 0;
int width = getWidth(); int width = getWidth();
int height = getHeight(); int height = getHeight();
int circles = conversations.size(); int circles = conversations.size();
int startX = (width / 2) - (((circles + 1) / 2) * 12); 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()) { switch (conversation.getStatus()) {
case Conversation.STATUS_DEFAULT: case Conversation.STATUS_DEFAULT:
paint.setColor(0xFF888888); paint.setColor(0xFF888888);
@ -115,7 +117,6 @@ public class ConversationSwitcher extends View
} }
canvas.drawCircle(startX + 12 * i, height / 2, 4, paint); canvas.drawCircle(startX + 12 * i, height / 2, 4, paint);
i++;
} }
} }