project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/ChatlogAdapter.java
changeset 7582 714310efad8f
parent 7508 763d3961400b
child 7584 7831c84cc644
equal deleted inserted replaced
7580:c92596feac0d 7582:714310efad8f
       
     1 /*
       
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU General Public License
       
     7  * as published by the Free Software Foundation; either version 2
       
     8  * of the License, or (at your option) any later version.
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13  * GNU General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License
       
    16  * along with this program; if not, write to the Free Software
       
    17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
       
    18  */
       
    19 
     1 package org.hedgewars.hedgeroid;
    20 package org.hedgewars.hedgeroid;
     2 
    21 
     3 import java.util.ArrayList;
    22 import java.util.ArrayList;
     4 import java.util.Collection;
    23 import java.util.Collection;
     5 import java.util.List;
    24 import java.util.List;
     6 
    25 
     7 import org.hedgewars.hedgeroid.netplay.MessageLog.Observer;
    26 import org.hedgewars.hedgeroid.netplay.MessageLog;
     8 
    27 
     9 import android.content.Context;
    28 import android.content.Context;
    10 import android.text.method.LinkMovementMethod;
    29 import android.text.method.LinkMovementMethod;
    11 import android.view.View;
    30 import android.view.View;
    12 import android.view.ViewGroup;
    31 import android.view.ViewGroup;
    28 	public LoglineView(Context context) {
    47 	public LoglineView(Context context) {
    29 		super(context);
    48 		super(context);
    30 	}
    49 	}
    31 }
    50 }
    32 
    51 
    33 public class ChatlogAdapter extends BaseAdapter implements Observer {
    52 /**
       
    53  * For performance reasons, the chatlog is implemented as ListView instead of a
       
    54  * single TextView (although I later learned that TextView might also have
       
    55  * facilities for efficient appending with limited backlog... oh well, this
       
    56  * works). Every chat line is a line in the ListView, and this adapter prepares
       
    57  * the textviews from a messagelog in an efficient way.
       
    58  */
       
    59 public class ChatlogAdapter extends BaseAdapter implements MessageLog.Listener {
    34 	long idOffset = 0;
    60 	long idOffset = 0;
    35 	private List<CharSequence> log = new ArrayList<CharSequence>();
    61 	private List<CharSequence> log = new ArrayList<CharSequence>();
    36 	private Context context;
    62 	private Context context;
    37 	
    63 	
    38 	public ChatlogAdapter(Context context) {
    64 	public ChatlogAdapter(Context context) {