DroidFish: Use SVG graphics for buttons. Implemented "toggle large buttons" button action.

This commit is contained in:
Peter Osterlund 2012-06-09 20:04:22 +00:00
parent 64d0048222
commit 499ce4e6e4
24 changed files with 944 additions and 75 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -23,36 +23,31 @@
android:id="@+id/custom2Button"
android:contentDescription="@string/buttonDesc_custom2"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/custom">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/custom1Button"
android:contentDescription="@string/buttonDesc_custom1"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/custom">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/modeButton"
android:contentDescription="@string/buttonDesc_mode"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/mode">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/undoButton"
android:contentDescription="@string/buttonDesc_back"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/left">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/redoButton"
android:contentDescription="@string/buttonDesc_forward"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/right">
android:layout_height="32dp">
</ImageButton>
</LinearLayout>
<TextView

View File

@ -25,36 +25,31 @@
android:id="@+id/custom2Button"
android:contentDescription="@string/buttonDesc_custom2"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/custom">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/custom1Button"
android:contentDescription="@string/buttonDesc_custom1"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/custom">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/modeButton"
android:contentDescription="@string/buttonDesc_mode"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/mode">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/undoButton"
android:contentDescription="@string/buttonDesc_back"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/left">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/redoButton"
android:contentDescription="@string/buttonDesc_forward"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/right">
android:layout_height="32dp">
</ImageButton>
</LinearLayout>
<RelativeLayout

View File

@ -18,36 +18,31 @@
android:id="@+id/custom2Button"
android:contentDescription="@string/buttonDesc_custom2"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/custom">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/custom1Button"
android:contentDescription="@string/buttonDesc_custom1"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/custom">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/modeButton"
android:contentDescription="@string/buttonDesc_mode"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/mode">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/undoButton"
android:contentDescription="@string/buttonDesc_back"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/left">
android:layout_height="32dp">
</ImageButton>
<ImageButton
android:id="@+id/redoButton"
android:contentDescription="@string/buttonDesc_forward"
android:layout_width="36dp"
android:layout_height="32dp"
android:src="@drawable/right">
android:layout_height="32dp">
</ImageButton>
</LinearLayout>
<TextView

View File

