Button background color changing

This commit is contained in:
Neale Pickett 2012-05-26 16:22:14 -06:00
parent f2b0fc27d3
commit 37e49d83d4
11 changed files with 433 additions and 18 deletions

View File

@ -3,14 +3,14 @@
package="org.woozle.penaltytimer"
android:versionCode="1"
android:versionName="1.0">
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="PenaltyTimer"
android:label="@string/app_name">
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="4" />
<uses-permission android:name="android.permission.VIBRATE"/>
<application android:label="@string/app_name" android:description="@string/description" android:icon="@drawable/ic_launcher">
<activity android:name="PenaltyTimer">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.VIBRATE"/>
</manifest>

View File

@ -1,8 +1,15 @@
install: bin/PenaltyTimer-debug.apk
install: debug-install
debug-install: bin/PenaltyTimer-debug.apk
adb install -r $<
release-install: bin/PenaltyTimer-release.apk
adb install -r $<
clean:
ant clean
bin/PenaltyTimer-release.apk: src/org/woozle/penaltytimer/* res/*/*
ant release
bin/PenaltyTimer-debug.apk: src/org/woozle/penaltytimer/* res/*/*
ant debug

View File

@ -14,4 +14,5 @@
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
key.store = /home/neale/.local/android.keystore
key.alias = dartcatcher

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -11,7 +11,7 @@
android:gravity="center"
android:stretchColumns="*">
<TableRow>
<Button android:text="Jam End"
<Button android:text="@+string/jam_end"
android:id="@+id/pause"
android:layout_span="2"
android:onClick="pauseButton" />

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WFTDA penalty timer</string>
<string name="self_destruct">Boom</string>
<string name="app_name">Penalty Timer</string>
<string name="description">WFTDA Roller Derby Penalty Tracker from woozle.org</string>
<string name="jam_begin">Jam Begin</string>
<string name="jam_end">Jam End</string>
</resources>

View File

@ -137,9 +137,9 @@ public class PenaltyTimer extends Activity
}
}
if (paused) {
e.setText("Jam Begin");
e.setText(R.string.jam_begin);
} else {
e.setText("Jam End");
e.setText(R.string.jam_end);
}
}
}

View File

