project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/ChatlogAdapter.java
changeset 10017 de822cd3df3a
parent 7584 7831c84cc644
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/ChatlogAdapter.java	Tue Jan 21 22:38:13 2014 +0100
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/ChatlogAdapter.java	Tue Jan 21 22:43:06 2014 +0100
@@ -39,14 +39,14 @@
  * Since lines with a given ID never change in our chatlog, we can avoid the effort
  * of TextView.setText in many cases by checking if the view is already set up for the
  * line with the right ID - but to do that, the view needs to remember the ID it's
- * holding the text for. That's what the LoglineView does. 
+ * holding the text for. That's what the LoglineView does.
  */
 class LoglineView extends TextView {
-	long chatlogId = -1;
-	
-	public LoglineView(Context context) {
-		super(context);
-	}
+    long chatlogId = -1;
+
+    public LoglineView(Context context) {
+        super(context);
+    }
 }
 
 /**
@@ -57,65 +57,65 @@
  * the textviews from a messagelog in an efficient way.
  */
 public class ChatlogAdapter extends BaseAdapter implements MessageLog.Listener {
-	long idOffset = 0;
-	private List<CharSequence> log = new ArrayList<CharSequence>();
-	private Context context;
-	
-	public ChatlogAdapter(Context context) {
-		this.context = context;
-	}
-	
-	public int getCount() {
-		return log.size();
-	}
+    long idOffset = 0;
+    private List<CharSequence> log = new ArrayList<CharSequence>();
+    private Context context;
+
+    public ChatlogAdapter(Context context) {
+        this.context = context;
+    }
+
+    public int getCount() {
+        return log.size();
+    }
 
-	public Object getItem(int position) {
-		return log.get(position);
-	}
+    public Object getItem(int position) {
+        return log.get(position);
+    }
+
+    public long getItemId(int position) {
+        return position+idOffset;
+    }
 
-	public long getItemId(int position) {
-		return position+idOffset;
-	}
+    public boolean hasStableIds() {
+        return true;
+    }
 
-	public boolean hasStableIds() {
-		return true;
-	}
+    public void clear() {
+        idOffset += log.size();
+        log.clear();
+        notifyDataSetChanged();
+    }
 
-	public void clear() {
-		idOffset += log.size();
-		log.clear();
-		notifyDataSetChanged();
-	}
-	
-	public void lineAdded(CharSequence text) {
-		log.add(text);
-		notifyDataSetChanged();
-	}
-	
-	public void lineRemoved() {
-		log.remove(0);
-		idOffset += 1;
-		notifyDataSetChanged();
-	}
-	
-	public void setLog(Collection<CharSequence> log) {
-		idOffset += log.size();
-		this.log = new ArrayList<CharSequence>(log);
-		notifyDataSetChanged();
-	}
-	
-	public View getView(int position, View convertView, ViewGroup parent) {
-		LoglineView v = (LoglineView)convertView;
-		if (v == null) {
-			v = new LoglineView(context);
-			v.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
-			v.setMovementMethod(LinkMovementMethod.getInstance());
-		}
-		long id = getItemId(position);
-		if(id != v.chatlogId) {
-			v.setText(log.get(position));
-			v.chatlogId = id;
-		}
-		return v;
-	}
+    public void lineAdded(CharSequence text) {
+        log.add(text);
+        notifyDataSetChanged();
+    }
+
+    public void lineRemoved() {
+        log.remove(0);
+        idOffset += 1;
+        notifyDataSetChanged();
+    }
+
+    public void setLog(Collection<CharSequence> log) {
+        idOffset += log.size();
+        this.log = new ArrayList<CharSequence>(log);
+        notifyDataSetChanged();
+    }
+
+    public View getView(int position, View convertView, ViewGroup parent) {
+        LoglineView v = (LoglineView)convertView;
+        if (v == null) {
+            v = new LoglineView(context);
+            v.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
+            v.setMovementMethod(LinkMovementMethod.getInstance());
+        }
+        long id = getItemId(position);
+        if(id != v.chatlogId) {
+            v.setText(log.get(position));
+            v.chatlogId = id;
+        }
+        return v;
+    }
 }
\ No newline at end of file