@ -164,19 +164,22 @@
<li>
User interface improvements by Aaro Korhonen.
</li>
</ul>
<ul>
<li>
Gaviota Tablebases Probing Code API, Copyright © 2010 Miguel A. Ballicora.
<ul>
<li>
LZMA compression by Igor Pavlov.
</li>
<li>
ZLIB compression, Copyright © 1995-2005 Jean-loup Gailly and Mark Adler.
</li>
<li>
LZF compression, Copyright © 2000-2007 Marc Alexander Lehmann.
</li>
</ul>
</li>
<li>
LZMA compression by Igor Pavlov.
</li>
<li>
ZLIB compression, Copyright © 1995-2005 Jean-loup Gailly and Mark Adler.
</li>
<li>
LZF compression, Copyright © 2000-2007 Marc Alexander Lehmann.
SVG reader from <a href="http://code.google.com/p/svg-android/">svg-android</a> project.
</li>
</ul>

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="36"
height="32"
id="svg3092"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="button.svg">
<defs
id="defs3094">
<linearGradient
id="linearGradient4004">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop4006" />
<stop
id="stop4012"
offset="0.69999999"
style="stop-color:#e0e0e0;stop-opacity:0.627451;" />
<stop
style="stop-color:#e0e0e0;stop-opacity:0;"
offset="1"
id="stop4008" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4004"
id="radialGradient4010"
cx="17.864586"
cy="15.999999"
fx="17.864586"
fy="15.999999"
r="17.5"
gradientTransform="matrix(1.3714287,-7.8784533e-8,6.4012425e-8,1.1142857,-6.5000057,-1.828569)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient7189-2"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000a0;stop-opacity:1;"
id="stop3081-4" />
<stop
id="stop7039"
style="stop-color:#4040c4;stop-opacity:1;"
offset="0.38888884" />
<stop
offset="1"
style="stop-color:#ceceff;stop-opacity:1;"
id="stop3083-1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7189-2"
id="linearGradient7041"
x1="12.375013"
y1="3.475548"
x2="21.375013"
y2="-18.024452"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="20.168143"
inkscape:cy="17.119046"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1441"
inkscape:window-height="1145"
inkscape:window-x="235"
inkscape:window-y="0"
inkscape:window-maximized="0"
showguides="true">
<inkscape:grid
type="xygrid"
id="grid3104"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.5px"
spacingy="0.5px" />
</sodipodi:namedview>
<metadata
id="metadata3097">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:url(#radialGradient4010);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.37777780999999999"
id="rect3100"
width="35"
height="31"
x="0.5"
y="0.5"
ry="7" />
<path
sodipodi:type="arc"
style="fill:none;fill-opacity:1;stroke:none"
id="path4103"
sodipodi:cx="22.185474"
sodipodi:cy="6.7209325"
sodipodi:rx="10.253048"
sodipodi:ry="10.253048"
d="m 32.438522,6.7209325 a 10.253048,10.253048 0 1 1 -20.506096,-5e-7"
sodipodi:start="0"
sodipodi:end="3.1415927"
sodipodi:open="true"
transform="translate(-4.5519999,-9.5901357)" />
<path
sodipodi:type="star"
style="fill:url(#linearGradient7041);fill-opacity:1;stroke:#000000;stroke-width:0.60000002;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path6967"
sodipodi:sides="5"
sodipodi:cx="17.5"
sodipodi:cy="-6.5"
sodipodi:r1="11.236103"
sodipodi:r2="5.6180515"
sodipodi:arg1="1.2068174"
sodipodi:arg2="1.8351359"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 21.5,4.0000006 16.032161,-1.07709 8.7499739,0.54890458 11.888919,-6.2202262 8.0921866,-12.643538 15.5,-11.75 l 4.935678,-5.59582 1.439335,7.321368 6.847149,2.9649047 -6.518255,3.6313162 z"
inkscape:transform-center-x="-0.90717414"
inkscape:transform-center-y="-0.17290973"
transform="translate(9.9737199e-8,22.25)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

170
DroidFish/res/raw/flip.svg Normal file
View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="36"
height="32"
id="svg3092"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="button.svg">
<defs
id="defs3094">
<linearGradient
id="linearGradient4004">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop4006" />
<stop
id="stop4012"
offset="0.69999999"
style="stop-color:#e0e0e0;stop-opacity:0.627451;" />
<stop
style="stop-color:#e0e0e0;stop-opacity:0;"
offset="1"
id="stop4008" />
</linearGradient>
<linearGradient
id="linearGradient6679"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000ff;stop-opacity:1;"
id="stop3076" />
<stop
offset="1"
style="stop-color:#d9d9ff;stop-opacity:1;"
id="stop3078" />
</linearGradient>
<linearGradient
id="linearGradient7189"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000a0;stop-opacity:1;"
id="stop3081" />
<stop
offset="1"
style="stop-color:#5959ff;stop-opacity:1;"
id="stop3083" />
</linearGradient>
<linearGradient
y2="876.73859"
x2="413.9183"
y1="903.00256"
x1="413.91833"
gradientUnits="userSpaceOnUse"
id="linearGradient3918"
xlink:href="#linearGradient6679"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4004"
id="radialGradient4010"
cx="17.864586"
cy="15.999999"
fx="17.864586"
fy="15.999999"
r="17.5"
gradientTransform="matrix(1.3714287,-7.8784533e-8,6.4012425e-8,1.1142857,-6.5000057,-1.828569)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="20.521696"
inkscape:cy="18.444872"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1441"
inkscape:window-height="1145"
inkscape:window-x="235"
inkscape:window-y="0"
inkscape:window-maximized="0"
showguides="true">
<inkscape:grid
type="xygrid"
id="grid3104"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.5px"
spacingy="0.5px" />
</sodipodi:namedview>
<metadata
id="metadata3097">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:url(#radialGradient4010);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.37777780999999999"
id="rect3100"
width="35"
height="31"
x="0.5"
y="0.5"
ry="7" />
<path
sodipodi:type="arc"
style="fill:none;fill-opacity:1;stroke:none"
id="path4103"
sodipodi:cx="22.185474"
sodipodi:cy="6.7209325"
sodipodi:rx="10.253048"
sodipodi:ry="10.253048"
d="m 32.438522,6.7209325 a 10.253048,10.253048 0 1 1 -20.506096,-5e-7"
sodipodi:start="0"
sodipodi:end="3.1415927"
sodipodi:open="true"
transform="translate(-4.5519999,-9.5901357)" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 26.5625,16.90625 C 25.328611,21.511188 20.604938,24.233889 16,23 14.255877,22.532663 12.695703,21.510759 11.5625,20.125 L 13.15625,18.9375 8.5,17.28125 l -0.46875,5.5 1.5625,-1.15625 c 1.470433,1.829672 3.494095,3.168408 5.78125,3.78125 5.91,1.58358 12.01017,-1.93375 13.59375,-7.84375 L 26.5625,16.90625 z"
id="path6938"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.60000002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 10.4375,15.09375 C 11.671389,10.488812 16.395062,7.766111 21,9 c 1.744123,0.467337 3.304297,1.489241 4.4375,2.875 l -1.59375,1.1875 4.65625,1.65625 0.46875,-5.5 -1.5625,1.15625 C 25.935817,8.545328 23.912155,7.206592 21.625,6.59375 15.715,5.01017 9.61483,8.5275 8.03125,14.4375 l 2.40625,0.65625 z"
id="path6938-6" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

158
DroidFish/res/raw/left.svg Normal file
View File

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="36"
height="32"
id="svg3092"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="button.svg">
<defs
id="defs3094">
<linearGradient
id="linearGradient4004">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop4006" />
<stop
id="stop4012"
offset="0.69999999"
style="stop-color:#e0e0e0;stop-opacity:0.627451;" />
<stop
style="stop-color:#e0e0e0;stop-opacity:0;"
offset="1"
id="stop4008" />
</linearGradient>
<linearGradient
id="linearGradient6679"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000ff;stop-opacity:1;"
id="stop3076" />
<stop
offset="1"
style="stop-color:#d9d9ff;stop-opacity:1;"
id="stop3078" />
</linearGradient>
<linearGradient
id="linearGradient7189"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000a0;stop-opacity:1;"
id="stop3081" />
<stop
offset="1"
style="stop-color:#5959ff;stop-opacity:1;"
id="stop3083" />
</linearGradient>
<linearGradient
y2="876.73859"
x2="413.9183"
y1="903.00256"
x1="413.91833"
gradientUnits="userSpaceOnUse"
id="linearGradient3918"
xlink:href="#linearGradient6679"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4004"
id="radialGradient4010"
cx="17.864586"
cy="15.999999"
fx="17.864586"
fy="15.999999"
r="17.5"
gradientTransform="matrix(1.3714287,-7.8784533e-8,6.4012425e-8,1.1142857,-6.5000057,-1.828569)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="20.168143"
inkscape:cy="17.141144"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1441"
inkscape:window-height="1145"
inkscape:window-x="235"
inkscape:window-y="0"
inkscape:window-maximized="0"
showguides="true">
<inkscape:grid
type="xygrid"
id="grid3104"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.5px"
spacingy="0.5px" />
</sodipodi:namedview>
<metadata
id="metadata3097">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:url(#radialGradient4010);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.37777780999999999"
id="rect3100"
width="35"
height="31"
x="0.5"
y="0.5"
ry="7" />
<g
id="layer1-9"
transform="matrix(-1,0,0,1,431.28571,-873.50504)"
style="stroke:#7377f7;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
<path
style="fill:url(#linearGradient3918);fill-opacity:1;stroke:#7377f7;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path6618"
d="m 400.78571,884.50504 0,10 17,0 0,7.5 9.5,-12.5 -9.5,-12.5 0,7.5 z"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

156
DroidFish/res/raw/mode.svg Normal file
View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="36"
height="32"
id="svg3092"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="button.svg">
<defs
id="defs3094">
<linearGradient
id="linearGradient4004">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop4006" />
<stop
id="stop4012"
offset="0.69999999"
style="stop-color:#e0e0e0;stop-opacity:0.627451;" />
<stop
style="stop-color:#e0e0e0;stop-opacity:0;"
offset="1"
id="stop4008" />
</linearGradient>
<linearGradient
id="linearGradient6679"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000ff;stop-opacity:1;"
id="stop3076" />
<stop
offset="1"
style="stop-color:#d9d9ff;stop-opacity:1;"
id="stop3078" />
</linearGradient>
<linearGradient
id="linearGradient7189"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000a0;stop-opacity:1;"
id="stop3081" />
<stop
offset="1"
style="stop-color:#5959ff;stop-opacity:1;"
id="stop3083" />
</linearGradient>
<linearGradient
y2="876.73859"
x2="413.9183"
y1="903.00256"
x1="413.91833"
gradientUnits="userSpaceOnUse"
id="linearGradient3918"
xlink:href="#linearGradient6679"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4004"
id="radialGradient4010"
cx="17.864586"
cy="15.999999"
fx="17.864586"
fy="15.999999"
r="17.5"
gradientTransform="matrix(1.3714287,-7.8784533e-8,6.4012425e-8,1.1142857,-6.5000057,-1.828569)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="20.521696"
inkscape:cy="15.27095"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1441"
inkscape:window-height="1145"
inkscape:window-x="235"
inkscape:window-y="0"
inkscape:window-maximized="0"
showguides="true">
<inkscape:grid
type="xygrid"
id="grid3104"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.5px"
spacingy="0.5px" />
</sodipodi:namedview>
<metadata
id="metadata3097">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:url(#radialGradient4010);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.37777780999999999"
id="rect3100"
width="35"
height="31"
x="0.5"
y="0.5"
ry="7" />
<g
transform="translate(0.347656,-0.1367188)"
style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
id="text4021">
<path
inkscape:connector-curvature="0"
d="m 9.8554688,7.5039062 3.5273442,0 4.464843,11.9062498 4.488281,-11.9062498 3.527344,0 0,17.4960938 -2.308594,0 0,-15.3632812 -4.511718,12.0000002 -2.378907,0 -4.511718,-12.0000002 0,15.3632812 -2.2968752,0 0,-17.4960938"
id="path4055" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

158
DroidFish/res/raw/right.svg Normal file
View File

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="36"
height="32"
id="svg3092"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="button.svg">
<defs
id="defs3094">
<linearGradient
id="linearGradient4004">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop4006" />
<stop
id="stop4012"
offset="0.69999999"
style="stop-color:#e0e0e0;stop-opacity:0.627451;" />
<stop
style="stop-color:#e0e0e0;stop-opacity:0;"
offset="1"
id="stop4008" />
</linearGradient>
<linearGradient
id="linearGradient6679"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000ff;stop-opacity:1;"
id="stop3076" />
<stop
offset="1"
style="stop-color:#d9d9ff;stop-opacity:1;"
id="stop3078" />
</linearGradient>
<linearGradient
id="linearGradient7189"
y1="903.00256"
x1="413.91833"
y2="876.73859"
x2="413.9183"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#0000a0;stop-opacity:1;"
id="stop3081" />
<stop
offset="1"
style="stop-color:#5959ff;stop-opacity:1;"
id="stop3083" />
</linearGradient>
<linearGradient
y2="876.73859"
x2="413.9183"
y1="903.00256"
x1="413.91833"
gradientUnits="userSpaceOnUse"
id="linearGradient3918"
xlink:href="#linearGradient6679"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4004"
id="radialGradient4010"
cx="17.864586"
cy="15.999999"
fx="17.864586"
fy="15.999999"
r="17.5"
gradientTransform="matrix(1.3714287,-7.8784533e-8,6.4012425e-8,1.1142857,-6.5000057,-1.828569)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="20.168143"
inkscape:cy="17.119046"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1441"
inkscape:window-height="1145"
inkscape:window-x="235"
inkscape:window-y="0"
inkscape:window-maximized="0"
showguides="true">
<inkscape:grid
type="xygrid"
id="grid3104"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.5px"
spacingy="0.5px" />
</sodipodi:namedview>
<metadata
id="metadata3097">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:url(#radialGradient4010);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.37777780999999999"
id="rect3100"
width="35"
height="31"
x="0.5"
y="0.5"
ry="7" />
<g
id="layer1-9"
transform="translate(-395.28571,-873.50504)"
style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke:#7377f7;stroke-opacity:1">
<path
style="fill:url(#linearGradient3918);fill-opacity:1;stroke:#7377f7;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path6618"
d="m 400.78571,884.50504 0,10 17,0 0,7.5 9.5,-12.5 -9.5,-12.5 0,7.5 z"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -106,6 +106,7 @@ you are not actively using the program.\
<string name="toggle_pgn_comments">Toggle Comments</string>
<string name="toggle_pgn_headers">Toggle Headers</string>
<string name="toggle_analysis">Toggle Engine Analysis</string>
<string name="toggle_large_buttons">Toggle Large Buttons</string>
<string name="cancel">Cancel</string>
<string name="yes">Yes</string>
<string name="no">No</string>
@ -508,6 +509,7 @@ you are not actively using the program.\
<item>@string/toggle_pgn_variations</item>
<item>@string/toggle_pgn_comments</item>
<item>@string/toggle_pgn_headers</item>
<item>@string/toggle_large_buttons</item>
</string-array>
<string-array name="button_action_values">
<item></item>
@ -518,5 +520,6 @@ you are not actively using the program.\
<item>viewVariations</item>
<item>viewComments</item>
<item>viewHeaders</item>
<item>largeButtons</item>
</string-array>
</resources>

View File

@ -121,12 +121,12 @@ public class ButtonActions {
}
/** Get icon resource for button. */
public int getIcon(boolean large) {
public int getIcon() {
int ret = -1;
if (mainAction != null)
ret = mainAction.getIcon(large);
ret = mainAction.getIcon();
if (ret == -1)
ret = large ? R.drawable.custom_large : R.drawable.custom;
ret = R.raw.custom;
return ret;
}
}

View File

@ -51,6 +51,9 @@ import org.petero.droidfish.gamelogic.PgnToken;
import org.petero.droidfish.gamelogic.GameTree.Node;
import org.petero.droidfish.gtb.Probe;
import com.larvalabs.svgandroid.SVG;
import com.larvalabs.svgandroid.SVGParser;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@ -211,7 +214,7 @@ public class DroidFish extends Activity implements GUIInterface {
addAction(new UIAction() {
public String getId() { return "flipboard"; }
public int getName() { return R.string.flip_board; }
public int getIcon(boolean large) { return large ? R.drawable.flip_large : R.drawable.flip; }
public int getIcon() { return R.raw.flip; }
public boolean enabled() { return true; }
public void run() {
boardFlipped = !cb.flipped;
@ -222,7 +225,7 @@ public class DroidFish extends Activity implements GUIInterface {
addAction(new UIAction() {
public String getId() { return "showThinking"; }
public int getName() { return R.string.toggle_show_thinking; }
public int getIcon(boolean large) { return -1; }
public int getIcon() { return -1; }
public boolean enabled() { return true; }
public void run() {
mShowThinking = toggleBooleanPref("showThinking");
@ -232,7 +235,7 @@ public class DroidFish extends Activity implements GUIInterface {
addAction(new UIAction() {
public String getId() { return "bookHints"; }
public int getName() { return R.string.toggle_book_hints; }
public int getIcon(boolean large) { return -1; }
public int getIcon() { return -1; }
public boolean enabled() { return true; }
public void run() {
mShowBookHints = toggleBooleanPref("bookHints");
@ -242,7 +245,7 @@ public class DroidFish extends Activity implements GUIInterface {
addAction(new UIAction() {
public String getId() { return "viewVariations"; }
public int getName() { return R.string.toggle_pgn_variations; }
public int getIcon(boolean large) { return -1; }
public int getIcon() { return -1; }
public boolean enabled() { return true; }
public void run() {
pgnOptions.view.variations = toggleBooleanPref("viewVariations");
@ -253,7 +256,7 @@ public class DroidFish extends Activity implements GUIInterface {
addAction(new UIAction() {
public String getId() { return "viewComments"; }
public int getName() { return R.string.toggle_pgn_comments; }
public int getIcon(boolean large) { return -1; }
public int getIcon() { return -1; }
public boolean enabled() { return true; }
public void run() {
pgnOptions.view.comments = toggleBooleanPref("viewComments");
@ -264,7 +267,7 @@ public class DroidFish extends Activity implements GUIInterface {
addAction(new UIAction() {
public String getId() { return "viewHeaders"; }
public int getName() { return R.string.toggle_pgn_headers; }
public int getIcon(boolean large) { return -1; }
public int getIcon() { return -1; }
public boolean enabled() { return true; }
public void run() {
pgnOptions.view.headers = toggleBooleanPref("viewHeaders");
@ -275,7 +278,7 @@ public class DroidFish extends Activity implements GUIInterface {
addAction(new UIAction() {
public String getId() { return "toggleAnalysis"; }
public int getName() { return R.string.toggle_analysis; }
public int getIcon(boolean large) { return -1; }
public int getIcon() { return -1; }
public boolean enabled() { return true; }
public void run() {
int gameModeType = ctrl.analysisMode() ? GameMode.EDIT_GAME : GameMode.ANALYSIS;
@ -288,6 +291,16 @@ public class DroidFish extends Activity implements GUIInterface {
setBoardFlip(true);
}
});
addAction(new UIAction() {
public String getId() { return "largeButtons"; }
public int getName() { return R.string.toggle_large_buttons; }
public int getIcon() { return -1; }
public boolean enabled() { return true; }
public void run() {
pgnOptions.view.headers = toggleBooleanPref("largeButtons");
updateButtons();
}
});
}
@Override
@ -734,30 +747,7 @@ public class DroidFish extends Activity implements GUIInterface {
custom1ButtonActions.readPrefs(settings, actionFactory);
custom2ButtonActions.readPrefs(settings, actionFactory);
boolean largeButtons = settings.getBoolean("largeButtons", false);
Resources r = getResources();
int bWidth = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, r.getDisplayMetrics()));
int bHeight = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, r.getDisplayMetrics()));
if (largeButtons) {
bWidth = bWidth * 3 / 2;
bHeight = bHeight * 3 / 2;
custom1Button.setImageResource(custom1ButtonActions.getIcon(true));
custom2Button.setImageResource(custom2ButtonActions.getIcon(true));
modeButton.setImageResource(R.drawable.mode_large);
undoButton.setImageResource(R.drawable.left_large);
redoButton.setImageResource(R.drawable.right_large);
} else {
custom1Button.setImageResource(custom1ButtonActions.getIcon(false));
custom2Button.setImageResource(custom2ButtonActions.getIcon(false));
modeButton.setImageResource(R.drawable.mode);
undoButton.setImageResource(R.drawable.left);
redoButton.setImageResource(R.drawable.right);
}
custom1Button.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
custom2Button.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
modeButton.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
undoButton.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
redoButton.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
updateButtons();
bookOptions.filename = settings.getString("bookFile", "");
bookOptions.maxLength = getIntSetting("bookMaxLength", 1000000);
@ -803,6 +793,39 @@ public class DroidFish extends Activity implements GUIInterface {
ctrl.prefsChanged();
}
private void updateButtons() {
boolean largeButtons = settings.getBoolean("largeButtons", false);
Resources r = getResources();
int bWidth = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, r.getDisplayMetrics()));
int bHeight = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, r.getDisplayMetrics()));
if (largeButtons) {
bWidth = bWidth * 3 / 2;
bHeight = bHeight * 3 / 2;
}
SVG svg = SVGParser.getSVGFromResource(getResources(),
custom1ButtonActions.getIcon());
custom1Button.setBackgroundDrawable(new SVGPictureDrawable(svg));
svg = SVGParser.getSVGFromResource(getResources(),
custom2ButtonActions.getIcon());
custom2Button.setBackgroundDrawable(new SVGPictureDrawable(svg));
svg = SVGParser.getSVGFromResource(getResources(), R.raw.right);
redoButton.setBackgroundDrawable(new SVGPictureDrawable(svg));
svg = SVGParser.getSVGFromResource(getResources(), R.raw.left);
undoButton.setBackgroundDrawable(new SVGPictureDrawable(svg));
svg = SVGParser.getSVGFromResource(getResources(), R.raw.mode);
modeButton.setBackgroundDrawable(new SVGPictureDrawable(svg));
custom1Button.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
custom2Button.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
modeButton.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
undoButton.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
redoButton.setLayoutParams(new LinearLayout.LayoutParams(bWidth, bHeight));
}
private synchronized final void setWakeLock(boolean enableLock) {
WakeLock wl = wakeLock;
if (wl != null) {

View File

@ -0,0 +1,47 @@
package org.petero.droidfish;
import com.larvalabs.svgandroid.SVG;
import android.graphics.Canvas;
import android.graphics.RectF;
import android.graphics.drawable.PictureDrawable;
/**
* Like PictureDrawable but scales the picture according to current drawing bounds.
*/
public class SVGPictureDrawable extends PictureDrawable {
private final int iWidth;
private final int iHeight;
public SVGPictureDrawable(SVG svg) {
super(svg.getPicture());
RectF bounds = svg.getBounds();
RectF limits = svg.getLimits();
if (bounds != null) {
iWidth = (int)bounds.width();
iHeight = (int)bounds.height();
} else if (limits != null) {
iWidth = (int)limits.width();
iHeight = (int)limits.height();
} else {
iWidth = -1;
iHeight = -1;
}
}
@Override
public int getIntrinsicWidth() {
return iWidth;
}
@Override
public int getIntrinsicHeight() {
return iHeight;
}
@Override
public void draw(Canvas canvas) {
canvas.drawPicture(getPicture(), getBounds());
}
}

View File

@ -26,8 +26,8 @@ public interface UIAction extends Runnable {
/** Get name resource for the action. */
public int getName();
/** Get icon resource or -1 for no icon. */
public int getIcon(boolean large);
/** Get icon SVG resource or -1 for no icon. */
public int getIcon();
/** Return true if the action is currently enabled. */
public boolean enabled();