@ -5,7 +5,9 @@ import android.widget.*;
import android.view.View;
import android.view.View.*;
import android.view.Gravity;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuff;
import android.os.SystemClock;
import android.os.Vibrator;
import java.util.*;
@ -22,9 +24,9 @@ public class TimerButton
Vibrator vibr;
long now;
static int releaseColor = Color.rgb(0, 127, 0);
static int standColor = Color.rgb(127, 127, 0);
static int normalColor = Color.BLACK;
static ColorFilter releaseColor = null;
static ColorFilter standColor = new PorterDuffColorFilter(0xffffff88, PorterDuff.Mode.MULTIPLY);
static ColorFilter normalColor = new PorterDuffColorFilter(0xffff8888, PorterDuff.Mode.MULTIPLY);
public TimerButton(Context context, long now) {
b = new Button(context);
@ -104,6 +106,7 @@ public class TimerButton
public void update() {
long r = remaining();
ColorFilter cf;
if ((duration > 0) && (r <= 0)) {
duration = 0;
@ -113,16 +116,17 @@ public class TimerButton
}
if (r <= 0) {
b.setTextColor(releaseColor);
cf = releaseColor;
} else if (r < 10000) {
if (! shook) {
vibr.vibrate(200);
shook = true;
}
b.setTextColor(standColor);
cf = standColor;
} else {
b.setTextColor(normalColor);
cf = normalColor;
}
b.getBackground().setColorFilter(cf);
b.setText(str(r, true));
}

401
timer.svg Normal file
View File

@ -0,0 +1,401 @@
<?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"
inkscape:export-ydpi="148.41405"
inkscape:export-xdpi="148.41405"
inkscape:export-filename="/home/neale/src/ptimer/res/drawable-hdpi/ic_launcher.png"
width="43.690239"
height="43.690239"
id="svg11300"
sodipodi:version="0.32"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="timer.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs3">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective59" />
<linearGradient
inkscape:collect="always"
id="linearGradient5204">
<stop
style="stop-color:#c4a000;stop-opacity:1;"
offset="0"
id="stop5206" />
<stop
style="stop-color:#c4a000;stop-opacity:0;"
offset="1"
id="stop5208" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient5196">
<stop
style="stop-color:#c4a000;stop-opacity:1;"
offset="0"
id="stop5198" />
<stop
style="stop-color:#c4a000;stop-opacity:0;"
offset="1"
id="stop5200" />
</linearGradient>
<linearGradient
id="linearGradient12512">
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop12513" />
<stop
style="stop-color:#fff520;stop-opacity:0.89108908;"
offset="0.50000000"
id="stop12517" />
<stop
style="stop-color:#fff300;stop-opacity:0.0000000;"
offset="1.0000000"
id="stop12514" />
</linearGradient>
<linearGradient
id="linearGradient10653">
<stop
style="stop-color:#f3f4ff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop10655" />
<stop
style="stop-color:#9193af;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop10657" />
</linearGradient>
<linearGradient
id="linearGradient42174">
<stop
style="stop-color:#a0a0a0;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop42176" />
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop42178" />
</linearGradient>
<linearGradient
id="linearGradient2145">
<stop
style="stop-color:#fffffd;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop2147" />
<stop
style="stop-color:#cbcbc9;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop2149" />
</linearGradient>
<linearGradient
id="linearGradient37935">
<stop
id="stop37937"
offset="0.0000000"
style="stop-color:#9497b3;stop-opacity:1.0000000;" />
<stop
id="stop37939"
offset="1.0000000"
style="stop-color:#4c4059;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient2152">
<stop
id="stop2154"
offset="0.0000000"
style="stop-color:#9aa29a;stop-opacity:1.0000000;" />
<stop
id="stop2156"
offset="1.0000000"
style="stop-color:#b5beb5;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3816">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3818" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3820" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3816"
id="radialGradient3822"
cx="31.112698"
cy="19.008621"
fx="31.112698"
fy="19.008621"
r="8.6620579"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2152"
id="linearGradient4307"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(3.123841,0,0,0.969691,-31.88758,-19.59492)"
x1="8.9156475"
y1="37.197018"
x2="9.8855038"
y2="52.090679" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient10653"
id="radialGradient4309"
gradientUnits="userSpaceOnUse"
cx="11.3292"
cy="10.58397"
fx="11.3292"
fy="10.58397"
r="15.532059" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2145"
id="radialGradient4311"
gradientUnits="userSpaceOnUse"
cx="11.901996"
cy="10.045444"
fx="11.901996"
fy="10.045444"
r="29.292715" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient42174"
id="linearGradient4313"
gradientUnits="userSpaceOnUse"
x1="6.342216"
y1="7.7893324"
x2="22.218424"
y2="25.884274" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5196"
id="radialGradient5202"
cx="23.375"
cy="10.972863"
fx="23.375"
fy="10.972863"
r="3.3478093"
gradientTransform="matrix(3.63042,0,0,3.742066,-61.48607,-29.18618)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5204"
id="linearGradient5210"
x1="19.667364"
y1="4.2570662"
x2="20.329933"
y2="5.2845874"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient37935"
id="radialGradient5212"
gradientUnits="userSpaceOnUse"
cx="8.7468252"
cy="6.8283234"
fx="8.7468252"
fy="6.8283234"
r="29.889715" />
</defs>
<sodipodi:namedview
stroke="#c4a000"
fill="#babdb6"
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.25490196"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.313708"
inkscape:cx="21.844716"
inkscape:cy="22.830558"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:showpageshadow="false"
inkscape:window-width="1276"
inkscape:window-height="1004"
inkscape:window-x="0"
inkscape:window-y="16"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:creator>
<cc:Agent>
<dc:title>Jakub Steiner</dc:title>
</cc:Agent>
</dc:creator>
<dc:source>http://jimmac.musichall.cz</dc:source>
<cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
<dc:title></dc:title>
<dc:subject>
<rdf:Bag>
<rdf:li>appointment</rdf:li>
<rdf:li>new</rdf:li>
<rdf:li>meeting</rdf:li>
<rdf:li>rvsp</rdf:li>
</rdf:Bag>
</dc:subject>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(-1.9866858,-0.70844118)">
<path
sodipodi:nodetypes="cccc"
id="path14341"
d="M 18.587591,1.403729 4.2267555,18.096665 5.4854725,19.339844 18.587591,1.403729 z"
style="color:#000000;fill:url(#linearGradient4307);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccc"
id="path18921"
d="M 18.467176,1.3138035 5.6605725,19.072612 7.4900995,20.687913 18.467176,1.3138035 z"
style="fill:#fefefe;fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
transform="matrix(1.431529,0,0,1.431529,0.56945948,-1.654618)"
d="m 31.160714,16.910715 c 0,8.23496 -6.675754,14.910714 -14.910714,14.910714 -8.23496,0 -14.9107141,-6.675754 -14.9107141,-14.910714 0,-8.2349599 6.6757541,-14.910714 14.9107141,-14.910714 8.23496,0 14.910714,6.6757541 14.910714,14.910714 z"
sodipodi:ry="14.910714"
sodipodi:rx="14.910714"
sodipodi:cy="16.910715"
sodipodi:cx="16.25"
id="path27786"
style="fill:url(#radialGradient5212);fill-opacity:1;fill-rule:evenodd;stroke:#605773;stroke-width:0.69855404;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
sodipodi:type="arc" />
<path
transform="matrix(1.163838,0,0,1.163838,4.8248015,2.777556)"
d="m 31.160714,16.910715 c 0,8.23496 -6.675754,14.910714 -14.910714,14.910714 -8.23496,0 -14.9107141,-6.675754 -14.9107141,-14.910714 0,-8.2349599 6.6757541,-14.910714 14.9107141,-14.910714 8.23496,0 14.910714,6.6757541 14.910714,14.910714 z"
sodipodi:ry="14.910714"
sodipodi:rx="14.910714"
sodipodi:cy="16.910715"
sodipodi:cx="16.25"
id="path35549"
style="fill:url(#radialGradient4311);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4313);stroke-width:0.71139598;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
sodipodi:type="arc" />
<path
sodipodi:type="arc"
style="color:#000000;fill:url(#radialGradient5202);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient5210);stroke-width:0.56498736;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible"
id="path4120"
sodipodi:cx="23.375"
sodipodi:cy="11.875"
sodipodi:rx="8.5"
sodipodi:ry="8.5"
d="M 16.679382,6.6387137 C 18.281221,4.590448 20.732476,3.3880482 23.332691,3.3751053 L 23.375,11.875 z"
transform="matrix(0.59328974,1.6675532,-1.6675532,0.59328974,30.095187,-23.148508)"
sodipodi:start="3.8052902"
sodipodi:end="4.7074114"
inkscape:transform-center-x="-7.1558421"
inkscape:transform-center-y="-6.8798241" />
<path
transform="matrix(2.073295,0,0,2.073295,-7.3102235,-13.13682)"
d="m 16.40625,17.28125 c 0,0.673097 -0.545653,1.21875 -1.21875,1.21875 -0.673097,0 -1.21875,-0.545653 -1.21875,-1.21875 0,-0.673097 0.545653,-1.21875 1.21875,-1.21875 0.673097,0 1.21875,0.545653 1.21875,1.21875 z"
sodipodi:ry="1.21875"
sodipodi:rx="1.21875"
sodipodi:cy="17.28125"
sodipodi:cx="15.1875"
id="path34778"
style="fill:#f3f3f3;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.48232403;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
sodipodi:type="arc" />
<path
id="path35559"
d="M 25.23351,20.189223 29.349023,9.1501365"
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0"
inkscape:transform-center-x="-3.2115056"
inkscape:transform-center-y="-7.9500406" />
<path
transform="matrix(2.749493,0,0,2.749493,-22.30073,-12.40939)"
d="m 17.324117,7.6932044 c 0,0.3417088 -0.27701,0.6187184 -0.618718,0.6187184 -0.341709,0 -0.618719,-0.2770096 -0.618719,-0.6187184 0,-0.3417088 0.27701,-0.6187184 0.618719,-0.6187184 0.341708,0 0.618718,0.2770096 0.618718,0.6187184 z"
sodipodi:ry="0.61871845"
sodipodi:rx="0.61871845"
sodipodi:cy="7.6932044"
sodipodi:cx="16.705399"
id="path35563"
style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none"
sodipodi:type="arc" />
<path
transform="matrix(2.749493,0,0,2.749493,-22.30073,14.80922)"
d="m 17.324117,7.6932044 c 0,0.3417088 -0.27701,0.6187184 -0.618718,0.6187184 -0.341709,0 -0.618719,-0.2770096 -0.618719,-0.6187184 0,-0.3417088 0.27701,-0.6187184 0.618719,-0.6187184 0.341708,0 0.618718,0.2770096 0.618718,0.6187184 z"
sodipodi:ry="0.61871845"
sodipodi:rx="0.61871845"
sodipodi:cy="7.6932044"
sodipodi:cx="16.705399"
id="path35565"
style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none"
sodipodi:type="arc" />
<path
transform="matrix(2.749493,0,0,2.749493,-35.91004,1.19989)"
d="m 17.324117,7.6932044 c 0,0.3417088 -0.27701,0.6187184 -0.618718,0.6187184 -0.341709,0 -0.618719,-0.2770096 -0.618719,-0.6187184 0,-0.3417088 0.27701,-0.6187184 0.618719,-0.6187184 0.341708,0 0.618718,0.2770096 0.618718,0.6187184 z"
sodipodi:ry="0.61871845"
sodipodi:rx="0.61871845"
sodipodi:cy="7.6932044"
sodipodi:cx="16.705399"
id="path35567"
style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none"
sodipodi:type="arc" />
<path
transform="matrix(2.749493,0,0,2.749493,-8.6914475,1.19989)"
d="m 17.324117,7.6932044 c 0,0.3417088 -0.27701,0.6187184 -0.618718,0.6187184 -0.341709,0 -0.618719,-0.2770096 -0.618719,-0.6187184 0,-0.3417088 0.27701,-0.6187184 0.618719,-0.6187184 0.341708,0 0.618718,0.2770096 0.618718,0.6187184 z"
sodipodi:ry="0.61871845"
sodipodi:rx="0.61871845"
sodipodi:cy="7.6932044"
sodipodi:cx="16.705399"
id="path35569"
style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none"
sodipodi:type="arc" />
<path
sodipodi:type="arc"
style="fill:none;stroke:url(#radialGradient4309);stroke-width:0.73656511;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
id="path10651"
sodipodi:cx="16.25"
sodipodi:cy="16.910715"
sodipodi:rx="14.910714"
sodipodi:ry="14.910714"
d="m 31.160714,16.910715 c 0,8.23496 -6.675754,14.910714 -14.910714,14.910714 -8.23496,0 -14.9107141,-6.675754 -14.9107141,-14.910714 0,-8.2349599 6.6757541,-14.910714 14.9107141,-14.910714 8.23496,0 14.910714,6.6757541 14.910714,14.910714 z"
transform="matrix(1.357654,0,0,1.357654,1.7698965,-0.493735)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB