Skip to content
Browse files

inital commit, whole project done outside of Git oulala.. :)

  • Loading branch information...
0 parents commit d3bc380f5cd520a0e6062c1cb0fbc8a0439a4fa7 @pyricau committed Aug 29, 2012
Showing with 1,043 additions and 0 deletions.
  1. +14 −0 .classpath
  2. +4 −0 .factorypath
  3. +4 −0 .gitignore
  4. +33 −0 .project
  5. +4 −0 .settings/org.eclipse.jdt.apt.core.prefs
  6. +12 −0 .settings/org.eclipse.jdt.core.prefs
  7. +26 −0 AndroidManifest.xml
  8. +16 −0 LICENSE.txt
  9. +1 −0 README.md
  10. BIN ext-libs/androidannotations-2.7-SNAPSHOT.jar
  11. BIN ic_launcher-web.png
  12. BIN libs/android-support-v4.jar
  13. BIN libs/androidannotations-2.7-SNAPSHOT-api.jar
  14. +20 −0 proguard-project.txt
  15. +14 −0 project.properties
  16. +24 −0 res/color/primary_text_holo_dark.xml
  17. +26 −0 res/color/primary_text_holo_light.xml
  18. BIN res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png
  19. BIN res/drawable-hdpi/btn_default_disabled_holo_light.9.png
  20. BIN res/drawable-hdpi/btn_default_focused_holo_light.9.png
  21. BIN res/drawable-hdpi/btn_default_normal_holo_light.9.png
  22. BIN res/drawable-hdpi/btn_default_pressed_holo_light.9.png
  23. BIN res/drawable-hdpi/ic_launcher.png
  24. BIN res/drawable-hdpi/scrubber_control_disabled_holo.png
  25. BIN res/drawable-hdpi/scrubber_control_focused_holo.png
  26. BIN res/drawable-hdpi/scrubber_control_normal_holo.png
  27. BIN res/drawable-hdpi/scrubber_control_pressed_holo.png
  28. BIN res/drawable-hdpi/scrubber_primary_holo.9.png
  29. BIN res/drawable-hdpi/scrubber_secondary_holo.9.png
  30. BIN res/drawable-hdpi/scrubber_track_holo_light.9.png
  31. BIN res/drawable-hdpi/textfield_activated_holo_light.9.png
  32. BIN res/drawable-hdpi/textfield_default_holo_light.9.png
  33. BIN res/drawable-hdpi/textfield_disabled_focused_holo_light.9.png
  34. BIN res/drawable-hdpi/textfield_disabled_holo_light.9.png
  35. BIN res/drawable-hdpi/textfield_focused_holo_light.9.png
  36. BIN res/drawable-hdpi/textfield_multiline_activated_holo_light.9.png
  37. BIN res/drawable-hdpi/textfield_multiline_default_holo_light.9.png
  38. BIN res/drawable-hdpi/textfield_multiline_disabled_focused_holo_light.9.png
  39. BIN res/drawable-hdpi/textfield_multiline_disabled_holo_light.9.png
  40. BIN res/drawable-hdpi/textfield_multiline_focused_holo_light.9.png
  41. BIN res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png
  42. BIN res/drawable-mdpi/btn_default_disabled_holo_light.9.png
  43. BIN res/drawable-mdpi/btn_default_focused_holo_light.9.png
  44. BIN res/drawable-mdpi/btn_default_normal_holo_light.9.png
  45. BIN res/drawable-mdpi/btn_default_pressed_holo_light.9.png
  46. BIN res/drawable-mdpi/ic_launcher.png
  47. BIN res/drawable-mdpi/scrubber_control_disabled_holo.png
  48. BIN res/drawable-mdpi/scrubber_control_focused_holo.png
  49. BIN res/drawable-mdpi/scrubber_control_normal_holo.png
  50. BIN res/drawable-mdpi/scrubber_control_pressed_holo.png
  51. BIN res/drawable-mdpi/scrubber_primary_holo.9.png
  52. BIN res/drawable-mdpi/scrubber_secondary_holo.9.png
  53. BIN res/drawable-mdpi/scrubber_track_holo_light.9.png
  54. BIN res/drawable-mdpi/textfield_activated_holo_light.9.png
  55. BIN res/drawable-mdpi/textfield_default_holo_light.9.png
  56. BIN res/drawable-mdpi/textfield_disabled_focused_holo_light.9.png
  57. BIN res/drawable-mdpi/textfield_disabled_holo_light.9.png
  58. BIN res/drawable-mdpi/textfield_focused_holo_light.9.png
  59. BIN res/drawable-mdpi/textfield_multiline_activated_holo_light.9.png
  60. BIN res/drawable-mdpi/textfield_multiline_default_holo_light.9.png
  61. BIN res/drawable-mdpi/textfield_multiline_disabled_focused_holo_light.9.png
  62. BIN res/drawable-mdpi/textfield_multiline_disabled_holo_light.9.png
  63. BIN res/drawable-mdpi/textfield_multiline_focused_holo_light.9.png
  64. BIN res/drawable-xhdpi/btn_default_disabled_focused_holo_light.9.png
  65. BIN res/drawable-xhdpi/btn_default_disabled_holo_light.9.png
  66. BIN res/drawable-xhdpi/btn_default_focused_holo_light.9.png
  67. BIN res/drawable-xhdpi/btn_default_normal_holo_light.9.png
  68. BIN res/drawable-xhdpi/btn_default_pressed_holo_light.9.png
  69. BIN res/drawable-xhdpi/ic_launcher.png
  70. BIN res/drawable-xhdpi/scrubber_control_disabled_holo.png
  71. BIN res/drawable-xhdpi/scrubber_control_focused_holo.png
  72. BIN res/drawable-xhdpi/scrubber_control_normal_holo.png
  73. BIN res/drawable-xhdpi/scrubber_control_pressed_holo.png
  74. BIN res/drawable-xhdpi/scrubber_primary_holo.9.png
  75. BIN res/drawable-xhdpi/scrubber_secondary_holo.9.png
  76. BIN res/drawable-xhdpi/scrubber_track_holo_light.9.png
  77. BIN res/drawable-xhdpi/textfield_activated_holo_light.9.png
  78. BIN res/drawable-xhdpi/textfield_default_holo_light.9.png
  79. BIN res/drawable-xhdpi/textfield_disabled_focused_holo_light.9.png
  80. BIN res/drawable-xhdpi/textfield_disabled_holo_light.9.png
  81. BIN res/drawable-xhdpi/textfield_focused_holo_light.9.png
  82. BIN res/drawable-xhdpi/textfield_multiline_activated_holo_light.9.png
  83. BIN res/drawable-xhdpi/textfield_multiline_default_holo_light.9.png
  84. BIN res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_light.9.png
  85. BIN res/drawable-xhdpi/textfield_multiline_disabled_holo_light.9.png
  86. BIN res/drawable-xhdpi/textfield_multiline_focused_holo_light.9.png
  87. +32 −0 res/drawable/btn_default_holo_light.xml
  88. +35 −0 res/drawable/edit_text_holo_light.xml
  89. +22 −0 res/drawable/scrubber_control_selector_holo.xml
  90. +28 −0 res/drawable/scrubber_progress_horizontal_holo_light.xml
  91. +87 −0 res/layout/time_is_money.xml
  92. +20 −0 res/values-fr/materials.xml
  93. +21 −0 res/values-fr/strings.xml
  94. +93 −0 res/values/ics_styles.xml
  95. +20 −0 res/values/materials.xml
  96. +20 −0 res/values/strings.xml
  97. +53 −0 res/values/styles.xml
  98. BIN screenshot1.png
  99. BIN screenshot2.png
  100. +20 −0 src/info/piwai/timeismoney/AbstractOnSeekBarChangeListener.java
  101. +50 −0 src/info/piwai/timeismoney/BackgroundPreferenceHandler.java
  102. +81 −0 src/info/piwai/timeismoney/Material.java
  103. +75 −0 src/info/piwai/timeismoney/TimeCosts.java
  104. +188 −0 src/info/piwai/timeismoney/TimeIsMoneyActivity.java
