diff options
48 files changed, 4145 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..555186d --- /dev/null +++ b/Android.mk @@ -0,0 +1,36 @@ +# +# Copyright (C) 2008 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_STATIC_JAVA_LIBRARIES := libarity + +LOCAL_MODULE_TAGS := eng development + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := Calculator + +include $(BUILD_PACKAGE) +################################################## +include $(CLEAR_VARS) + +LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libarity:arity-1.3.1.jar +include $(BUILD_MULTI_PREBUILT) + +# Use the folloing include to make our test apk. +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..ce9063f --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.calculator2"> + <application android:label="@string/app_name" android:icon="@drawable/icon"> + <activity android:name="Calculator" + android:theme="@android:style/Theme.Black"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/MODULE_LICENSE_APACHE2 @@ -0,0 +1,190 @@ + + Copyright (c) 2005-2008, The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + diff --git a/arity-1.3.1.jar b/arity-1.3.1.jar Binary files differnew file mode 100644 index 0000000..ceab57a --- /dev/null +++ b/arity-1.3.1.jar diff --git a/calculator.svg b/calculator.svg new file mode 100644 index 0000000..750f03c --- /dev/null +++ b/calculator.svg @@ -0,0 +1,1409 @@ +<?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://web.resource.org/cc/" + 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="744.09448819" + height="1052.3622047" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.45.1" + sodipodi:docbase="/local_home/Dev/jaceks-soundrecorder/device/apps/Calculator2" + sodipodi:docname="calculator.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <linearGradient + inkscape:collect="always" + id="linearGradient4570"> + <stop + style="stop-color:#232323;stop-opacity:1" + offset="0" + id="stop4572" /> + <stop + style="stop-color:#525252;stop-opacity:1" + offset="1" + id="stop4574" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient5227"> + <stop + style="stop-color:#000000;stop-opacity:1;" + offset="0" + id="stop5229" /> + <stop + style="stop-color:#3d3d3d;stop-opacity:1" + offset="1" + id="stop5231" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient5227" + id="linearGradient5233" + x1="334.36539" + y1="70.519363" + x2="357.89621" + y2="91.84127" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(2.2465112,0,0,2.2465112,-138.16174,-98.256934)" /> + <linearGradient + inkscape:collect="always" + id="linearGradient4343"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop4345" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop4347" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4343" + id="linearGradient4349" + x1="280.12793" + y1="72.910743" + x2="285.12817" + y2="74.047165" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(2.2465112,0,0,2.2465112,-21.943409,-90.262612)" /> + <filter + inkscape:collect="always" + id="filter3650"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="1.7841818" + id="feGaussianBlur3652" /> + </filter> + <filter + inkscape:collect="always" + x="-0.026997312" + width="1.0539946" + y="-0.18725794" + height="1.3745159" + id="filter3430"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="3.3339287" + id="feGaussianBlur3432" /> + </filter> + <linearGradient + inkscape:collect="always" + id="linearGradient4704"> + <stop + style="stop-color:#ffffff;stop-opacity:1" + offset="0" + id="stop4706" /> + <stop + style="stop-color:#ffffff;stop-opacity:0" + offset="1" + id="stop4708" /> + </linearGradient> + <linearGradient + id="linearGradient4690"> + <stop + id="stop4692" + offset="0" + style="stop-color:#000000;stop-opacity:0" /> + <stop + id="stop4694" + offset="1" + style="stop-color:#000000;stop-opacity:0.70391059" /> + </linearGradient> + <linearGradient + id="linearGradient4678"> + <stop + style="stop-color:#000000;stop-opacity:0" + offset="0" + id="stop4680" /> + <stop + style="stop-color:#000000;stop-opacity:1" + offset="1" + id="stop4682" /> + </linearGradient> + <linearGradient + id="linearGradient4654"> + <stop + id="stop4656" + offset="0" + style="stop-color:#ffffff;stop-opacity:1;" /> + <stop + id="stop4658" + offset="1" + style="stop-color:#000000;stop-opacity:1;" /> + </linearGradient> + <linearGradient + id="linearGradient4557"> + <stop + id="stop4559" + offset="0" + style="stop-color:#000000;stop-opacity:1;" /> + <stop + id="stop4561" + offset="1" + style="stop-color:#000000;stop-opacity:0;" /> + </linearGradient> + <linearGradient + id="linearGradient4491"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop4493" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop4495" /> + </linearGradient> + <linearGradient + id="linearGradient4416"> + <stop + style="stop-color:#ffffff;stop-opacity:1" + offset="0" + id="stop4418" /> + <stop + style="stop-color:#081d44;stop-opacity:1" + offset="1" + id="stop4420" /> + </linearGradient> + <linearGradient + id="linearGradient4208"> + <stop + style="stop-color:#6d0d0d;stop-opacity:1" + offset="0" + id="stop4210" /> + <stop + style="stop-color:#000000;stop-opacity:0" + offset="1" + id="stop4212" /> + </linearGradient> + <linearGradient + id="linearGradient4428"> + <stop + style="stop-color:#000000;stop-opacity:0" + offset="0" + id="stop4430" /> + <stop + style="stop-color:#000000;stop-opacity:1" + offset="1" + id="stop4432" /> + </linearGradient> + <linearGradient + id="linearGradient4402"> + <stop + style="stop-color:#ffffff;stop-opacity:0" + offset="0" + id="stop4404" /> + <stop + style="stop-color:#202020;stop-opacity:1" + offset="1" + id="stop4406" /> + </linearGradient> + <linearGradient + id="linearGradient4197"> + <stop + style="stop-color:#0031e4;stop-opacity:1;" + offset="0" + id="stop4199" /> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="1" + id="stop4201" /> + </linearGradient> + <linearGradient + id="linearGradient3931"> + <stop + style="stop-color:#0000ff;stop-opacity:1;" + offset="0" + id="stop3933" /> + <stop + style="stop-color:#0000ff;stop-opacity:0;" + offset="1" + id="stop3935" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient4137"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop4139" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop4141" /> + </linearGradient> + <linearGradient + id="linearGradient4074"> + <stop + style="stop-color:#f8f8f8;stop-opacity:0" + offset="0" + id="stop4076" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop4078" /> + </linearGradient> + <linearGradient + id="linearGradient4046"> + <stop + style="stop-color:#0b1467;stop-opacity:1;" + offset="0" + id="stop4048" /> + <stop + style="stop-color:#1a2059;stop-opacity:0.48453608;" + offset="1" + id="stop4050" /> + </linearGradient> + <linearGradient + id="linearGradient3582"> + <stop + style="stop-color:#000000;stop-opacity:0;" + offset="0" + id="stop3584" /> + <stop + style="stop-color:#000000;stop-opacity:1;" + offset="1" + id="stop3586" /> + </linearGradient> + <linearGradient + id="linearGradient3356"> + <stop + style="stop-color:#323c9a;stop-opacity:1;" + offset="0" + id="stop3358" /> + <stop + style="stop-color:#323c9a;stop-opacity:0.50515461;" + offset="1" + id="stop3360" /> + </linearGradient> + <linearGradient + id="linearGradient3342"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop3344" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop3346" /> + </linearGradient> + <linearGradient + id="linearGradient4376"> + <stop + id="stop4378" + offset="0" + style="stop-color:#f87a00;stop-opacity:0;" /> + <stop + id="stop4380" + offset="1" + style="stop-color:#1e107e;stop-opacity:0.68041235;" /> + </linearGradient> + <linearGradient + id="linearGradient4348"> + <stop + id="stop4350" + offset="0" + style="stop-color:#40e751;stop-opacity:0;" /> + <stop + id="stop4352" + offset="1" + style="stop-color:#4051e7;stop-opacity:1;" /> + </linearGradient> + <linearGradient + id="linearGradient4310"> + <stop + id="stop4312" + offset="0" + style="stop-color:#2719c4;stop-opacity:0;" /> + <stop + id="stop4314" + offset="1" + style="stop-color:#09204b;stop-opacity:1;" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient3153"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop3155" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop3157" /> + </linearGradient> + <linearGradient + id="linearGradient3209"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop3211" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop3213" /> + </linearGradient> + <linearGradient + id="linearGradient3138"> + <stop + style="stop-color:#2e19c0;stop-opacity:0;" + offset="0" + id="stop3140" /> + <stop + style="stop-color:#1e107e;stop-opacity:0.68041235;" + offset="1" + id="stop3142" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3149" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3159" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3165" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3167" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3380" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3382" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3396" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3398" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3412" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3414" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3428" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3430" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3444" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3446" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3460" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3462" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3476" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3478" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3492" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3494" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3508" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3510" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3524" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3526" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3540" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3542" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3556" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3558" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3572" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3574" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3588" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3590" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient3604" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3606" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient4018" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient4020" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient4104" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient4194" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient4236" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient4244" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient4246" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient4286" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3138" + id="linearGradient4294" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4310" + id="linearGradient4392" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4310" + id="linearGradient4394" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3153" + id="linearGradient3756" + gradientUnits="userSpaceOnUse" + x1="265" + y1="322.00504" + x2="265" + y2="346.64792" /> + <clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath3574"> + <rect + ry="29.698481" + y="-5.4695649" + x="114.55128" + height="171.11983" + width="528.91589" + id="rect3576" + style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" /> + </clipPath> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient4137" + id="radialGradient4145" + cx="141.31583" + cy="14.846804" + fx="141.31583" + fy="14.846804" + r="84.602429" + gradientTransform="matrix(0.3491756,0.3789526,-1.1464775,1.0563903,108.99333,-43.993643)" + gradientUnits="userSpaceOnUse" /> + <clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath3706"> + <rect + ry="29.698481" + y="-5.4695649" + x="114.55128" + height="171.11983" + width="528.91589" + id="rect3708" + style="opacity:0.83647802;fill:url(#linearGradient3710);fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" /> + </clipPath> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4046" + id="linearGradient3710" + gradientUnits="userSpaceOnUse" + x1="643.46716" + y1="-5.4695649" + x2="643.46716" + y2="165.65027" /> + <clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath3798"> + <rect + style="opacity:0.83647802;fill:url(#linearGradient3802);fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" + id="rect3800" + width="528.91589" + height="171.11983" + x="114.55128" + y="-5.4695649" + ry="29.698481" /> + </clipPath> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4046" + id="linearGradient3802" + gradientUnits="userSpaceOnUse" + x1="643.46716" + y1="-5.4695649" + x2="643.46716" + y2="165.65027" /> + <clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath3921"> + <rect + style="opacity:0.83647802;fill:url(#linearGradient3925);fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline" + id="rect3923" + width="528.91589" + height="171.11983" + x="132.55127" + y="8.5304337" + ry="29.698481" /> + </clipPath> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4046" + id="linearGradient3925" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(18,14)" + x1="114.55128" + y1="80.090349" + x2="643.46717" + y2="80.090349" /> + <clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath4386"> + <rect + inkscape:export-ydpi="45.759998" + inkscape:export-xdpi="45.759998" + inkscape:export-filename="/Users/jaceks/Documents/Pictures/calculator.png" + ry="68" + y="-52.665527" + x="52.325901" + height="965.02057" + width="649.12402" + id="rect4388" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + </clipPath> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4197" + id="linearGradient4203" + x1="322" + y1="390.36218" + x2="492" + y2="624.36218" + gradientUnits="userSpaceOnUse" /> + <clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath4212"> + <rect + inkscape:export-ydpi="45.759998" + inkscape:export-xdpi="45.759998" + inkscape:export-filename="/Users/jaceks/Documents/Pictures/calculator.png" + ry="68" + y="-52.665527" + x="52.325901" + height="965.02057" + width="649.12402" + id="rect4214" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + </clipPath> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4428" + id="linearGradient4447" + gradientUnits="userSpaceOnUse" + x1="257.14285" + y1="427.51218" + x2="255.26746" + y2="310.06931" /> + <filter + inkscape:collect="always" + x="-0.15505618" + width="1.3101124" + y="-0.15505618" + height="1.3101124" + id="filter4402"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="7.5679762" + id="feGaussianBlur4404" /> + </filter> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient4690" + id="radialGradient4688" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(2.480299,0,0,2.2736075,-188.74735,-298.98567)" + cx="127.50623" + cy="236.50375" + fx="127.50623" + fy="236.50375" + r="63.253914" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4704" + id="linearGradient4710" + x1="102.3125" + y1="212.8125" + x2="127.27922" + y2="229.64348" + gradientUnits="userSpaceOnUse" /> + <filter + inkscape:collect="always" + id="filter4836"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="1.7878775" + id="feGaussianBlur4838" /> + </filter> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient4690" + id="radialGradient4848" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(2.480299,0,0,2.2736075,-188.74735,-298.98567)" + cx="127.50623" + cy="236.50375" + fx="127.50623" + fy="236.50375" + r="63.253914" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4704" + id="linearGradient4850" + gradientUnits="userSpaceOnUse" + x1="102.3125" + y1="212.8125" + x2="127.27922" + y2="229.64348" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4570" + id="linearGradient4576" + x1="241.03917" + y1="285.45187" + x2="273.24652" + y2="452.12961" + gradientUnits="userSpaceOnUse" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1" + inkscape:cx="352.0362" + inkscape:cy="902.52439" + inkscape:document-units="px" + inkscape:current-layer="layer2" + inkscape:window-width="1194" + inkscape:window-height="856" + inkscape:window-x="20" + inkscape:window-y="307" + showguides="true" + inkscape:guide-bbox="true"> + <sodipodi:guide + orientation="vertical" + position="-150" + id="guide4456" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:groupmode="layer" + id="layer3" + inkscape:label="Case" + style="display:inline"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect2346" + width="649.12402" + height="965.02057" + x="-10.851109" + y="-43.199562" + ry="68" + inkscape:export-filename="/Users/jaceks/Documents/Pictures/calculator.png" + inkscape:export-xdpi="45.759998" + inkscape:export-ydpi="45.759998" + rx="68" /> + <rect + style="fill:none;fill-opacity:1;stroke:#3f3f3f;stroke-width:5.17405939;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect3508" + width="503.93237" + height="93.976578" + x="108.3531" + y="30.732063" + rx="6.8185301" + ry="5.9093924" + inkscape:export-filename="/home/jaceks/Documents/lcd.png" + inkscape:export-xdpi="101.98504" + inkscape:export-ydpi="101.98504" /> + <rect + ry="3.1891119" + rx="4.0992742" + y="51.0881" + x="14.656492" + height="52.275394" + width="304.56097" + id="rect3612" + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3650)" + transform="matrix(1.6633504,0,0,1.8529899,85.263411,-62.116954)" + inkscape:export-filename="/home/jaceks/Documents/lcd.png" + inkscape:export-xdpi="101.98504" + inkscape:export-ydpi="101.98504" /> + <rect + style="fill:#999999;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect3155" + width="503.93237" + height="93.976578" + x="109.11044" + y="31.970947" + rx="6.8185301" + ry="5.9093924" + inkscape:export-filename="/home/jaceks/Documents/lcd.png" + inkscape:export-xdpi="101.98504" + inkscape:export-ydpi="101.98504" /> + <rect + ry="0" + rx="0" + y="55.068924" + x="18.182747" + height="42.72945" + width="296.37872" + id="rect3408" + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3430)" + inkscape:export-filename="/home/jaceks/Documents/lcd.png" + inkscape:export-xdpi="101.98504" + inkscape:export-ydpi="101.98504" + transform="matrix(1.654619,0,0,1.7977209,88.050581,-56.404184)" /> + <text + xml:space="preserve" + style="font-size:76.62024689px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="166.00705" + y="114.16422" + id="text3144" + sodipodi:linespacing="100%" + transform="scale(1.070448,0.9341883)"><tspan + sodipodi:role="line" + id="tspan3146" + x="166.00705" + y="114.16422">12345663</tspan></text> + <rect + style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:3.44937301;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect3573" + width="503.93237" + height="93.976578" + x="109.11044" + y="31.970947" + rx="6.8185301" + ry="5.9093924" + inkscape:export-filename="/home/jaceks/Documents/lcd.png" + inkscape:export-xdpi="101.98504" + inkscape:export-ydpi="101.98504" /> + <g + id="g4588"> + <path + inkscape:export-ydpi="126.97" + inkscape:export-xdpi="126.97" + inkscape:export-filename="/home/jaceks/Documents/del.png" + id="path4918" + d="M 621.01863,49.10015 C 619.09032,49.241042 617.32126,50.272856 616.3852,51.978493 L 602.2041,76.97093 C 601.3449,78.429084 601.34483,80.286564 602.2041,81.744766 L 616.52561,105.96496 C 617.5457,107.69142 619.47939,108.69003 621.51006,108.7029 L 660.7538,108.7029 C 663.71021,108.70044 666.43677,106.54332 666.44028,103.57805 L 666.44028,54.225004 C 666.43673,51.259764 663.71021,49.102605 660.7538,49.10015 L 621.51006,49.10015 C 621.34291,49.0939 621.25591,49.093905 621.08883,49.10015 C 621.06543,49.099728 621.04204,49.099728 621.01863,49.10015 z M 621.15904,51.065847 C 621.27028,51.061689 621.39879,51.061687 621.51006,51.065847 L 660.7538,51.065847 C 662.82766,51.06757 664.47249,52.480961 664.47458,54.225004 L 664.47458,103.57805 C 664.47251,105.32209 662.82766,106.73548 660.7538,106.7372 L 621.51006,106.7372 C 620.0926,106.72822 618.84127,106.04966 618.21049,104.98212 L 603.88898,80.761917 C 603.36766,79.877203 603.36768,78.83849 603.88898,77.953778 L 618.07008,52.891138 C 618.6356,51.860676 619.81457,51.164081 621.15904,51.065847 z " + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.20000005;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:export-ydpi="126.97" + inkscape:export-xdpi="126.97" + inkscape:export-filename="/home/jaceks/Documents/del.png" + id="path4333" + d="M 621.18182,51.046271 C 619.83733,51.144507 618.65854,51.8411 618.09302,52.871562 L 603.90134,77.934202 C 603.38001,78.818916 603.38001,79.857627 603.90134,80.742341 L 618.1765,104.96254 C 618.80726,106.03009 620.09828,106.70864 621.51574,106.71763 L 660.7516,106.71763 C 662.82546,106.7159 664.50615,105.30251 664.50821,103.55847 L 664.50821,54.205428 C 664.50615,52.461387 662.82546,51.047994 660.7516,51.046271 L 621.51574,51.046271 C 621.40447,51.042113 621.29306,51.042113 621.18182,51.046271 z " + style="fill:url(#linearGradient5233);fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.69581366;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:export-ydpi="126.97" + inkscape:export-xdpi="126.97" + inkscape:export-filename="/home/jaceks/Documents/del.png" + id="path4327" + d="M 627.30511,63.215117 C 625.91306,63.299224 624.69318,64.035687 624.13286,65.110611 C 623.57255,66.185526 623.764,67.422082 624.63374,68.339971 L 634.40096,78.870492 L 624.63374,89.471217 C 623.36585,90.867019 623.64179,92.827796 625.30158,93.894035 C 626.96139,94.960275 629.37644,94.72821 630.64435,93.332408 L 639.15934,84.065549 L 646.75608,92.349559 C 647.53162,93.343941 648.94009,93.88334 650.34576,93.753628 C 651.75138,93.623924 652.93385,92.829877 653.43453,91.717728 C 653.93523,90.605574 653.63429,89.368396 652.68321,88.488368 L 643.91775,78.870492 L 652.68321,69.322819 C 653.60762,68.345403 653.78631,66.990628 653.10061,65.882849 C 652.41486,64.775067 650.99327,64.121816 649.51095,64.197966 C 648.41755,64.261443 647.4115,64.722919 646.75608,65.461628 L 639.15934,73.745638 L 630.64435,64.478779 C 629.86678,63.599475 628.60335,63.121354 627.30511,63.215117 z " + style="fill:#a80000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.69581366;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + inkscape:export-ydpi="126.97" + inkscape:export-xdpi="126.97" + inkscape:export-filename="/home/jaceks/Documents/del.png" + id="path4341" + d="M 621.1532,54.384816 L 607.3671,78.89346 L 615.02604,92.679574 L 621.1532,54.384816 z " + style="fill:url(#linearGradient4349);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + </g> + </g> + <g + inkscape:label="Numbers" + inkscape:groupmode="layer" + id="layer1" + style="display:inline" /> + <g + inkscape:groupmode="layer" + id="layer2" + inkscape:label="Buttons" + style="display:inline"> + <path + d="M 315.71428 368.79074 A 58.57143 58.57143 0 1 1 198.57142,368.79074 A 58.57143 58.57143 0 1 1 315.71428 368.79074 z" + sodipodi:ry="58.57143" + sodipodi:rx="58.57143" + sodipodi:cy="368.79074" + sodipodi:cx="257.14285" + id="path4240" + style="opacity:0.55056176;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4.60000038;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline;filter:url(#filter4402)" + sodipodi:type="arc" + transform="matrix(0.8484207,-0.573635,0.573635,0.8484207,-781.3385,17.402966)" + inkscape:export-filename="/Users/jaceks/Documents/Pictures/calculator.png" + inkscape:export-xdpi="45.759998" + inkscape:export-ydpi="45.759998" /> + <path + d="M 315.71428 368.79074 A 58.57143 58.57143 0 1 1 198.57142,368.79074 A 58.57143 58.57143 0 1 1 315.71428 368.79074 z" + sodipodi:ry="58.57143" + sodipodi:rx="58.57143" + sodipodi:cy="368.79074" + sodipodi:cx="257.14285" + id="path4280" + style="fill:url(#linearGradient4447);fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + sodipodi:type="arc" + transform="matrix(-0.8284178,0.5601106,-0.5601106,-0.8284178,337.84382,396.32504)" + inkscape:export-filename="/home/jaceks/Documents/Pictures/button_back.png" + inkscape:export-xdpi="56.09" + inkscape:export-ydpi="56.09" /> + <path + transform="matrix(0.9998146,-0.6759956,0.9416352,1.3927024,-920.72887,-63.546214)" + d="M 296.07143 334.32648 A 31.071428 12.321428 0 1 1 233.92857,334.32648 A 31.071428 12.321428 0 1 1 296.07143 334.32648 z" + sodipodi:ry="12.321428" + sodipodi:rx="31.071428" + sodipodi:cy="334.32648" + sodipodi:cx="265" + id="path4282" + style="opacity:0.84905659;fill:url(#linearGradient4286);fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + sodipodi:type="arc" + inkscape:export-filename="/Users/jaceks/Documents/Pictures/calculator.png" + inkscape:export-xdpi="45.759998" + inkscape:export-ydpi="45.759998" /> + <text + inkscape:export-ydpi="45.759998" + inkscape:export-xdpi="45.759998" + inkscape:export-filename="/Users/jaceks/Documents/Pictures/calculator.png" + sodipodi:linespacing="100%" + id="text3560" + y="202.52045" + x="-368.65518" + style="font-size:72px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline;font-family:Charcoal CY" + xml:space="preserve"><tspan + y="202.52045" + x="-368.65518" + id="tspan3562" + sodipodi:role="line">/</tspan></text> + <path + inkscape:export-ydpi="47.369999" + inkscape:export-xdpi="47.369999" + inkscape:export-filename="/home/jaceks/Documents/sqbutton2.png" + transform="translate(-1051.0586,-52.797504)" + d="M 125.96875,202.21875 C 107.03973,202.21875 91.71875,217.53973 91.71875,236.46875 L 91.71875,289.96875 C 91.71875,308.89777 107.03608,324.25001 125.96875,324.25 L 190.03125,324.25 C 208.96392,324.25 224.28125,308.89777 224.28125,289.96875 L 224.28125,236.46875 C 224.28125,217.53973 208.96027,202.21875 190.03125,202.21875 L 125.96875,202.21875 z " + id="path4774" + style="opacity:0.65168541;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4836)" + inkscape:original="M 125.96875 205.25 C 108.66708 205.25 94.75 219.16708 94.75 236.46875 L 94.75 289.96875 C 94.75 307.27042 108.66708 321.21876 125.96875 321.21875 L 190.03125 321.21875 C 207.33292 321.21875 221.25 307.27042 221.25 289.96875 L 221.25 236.46875 C 221.25 219.16708 207.33292 205.25 190.03125 205.25 L 125.96875 205.25 z " + inkscape:radius="3.0346668" + sodipodi:type="inkscape:offset" /> + <rect + ry="31.23045" + rx="31.23045" + y="147.50104" + x="-960.54895" + height="115.96551" + width="126.50783" + id="rect4422" + style="opacity:1;fill:#245098;fill-opacity:1;stroke:#ffffff;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:export-filename="/home/jaceks/Documents/sqbutton2.png" + inkscape:export-xdpi="47.369999" + inkscape:export-ydpi="47.369999" /> + <path + sodipodi:type="inkscape:offset" + inkscape:radius="3.0346668" + inkscape:original="M 125.96875 205.25 C 108.66708 205.25 94.75 219.16708 94.75 236.46875 L 94.75 289.96875 C 94.75 307.27042 108.66708 321.21876 125.96875 321.21875 L 190.03125 321.21875 C 207.33292 321.21875 221.25 307.27042 221.25 289.96875 L 221.25 236.46875 C 221.25 219.16708 207.33292 205.25 190.03125 205.25 L 125.96875 205.25 z " + style="opacity:1;fill:url(#radialGradient4688);fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path4686" + d="M 125.96875,202.21875 C 107.03973,202.21875 91.71875,217.53973 91.71875,236.46875 L 91.71875,289.96875 C 91.71875,308.89777 107.03608,324.25001 125.96875,324.25 L 190.03125,324.25 C 208.96392,324.25 224.28125,308.89777 224.28125,289.96875 L 224.28125,236.46875 C 224.28125,217.53973 208.96027,202.21875 190.03125,202.21875 L 125.96875,202.21875 z " + transform="translate(-1055.3012,-57.747254)" + inkscape:export-filename="/home/jaceks/Documents/sqbutton2.png" + inkscape:export-xdpi="47.369999" + inkscape:export-ydpi="47.369999" /> + <path + d="M 125.96875,212.46875 C 112.53978,212.46875 101.96875,223.03978 101.96875,236.46875 L 101.96875,289.96875 C 101.96875,303.39772 112.54848,314.00001 125.96875,314 L 190.03125,314 C 203.45152,314 214.03125,303.39772 214.03125,289.96875 L 214.03125,236.46875 C 214.03125,223.03978 203.46022,212.46875 190.03125,212.46875 L 125.96875,212.46875 z " + id="path4702" + style="opacity:0.74719101;fill:url(#linearGradient4710);fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:original="M 125.96875 205.25 C 108.66708 205.25 94.75 219.16708 94.75 236.46875 L 94.75 289.96875 C 94.75 307.27042 108.66708 321.21876 125.96875 321.21875 L 190.03125 321.21875 C 207.33292 321.21875 221.25 307.27042 221.25 289.96875 L 221.25 236.46875 C 221.25 219.16708 207.33292 205.25 190.03125 205.25 L 125.96875 205.25 z " + inkscape:radius="-7.2217979" + sodipodi:type="inkscape:offset" + transform="translate(-1055.3012,-57.747254)" + inkscape:export-filename="/home/jaceks/Documents/sqbutton2.png" + inkscape:export-xdpi="47.369999" + inkscape:export-ydpi="47.369999" /> + <path + sodipodi:type="inkscape:offset" + inkscape:radius="3.0346668" + inkscape:original="M 125.96875 205.25 C 108.66708 205.25 94.75 219.16708 94.75 236.46875 L 94.75 289.96875 C 94.75 307.27042 108.66708 321.21876 125.96875 321.21875 L 190.03125 321.21875 C 207.33292 321.21875 221.25 307.27042 221.25 289.96875 L 221.25 236.46875 C 221.25 219.16708 207.33292 205.25 190.03125 205.25 L 125.96875 205.25 z " + style="opacity:0.65168541;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4836)" + id="path4840" + d="M 125.96875,202.21875 C 107.03973,202.21875 91.71875,217.53973 91.71875,236.46875 L 91.71875,289.96875 C 91.71875,308.89777 107.03608,324.25001 125.96875,324.25 L 190.03125,324.25 C 208.96392,324.25 224.28125,308.89777 224.28125,289.96875 L 224.28125,236.46875 C 224.28125,217.53973 208.96027,202.21875 190.03125,202.21875 L 125.96875,202.21875 z " + transform="translate(-1223.5927,-58.454364)" + inkscape:export-filename="/home/jaceks/Documents/Pictures/sqbutton.png" + inkscape:export-xdpi="47.52" + inkscape:export-ydpi="47.52" /> + <rect + inkscape:export-ydpi="47.52" + inkscape:export-xdpi="47.52" + inkscape:export-filename="/home/jaceks/Documents/Pictures/sqbutton.png" + style="opacity:1;fill:#3929ad;fill-opacity:1;stroke:#ffffff;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect4842" + width="126.50783" + height="115.96551" + x="-1133.083" + y="141.84419" + rx="31.23045" + ry="31.23045" /> + <path + inkscape:export-ydpi="47.52" + inkscape:export-xdpi="47.52" + inkscape:export-filename="/home/jaceks/Documents/Pictures/sqbutton.png" + transform="translate(-1227.8353,-63.404114)" + d="M 125.96875,202.21875 C 107.03973,202.21875 91.71875,217.53973 91.71875,236.46875 L 91.71875,289.96875 C 91.71875,308.89777 107.03608,324.25001 125.96875,324.25 L 190.03125,324.25 C 208.96392,324.25 224.28125,308.89777 224.28125,289.96875 L 224.28125,236.46875 C 224.28125,217.53973 208.96027,202.21875 190.03125,202.21875 L 125.96875,202.21875 z " + id="path4844" + style="opacity:1;fill:url(#radialGradient4848);fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:original="M 125.96875 205.25 C 108.66708 205.25 94.75 219.16708 94.75 236.46875 L 94.75 289.96875 C 94.75 307.27042 108.66708 321.21876 125.96875 321.21875 L 190.03125 321.21875 C 207.33292 321.21875 221.25 307.27042 221.25 289.96875 L 221.25 236.46875 C 221.25 219.16708 207.33292 205.25 190.03125 205.25 L 125.96875 205.25 z " + inkscape:radius="3.0346668" + sodipodi:type="inkscape:offset" /> + <path + inkscape:export-ydpi="47.52" + inkscape:export-xdpi="47.52" + inkscape:export-filename="/home/jaceks/Documents/Pictures/sqbutton.png" + transform="translate(-1227.8353,-63.404114)" + sodipodi:type="inkscape:offset" + inkscape:radius="-7.2217979" + inkscape:original="M 125.96875 205.25 C 108.66708 205.25 94.75 219.16708 94.75 236.46875 L 94.75 289.96875 C 94.75 307.27042 108.66708 321.21876 125.96875 321.21875 L 190.03125 321.21875 C 207.33292 321.21875 221.25 307.27042 221.25 289.96875 L 221.25 236.46875 C 221.25 219.16708 207.33292 205.25 190.03125 205.25 L 125.96875 205.25 z " + style="opacity:0.74719101;fill:url(#linearGradient4850);fill-opacity:1;stroke:none;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path4846" + d="M 125.96875,212.46875 C 112.53978,212.46875 101.96875,223.03978 101.96875,236.46875 L 101.96875,289.96875 C 101.96875,303.39772 112.54848,314.00001 125.96875,314 L 190.03125,314 C 203.45152,314 214.03125,303.39772 214.03125,289.96875 L 214.03125,236.46875 C 214.03125,223.03978 203.46022,212.46875 190.03125,212.46875 L 125.96875,212.46875 z " /> + <text + xml:space="preserve" + style="font-size:72px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="-1093.9495" + y="224.35384" + id="text4852" + sodipodi:linespacing="100%"><tspan + sodipodi:role="line" + id="tspan4854" + x="-1093.9495" + y="224.35384">1</tspan></text> + <text + xml:space="preserve" + style="font-size:72px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline;font-family:Bitstream Vera Sans" + x="-918.91095" + y="228.31372" + id="text4856" + sodipodi:linespacing="100%" + inkscape:export-filename="/home/jaceks/Documents/sqbutton2.png" + inkscape:export-xdpi="47.369999" + inkscape:export-ydpi="47.369999"><tspan + sodipodi:role="line" + id="tspan4858" + x="-918.91095" + y="228.31372">2</tspan></text> + <g + id="g4594" + transform="translate(-21,-16)" + inkscape:export-filename="/local_home/Dev/jaceks-soundrecorder/device/apps/Calculator2/res/drawable/button.png" + inkscape:export-xdpi="54.689999" + inkscape:export-ydpi="54.689999"> + <path + transform="matrix(0.9998146,-0.6759956,0.9416352,1.3927024,-427.18562,-59.255956)" + d="M 296.07143 334.32648 A 31.071428 12.321428 0 1 1 233.92857,334.32648 A 31.071428 12.321428 0 1 1 296.07143 334.32648 z" + sodipodi:ry="12.321428" + sodipodi:rx="31.071428" + sodipodi:cy="334.32648" + sodipodi:cx="265" + id="path3151" + style="opacity:0.45505616;fill:url(#linearGradient3756);fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + sodipodi:type="arc" /> + <path + d="M 315.71428 368.79074 A 58.57143 58.57143 0 1 1 198.57142,368.79074 A 58.57143 58.57143 0 1 1 315.71428 368.79074 z" + sodipodi:ry="58.57143" + sodipodi:rx="58.57143" + sodipodi:cy="368.79074" + sodipodi:cx="257.14285" + id="path4560" + style="fill:none;fill-opacity:1;stroke:url(#linearGradient4576);stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + sodipodi:type="arc" + transform="matrix(-0.8284178,0.5601106,-0.5601106,-0.8284178,586.84382,412.32504)" + inkscape:export-filename="/home/jaceks/Documents/Pictures/button_back.png" + inkscape:export-xdpi="56.09" + inkscape:export-ydpi="56.09" /> + </g> + <text + xml:space="preserve" + style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="-139" + y="131.36221" + id="text4578"><tspan + sodipodi:role="line" + id="tspan4580" + x="-139" + y="131.36221">Feedback gradient</tspan><tspan + sodipodi:role="line" + x="-139" + y="146.36221" + id="tspan4584">button_back.png</tspan><tspan + sodipodi:role="line" + x="-139" + y="161.36221" + id="tspan4600">73x73</tspan></text> + <text + xml:space="preserve" + style="font-size:12px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="117" + y="330.36221" + id="text4604"><tspan + sodipodi:role="line" + id="tspan4606" + x="117" + y="330.36221">button.png</tspan><tspan + sodipodi:role="line" + x="117" + y="345.36221" + id="tspan4608">73x73</tspan></text> + <text + xml:space="preserve" + style="font-size:12px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="595" + y="146.36221" + id="text4610"><tspan + sodipodi:role="line" + id="tspan4612" + x="595" + y="146.36221">del.png</tspan><tspan + sodipodi:role="line" + x="595" + y="161.36221" + id="tspan4614">40x37</tspan></text> + <text + xml:space="preserve" + style="font-size:12px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="299" + y="159.36221" + id="text4616"><tspan + sodipodi:role="line" + id="tspan4618" + x="299" + y="159.36221">lcd.png 328x69</tspan></text> + </g> +</svg> diff --git a/res/drawable/advanced.png b/res/drawable/advanced.png Binary files differnew file mode 100644 index 0000000..aa634e7 --- /dev/null +++ b/res/drawable/advanced.png diff --git a/res/drawable/android.png b/res/drawable/android.png Binary files differnew file mode 100644 index 0000000..42113e3 --- /dev/null +++ b/res/drawable/android.png diff --git a/res/drawable/button.png b/res/drawable/button.png Binary files differnew file mode 100644 index 0000000..f28073c --- /dev/null +++ b/res/drawable/button.png diff --git a/res/drawable/button_bg.png b/res/drawable/button_bg.png Binary files differnew file mode 100644 index 0000000..83eeb0f --- /dev/null +++ b/res/drawable/button_bg.png diff --git a/res/drawable/clear_history.png b/res/drawable/clear_history.png Binary files differnew file mode 100644 index 0000000..ec3dc55 --- /dev/null +++ b/res/drawable/clear_history.png diff --git a/res/drawable/del.png b/res/drawable/del.png Binary files differnew file mode 100644 index 0000000..47f431d --- /dev/null +++ b/res/drawable/del.png diff --git a/res/drawable/gradient.xml b/res/drawable/gradient.xml new file mode 100644 index 0000000..1ff3e72 --- /dev/null +++ b/res/drawable/gradient.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* //device/apps/common/res/drawable/list_highlight_active.xml +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient android:startColor="#00FFFFFF" android:endColor="#11FFFFFF" + android:angle="270"/> +</shape> diff --git a/res/drawable/icon.png b/res/drawable/icon.png Binary files differnew file mode 100644 index 0000000..298c267 --- /dev/null +++ b/res/drawable/icon.png diff --git a/res/drawable/lcd.9.png b/res/drawable/lcd.9.png Binary files differnew file mode 100644 index 0000000..942ede9 --- /dev/null +++ b/res/drawable/lcd.9.png diff --git a/res/drawable/simple.png b/res/drawable/simple.png Binary files differnew file mode 100644 index 0000000..563ff0f --- /dev/null +++ b/res/drawable/simple.png diff --git a/res/drawable/small_button.9.png b/res/drawable/small_button.9.png Binary files differnew file mode 100644 index 0000000..c6b60a8 --- /dev/null +++ b/res/drawable/small_button.9.png diff --git a/res/drawable/small_button_pressed.9.png b/res/drawable/small_button_pressed.9.png Binary files differnew file mode 100644 index 0000000..5b5c866 --- /dev/null +++ b/res/drawable/small_button_pressed.9.png diff --git a/res/drawable/small_button_stateful.xml b/res/drawable/small_button_stateful.xml new file mode 100644 index 0000000..a3326dd --- /dev/null +++ b/res/drawable/small_button_stateful.xml @@ -0,0 +1,4 @@ +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/small_button_pressed" /> + <item android:drawable="@drawable/small_button" /> +</selector> diff --git a/res/layout-land/history_item.xml b/res/layout-land/history_item.xml new file mode 100644 index 0000000..cc0a3c6 --- /dev/null +++ b/res/layout-land/history_item.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + + <TextView + android:id="@+id/historyExpr" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:textSize="23dp" + android:singleLine="true" + /> + + <TextView + android:id="@+id/historyResult" + android:layout_width="180px" + android:layout_height="wrap_content" + android:layout_weight="0" + android:textSize="23dp" + android:singleLine="true" + /> + +</LinearLayout> diff --git a/res/layout-land/main.xml b/res/layout-land/main.xml new file mode 100644 index 0000000..af63b16 --- /dev/null +++ b/res/layout-land/main.xml @@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- +/* + * Copyright (C) 2008, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="#ff000000"> + + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_weight="0" + android:layout_marginLeft="0px" + android:layout_marginRight="0px" + android:layout_marginBottom="0px" + > + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="@drawable/lcd" + android:layout_marginRight="0px" + > + + <com.android.calculator2.CalculatorDisplay + android:id="@+id/display" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + + <EditText style="@style/display_style" /> + <EditText style="@style/display_style" /> + + </com.android.calculator2.CalculatorDisplay> + </LinearLayout> + </RelativeLayout> + + <com.android.calculator2.PanelSwitcher + android:id="@+id/panelswitch" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + > + + <LinearLayout + android:id="@+id/simplePad" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" + android:layout_gravity="center" + > + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/digit7" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit8" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit9" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/leftParen" + style="@style/button_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/rightParen" + style="@style/button_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/mul" + style="@style/button_style"/> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/digit4" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit5" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit6" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/dot" + style="@style/button_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/div" + style="@style/button_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/minus" + style="@style/button_style"/> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/digit1" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit2" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit3" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit0" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:id="@+id/equal" + android:text="@string/equal" + style="@style/button_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/plus" + style="@style/button_style" + /> + </LinearLayout> + </LinearLayout> + + <LinearLayout + android:id="@+id/advancedPad" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layout_weight="1" + android:orientation="vertical" + android:layout_gravity="center" + android:layout_marginTop="5px" + android:layout_marginBottom="0px" + > + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/sin" + style="@style/button_small_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/cos" + style="@style/button_small_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/tan" + style="@style/button_small_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/pi" + style="@style/button_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/factorial" + style="@style/button_style" + /> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/ln" + style="@style/button_small_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/lg" + style="@style/button_small_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/e" + style="@style/button_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/power" + style="@style/button_style" + /> + <com.android.calculator2.ColorButton + android:text="@string/sqrt" + style="@style/button_style" + /> + </LinearLayout> + </LinearLayout> + </com.android.calculator2.PanelSwitcher> +</LinearLayout> diff --git a/res/layout-port/history_item.xml b/res/layout-port/history_item.xml new file mode 100644 index 0000000..cc0a3c6 --- /dev/null +++ b/res/layout-port/history_item.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + + <TextView + android:id="@+id/historyExpr" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:textSize="23dp" + android:singleLine="true" + /> + + <TextView + android:id="@+id/historyResult" + android:layout_width="180px" + android:layout_height="wrap_content" + android:layout_weight="0" + android:textSize="23dp" + android:singleLine="true" + /> + +</LinearLayout> diff --git a/res/layout-port/main.xml b/res/layout-port/main.xml new file mode 100644 index 0000000..9243901 --- /dev/null +++ b/res/layout-port/main.xml @@ -0,0 +1,237 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- +/* + * Copyright (C) 2008, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="#ff000000"> + + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginTop="5px" + > + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="@drawable/lcd" + android:layout_marginRight="0px"> + + <com.android.calculator2.CalculatorDisplay + android:id="@+id/display" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + + <EditText style="@style/display_style" /> + <EditText style="@style/display_style" /> + + </com.android.calculator2.CalculatorDisplay> + </LinearLayout> + </RelativeLayout> + + <com.android.calculator2.PanelSwitcher + android:id="@+id/panelswitch" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + > + + <LinearLayout + android:id="@+id/simplePad" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" + android:layout_gravity="center" + > + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="8px" + android:layout_marginTop="5px" + > + + <View + android:layout_width="0px" + android:layout_height="0px" + android:layout_weight="1" + /> + + <!-- marginRight has to be 0 to catch border-touch --> + <Button + android:background="@drawable/small_button_stateful" + android:id="@+id/del" + android:text="@string/clear" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:width="90px" + android:height="50px" + android:textColor="#ffffffff" + android:layout_marginRight="0px" + android:layout_marginBottom="3px" + android:layout_weight="0" + /> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/digit7" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit8" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit9" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/div" + style="@style/button_style"/> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/digit4" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit5" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit6" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/mul" + style="@style/button_style"/> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/digit1" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit2" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit3" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/minus" + style="@style/button_style"/> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/dot" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/digit0" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:id="@+id/equal" + android:text="@string/equal" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/plus" + style="@style/button_style"/> + </LinearLayout> + </LinearLayout> + + <LinearLayout android:id="@+id/advancedPad" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" + android:layout_gravity="center" + > + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/sin" + style="@style/button_small_style"/> + <com.android.calculator2.ColorButton + android:text="@string/cos" + style="@style/button_small_style"/> + <com.android.calculator2.ColorButton + android:text="@string/tan" + style="@style/button_small_style"/> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/ln" + style="@style/button_small_style"/> + <com.android.calculator2.ColorButton + android:text="@string/lg" + style="@style/button_small_style"/> + <com.android.calculator2.ColorButton + android:text="@string/factorial" + style="@style/button_style"/> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/pi" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/e" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/power" + style="@style/button_style"/> + </LinearLayout> + + <LinearLayout + android:layout_weight="1" + android:layout_width="fill_parent" + android:layout_height="0px"> + <com.android.calculator2.ColorButton + android:text="@string/leftParen" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/rightParen" + style="@style/button_style"/> + <com.android.calculator2.ColorButton + android:text="@string/sqrt" + style="@style/button_style"/> + </LinearLayout> + </LinearLayout> + </com.android.calculator2.PanelSwitcher> +</LinearLayout> diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml new file mode 100644 index 0000000..1aeac5e --- /dev/null +++ b/res/values-cs/strings.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="acos">acos</string> + <string name="advanced">Rozšířený panel</string> + <string name="app_name">Kalkulačka</string> + <string name="asin">asin</string> + <string name="atan">atan</string> + <string name="basic">Základní panel</string> + <string name="clear">VYMAZAT</string> + <string name="clear_history">Vymazat historii</string> + <string name="cos">cos</string> + <string name="del">ODSTRANIT</string> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <string name="div">\u00f7</string> + <string name="dot">.</string> + <string name="e">e</string> + <string name="enter">\u2193</string> + <string name="equal">=</string> + <string name="error">Chyba</string> + <string name="factorial">!</string> + <string name="leftParen">(</string> + <string name="lg">log</string> + <string name="ln">ln</string> + <string name="minus">\u2212</string> + <string name="mul">\u00d7</string> + <string name="ok">OK</string> + <string name="pi">\u03c0</string> + <string name="plus">+</string> + <string name="power">^</string> + <string name="rightParen">)</string> + <string name="sin">sin</string> + <string name="sqrt">\u221a</string> + <string name="syntax_error">Chyba syntaxe</string> + <string name="tan">tan</string> + <string name="version_mismatch">Neplatná verze</string> +</resources> diff --git a/res/values-de-rDE/strings.xml b/res/values-de-rDE/strings.xml new file mode 100644 index 0000000..bf9352f --- /dev/null +++ b/res/values-de-rDE/strings.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="acos">acos</string> + <string name="advanced">Erweitertes Feld</string> + <string name="app_name">Rechner</string> + <string name="asin">asin</string> + <string name="atan">atan</string> + <string name="basic">Grundsätzliches Feld</string> + <string name="clear">LÖSCHEN</string> + <string name="clear_history">Verlauf löschen</string> + <string name="cos">cos</string> + <string name="del">LÖSCHEN</string> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <string name="div">\u00f7</string> + <string name="dot">.</string> + <string name="e">e</string> + <string name="enter">\u2193</string> + <string name="equal">=</string> + <string name="error">Fehler</string> + <string name="factorial">!</string> + <string name="leftParen">(</string> + <string name="lg">log</string> + <string name="ln">ln</string> + <string name="minus">\u2212</string> + <string name="mul">\u00d7</string> + <string name="ok">OK</string> + <string name="pi">\u03c0</string> + <string name="plus">+</string> + <string name="power">^</string> + <string name="rightParen">)</string> + <string name="sin">sin</string> + <string name="sqrt">\u221a</string> + <string name="syntax_error">Syntaxfehler</string> + <string name="tan">tan</string> + <string name="version_mismatch">Ungültige Version</string> +</resources> diff --git a/res/values-en-rGB/strings.xml b/res/values-en-rGB/strings.xml new file mode 100644 index 0000000..3e21737 --- /dev/null +++ b/res/values-en-rGB/strings.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="acos">acos</string> + <string name="advanced">Advanced panel</string> + <string name="app_name">Calculator</string> + <string name="asin">asin</string> + <string name="atan">atan</string> + <string name="basic">Basic panel</string> + <string name="clear">CLEAR</string> + <string name="clear_history">Clear history</string> + <string name="cos">cos</string> + <string name="del">DELETE</string> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <string name="div">\u00f7</string> + <string name="dot">.</string> + <string name="e">e</string> + <string name="enter">\u2193</string> + <string name="equal">=</string> + <string name="error">Error</string> + <string name="factorial">!</string> + <string name="leftParen">(</string> + <string name="lg">log</string> + <string name="ln">ln</string> + <string name="minus">\u2212</string> + <string name="mul">\u00d7</string> + <string name="ok">OK</string> + <string name="pi">\u03c0</string> + <string name="plus">+</string> + <string name="power">^</string> + <string name="rightParen">)</string> + <string name="sin">sin</string> + <string name="sqrt">\u221a</string> + <string name="syntax_error">Syntax error</string> + <string name="tan">tan</string> + <string name="version_mismatch">Invalid version</string> +</resources> diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml new file mode 100644 index 0000000..fbc26cc --- /dev/null +++ b/res/values-es-rUS/strings.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="acos">acos</string> + <string name="advanced">Panel avanzado</string> + <string name="app_name">Calculadora</string> + <string name="asin">asin</string> + <string name="atan">atan</string> + <string name="basic">Panel básico</string> + <string name="clear">BORRAR</string> + <string name="clear_history">Borrar historial</string> + <string name="cos">cos</string> + <string name="del">ELIMINAR</string> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <string name="div">\u00f7</string> + <string name="dot">.</string> + <string name="e">e</string> + <string name="enter">\u2193</string> + <string name="equal">=</string> + <string name="error">Error</string> + <string name="factorial">!</string> + <string name="leftParen">(</string> + <string name="lg">log</string> + <string name="ln">En</string> + <string name="minus">\u2212</string> + <string name="mul">\u00d7</string> + <string name="ok">Aceptar</string> + <string name="pi">\u03c0</string> + <string name="plus">+</string> + <string name="power">^</string> + <string name="rightParen">)</string> + <string name="sin">sin</string> + <string name="sqrt">\u221a</string> + <string name="syntax_error">Error de sintaxis</string> + <string name="tan">tan</string> + <string name="version_mismatch">Versión no válida</string> +</resources> diff --git a/res/values-fr-rFR/strings.xml b/res/values-fr-rFR/strings.xml new file mode 100644 index 0000000..683f85f --- /dev/null +++ b/res/values-fr-rFR/strings.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="acos">acos</string> + <string name="advanced">Panneau avancé</string> + <string name="app_name">Calculatrice</string> + <string name="asin">asin</string> + <string name="atan">atan</string> + <string name="basic">Panneau de base</string> + <string name="clear">CLEAR</string> + <string name="clear_history">Effacer l\'historique</string> + <string name="cos">cos</string> + <string name="del">DELETE</string> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <string name="div">\u00f7</string> + <string name="dot">.</string> + <string name="e">e</string> + <string name="enter">\u2193</string> + <string name="equal">=</string> + <string name="error">Error</string> + <string name="factorial">!</string> + <string name="leftParen">(</string> + <string name="lg">log</string> + <string name="ln">ln</string> + <string name="minus">\u2212</string> + <string name="mul">\u00d7</string> + <string name="ok">OK</string> + <string name="pi">\u03c0</string> + <string name="plus">+</string> + <string name="power">^</string> + <string name="rightParen">)</string> + <string name="sin">sin</string> + <string name="sqrt">\u221a</string> + <string name="syntax_error">Syntax error</string> + <string name="tan">tan</string> + <string name="version_mismatch">Version non valide</string> +</resources> diff --git a/res/values-it-rIT/strings.xml b/res/values-it-rIT/strings.xml new file mode 100644 index 0000000..3311e4f --- /dev/null +++ b/res/values-it-rIT/strings.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="acos">acos</string> + <string name="advanced">Pannello Avanzate</string> + <string name="app_name">Calcolatore</string> + <string name="asin">asin</string> + <string name="atan">atan</string> + <string name="basic">Pannello base</string> + <string name="clear">CANCELLA</string> + <string name="clear_history">Cancella cronologia</string> + <string name="cos">cos</string> + <string name="del">ELIMINA</string> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <string name="div">\u00f7</string> + <string name="dot">.</string> + <string name="e">e</string> + <string name="enter">\u2193</string> + <string name="equal">=</string> + <string name="error">Errore</string> + <string name="factorial">!</string> + <string name="leftParen">(</string> + <string name="lg">log</string> + <string name="ln">ln</string> + <string name="minus">\u2212</string> + <string name="mul">\u00d7</string> + <string name="ok">OK</string> + <string name="pi">\u03c0</string> + <string name="plus">+</string> + <string name="power">^</string> + <string name="rightParen">)</string> + <string name="sin">sin</string> + <string name="sqrt">\u221a</string> + <string name="syntax_error">Errore di sintassi</string> + <string name="tan">tan</string> + <string name="version_mismatch">Versione non valida</string> +</resources> diff --git a/res/values-nl-rNL/strings.xml b/res/values-nl-rNL/strings.xml new file mode 100644 index 0000000..7093d40 --- /dev/null +++ b/res/values-nl-rNL/strings.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="acos">acos</string> + <string name="advanced">Geavanceerd paneel</string> + <string name="app_name">Rekenmachine</string> + <string name="asin">asin</string> + <string name="atan">atan</string> + <string name="basic">Basispaneel</string> + <string name="clear">WISSEN</string> + <string name="clear_history">Geschiedenis wissen</string> + <string name="cos">cos</string> + <string name="del">VERWIJDEREN</string> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <string name="div">\u00f7</string> + <string name="dot">.</string> + <string name="e">e</string> + <string name="enter">\u2193</string> + <string name="equal">=</string> + <string name="error">Fout</string> + <string name="factorial">!</string> + <string name="leftParen">(</string> + <string name="lg">log</string> + <string name="ln">ln</string> + <string name="minus">\u2212</string> + <string name="mul">\u00d7</string> + <string name="ok">OK</string> + <string name="pi">\u03c0</string> + <string name="plus">+</string> + <string name="power">^</string> + <string name="rightParen">)</string> + <string name="sin">sin</string> + <string name="sqrt">\u221a</string> + <string name="syntax_error">Syntaxisfout</string> + <string name="tan">tan</string> + <string name="version_mismatch">Ongeldige versie</string> +</resources> diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml new file mode 100644 index 0000000..958ddeb --- /dev/null +++ b/res/values-zh-rTW/strings.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="acos">acos</string> + <string name="advanced">進階面板</string> + <string name="app_name">小算盤</string> + <string name="asin">asin</string> + <string name="atan">atan</string> + <string name="basic">基本面板</string> + <string name="clear">CLEAR</string> + <string name="clear_history">清除記錄</string> + <string name="cos">cos</string> + <string name="del">DELETE</string> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <string name="div">\u00f7</string> + <string name="dot">.</string> + <string name="e">e</string> + <string name="enter">\u2193</string> + <string name="equal">=</string> + <string name="error">Error</string> + <string name="factorial">!</string> + <string name="leftParen">(</string> + <string name="lg">log</string> + <string name="ln">ln</string> + <string name="minus">\u2212</string> + <string name="mul">\u00d7</string> + <string name="ok">OK</string> + <string name="pi">\u03c0</string> + <string name="plus">+</string> + <string name="power">^</string> + <string name="rightParen">)</string> + <string name="sin">sin</string> + <string name="sqrt">\u221a</string> + <string name="syntax_error">Syntax Error</string> + <string name="tan">tan</string> + <string name="version_mismatch">無效的版本</string> +</resources> diff --git a/res/values/colors.xml b/res/values/colors.xml new file mode 100644 index 0000000..76f3f13 --- /dev/null +++ b/res/values/colors.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources> + <color name="magic_flame">#00ff2222</color> + <color name="button_text">#ffffffff</color> +</resources> diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..a3d0c18 --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <!-- Application name --> + <string name="app_name">Calculator</string> + <!-- Error dialog title --> + <string name="error">Error</string> + <!-- Error dialog message --> + <string name="syntax_error">Syntax error.</string> + <!-- Error dialog button --> + <string name="ok">OK</string> + <!-- Displayed numbers --> + <string name="digit0">0</string> + <string name="digit1">1</string> + <string name="digit2">2</string> + <string name="digit3">3</string> + <string name="digit4">4</string> + <string name="digit5">5</string> + <string name="digit6">6</string> + <string name="digit7">7</string> + <string name="digit8">8</string> + <string name="digit9">9</string> + <!-- Button name on screen --> + <string name="del">DELETE</string> + <!-- Button name on screen --> + <string name="clear">CLEAR</string> + <!-- Unicode division sign; don't translate. Displayed as button on screen. --> + <string name="div">\u00f7</string> + <!-- Unicode multiplication sign; don't translate. Displayed as button on screen. --> + <string name="mul">\u00d7</string> + <!-- Plus sign, displayed as button on screen --> + <string name="plus">+</string> + <!-- Unicode minus sign; don't translate. Displayed as button on screen. --> + <string name="minus">\u2212</string> + <!-- Decimal point; don't translate. Displayed as button on screen. --> + <string name="dot">.</string> + <!-- Equal sign; don't translate. Displayed as button on screen. --> + <string name="equal">=</string> + <!-- Down arrow; don't translate. Displayed as button on screen. --> + <string name="enter">\u2193</string> + <!-- Displayed on buttons on screen. --> + <string name="sin">sin</string> + <string name="cos">cos</string> + <string name="tan">tan</string> + <string name="asin">asin</string> + <string name="acos">acos</string> + <string name="atan">atan</string> + + <!-- Unicode pi sign; don't translate. Displayed as button on screen. --> + <string name="pi">\u03c0</string> + <!-- Displayed on buttons on screen. --> + <string name="e">e</string> + <string name="ln">ln</string> + <string name="lg">log</string> + <string name="leftParen">(</string> + <string name="rightParen">)</string> + <!-- Unicode square root sign; don't translate. Displayed on button on screen. --> + <string name="sqrt">\u221a</string> + <!-- Displayed on buttons on screen. --> + <string name="power">^</string> + <string name="factorial">!</string> + <!-- Menu items --> + <string name="basic">Basic panel</string> + <string name="advanced">Advanced panel</string> + <string name="clear_history">Clear history</string> + <string name="version_mismatch">Invalid version</string> +</resources> diff --git a/res/values/styles.xml b/res/values/styles.xml new file mode 100644 index 0000000..1fc670b --- /dev/null +++ b/res/values/styles.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <style name="button_style"> + <item name="android:textSize">40dp</item> + <item name="android:layout_width">fill_parent</item> + <item name="android:layout_height">fill_parent</item> + <item name="android:layout_weight">1</item> + <item name="android:focusable">true</item> + </style> + + <style name="button_small_style"> + <item name="android:textSize">30dp</item> + <item name="android:layout_width">fill_parent</item> + <item name="android:layout_height">fill_parent</item> + <item name="android:layout_weight">1</item> + <item name="android:focusable">true</item> + </style> + + <style name="display_style"> + <item name="android:textSize">40dp</item> + <item name="android:gravity">right</item> + <item name="android:textColor">#f000</item> + <item name="android:maxLines">1</item> + <item name="android:scrollbars">none</item> + <item name="android:scrollHorizontally">true</item> + <item name="android:layout_width">fill_parent</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:padding">8dp</item> + </style> +</resources> diff --git a/src/com/android/calculator2/Calculator.java b/src/com/android/calculator2/Calculator.java new file mode 100644 index 0000000..eb7453d --- /dev/null +++ b/src/com/android/calculator2/Calculator.java @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.util.Config; +import android.view.Menu; +import android.view.MenuItem; +import android.view.Window; +import android.view.View; +import android.widget.Button; +import android.widget.ListView; +import android.content.res.Configuration; + +public class Calculator extends Activity { + EventListener mListener = new EventListener(); + private CalculatorDisplay mDisplay; + private Persist mPersist; + private History mHistory; + private Logic mLogic; + private PanelSwitcher mPanelSwitcher; + + private static final int CMD_CLEAR_HISTORY = 1; + private static final int CMD_BASIC_PANEL = 2; + private static final int CMD_ADVANCED_PANEL = 3; + + static final int BASIC_PANEL = 0; + static final int ADVANCED_PANEL = 1; + + private static final String LOG_TAG = "Calculator"; + private static final boolean DEBUG = false; + private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV; + + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + requestWindowFeature(Window.FEATURE_NO_TITLE); + setContentView(R.layout.main); + + mPersist = new Persist(this); + mHistory = mPersist.history; + + mDisplay = (CalculatorDisplay) findViewById(R.id.display); + + mLogic = new Logic(this, mHistory, mDisplay, (Button) findViewById(R.id.equal)); + HistoryAdapter historyAdapter = new HistoryAdapter(this, mHistory, mLogic); + mHistory.setObserver(historyAdapter); + View view; + mPanelSwitcher = (PanelSwitcher) findViewById(R.id.panelswitch); + + mListener.setHandler(mLogic, mPanelSwitcher); + + mDisplay.setOnKeyListener(mListener); + + + if ((view = findViewById(R.id.del)) != null) { + view.setOnClickListener(mListener); + view.setOnLongClickListener(mListener); + } + /* + if ((view = findViewById(R.id.clear)) != null) { + view.setOnClickListener(mListener); + } + */ + + /* + ListView historyPad = (ListView) findViewById(R.id.historyPad); + if (historyPad != null) { + historyPad.setAdapter(historyAdapter); + } + */ + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + super.onCreateOptionsMenu(menu); + MenuItem item; + + item = menu.add(0, CMD_CLEAR_HISTORY, 0, R.string.clear_history); + item.setIcon(R.drawable.clear_history); + + item = menu.add(0, CMD_ADVANCED_PANEL, 0, R.string.advanced); + item.setIcon(R.drawable.advanced); + + item = menu.add(0, CMD_BASIC_PANEL, 0, R.string.basic); + item.setIcon(R.drawable.simple); + + return true; + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + super.onPrepareOptionsMenu(menu); + menu.findItem(CMD_BASIC_PANEL).setVisible(mPanelSwitcher != null && + mPanelSwitcher.getCurrentIndex() == ADVANCED_PANEL); + + menu.findItem(CMD_ADVANCED_PANEL).setVisible(mPanelSwitcher != null && + mPanelSwitcher.getCurrentIndex() == BASIC_PANEL); + + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case CMD_CLEAR_HISTORY: + mHistory.clear(); + break; + + case CMD_BASIC_PANEL: + if (mPanelSwitcher != null && + mPanelSwitcher.getCurrentIndex() == ADVANCED_PANEL) { + mPanelSwitcher.moveRight(); + } + break; + + case CMD_ADVANCED_PANEL: + if (mPanelSwitcher != null && + mPanelSwitcher.getCurrentIndex() == BASIC_PANEL) { + mPanelSwitcher.moveLeft(); + } + break; + } + return super.onOptionsItemSelected(item); + } + + @Override + protected void onSaveInstanceState(Bundle icicle) { + // as work-around for ClassCastException in TextView on restart + // avoid calling superclass, to keep icicle empty + } + + @Override + public void onPause() { + super.onPause(); + mLogic.updateHistory(); + mPersist.save(); + } + + static void log(String message) { + if (LOG_ENABLED) { + Log.v(LOG_TAG, message); + } + } +} diff --git a/src/com/android/calculator2/CalculatorDisplay.java b/src/com/android/calculator2/CalculatorDisplay.java new file mode 100644 index 0000000..c462197 --- /dev/null +++ b/src/com/android/calculator2/CalculatorDisplay.java @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.content.Context; +import android.text.Editable; +import android.text.Spanned; +import android.text.method.NumberKeyListener; +import android.util.AttributeSet; +import android.view.KeyEvent; +import android.view.animation.TranslateAnimation; +import android.widget.EditText; +import android.widget.ViewSwitcher; +import android.graphics.Rect; + +import java.util.Map; + +/** + * Provides vertical scrolling for the input/result EditText. + */ +class CalculatorDisplay extends ViewSwitcher { + // only these chars are accepted from keyboard + private static final char[] ACCEPTED_CHARS = + "0123456789.+-*/\u2212\u00d7\u00f7()!%^".toCharArray(); + + private static final int ANIM_DURATION = 500; + enum Scroll { UP, DOWN, NONE } + + TranslateAnimation inAnimUp; + TranslateAnimation outAnimUp; + TranslateAnimation inAnimDown; + TranslateAnimation outAnimDown; + + public CalculatorDisplay(Context context, AttributeSet attrs) { + super(context, attrs); + } + + protected void setLogic(Logic logic) { + NumberKeyListener calculatorKeyListener = + new NumberKeyListener() { + protected char[] getAcceptedChars() { + return ACCEPTED_CHARS; + } + + public CharSequence filter(CharSequence source, int start, int end, + Spanned dest, int dstart, int dend) { + /* the EditText should still accept letters (eg. 'sin') + coming from the on-screen touch buttons, so don't filter anything. + */ + return null; + } + }; + + Editable.Factory factory = new CalculatorEditable.Factory(logic); + for (int i = 0; i < 2; ++i) { + EditText text = (EditText) getChildAt(i); + text.setBackgroundDrawable(null); + text.setEditableFactory(factory); + text.setKeyListener(calculatorKeyListener); + } + } + + @Override + public void setOnKeyListener(OnKeyListener l) { + getChildAt(0).setOnKeyListener(l); + getChildAt(1).setOnKeyListener(l); + } + + @Override + protected void onSizeChanged(int w, int h, int oldW, int oldH) { + inAnimUp = new TranslateAnimation(0, 0, h, 0); + inAnimUp.setDuration(ANIM_DURATION); + outAnimUp = new TranslateAnimation(0, 0, 0, -h); + outAnimUp.setDuration(ANIM_DURATION); + + inAnimDown = new TranslateAnimation(0, 0, -h, 0); + inAnimDown.setDuration(ANIM_DURATION); + outAnimDown = new TranslateAnimation(0, 0, 0, h); + outAnimDown.setDuration(ANIM_DURATION); + } + + void insert(String delta) { + EditText editor = (EditText) getCurrentView(); + int cursor = editor.getSelectionStart(); + editor.getText().insert(cursor, delta); + } + + EditText getEditText() { + return (EditText) getCurrentView(); + } + + Editable getText() { + EditText text = (EditText) getCurrentView(); + return text.getText(); + } + + void setText(CharSequence text, Scroll dir) { + if (getText().length() == 0) { + dir = Scroll.NONE; + } + + if (dir == Scroll.UP) { + setInAnimation(inAnimUp); + setOutAnimation(outAnimUp); + } else if (dir == Scroll.DOWN) { + setInAnimation(inAnimDown); + setOutAnimation(outAnimDown); + } else { // Scroll.NONE + setInAnimation(null); + setOutAnimation(null); + } + + EditText editText = (EditText) getNextView(); + editText.setText(text); + //Calculator.log("selection to " + text.length() + "; " + text); + editText.setSelection(text.length()); + showNext(); + } + + void setSelection(int i) { + EditText text = (EditText) getCurrentView(); + text.setSelection(i); + } + + int getSelectionStart() { + EditText text = (EditText) getCurrentView(); + return text.getSelectionStart(); + } + + @Override + protected void onFocusChanged(boolean gain, int direction, Rect prev) { + //Calculator.log("focus " + gain + "; " + direction + "; " + prev); + if (!gain) { + requestFocus(); + } + } +} diff --git a/src/com/android/calculator2/CalculatorEditable.java b/src/com/android/calculator2/CalculatorEditable.java new file mode 100644 index 0000000..60ba817 --- /dev/null +++ b/src/com/android/calculator2/CalculatorEditable.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.text.SpannableStringBuilder; +import android.text.Editable; + +class CalculatorEditable extends SpannableStringBuilder { + private static final char[] ORIGINALS = {'-', '*', '/'}; + private static final char[] REPLACEMENTS = {'\u2212', '\u00d7', '\u00f7'}; + private boolean isInsideReplace = false; + private Logic mLogic; + + private CalculatorEditable(CharSequence source, Logic logic) { + super(source); + mLogic = logic; + } + + @Override + public SpannableStringBuilder + replace(int start, int end, CharSequence tb, int tbstart, int tbend) { + if (isInsideReplace) { + return super.replace(start, end, tb, tbstart, tbend); + } else { + isInsideReplace = true; + try { + String delta = tb.subSequence(tbstart, tbend).toString(); + return internalReplace(start, end, delta); + } finally { + isInsideReplace = false; + } + } + } + + private SpannableStringBuilder internalReplace(int start, int end, String delta) { + if (!mLogic.acceptInsert(delta)) { + mLogic.cleared(); + start = 0; + end = length(); + } + + for (int i = ORIGINALS.length - 1; i >= 0; --i) { + delta = delta.replace(ORIGINALS[i], REPLACEMENTS[i]); + } + + int length = delta.length(); + if (length == 1) { + char text = delta.charAt(0); + + //don't allow leading operator + * / + if (start == 0 && Logic.isOperator(text) && text != Logic.MINUS) { + return super.replace(start, end, ""); + } + + //don't allow two dots in the same number + if (text == '.') { + int p = start - 1; + while (p >= 0 && Character.isDigit(charAt(p))) { + --p; + } + if (p >= 0 && charAt(p) == '.') { + return super.replace(start, end, ""); + } + } + + char prevChar = start > 0 ? charAt(start-1) : '\0'; + + //don't allow 2 successive minuses + if (text == Logic.MINUS && prevChar == Logic.MINUS) { + return super.replace(start, end, ""); + } + + //don't allow multiple successive operators + if (Logic.isOperator(text)) { + while (Logic.isOperator(prevChar) && + (text != Logic.MINUS || prevChar == '+')) { + --start; + prevChar = start > 0 ? charAt(start-1) : '\0'; + } + } + } + return super.replace(start, end, delta); + } + + public static class Factory extends Editable.Factory { + private Logic mLogic; + + public Factory(Logic logic) { + mLogic = logic; + } + + public Editable newEditable(CharSequence source) { + return new CalculatorEditable(source, mLogic); + } + } +} diff --git a/src/com/android/calculator2/ColorButton.java b/src/com/android/calculator2/ColorButton.java new file mode 100644 index 0000000..5d78446 --- /dev/null +++ b/src/com/android/calculator2/ColorButton.java @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.widget.Button; +import android.view.View.OnClickListener; +import android.view.View; +import android.view.MotionEvent; +import android.content.res.Resources; + +import java.util.Map; + +/** + * Button with click-animation effect. + */ +class ColorButton extends Button implements OnClickListener { + int CLICK_FEEDBACK_COLOR; + static final int CLICK_FEEDBACK_INTERVAL = 10; + static final int CLICK_FEEDBACK_DURATION = 350; + + Drawable mButtonBackground; + Drawable mButton; + float mTextX; + float mTextY; + long mAnimStart; + OnClickListener mListener; + + public ColorButton(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + mListener = ((Calculator) context).mListener; + setOnClickListener(this); + } + + public void onClick(View view) { + animateClickFeedback(); + mListener.onClick(this); + } + + private void init() { + setBackgroundDrawable(null); + + Resources res = getResources(); + + mButtonBackground = res.getDrawable(R.drawable.button_bg); + mButton = res.getDrawable(R.drawable.button); + CLICK_FEEDBACK_COLOR = res.getColor(R.color.magic_flame); + getPaint().setColor(res.getColor(R.color.button_text)); + + mAnimStart = -1; + } + + + @Override + public void onSizeChanged(int w, int h, int oldW, int oldH) { + int selfW = mButton.getIntrinsicWidth(); + int selfH = mButton.getIntrinsicHeight(); + int marginX = (w - selfW) / 2; + int marginY = (h - selfH) / 2; + mButtonBackground.setBounds(marginX, marginY, marginX + selfW, marginY + selfH); + mButton.setBounds(marginX, marginY, marginX + selfW, marginY + selfH); + measureText(); + } + + private void measureText() { + Paint paint = getPaint(); + mTextX = (getWidth() - paint.measureText(getText().toString())) / 2; + mTextY = (getHeight() - paint.ascent() - paint.descent()) / 2; + } + + @Override + protected void onTextChanged(CharSequence text, int start, int before, int after) { + measureText(); + } + + private void drawMagicFlame(int duration, Canvas canvas) { + int alpha = 255 - 255 * duration / CLICK_FEEDBACK_DURATION; + int color = CLICK_FEEDBACK_COLOR | (alpha << 24); + mButtonBackground.setColorFilter(color, PorterDuff.Mode.SRC_IN); + + int cx = getWidth() / 2; + int cy = getHeight() / 2; + float angle = 250.0f * duration / CLICK_FEEDBACK_DURATION; + canvas.rotate(angle, cx, cy); + mButtonBackground.draw(canvas); + canvas.rotate(-angle, cx, cy); + } + + @Override + public void onDraw(Canvas canvas) { + if (mAnimStart != -1) { + int animDuration = (int) (System.currentTimeMillis() - mAnimStart); + + if (animDuration >= CLICK_FEEDBACK_DURATION) { + mButtonBackground.clearColorFilter(); + mAnimStart = -1; + } else { + drawMagicFlame(animDuration, canvas); + postInvalidateDelayed(CLICK_FEEDBACK_INTERVAL); + } + } else if (isPressed()) { + drawMagicFlame(0, canvas); + } + + mButton.draw(canvas); + + CharSequence text = getText(); + canvas.drawText(text, 0, text.length(), mTextX, mTextY, getPaint()); + } + + public void animateClickFeedback() { + mAnimStart = System.currentTimeMillis(); + invalidate(); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + int a = event.getAction(); + if (a == MotionEvent.ACTION_DOWN + || a == MotionEvent.ACTION_CANCEL + || a == MotionEvent.ACTION_UP) { + invalidate(); + } + return super.onTouchEvent(event); + } +} diff --git a/src/com/android/calculator2/EventListener.java b/src/com/android/calculator2/EventListener.java new file mode 100644 index 0000000..0566507 --- /dev/null +++ b/src/com/android/calculator2/EventListener.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.view.View; +import android.view.KeyEvent; +import android.view.View.OnClickListener; +import android.view.View.OnLongClickListener; +import android.view.View.OnKeyListener; +import android.widget.Button; + +class EventListener implements View.OnKeyListener, + View.OnClickListener, + View.OnLongClickListener { + Logic mHandler; + PanelSwitcher mPanelSwitcher; + + void setHandler(Logic handler, PanelSwitcher panelSwitcher) { + mHandler = handler; + mPanelSwitcher = panelSwitcher; + } + + //@Override + public void onClick(View view) { + int id = view.getId(); + switch (id) { + case R.id.del: + mHandler.onDelete(); + break; + + case R.id.equal: + mHandler.onEnter(); + break; + + /* + case R.id.clear: + mHandler.onClear(); + break; + */ + + default: + if (view instanceof Button) { + String text = ((Button) view).getText().toString(); + if (text.length() >= 2) { + // add paren after sin, cos, ln, etc. from buttons + text += '('; + } + mHandler.insert(text); + if (mPanelSwitcher != null && + mPanelSwitcher.getCurrentIndex() == Calculator.ADVANCED_PANEL) { + mPanelSwitcher.moveRight(); + } + } + } + } + + //@Override + public boolean onLongClick(View view) { + int id = view.getId(); + if (id == R.id.del) { + mHandler.onClear(); + return true; + } + return false; + } + + //@Override + public boolean onKey(View view, int keyCode, KeyEvent keyEvent) { + int action = keyEvent.getAction(); + + if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || + keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { + boolean eat = mHandler.eatHorizontalMove(keyCode == KeyEvent.KEYCODE_DPAD_LEFT); + return eat; + } + + //Calculator.log("KEY " + keyCode + "; " + action); + if (keyCode != KeyEvent.KEYCODE_DPAD_CENTER && + keyCode != KeyEvent.KEYCODE_DPAD_UP && + keyCode != KeyEvent.KEYCODE_DPAD_DOWN && + keyCode != KeyEvent.KEYCODE_ENTER) { + return false; + } + + /* + We should act on KeyEvent.ACTION_DOWN, but strangely + sometimes the DOWN event isn't received, only the UP. + So the workaround is to act on UP... + http://b/issue?id=1022478 + */ + + if (action == KeyEvent.ACTION_UP) { + switch (keyCode) { + case KeyEvent.KEYCODE_ENTER: + case KeyEvent.KEYCODE_DPAD_CENTER: + mHandler.onEnter(); + break; + + case KeyEvent.KEYCODE_DPAD_UP: + mHandler.onUp(); + break; + + case KeyEvent.KEYCODE_DPAD_DOWN: + mHandler.onDown(); + break; + } + } + return true; + } +} diff --git a/src/com/android/calculator2/History.java b/src/com/android/calculator2/History.java new file mode 100644 index 0000000..ff2cc65 --- /dev/null +++ b/src/com/android/calculator2/History.java @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.widget.BaseAdapter; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Vector; + +class History { + private static final int VERSION_1 = 1; + private static final int MAX_ENTRIES = 100; + Vector<HistoryEntry> mEntries = new Vector<HistoryEntry>(); + int mPos; + BaseAdapter mObserver; + + History() { + clear(); + } + + History(int version, DataInput in) throws IOException { + if (version >= VERSION_1) { + int size = in.readInt(); + for (int i = 0; i < size; ++i) { + mEntries.add(new HistoryEntry(version, in)); + } + mPos = in.readInt(); + } else { + throw new IOException("invalid version " + version); + } + } + + void setObserver(BaseAdapter observer) { + mObserver = observer; + } + + private void notifyChanged() { + if (mObserver != null) { + mObserver.notifyDataSetChanged(); + } + } + + void clear() { + mEntries.clear(); + mEntries.add(new HistoryEntry("")); + mPos = 0; + notifyChanged(); + } + + void write(DataOutput out) throws IOException { + out.writeInt(mEntries.size()); + for (HistoryEntry entry : mEntries) { + entry.write(out); + } + out.writeInt(mPos); + } + + void update(String text) { + current().setEdited(text); + } + + boolean moveToPrevious() { + if (mPos > 0) { + --mPos; + return true; + } + return false; + } + + boolean moveToNext() { + if (mPos < mEntries.size() - 1) { + ++mPos; + return true; + } + return false; + } + + void enter(String text) { + current().clearEdited(); + if (mEntries.size() >= MAX_ENTRIES) { + mEntries.remove(0); + } + if (mEntries.size() < 2 || + !text.equals(mEntries.elementAt(mEntries.size() - 2).getBase())) { + mEntries.insertElementAt(new HistoryEntry(text), mEntries.size() - 1); + } + mPos = mEntries.size() - 1; + notifyChanged(); + } + + HistoryEntry current() { + return mEntries.elementAt(mPos); + } + + String getText() { + return current().getEdited(); + } + + String getBase() { + return current().getBase(); + } +} diff --git a/src/com/android/calculator2/HistoryAdapter.java b/src/com/android/calculator2/HistoryAdapter.java new file mode 100644 index 0000000..02ceeee --- /dev/null +++ b/src/com/android/calculator2/HistoryAdapter.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.view.LayoutInflater; +import android.view.ViewGroup; +import android.view.View; +import android.content.Context; +import android.widget.BaseAdapter; +import android.widget.TextView; + +import java.util.Vector; + +import org.javia.arity.SyntaxException; + +class HistoryAdapter extends BaseAdapter { + private Vector<HistoryEntry> mEntries; + private LayoutInflater mInflater; + private Logic mEval; + + HistoryAdapter(Context context, History history, Logic evaluator) { + mEntries = history.mEntries; + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + mEval = evaluator; + } + + // @Override + public int getCount() { + return mEntries.size() - 1; + } + + // @Override + public Object getItem(int position) { + return mEntries.elementAt(position); + } + + // @Override + public long getItemId(int position) { + return position; + } + + @Override + public boolean hasStableIds() { + return true; + } + + // @Override + public View getView(int position, View convertView, ViewGroup parent) { + View view; + if (convertView == null) { + view = mInflater.inflate(R.layout.history_item, parent, false); + } else { + view = convertView; + } + + TextView expr = (TextView) view.findViewById(R.id.historyExpr); + TextView result = (TextView) view.findViewById(R.id.historyResult); + + HistoryEntry entry = mEntries.elementAt(position); + String base = entry.getBase(); + expr.setText(entry.getBase()); + + try { + String res = mEval.evaluate(base); + result.setText("= " + res); + } catch (SyntaxException e) { + result.setText(""); + } + + return view; + } +} + diff --git a/src/com/android/calculator2/HistoryEntry.java b/src/com/android/calculator2/HistoryEntry.java new file mode 100644 index 0000000..80319d8 --- /dev/null +++ b/src/com/android/calculator2/HistoryEntry.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +class HistoryEntry { + private static final int VERSION_1 = 1; + private String mBase; + private String mEdited; + + HistoryEntry(String str) { + mBase = str; + clearEdited(); + } + + HistoryEntry(int version, DataInput in) throws IOException { + if (version >= VERSION_1) { + mBase = in.readUTF(); + mEdited = in.readUTF(); + //Calculator.log("load " + mEdited); + } else { + throw new IOException("invalid version " + version); + } + } + + void write(DataOutput out) throws IOException { + out.writeUTF(mBase); + out.writeUTF(mEdited); + //Calculator.log("save " + mEdited); + } + + @Override + public String toString() { + return mBase; + } + + void clearEdited() { + mEdited = mBase; + } + + String getEdited() { + return mEdited; + } + + void setEdited(String edited) { + mEdited = edited; + } + + String getBase() { + return mBase; + } +} diff --git a/src/com/android/calculator2/Logic.java b/src/com/android/calculator2/Logic.java new file mode 100644 index 0000000..244f438 --- /dev/null +++ b/src/com/android/calculator2/Logic.java @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.view.View; +import android.view.KeyEvent; +import android.widget.Button; +import android.widget.EditText; +import android.content.Context; +import android.content.res.Configuration; + +import org.javia.arity.Symbols; +import org.javia.arity.SyntaxException; +import org.javia.arity.Util; + +class Logic { + private CalculatorDisplay mDisplay; + private Symbols mSymbols = new Symbols(); + private History mHistory; + private String mResult = ""; + private Button mEqualButton; + private final String mEnterString; + private boolean mIsError = false; + private final boolean mOrientationPortrait; + private final int mLineLength; + + private static final int LINE_LENGTH_PORTRAIT = 14; + private static final int LINE_LENGTH_LANDSCAPE = 21; + private static final String INFINITY_UNICODE = "\u221e"; + + // the two strings below are the result of Double.toString() for Infinity & NaN + // they are not output to the user and don't require internationalization + private static final String INFINITY = "Infinity"; + private static final String NAN = "NaN"; + + static final char MINUS = '\u2212'; + + private final String mErrorString; + + Logic(Context context, History history, CalculatorDisplay display, Button equalButton) { + mErrorString = context.getResources().getString(R.string.error); + mOrientationPortrait = context.getResources().getConfiguration().orientation + == Configuration.ORIENTATION_PORTRAIT; + mLineLength = mOrientationPortrait ? LINE_LENGTH_PORTRAIT : LINE_LENGTH_LANDSCAPE; + + try { + // in calculator we use log() for base-10, + // unlike in arity-lib where log() is natural logarithm + mSymbols.define(mSymbols.compileWithName("log(x)=log10(x)")); + } catch (SyntaxException e) { + throw new Error("" + e); //never + } + mHistory = history; + mDisplay = display; + mDisplay.setLogic(this); + mEqualButton = equalButton; + mEnterString = context.getText(R.string.enter).toString(); + + clearWithHistory(false); + } + + boolean eatHorizontalMove(boolean toLeft) { + EditText editText = mDisplay.getEditText(); + int cursorPos = editText.getSelectionStart(); + return toLeft ? cursorPos == 0 : cursorPos >= editText.length(); + } + + private String getText() { + return mDisplay.getText().toString(); + } + + void insert(String delta) { + mDisplay.insert(delta); + } + + private void setText(CharSequence text) { + mDisplay.setText(text, CalculatorDisplay.Scroll.UP); + } + + private void clearWithHistory(boolean scroll) { + mDisplay.setText(mHistory.getText(), + scroll ? CalculatorDisplay.Scroll.UP : CalculatorDisplay.Scroll.NONE); + mResult = ""; + mIsError = false; + } + + private void clear(boolean scroll) { + mDisplay.setText("", scroll ? CalculatorDisplay.Scroll.UP : CalculatorDisplay.Scroll.NONE); + cleared(); + } + + void cleared() { + mResult = ""; + mIsError = false; + updateHistory(); + } + + boolean acceptInsert(String delta) { + String text = getText(); + return !mIsError && + (!mResult.equals(text) || + isOperator(delta) || + mDisplay.getSelectionStart() != text.length()); + } + + void onDelete() { + if (getText().equals(mResult) || mIsError) { + clear(false); + } else { + mDisplay.dispatchKeyEvent(new KeyEvent(0, KeyEvent.KEYCODE_DEL)); + mResult = ""; + } + } + + void onClear() { + clear(false); + } + + void onEnter() { + String text = getText(); + if (text.equals(mResult)) { + clearWithHistory(false); //clear after an Enter on result + } else { + mHistory.enter(text); + try { + mResult = evaluate(text); + } catch (SyntaxException e) { + mIsError = true; + mResult = mErrorString; + } + if (text.equals(mResult)) { + //no need to show result, it is exactly what the user entered + clearWithHistory(true); + } else { + setText(mResult); + //mEqualButton.setText(mEnterString); + } + } + } + + void onUp() { + String text = getText(); + if (!text.equals(mResult)) { + mHistory.update(text); + } + if (mHistory.moveToPrevious()) { + mDisplay.setText(mHistory.getText(), CalculatorDisplay.Scroll.DOWN); + } + } + + void onDown() { + String text = getText(); + if (!text.equals(mResult)) { + mHistory.update(text); + } + if (mHistory.moveToNext()) { + mDisplay.setText(mHistory.getText(), CalculatorDisplay.Scroll.UP); + } + } + + void updateHistory() { + mHistory.update(getText()); + } + + private static final int ROUND_DIGITS = 1; + String evaluate(String input) throws SyntaxException { + if (input.trim().equals("")) { + return ""; + } + + // drop final infix operators (they can only result in error) + int size = input.length(); + while (size > 0 && isOperator(input.charAt(size - 1))) { + input = input.substring(0, size - 1); + --size; + } + + String result = Util.doubleToString(mSymbols.eval(input), mLineLength, ROUND_DIGITS); + if (result.equals(NAN)) { // treat NaN as Error + mIsError = true; + return mErrorString; + } + return result.replace('-', MINUS).replace(INFINITY, INFINITY_UNICODE); + } + + static boolean isOperator(String text) { + return text.length() == 1 && isOperator(text.charAt(0)); + } + + static boolean isOperator(char c) { + //plus minus times div + return "+\u2212\u00d7\u00f7/*".indexOf(c) != -1; + } +} diff --git a/src/com/android/calculator2/PanelSwitcher.java b/src/com/android/calculator2/PanelSwitcher.java new file mode 100644 index 0000000..90b3daf --- /dev/null +++ b/src/com/android/calculator2/PanelSwitcher.java @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import android.view.animation.TranslateAnimation; +import android.view.MotionEvent; +import android.view.View; +import android.view.GestureDetector; +import android.widget.FrameLayout; +import android.content.Context; +import android.util.AttributeSet; +import android.os.Handler; + +import java.util.Map; + +class PanelSwitcher extends FrameLayout { + private static final int MAJOR_MOVE = 60; + private static final int ANIM_DURATION = 400; + + private GestureDetector mGestureDetector; + private int mCurrentView; + private View mChild, mHistoryView; + private View children[]; + + private int mWidth; + private TranslateAnimation inLeft; + private TranslateAnimation outLeft; + + private TranslateAnimation inRight; + private TranslateAnimation outRight; + + private static final int NONE = 1; + private static final int LEFT = 2; + private static final int RIGHT = 3; + private int mPreviousMove; + + public PanelSwitcher(Context context, AttributeSet attrs) { + super(context, attrs); + mCurrentView = 0; + mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { + public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, + float velocityY) { + int dx = (int) (e2.getX() - e1.getX()); + + // don't accept the fling if it's too short + // as it may conflict with a button push + if (Math.abs(dx) > MAJOR_MOVE && Math.abs(velocityX) > Math.abs(velocityY)) { + if (velocityX > 0) { + moveRight(); + } else { + moveLeft(); + } + return true; + } else { + return false; + } + } + }); + } + + @Override + public void onSizeChanged(int w, int h, int oldW, int oldH) { + mWidth = w; + inLeft = new TranslateAnimation(mWidth, 0, 0, 0); + outLeft = new TranslateAnimation(0, -mWidth, 0, 0); + inRight = new TranslateAnimation(-mWidth, 0, 0, 0); + outRight = new TranslateAnimation(0, mWidth, 0, 0); + + inLeft.setDuration(ANIM_DURATION); + outLeft.setDuration(ANIM_DURATION); + inRight.setDuration(ANIM_DURATION); + outRight.setDuration(ANIM_DURATION); + } + + protected void onFinishInflate() { + int count = getChildCount(); + children = new View[count]; + for (int i = 0; i < count; ++i) { + children[i] = getChildAt(i); + if (i != mCurrentView) { + children[i].setVisibility(View.GONE); + } + } + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + mGestureDetector.onTouchEvent(event); + return true; + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent event) { + return mGestureDetector.onTouchEvent(event); + } + + void moveLeft() { + // <-- + if (mCurrentView < children.length - 1 && mPreviousMove != LEFT) { + children[mCurrentView+1].setVisibility(View.VISIBLE); + children[mCurrentView+1].startAnimation(inLeft); + children[mCurrentView].startAnimation(outLeft); + children[mCurrentView].setVisibility(View.GONE); + + mCurrentView++; + mPreviousMove = LEFT; + } + } + + void moveRight() { + // --> + if (mCurrentView > 0 && mPreviousMove != RIGHT) { + children[mCurrentView-1].setVisibility(View.VISIBLE); + children[mCurrentView-1].startAnimation(inRight); + children[mCurrentView].startAnimation(outRight); + children[mCurrentView].setVisibility(View.GONE); + + mCurrentView--; + mPreviousMove = RIGHT; + } + } + + int getCurrentIndex() { + return mCurrentView; + } +} diff --git a/src/com/android/calculator2/Persist.java b/src/com/android/calculator2/Persist.java new file mode 100644 index 0000000..454f10b --- /dev/null +++ b/src/com/android/calculator2/Persist.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.IOException; +import java.io.FileNotFoundException; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; + +import android.content.Context; + +class Persist { + private static final int LAST_VERSION = 1; + private static final String FILE_NAME = "calculator.data"; + private Context mContext; + + History history = new History(); + + Persist(Context context) { + this.mContext = context; + load(); + } + + private void load() { + try { + InputStream is = new BufferedInputStream(mContext.openFileInput(FILE_NAME), 8192); + DataInputStream in = new DataInputStream(is); + int version = in.readInt(); + if (version > LAST_VERSION) { + throw new IOException("data version " + version + "; expected " + LAST_VERSION); + } + history = new History(version, in); + in.close(); + } catch (FileNotFoundException e) { + Calculator.log("" + e); + } catch (IOException e) { + Calculator.log("" + e); + } + } + + void save() { + try { + OutputStream os = new BufferedOutputStream(mContext.openFileOutput(FILE_NAME, 0), 8192); + DataOutputStream out = new DataOutputStream(os); + out.writeInt(LAST_VERSION); + history.write(out); + out.close(); + } catch (IOException e) { + Calculator.log("" + e); + } + } +} diff --git a/tests/Android.mk b/tests/Android.mk new file mode 100644 index 0000000..11455d0 --- /dev/null +++ b/tests/Android.mk @@ -0,0 +1,16 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +# We only want this apk build for tests. +LOCAL_MODULE_TAGS := tests + +LOCAL_JAVA_LIBRARIES := android.test.runner + +# Include all test java files. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := CalculatorTests + +LOCAL_INSTRUMENTATION_FOR := Calculator + +include $(BUILD_PACKAGE) diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml new file mode 100644 index 0000000..5c0496b --- /dev/null +++ b/tests/AndroidManifest.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.calculator2.tests"> + + <application> + <uses-library android:name="android.test.runner" /> + </application> + + <instrumentation android:name="CalculatorLaunchPerformance" + android:targetPackage="com.android.calculator2" + android:label="Calculator Launch Performance"> + </instrumentation> + +</manifest> diff --git a/tests/src/com/android/calculator/CalculatorLaunchPerformance.java b/tests/src/com/android/calculator/CalculatorLaunchPerformance.java new file mode 100644 index 0000000..6c84e17 --- /dev/null +++ b/tests/src/com/android/calculator/CalculatorLaunchPerformance.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.calculator2.tests; + +import android.app.Activity; +import android.test.LaunchPerformanceBase; +import android.os.Bundle; + +import java.util.Map; + +/** + * Instrumentation class for Calculator launch performance testing. + */ +public class CalculatorLaunchPerformance extends LaunchPerformanceBase { + + public static final String LOG_TAG = "CalculatorLaunchPerformance"; + + public CalculatorLaunchPerformance() { + super(); + } + + @Override + public void onCreate(Bundle arguments) { + super.onCreate(arguments); + + mIntent.setClassName(getTargetContext(), "com.android.calculator2.Calculator"); + start(); + } + + /** + * Calls LaunchApp and finish. + */ + @Override + public void onStart() { + super.onStart(); + LaunchApp(); + finish(Activity.RESULT_OK, mResults); + } +} |