DroidFish: Use EditText instead of TextView to display the move list.

About twice as fast for games with lots of comments on an HTC One M9.
This commit is contained in:
Peter Osterlund 2015-12-29 21:03:06 +01:00
parent 929f77ced2
commit 58e10bbc79
5 changed files with 18 additions and 7 deletions

View File

@ -99,11 +99,14 @@
android:layout_above="@+id/scrollViewBot"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
<EditText
android:id="@+id/moveList"
android:tag="moveList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:includeFontPadding="true"
android:editable="false"
android:padding="0dp"
android:fontFamily="monospace"
android:typeface="monospace"
android:textSize="12sp"/>

View File

@ -93,11 +93,14 @@
android:layout_above="@+id/scrollViewBot"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
<EditText
android:id="@+id/moveList"
android:tag="moveList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:includeFontPadding="true"
android:editable="false"
android:padding="0dp"
android:fontFamily="monospace"
android:typeface="monospace"
android:textSize="12sp"/>

View File

@ -94,11 +94,14 @@
android:layout_above="@+id/scrollViewBot"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
<EditText
android:id="@+id/moveList"
android:tag="moveList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:includeFontPadding="true"
android:editable="false"
android:padding="0dp"
android:fontFamily="monospace"
android:typeface="monospace"
android:textSize="12sp"/>

View File

@ -139,6 +139,7 @@ import android.widget.ImageView.ScaleType;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.TextView.BufferType;
import android.widget.Toast;
@SuppressLint("ClickableViewAccessibility")
@ -1716,7 +1717,7 @@ public class DroidFish extends Activity implements GUIInterface {
@Override
public void moveListUpdated() {
moveList.setText(gameTextListener.getSpannableData());
moveList.setText(gameTextListener.getSpannableData(), BufferType.SPANNABLE);
Layout layout = moveList.getLayout();
if (layout != null) {
int currPos = gameTextListener.getCurrPos();

View File

@ -119,12 +119,13 @@ public final class Util {
if (v == null)
return;
final int bg = ColorTheme.instance().getColor(ColorTheme.GENERAL_BACKGROUND);
Object tag = v.getTag();
final boolean excludedItems = v instanceof Button ||
v instanceof EditText ||
((v instanceof EditText) && !"moveList".equals(tag)) ||
v instanceof ImageButton ||
"title".equals(v.getTag());
"title".equals(tag);
if (!excludedItems) {
if ("drawer".equals(v.getTag()))
if ("drawer".equals(tag))
return;
v.setBackgroundColor(bg);
}