14 .classpath
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry kind="lib" path="libs/androidannotations-2.7-SNAPSHOT-api.jar"/>
+ <classpathentry kind="src" path=".apt_generated">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="bin/classes"/>
+</classpath>
4 .factorypath
@@ -0,0 +1,4 @@
+<factorypath>
+ <factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="true" runInBatchMode="false"/>
+ <factorypathentry kind="WKSPJAR" id="/TimeIsMoney/ext-libs/androidannotations-2.7-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
+</factorypath>
4 .gitignore
@@ -0,0 +1,4 @@
+.apt_generated
+bin
+gen
+*.apk
33 .project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>TimeIsMoney</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
4 .settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=true
+org.eclipse.jdt.apt.genSrcDir=.apt_generated
+org.eclipse.jdt.apt.reconcileEnabled=true
12 .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.processAnnotations=enabled
+org.eclipse.jdt.core.compiler.source=1.6
26 AndroidManifest.xml
@@ -0,0 +1,26 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="info.piwai.timeismoney"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="7"
+ android:targetSdkVersion="15" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/CustomTheme" >
+ <activity
+ android:name=".TimeIsMoneyActivity_"
+ android:label="@string/app_name"
+ android:windowSoftInputMode="stateHidden" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
16 LICENSE.txt
@@ -0,0 +1,16 @@
+************************************
+This project is available under the following license:
+************************************
+Copyright 2012 Pierre-Yves Ricau
+
+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.
1 README.md
@@ -0,0 +1 @@
+The Waste-o-meter is an Android application...
BIN ext-libs/androidannotations-2.7-SNAPSHOT.jar
Binary file not shown.
BIN ic_launcher-web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN libs/android-support-v4.jar
Binary file not shown.
BIN libs/androidannotations-2.7-SNAPSHOT-api.jar
Binary file not shown.
20 proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
14 project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-15
24 res/color/primary_text_holo_dark.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false" android:color="@color/bright_foreground_disabled_holo_dark"/>
+ <item android:state_window_focused="false" android:color="@color/bright_foreground_holo_dark"/>
+ <item android:state_pressed="true" android:color="@color/bright_foreground_holo_dark"/>
+ <item android:state_selected="true" android:color="@color/bright_foreground_holo_dark"/>
+ <item android:state_activated="true" android:color="@color/bright_foreground_holo_dark"/>
+ <item android:color="@color/bright_foreground_holo_dark"/> <!-- not selected -->
+</selector>
26 res/color/primary_text_holo_light.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false" android:color="@color/bright_foreground_disabled_holo_light"/>
+ <item android:state_window_focused="false" android:color="@color/bright_foreground_holo_light"/>
+ <item android:state_pressed="true" android:color="@color/bright_foreground_holo_light"/>
+ <item android:state_selected="true" android:color="@color/bright_foreground_holo_light"/>
+ <item android:state_activated="true" android:color="@color/bright_foreground_holo_light"/>
+ <item android:color="@color/bright_foreground_holo_light"/> <!-- not selected -->
+
+</selector>
+
BIN res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/btn_default_disabled_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/btn_default_focused_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/btn_default_normal_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/btn_default_pressed_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/scrubber_control_disabled_holo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/scrubber_control_focused_holo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/scrubber_control_normal_holo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/scrubber_control_pressed_holo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/scrubber_primary_holo.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/scrubber_secondary_holo.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/scrubber_track_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_activated_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_default_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_disabled_focused_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_disabled_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_focused_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_multiline_activated_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_multiline_default_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_multiline_disabled_focused_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_multiline_disabled_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-hdpi/textfield_multiline_focused_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN res/drawable-mdpi/btn_default_disabled_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/btn_default_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/btn_default_normal_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/btn_default_pressed_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/ic_launcher.png
Diff not rendered.
BIN res/drawable-mdpi/scrubber_control_disabled_holo.png
Diff not rendered.
BIN res/drawable-mdpi/scrubber_control_focused_holo.png
Diff not rendered.
BIN res/drawable-mdpi/scrubber_control_normal_holo.png
Diff not rendered.
BIN res/drawable-mdpi/scrubber_control_pressed_holo.png
Diff not rendered.
BIN res/drawable-mdpi/scrubber_primary_holo.9.png
Diff not rendered.
BIN res/drawable-mdpi/scrubber_secondary_holo.9.png
Diff not rendered.
BIN res/drawable-mdpi/scrubber_track_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_activated_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_default_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_disabled_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_disabled_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_multiline_activated_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_multiline_default_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_multiline_disabled_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_multiline_disabled_holo_light.9.png
Diff not rendered.
BIN res/drawable-mdpi/textfield_multiline_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/btn_default_disabled_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/btn_default_disabled_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/btn_default_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/btn_default_normal_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/btn_default_pressed_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/ic_launcher.png
Diff not rendered.
BIN res/drawable-xhdpi/scrubber_control_disabled_holo.png
Diff not rendered.
BIN res/drawable-xhdpi/scrubber_control_focused_holo.png
Diff not rendered.
BIN res/drawable-xhdpi/scrubber_control_normal_holo.png
Diff not rendered.
BIN res/drawable-xhdpi/scrubber_control_pressed_holo.png
Diff not rendered.
BIN res/drawable-xhdpi/scrubber_primary_holo.9.png
Diff not rendered.
BIN res/drawable-xhdpi/scrubber_secondary_holo.9.png
Diff not rendered.
BIN res/drawable-xhdpi/scrubber_track_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_activated_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_default_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_disabled_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_disabled_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_multiline_activated_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_multiline_default_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_multiline_disabled_focused_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_multiline_disabled_holo_light.9.png
Diff not rendered.
BIN res/drawable-xhdpi/textfield_multiline_focused_holo_light.9.png
Diff not rendered.
32 res/drawable/btn_default_holo_light.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_window_focused="false" android:state_enabled="true"
+ android:drawable="@drawable/btn_default_normal_holo_light" />
+ <item android:state_window_focused="false" android:state_enabled="false"
+ android:drawable="@drawable/btn_default_disabled_holo_light" />
+ <item android:state_pressed="true"
+ android:drawable="@drawable/btn_default_pressed_holo_light" />
+ <item android:state_focused="true" android:state_enabled="true"
+ android:drawable="@drawable/btn_default_focused_holo_light" />
+ <item android:state_enabled="true"
+ android:drawable="@drawable/btn_default_normal_holo_light" />
+ <item android:state_focused="true"
+ android:drawable="@drawable/btn_default_disabled_focused_holo_light" />
+ <item
+ android:drawable="@drawable/btn_default_disabled_holo_light" />
+</selector>
35 res/drawable/edit_text_holo_light.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_multiline="true" android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/textfield_multiline_default_holo_light" />
+ <item android:state_multiline="true" android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/textfield_multiline_disabled_holo_light" />
+ <item android:state_multiline="true" android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/textfield_multiline_activated_holo_light" />
+ <item android:state_multiline="true" android:state_enabled="true" android:state_activated="true" android:drawable="@drawable/textfield_multiline_focused_holo_light" />
+ <item android:state_multiline="true" android:state_enabled="true" android:drawable="@drawable/textfield_multiline_default_holo_light" />
+ <item android:state_multiline="true" android:state_focused="true" android:drawable="@drawable/textfield_multiline_disabled_focused_holo_light" />
+ <item android:state_multiline="true" android:drawable="@drawable/textfield_multiline_disabled_holo_light" />
+
+ <item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/textfield_default_holo_light" />
+ <item android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/textfield_disabled_holo_light" />
+ <item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/textfield_activated_holo_light" />
+ <iten android:state_enabled="true" android:state_activated="true" android:drawable="@drawable/textfield_focused_holo_light" />
+ <item android:state_enabled="true" android:drawable="@drawable/textfield_default_holo_light" />
+ <item android:state_focused="true" android:drawable="@drawable/textfield_disabled_focused_holo_light" />
+ <item android:drawable="@drawable/textfield_disabled_holo_light" />
+</selector>
+
22 res/drawable/scrubber_control_selector_holo.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false" android:drawable="@drawable/scrubber_control_disabled_holo" />
+ <item android:state_pressed="true" android:drawable="@drawable/scrubber_control_pressed_holo" />
+ <item android:state_selected="true" android:drawable="@drawable/scrubber_control_focused_holo" />
+ <item android:drawable="@drawable/scrubber_control_normal_holo" />
+</selector>
28 res/drawable/scrubber_progress_horizontal_holo_light.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@android:id/background"
+ android:drawable="@drawable/scrubber_track_holo_light" />
+ <item android:id="@android:id/secondaryProgress">
+ <scale android:scaleWidth="100%"
+ android:drawable="@drawable/scrubber_secondary_holo" />
+ </item>
+ <item android:id="@android:id/progress">
+ <scale android:scaleWidth="100%"
+ android:drawable="@drawable/scrubber_primary_holo" />
+ </item>
+</layer-list>
87 res/layout/time_is_money.xml
@@ -0,0 +1,87 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#ffffff"
+ tools:context=".TimeIsMoneyActivity" >
+
+ <Button
+ android:id="@+id/shareButton"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:text="@string/share" />
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_above="@id/shareButton" >
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:id="@+id/costPerDayTitle"
+ style="@style/IntroLabel"
+ android:text="@string/cost_per_day_title" />
+
+ <EditText
+ android:id="@+id/costPerDayInput"
+ style="@style/NumberInput"
+ android:layout_below="@id/costPerDayTitle"
+ android:hint="400"
+ tools:ignore="HardcodedText" />
+
+ <TextView
+ android:id="@+id/costPerDayLabel"
+ style="@style/RightLabel"
+ android:layout_below="@id/costPerDayTitle"
+ android:layout_toRightOf="@id/costPerDayInput" />
+
+ <TextView
+ android:id="@+id/lostMinutesPerDayTitle"
+ style="@style/IntroLabel"
+ android:layout_below="@id/costPerDayLabel"
+ android:text="@string/lost_minutes_per_day_title" />
+
+ <EditText
+ android:id="@+id/lostMinutesPerDayInput"
+ style="@style/NumberInput"
+ android:layout_below="@id/lostMinutesPerDayTitle"
+ android:hint="10"
+ tools:ignore="HardcodedText" />
+
+ <TextView
+ android:id="@+id/lostMinutesPerDayLabel"
+ style="@style/RightLabel"
+ android:layout_below="@id/lostMinutesPerDayTitle"
+ android:layout_toRightOf="@id/lostMinutesPerDayInput"
+ android:text="@string/lost_minutes_per_day_label" />
+
+ <TextView
+ android:id="@+id/workingDaysTitle"
+ style="@style/IntroLabel"
+ android:layout_below="@id/lostMinutesPerDayInput" />
+
+ <SeekBar
+ android:id="@+id/workingDaysInput"
+ style="@style/SeekbarInput"
+ android:layout_below="@id/workingDaysTitle"
+ android:max="199" />
+
+ <TextView
+ android:id="@+id/materialCostsTitle"
+ style="@style/IntroLabel"
+ android:layout_below="@id/workingDaysInput" />
+
+ <TextView
+ android:id="@+id/materialCostsLabel"
+ style="@style/RightLabel"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/materialCostsTitle"
+ android:layout_marginLeft="16dp" />
+ </RelativeLayout>
+ </ScrollView>
+
+</RelativeLayout>
20 res/values-fr/materials.xml
@@ -0,0 +1,20 @@
+<resources>
+
+ <!-- materialNames items are mapped to materialPrices items -->
+ <string-array name="materialNames">
+ <item>8 Go de RAM</item>
+ <item>un écran 22\" Full HD</item>
+ <item>un disque SSD 180 Go</item>
+ <item>un processeur quad-core</item>
+ <item>"un serveur d'intégration"</item>
+ </string-array>
+
+ <integer-array name="materialPrices">
+ <item>84</item>
+ <item>126</item>
+ <item>168</item>
+ <item>336</item>
+ <item>840</item>
+ </integer-array>
+
+</resources>
21 res/values-fr/strings.xml
@@ -0,0 +1,21 @@
+<resources>
+
+ <string name="app_name">Le Gachômètre</string>
+ <string name="share_with">Partager via</string>
+ <string name="share">Partager</string>
+ <string name="cost_per_day_title">JE SUIS FACTURÉ</string>
+ <string name="cost_per_minute_label_format">"<![CDATA[€ / jour (soit <font color="#33b5e5"><b>%.2f € / min</b></font>)]]></string>
+ <string name="lost_minutes_per_day_title">"J'ATTENDS MA MACHINE"</string>
+ <string name="lost_minutes_per_day_label">minutes par jour</string>
+ <string name="working_days_title_format">"<![CDATA[EN <b>%d</b> JOURS DE TRAVAIL]]>"</string>
+ <string name="total_cost_title_format">"<![CDATA[MA MACHINE GÂCHE <b>%.0f€</b>]]>"</string>
+ <string name="material_start">"Soit "</string>
+ <string name="material_start_share">"soit "</string>
+ <string name="material_separator">", "</string>
+ <string name="material_last_separator">" et "</string>
+ <string name="material_format" formatted="false">"<![CDATA[<font color="#33b5e5"><b>%s</b></font> (%d€)]]>"</string>
+ <string name="material_format_share" formatted="false">"%s (%d€)"</string>
+ <string name="share_format" formatted="false">"En %d jours de travail ma machine gâche %.0f€, "</string>
+
+
+</resources>
93 res/values/ics_styles.xml
@@ -0,0 +1,93 @@
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <style name="Widget">
+ <item name="android:textAppearance">?android:attr/textAppearance</item>
+ </style>
+
+ <style name="Widget.Holo" parent="Widget"></style>
+
+ <style name="Widget.Holo.Light" parent="Widget.Holo"></style>
+
+ <style name="Widget.Holo.Light.Button" parent="@android:style/Widget.Button">
+ <item name="android:background">@drawable/btn_default_holo_light</item>
+ <!-- <item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item> -->
+ <item name="android:textColor">@color/primary_text_holo_light</item>
+ <item name="android:minHeight">48dip</item>
+ <item name="android:minWidth">64dip</item>
+ </style>
+
+ <style name="Widget.Holo.Light.SeekBar">
+ <item name="android:indeterminateOnly">false</item>
+ <item name="android:progressDrawable">@drawable/scrubber_progress_horizontal_holo_light</item>
+ <item name="android:indeterminateDrawable">@drawable/scrubber_progress_horizontal_holo_light</item>
+ <item name="android:minHeight">13dip</item>
+ <item name="android:maxHeight">13dip</item>
+ <item name="android:thumb">@drawable/scrubber_control_selector_holo</item>
+ <item name="android:thumbOffset">16dip</item>
+ <item name="android:focusable">true</item>
+ <item name="android:paddingLeft">16dip</item>
+ <item name="android:paddingRight">16dip</item>
+ </style>
+
+ <style name="Widget.Holo.Light.TextView" parent="@android:style/Widget.TextView"></style>
+
+ <style name="Widget.Holo.EditText" parent="@android:style/Widget.EditText"></style>
+
+ <style name="Widget.Holo.Light.EditText" parent="Widget.Holo.EditText">
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:background">@drawable/edit_text_holo_light</item>
+ </style>
+
+ <style name="TextAppearance.Holo.Light.Widget" parent="@android:style/TextAppearance.Widget"></style>
+
+ <style name="TextAppearance.Holo.Light.Widget.Button"></style>
+
+ <style name="TextAppearance.Holo.Light" parent="TextAppearance.Holo"></style>
+
+ <style name="TextAppearance.Holo" parent="@android:style/TextAppearance"></style>
+
+ <style name="TextAppearance.Holo.Light.Inverse">
+ <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
+ <item name="android:textColorHint">?android:attr/textColorHintInverse</item>
+ <item name="android:textColorHighlight">?android:attr/textColorHighlightInverse</item>
+ <item name="android:textColorLink">?android:attr/textColorLinkInverse</item>
+ </style>
+
+ <style name="TextAppearance.Holo.Medium" parent="android:style/TextAppearance.Medium"></style>
+
+ <style name="TextAppearance.Holo.Light.Medium" parent="TextAppearance.Holo.Medium"></style>
+
+ <style name="TextAppearance.Holo.Light.Medium.Inverse">
+ <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
+ <item name="android:textColorHint">?android:attr/textColorHintInverse</item>
+ <item name="android:textColorHighlight">?android:attr/textColorHighlightInverse</item>
+ <item name="android:textColorLink">?android:attr/textColorLinkInverse</item>
+ </style>
+
+ <style name="Theme.Holo.Light" parent="android:style/Theme.Light">
+ <item name="android:textColorPrimary">@color/primary_text_holo_light</item>
+ <item name="android:textAppearanceButton">@style/TextAppearance.Holo.Light.Widget.Button</item>
+ <item name="android:textAppearance">@style/TextAppearance.Holo.Light</item>
+ <item name="android:textAppearanceInverse">@style/TextAppearance.Holo.Light.Inverse</item>
+ <item name="android:textViewStyle">@style/Widget.Holo.Light.TextView</item>
+ <item name="android:buttonStyle">@style/Widget.Holo.Light.Button</item>
+ <item name="android:textColorPrimaryInverse">@color/primary_text_holo_dark</item>
+ <!-- <item name="android:textAppearanceMediumInverse">@style/TextAppearance.Holo.Light.Medium.Inverse</item> -->
+ <item name="android:editTextStyle">@style/Widget.Holo.Light.EditText</item>
+ <item name="android:seekBarStyle">@style/Widget.Holo.Light.SeekBar</item>
+ <item name="android:textColorHintInverse">@color/hint_foreground_holo_dark</item>
+ <item name="android:textColorHighlightInverse">@color/highlighted_text_holo_dark</item>
+ <item name="android:textColorLinkInverse">@color/holo_blue_light</item>
+ </style>
+
+ <color name="bright_foreground_disabled_holo_light">#ffb2b2b2</color>
+ <color name="background_holo_dark">#ff000000</color>
+ <color name="bright_foreground_holo_light">@color/background_holo_dark</color>
+ <color name="holo_blue_light">#ff33b5e5</color>
+ <color name="highlighted_text_holo_dark">#6633b5e5</color>
+ <color name="hint_foreground_holo_dark">#808080</color>
+ <color name="background_holo_light">#fff3f3f3</color>
+ <color name="bright_foreground_holo_dark">@color/background_holo_light</color>
+ <color name="bright_foreground_disabled_holo_dark">#ff4c4c4c</color>
+
+</resources>
20 res/values/materials.xml
@@ -0,0 +1,20 @@
+<resources>
+
+ <!-- materialNames items are mapped to materialPrices items -->
+ <string-array name="materialNames">
+ <item>8 GB of RAM</item>
+ <item>a 22\" Full HD Monitor</item>
+ <item>a 180 GB SSD Drive </item>
+ <item>a quad-core processor</item>
+ <item>an integration server</item>
+ </string-array>
+
+ <integer-array name="materialPrices">
+ <item>84</item>
+ <item>126</item>
+ <item>168</item>
+ <item>336</item>
+ <item>840</item>
+ </integer-array>
+
+</resources>
20 res/values/strings.xml
@@ -0,0 +1,20 @@
+<resources>
+
+ <string name="app_name">The Waste-O-Meter</string>
+ <string name="share_with">Share with</string>
+ <string name="share">Share</string>
+ <string name="cost_per_day_title">I COST</string>
+ <string name="cost_per_minute_label_format">"<![CDATA[$ / day (that's <font color="#33b5e5"><b>%.2f $ / min</b></font>)]]></string>
+ <string name="lost_minutes_per_day_title">"I WAIT FOR MY COMPUTER"</string>
+ <string name="lost_minutes_per_day_label">minutes a day</string>
+ <string name="working_days_title_format">"<![CDATA[IN <b>%d</b> WORKING DAYS]]>"</string>
+ <string name="total_cost_title_format">"<![CDATA[MY COMPUTER WASTES <b>%.0f$</b>]]>"</string>
+ <string name="material_start">"That's "</string>
+ <string name="material_start_share">"that's "</string>
+ <string name="material_separator">", "</string>
+ <string name="material_last_separator">" and "</string>
+ <string name="material_format" formatted="false">"<![CDATA[<font color="#33b5e5"><b>%s</b></font> (%d$)]]>"</string>
+ <string name="material_format_share" formatted="false">"%s (%d$)"</string>
+ <string name="share_format" formatted="false">"In %d working days my computer wastes %.0f$, "</string>
+
+</resources>
53 res/values/styles.xml
@@ -0,0 +1,53 @@
+<resources>
+
+ <style name="IntroLabel" parent="Widget.Holo.Light.TextView">
+ <item name="android:gravity">center_vertical</item>
+ <item name="android:paddingLeft">16dp</item>
+ <item name="android:paddingRight">16dp</item>
+ <item name="android:textColor">#0099cc</item>
+ <item name="android:background">#e8e8e8</item>
+ <item name="android:textSize">18dp</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">48dp</item>
+ </style>
+
+ <style name="NumberInput" parent="Widget.Holo.Light.EditText">
+ <item name="android:layout_marginLeft">16dp</item>
+ <item name="android:layout_marginRight">4dp</item>
+ <item name="android:layout_marginTop">4dp</item>
+ <item name="android:layout_marginBottom">4dp</item>
+ <item name="android:gravity">right</item>
+ <item name="android:inputType">number</item>
+ <item name="android:singleLine">true</item>
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:minWidth">80dp</item>
+ <item name="android:maxLength">5</item>
+ <item name="android:layout_height">40dp</item>
+ </style>
+
+ <style name="SeekbarInput" parent="Widget.Holo.Light.SeekBar">
+ <item name="android:layout_marginLeft">16dp</item>
+ <item name="android:layout_marginRight">16dp</item>
+ <item name="android:layout_marginTop">8dp</item>
+ <item name="android:layout_marginBottom">8dp</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ </style>
+
+ <style name="RightLabel" parent="Widget.Holo.Light.TextView">
+ <item name="android:layout_marginLeft">4dp</item>
+ <item name="android:layout_marginRight">16dp</item>
+ <item name="android:layout_marginTop">4dp</item>
+ <item name="android:layout_marginBottom">4dp</item>
+ <item name="android:gravity">center_vertical</item>
+ <item name="android:textSize">16dp</item>
+ <item name="android:layout_margin">4dp</item>
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">40dp</item>
+ </style>
+
+ <style name="CustomTheme" parent="Theme.Holo.Light">
+ <item name="android:windowNoTitle">true</item>
+ </style>
+
+</resources>
BIN screenshot1.png
Diff not rendered.
BIN screenshot2.png
Diff not rendered.
20 src/info/piwai/timeismoney/AbstractOnSeekBarChangeListener.java
@@ -0,0 +1,20 @@
+package info.piwai.timeismoney;
+
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+
+public abstract class AbstractOnSeekBarChangeListener implements OnSeekBarChangeListener {
+
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+
+}
50 src/info/piwai/timeismoney/BackgroundPreferenceHandler.java
@@ -0,0 +1,50 @@
+package info.piwai.timeismoney;
+
+import android.content.SharedPreferences;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Looper;
+import android.os.Message;
+import android.os.Process;
+
+/**
+ * Saves preferences serially, in a background thread. Saving order is
+ * guaranteed.
+ */
+public class BackgroundPreferenceHandler {
+
+ private static class BackgroundHandler extends Handler {
+
+ private final SharedPreferences preferences;
+
+ public BackgroundHandler(Looper backgroundThreadLooper, SharedPreferences preferences) {
+ super(backgroundThreadLooper);
+ this.preferences = preferences;
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ String key = (String) msg.obj;
+ int value = msg.arg1;
+ preferences.edit() //
+ .putInt(key, value) //
+ .commit();
+ }
+ }
+
+ private final Handler backgroundHandler;
+
+ public BackgroundPreferenceHandler(SharedPreferences preferences) {
+ HandlerThread backgroundThread = new HandlerThread("Background thread saving preferences", Process.THREAD_PRIORITY_MORE_FAVORABLE);
+ backgroundThread.start();
+
+ backgroundHandler = new BackgroundHandler(backgroundThread.getLooper(), preferences);
+ }
+
+ public void putIntAsync(String key, int value) {
+ Message message = Message.obtain();
+ message.obj = key;
+ message.arg1 = value;
+ backgroundHandler.sendMessage(message);
+ }
+}
81 src/info/piwai/timeismoney/Material.java
@@ -0,0 +1,81 @@
+package info.piwai.timeismoney;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import android.content.res.Resources;
+
+public class Material implements Comparable<Material> {
+
+ public static SortedSet<Material> createFromResources(Resources resources) {
+ SortedSet<Material> materials = new TreeSet<Material>();
+
+ String[] materialNames = resources.getStringArray(R.array.materialNames);
+ int[] materialPrices = resources.getIntArray(R.array.materialPrices);
+
+ for (int i = 0; i < materialNames.length; i++) {
+ materials.add(new Material(materialNames[i], materialPrices[i]));
+ }
+
+ return materials;
+ }
+
+ private final String name;
+ private final int price;
+
+ public Material(String name, int price) {
+ this.name = name;
+ this.price = price;
+ }
+
+ public String formatNameAndPrice(String format) {
+ return String.format(format, name, price);
+ }
+
+ public int getPrice() {
+ return price;
+ }
+
+ /**
+ * Sorted desc by price
+ */
+ @Override
+ public int compareTo(Material another) {
+ return Integer.valueOf(another.price).compareTo(price);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (name == null ? 0 : name.hashCode());
+ result = prime * result + price;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Material other = (Material) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ if (price != other.price) {
+ return false;
+ }
+ return true;
+ }
+
+}
75 src/info/piwai/timeismoney/TimeCosts.java
@@ -0,0 +1,75 @@
+package info.piwai.timeismoney;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public class TimeCosts {
+
+ private static final int MINUTES_PER_HOUR = 60;
+ private static final int WORKING_HOURS_PER_DAY = 8;
+
+ private final SortedSet<Material> materials;
+ private final SortedSet<Material> costInMaterials = new TreeSet<Material>();
+
+ private int costPerDay;
+ private int lostMinutesPerDay;
+ private int workingDays;
+ private double costPerMinute;
+ private double totalCost;
+
+ public TimeCosts(SortedSet<Material> materials) {
+ this.materials = materials;
+ }
+
+ public void updateCosts() {
+ costPerMinute = costPerDay * 1. / WORKING_HOURS_PER_DAY / MINUTES_PER_HOUR;
+ totalCost = costPerMinute * lostMinutesPerDay * workingDays;
+
+ costInMaterials.clear();
+ double rest = totalCost;
+ for (Material material : materials) {
+ int price = material.getPrice();
+ if (rest > price) {
+ rest -= price;
+ costInMaterials.add(material);
+ }
+ }
+ }
+
+ public int getCostPerDay() {
+ return costPerDay;
+ }
+
+ public void setCostPerDay(int costPerDay) {
+ this.costPerDay = costPerDay;
+ }
+
+ public int getLostMinutesPerDay() {
+ return lostMinutesPerDay;
+ }
+
+ public void setLostMinutesPerDay(int lostMinutesPerDay) {
+ this.lostMinutesPerDay = lostMinutesPerDay;
+ }
+
+ public int getWorkingDays() {
+ return workingDays;
+ }
+
+ public void setWorkingDays(int workingDays) {
+ this.workingDays = workingDays;
+ }
+
+ public double getCostPerMinute() {
+ return costPerMinute;
+ }
+
+ public double getTotalCost() {
+ return totalCost;
+ }
+
+ public SortedSet<Material> getCostInMaterials() {
+ return costInMaterials;
+ }
+
+}
188 src/info/piwai/timeismoney/TimeIsMoneyActivity.java
@@ -0,0 +1,188 @@
+package info.piwai.timeismoney;
+
+import java.util.SortedSet;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.text.Html;
+import android.widget.EditText;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+import com.googlecode.androidannotations.annotations.AfterViews;
+import com.googlecode.androidannotations.annotations.Click;
+import com.googlecode.androidannotations.annotations.EActivity;
+import com.googlecode.androidannotations.annotations.TextChange;
+import com.googlecode.androidannotations.annotations.ViewById;
+
+@EActivity(R.layout.time_is_money)
+public class TimeIsMoneyActivity extends Activity {
+
+ private static final String STORE_URL = "http://goo.gl/5NUr8";
+ private static final String COST_PER_DAY = "costPerDay";
+ private static final String LOST_MINUTES_PER_DAY = "lostMinutesPerDay";
+ private static final String WORKING_DAYS = "workingDays";
+
+ private TimeCosts timeCosts;
+
+ @ViewById
+ EditText costPerDayInput;
+
+ @ViewById
+ EditText lostMinutesPerDayInput;
+
+ @ViewById
+ SeekBar workingDaysInput;
+
+ @ViewById
+ TextView costPerDayLabel;
+
+ @ViewById
+ TextView workingDaysTitle;
+
+ @ViewById
+ TextView materialCostsTitle;
+
+ @ViewById
+ TextView materialCostsLabel;
+
+ private BackgroundPreferenceHandler preferencesHandler;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ SharedPreferences preferences = getPreferences(MODE_PRIVATE);
+
+ preferencesHandler = new BackgroundPreferenceHandler(preferences);
+
+ SortedSet<Material> materials = Material.createFromResources(getResources());
+ timeCosts = new TimeCosts(materials);
+
+ initTimeCosts(preferences);
+ }
+
+ private void initTimeCosts(SharedPreferences preferences) {
+ timeCosts.setCostPerDay(preferences.getInt(COST_PER_DAY, 450));
+ timeCosts.setLostMinutesPerDay(preferences.getInt(LOST_MINUTES_PER_DAY, 15));
+ timeCosts.setWorkingDays(preferences.getInt(WORKING_DAYS, 30));
+ }
+
+ @AfterViews
+ void initViews() {
+ workingDaysInput.setOnSeekBarChangeListener(new AbstractOnSeekBarChangeListener() {
+
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ workingDaysInput(progress);
+ }
+ });
+
+ costPerDayInput.setText(Integer.toString(timeCosts.getCostPerDay()));
+ lostMinutesPerDayInput.setText(Integer.toString(timeCosts.getLostMinutesPerDay()));
+ int progress = timeCosts.getWorkingDays() - 1;
+ workingDaysInput.setProgress(progress);
+ updateCosts();
+ }
+
+ @Click
+ void shareButtonClicked() {
+
+ StringBuilder message = new StringBuilder();
+
+ message.append(String.format(getString(R.string.share_format), timeCosts.getWorkingDays(), timeCosts.getTotalCost()));
+
+ SortedSet<Material> materials = timeCosts.getCostInMaterials();
+ int lastItem = materials.size() - 1;
+ int i = 0;
+ for (Material material : materials) {
+ if (i == 0) {
+ message.append(getString(R.string.material_start_share));
+ } else if (i < lastItem) {
+ message.append(getString(R.string.material_separator));
+ } else {
+ message.append(getString(R.string.material_last_separator));
+ }
+ message.append(material.formatNameAndPrice(getString(R.string.material_format_share)));
+
+ i++;
+ }
+
+ message.append(" ") //
+ .append(STORE_URL);
+
+ Intent sharingIntent = new Intent(Intent.ACTION_SEND);
+ sharingIntent.setType("text/plain");
+ sharingIntent.putExtra(Intent.EXTRA_TEXT, message.toString());
+ startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_with)));
+ }
+
+ @TextChange
+ void costPerDayInput(CharSequence text) {
+ int costPerDay = parse(text);
+ if (costPerDay != timeCosts.getCostPerDay()) {
+ timeCosts.setCostPerDay(costPerDay);
+ preferencesHandler.putIntAsync(COST_PER_DAY, costPerDay);
+ updateCosts();
+ }
+ }
+
+ @TextChange
+ void lostMinutesPerDayInput(CharSequence text) {
+ int lostMinutesPerDay = parse(text);
+ if (lostMinutesPerDay != timeCosts.getLostMinutesPerDay()) {
+ timeCosts.setLostMinutesPerDay(lostMinutesPerDay);
+ preferencesHandler.putIntAsync(LOST_MINUTES_PER_DAY, lostMinutesPerDay);
+ updateCosts();
+ }
+ }
+
+ private int parse(CharSequence charSequence) {
+ String string = charSequence.toString();
+ if (string.equals("")) {
+ return 0;
+ }
+ return Integer.parseInt(string);
+ }
+
+ /*
+ * TODO Use SeekBar dedicated annotation when available
+ */
+ void workingDaysInput(int progress) {
+ int workingDays = progress + 1;
+ if (workingDays != timeCosts.getWorkingDays()) {
+ timeCosts.setWorkingDays(workingDays);
+ preferencesHandler.putIntAsync(WORKING_DAYS, workingDays);
+ updateCosts();
+ }
+ }
+
+ void updateCosts() {
+ timeCosts.updateCosts();
+
+ costPerDayLabel.setText(Html.fromHtml(String.format(getString(R.string.cost_per_minute_label_format), timeCosts.getCostPerMinute())));
+ workingDaysTitle.setText(Html.fromHtml(String.format(getString(R.string.working_days_title_format), timeCosts.getWorkingDays())));
+ materialCostsTitle.setText(Html.fromHtml(String.format(getString(R.string.total_cost_title_format), timeCosts.getTotalCost())));
+
+ StringBuilder materialCosts = new StringBuilder();
+ SortedSet<Material> materials = timeCosts.getCostInMaterials();
+ int lastItem = materials.size() - 1;
+ int i = 0;
+ for (Material material : materials) {
+ if (i == 0) {
+ materialCosts.append(getString(R.string.material_start));
+ } else if (i < lastItem) {
+ materialCosts.append(getString(R.string.material_separator));
+ } else {
+ materialCosts.append(getString(R.string.material_last_separator));
+ }
+ materialCosts.append(material.formatNameAndPrice(getString(R.string.material_format)));
+
+ i++;
+ }
+
+ materialCostsLabel.setText(Html.fromHtml(materialCosts.toString()));
+ }
+}

0 comments on commit d3bc380

Please sign in to comment.
Something went wrong with that request. Please try again.