author | Medo <smaxein@googlemail.com> |
Tue, 17 Jul 2012 23:06:20 +0200 | |
changeset 7334 | 66a10ae88457 |
parent 7332 | 3f2e130f9715 |
child 7346 | b0f67c5b4215 |
permissions | -rw-r--r-- |
7332
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
1 |
package org.hedgewars.hedgeroid.netplay; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
2 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
3 |
import java.util.Date; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
4 |
import java.util.LinkedList; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
5 |
import java.util.List; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
6 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
7 |
import org.hedgewars.hedgeroid.R; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
8 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
9 |
import android.content.Context; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
10 |
import android.graphics.Color; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
11 |
import android.graphics.Typeface; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
12 |
import android.text.Html; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
13 |
import android.text.Spannable; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
14 |
import android.text.SpannableString; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
15 |
import android.text.SpannableStringBuilder; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
16 |
import android.text.Spanned; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
17 |
import android.text.TextUtils; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
18 |
import android.text.format.DateFormat; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
19 |
import android.text.style.ForegroundColorSpan; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
20 |
import android.text.style.RelativeSizeSpan; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
21 |
import android.text.style.StyleSpan; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
22 |
import android.util.Log; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
23 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
24 |
public class MessageLog { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
25 |
private static final int BACKLOG_CHARS = 10000; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
26 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
27 |
private static final int INFO_COLOR = Color.GRAY; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
28 |
private static final int CHAT_COLOR = Color.GREEN; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
29 |
private static final int MECHAT_COLOR = Color.CYAN; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
30 |
private static final int WARN_COLOR = Color.RED; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
31 |
private static final int ERROR_COLOR = Color.RED; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
32 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
33 |
private final Context context; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
34 |
private List<Observer> observers = new LinkedList<Observer>(); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
35 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
36 |
private SpannableStringBuilder log = new SpannableStringBuilder(); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
37 |
private List<Integer> lineLengths = new LinkedList<Integer>(); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
38 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
39 |
public MessageLog(Context context) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
40 |
this.context = context; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
41 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
42 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
43 |
private Spanned makeLogTime() { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
44 |
String time = DateFormat.getTimeFormat(context).format(new Date()); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
45 |
return withColor("[" + time + "] ", INFO_COLOR); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
46 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
47 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
48 |
private static Spanned span(CharSequence s, Object o) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
49 |
Spannable spannable = new SpannableString(s); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
50 |
spannable.setSpan(o, 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
51 |
return spannable; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
52 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
53 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
54 |
private static Spanned withColor(CharSequence s, int color) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
55 |
return span(s, new ForegroundColorSpan(color)); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
56 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
57 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
58 |
private static Spanned bold(CharSequence s) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
59 |
return span(s, new StyleSpan(Typeface.BOLD)); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
60 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
61 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
62 |
private void append(CharSequence msg) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
63 |
SpannableStringBuilder ssb = new SpannableStringBuilder(); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
64 |
ssb.append(makeLogTime()).append(msg).append("\n"); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
65 |
appendRaw(ssb); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
66 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
67 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
68 |
private void appendRaw(CharSequence msg) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
69 |
lineLengths.add(msg.length()); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
70 |
log.append(msg); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
71 |
while(log.length() > BACKLOG_CHARS) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
72 |
log.delete(0, lineLengths.remove(0)); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
73 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
74 |
for(Observer o : observers) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
75 |
o.textChanged(log); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
76 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
77 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
78 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
79 |
void appendPlayerJoin(String playername) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
80 |
append(withColor("***" + context.getResources().getString(R.string.log_player_join, playername), INFO_COLOR)); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
81 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
82 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
83 |
void appendPlayerLeave(String playername, String partMsg) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
84 |
String msg = "***"; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
85 |
if(partMsg != null) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
86 |
msg += context.getResources().getString(R.string.log_player_leave_with_msg, playername, partMsg); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
87 |
} else { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
88 |
msg += context.getResources().getString(R.string.log_player_leave, playername); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
89 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
90 |
append(withColor(msg, INFO_COLOR)); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
91 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
92 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
93 |
void appendChat(String playerName, String msg) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
94 |
if(msg.startsWith("/me ")) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
95 |
append(withColor("*"+playerName+" "+msg, MECHAT_COLOR)); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
96 |
} else { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
97 |
Spanned name = bold(playerName+": "); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
98 |
Spanned fullMessage = withColor(TextUtils.concat(name, msg), CHAT_COLOR); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
99 |
append(fullMessage); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
100 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
101 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
102 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
103 |
void appendMessage(int type, String msg) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
104 |
switch(type) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
105 |
case JnaFrontlib.NETCONN_MSG_TYPE_ERROR: |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
106 |
append(withColor("***"+msg, ERROR_COLOR)); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
107 |
break; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
108 |
case JnaFrontlib.NETCONN_MSG_TYPE_WARNING: |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
109 |
append(withColor("***"+msg, WARN_COLOR)); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
110 |
break; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
111 |
case JnaFrontlib.NETCONN_MSG_TYPE_PLAYERINFO: |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
112 |
// TODO better formatting or different way to display |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
113 |
append(msg); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
114 |
break; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
115 |
case JnaFrontlib.NETCONN_MSG_TYPE_SERVERMESSAGE: |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
116 |
appendRaw(span(TextUtils.concat("\n", Html.fromHtml(msg), "\n\n"), new RelativeSizeSpan(1.5f))); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
117 |
break; |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
118 |
default: |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
119 |
Log.e("MessageLog", "Unknown messagetype "+type); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
120 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
121 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
122 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
123 |
void clear() { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
124 |
log.clear(); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
125 |
lineLengths.clear(); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
126 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
127 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
128 |
public void observe(Observer o) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
129 |
observers.add(o); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
130 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
131 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
132 |
public void unobserve(Observer o) { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
133 |
observers.remove(o); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
134 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
135 |
|
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
136 |
public static interface Observer { |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
137 |
void textChanged(Spanned text); |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
138 |
} |
3f2e130f9715
Hedgeroid: Chat and player list work now, but everything is very much WIP
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
139 |
} |