mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 19:34:08 +01:00
DroidFish: Disable use of boldface in android 4.1 to work around crash bug, see http://code.google.com/p/android/issues/detail?id=34872.
This commit is contained in:
parent
9ccffdbb45
commit
210bf89ef8
|
@ -1327,7 +1327,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
String s = "";
|
||||
if (!thinkingEmpty)
|
||||
s += "<br>";
|
||||
s += "<b>" + getString(R.string.book) + "</b>" + bookInfoStr;
|
||||
s += Util.boldStart + getString(R.string.book) + Util.boldStop + bookInfoStr;
|
||||
thinking.append(Html.fromHtml(s));
|
||||
thinkingEmpty = false;
|
||||
}
|
||||
|
@ -1335,7 +1335,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
String s = "";
|
||||
if (!thinkingEmpty)
|
||||
s += "<br>";
|
||||
s += "<b>" + getString(R.string.variation) + "</b> " + variantStr;
|
||||
s += Util.boldStart + getString(R.string.variation) + Util.boldStop + variantStr;
|
||||
thinking.append(Html.fromHtml(s));
|
||||
thinkingEmpty = false;
|
||||
}
|
||||
|
|
21
DroidFish/src/org/petero/droidfish/Util.java
Normal file
21
DroidFish/src/org/petero/droidfish/Util.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package org.petero.droidfish;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
public final class Util {
|
||||
public final static String boldStart;
|
||||
public final static String boldStop;
|
||||
|
||||
static {
|
||||
// Using bold face causes crashes in android 4.1, see:
|
||||
// http://code.google.com/p/android/issues/detail?id=34872
|
||||
final int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
|
||||
if (sdkVersion >= 16) {
|
||||
boldStart = "";
|
||||
boldStop = "";
|
||||
} else {
|
||||
boldStart = "<b>";
|
||||
boldStop = "</b>";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.petero.droidfish.Util;
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.MoveGen;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
|
@ -154,9 +155,9 @@ public final class DroidBook {
|
|||
first = false;
|
||||
else
|
||||
ret.append(' ');
|
||||
ret.append("<b>");
|
||||
ret.append(Util.boldStart);
|
||||
ret.append(moveStr);
|
||||
ret.append("</b>");
|
||||
ret.append(Util.boldStop);
|
||||
ret.append(':');
|
||||
int percent = (int)Math.round(scaleWeight(be.weight) * 100 / totalWeight);
|
||||
ret.append(percent);
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.petero.droidfish.EGTBOptions;
|
|||
import org.petero.droidfish.GUIInterface;
|
||||
import org.petero.droidfish.GameMode;
|
||||
import org.petero.droidfish.PGNOptions;
|
||||
import org.petero.droidfish.Util;
|
||||
import org.petero.droidfish.book.BookOptions;
|
||||
import org.petero.droidfish.engine.DroidComputerPlayer;
|
||||
import org.petero.droidfish.engine.DroidComputerPlayer.SearchRequest;
|
||||
|
@ -955,10 +956,10 @@ public class DroidChessController {
|
|||
for (int i = 0; i < prevVarList.size(); i++) {
|
||||
if (i > 0) sb.append(' ');
|
||||
if (i == game.tree.currentNode.defaultChild)
|
||||
sb.append("<b>");
|
||||
sb.append(Util.boldStart);
|
||||
sb.append(TextIO.moveToString(pos, prevVarList.get(i), false));
|
||||
if (i == game.tree.currentNode.defaultChild)
|
||||
sb.append("</b>");
|
||||
sb.append(Util.boldStop);
|
||||
}
|
||||
game.tree.goForward(-1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user