Commit c5aa527f authored by Dave Griffiths's avatar Dave Griffiths

first commit

parents
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="foam.opensauces"
android:versionCode="2"
android:versionName="1.0">
<application android:label="@string/app_name"
android:icon="@drawable/logo"
android:hardwareAccelerated="true"
>
<activity android:name="foam.starwisp.starwisp"
android:configChanges="orientation"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COURSE_LOCATION" />
<uses-sdk android:minSdkVersion="8" />
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
</manifest>
Open Sauces Notebook
====================
A structured notebook for recipes
#
# Set the keystore properties for signing the application.
#
#key.store=ushahidi-key.keystore
#key.alias=ushahidi-android
key.store=/home/dave/.keystore
key.alias=release_key
This diff is collapsed.
This diff is collapsed.
; convert scheme values into equivilent json strings
(define (scheme->json v)
(cond
((number? v) (number->string v))
((symbol? v) (string-append "\"" (symbol->string v) "\""))
((string? v) (string-append "\"" v "\""))
((boolean? v) (if v "true" "false"))
((list? v)
(cond
((null? v) "null")
(else
; if it quacks like an assoc list...
(if (and (not (null? v)) (not (list? (car v))) (pair? (car v)))
(assoc->json v)
(list->json v)))))
(else (printf "value->js, unsupported type for ~a~n" v) 0)))
(define (list->json l)
(define (_ l s)
(cond
((null? l) s)
(else
(_ (cdr l)
(string-append s
(if (not (string=? s "")) ", " "")
(scheme->json (car l)))))))
(string-append "[" (_ l "") "]"))
; ((one . 1) (two . "three")) -> { "one": 1, "two": "three }
(define (assoc->json l)
(define (_ l s)
(cond
((null? l) s)
(else
(let ((token (scheme->json (car (car l))))
(value (scheme->json (cdr (car l)))))
(_ (cdr l) (string-append s (if (not (string=? s "")) "," "")
"\n" token ": " value))))))
(string-append "{" (_ l "") "\n" "}"))
This diff is collapsed.
This diff is collapsed.
;; Starwisp Copyright (C) 2013 Dave Griffiths
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-activity-list
(activity
"main"
(linear-layout
(make-id "top")
'vertical
(layout 'fill-parent 'fill-parent 1 'left)
(list
(spinner (make-id "spinner") (list "one" "two" "three" "cows") fillwrap
(lambda (v)
(display "spinner fn called")(newline)
(list (update-widget 'text-view (get-id "view3") 'text v))))
(edit-text (make-id "name") "Name" 20 fillwrap
(lambda (v) (list (update-widget 'text-view 999 'text v))))
(linear-layout
(make-id "foo")
'horizontal
(layout 'fill-parent 'fill-parent 1 'centre)
(list
(button (make-id "but1") "Click me" 20 (layout 'wrap-content 'wrap-content 0 'centre)
(lambda () (list (update-widget 'text-view 999 'hide 0))))
(button (make-id "but3") "Boo" 20 (layout 'wrap-content 'wrap-content 0 'centre)
(lambda () (list (update-widget 'text-view 999 'hide 0))))))
(text-view (make-id "view1") "This is the title" 10 fillwrap)
(text-view (make-id "view2") "More texht" 40 fillwrap)
(text-view (make-id "view3") "event More texht" 30 fillwrap)
(button (make-id "but2") "Click me also pretty please" 20 fillwrap
(lambda ()
(list
(toast "hello dudes")
(start-activity "two" 2)
(update-widget 'text-view (get-id "view1") 'text "I have been updated"))))
(seek-bar (make-id "seek") 100 fillwrap
(lambda (v)
(list
(update-widget 'text-view (get-id "view2") 'text (number->string v))
(update-widget 'canvas (get-id "canvas") 'drawlist
(list (drawlist-line '(255 0 0) 10 (list 0 0 v 100))))
)))
(canvas (make-id "canvas")
(layout 200 200 1 'centre)
(list
(drawlist-line '(255 0 0) 5 '(0 0 100 100))))
(button (make-id "but4") "one two" 10 fillwrap
(lambda ()
'()))))
(lambda (activity)
(activity-layout activity))
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '()))
(activity
"two"
(linear-layout
(make-id "top")
'vertical
(layout 'fill-parent 'fill-parent 1 'left)
(list
(spinner (make-id "spinner") (list "one" "two" "three" "cows") fillwrap
(lambda (v)
(list (toast "what's up doc?"))))
(image-view (make-id "face") "face" wrap)
(button (make-id "exit") "Exit" 50 fillwrap
(lambda ()
(list (finish-activity 99))))))
(lambda (activity)
(activity-layout activity))
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())))
(start-activity "calc" 2)
(asserteq "filter" (filter (lambda (i) (odd? i)) (list 0 1 2 3)) (list 1 3))
(asserteq "sort" (sort (list 3 2 0 1) <) (list 0 1 2 3))
(asserteq "find" (find 3 (list '(3 30) '(2 20) '(0 100) '(1 10))) (list 3 30))
(asserteq "build-list" (build-list (lambda (i) (* i 2)) 5) (list 0 2 4 6 8))
(asserteq "foldl" (foldl (lambda (i r) (+ i r)) 0 (list 1 2 3 4)) 10)
(asserteq "insert-to" (insert-to 999 3 (list 0 1 2 3 4)) (list 0 1 2 999 3 4))
(asserteq "list-replace" (list-replace (list 1 2 3 4) 2 100) (list 1 2 100 4))
(asserteq "insert" (insert 4 < (list 2 5 100)) (list 2 4 5 100))
(assert "date<" (date< (list 20 12 2010) (list 25 12 2010)))
(asserteq "date->string" (date->string (list 20 12 2012)) "20/12/2012")
(asserteq "scheme->json" (scheme->json (list 10)) "[10]")
(asserteq "scheme->json2" (scheme->json (list 10 20)) "[10, 20]")
(asserteq "scheme->json3" (scheme->json (list (list "one" "two") 10))
"[[\"one\", \"two\"], 10]")
(asserteq "scheme->json4" (scheme->json (list)) "[]")
(asserteq "scheme->json5" (scheme->json 'sym) "\"sym\"")
(asserteq "scheme->json6" (scheme->json (list #t #f)) "[true, false]")
(asserteq "assoc->json" (assoc->json '((one . 1) (two . "three")))
"{\n\"one\": 1,\n\"two\": \"three\"\n}")
;; db
(msg "testing db")
(define db "unit-test.db")
(db-open db)
(define (feq a b)
(< (abs (- a b)) 0.001))
;;(msg (db-status db))
;; test low level sql
(db-exec db "create table unittest ( id integer primary key autoincrement, name varchar(256), num int, r real )")
(define id (db-insert db "insert into unittest values (null, ?, ?, ?)" "hello" 23 1.1))
(asserteq "sql autoinc" (+ id 1) (db-insert db "insert into unittest values (null, ?, ?, ?)" "hello2" 26 2.3))
(let ((q (db-exec db "select * from unittest")))
(assert "sql length" (> (length q) 2)))
(let ((q (db-exec db "select * from unittest where id = ?" id)))
(asserteq "sql select one" (length q) 2)
(assert "sql select two" (vector? (car q)))
(asserteq "sql select 3" (vector-ref (cadr q) 2) 23)
(assert "sql select 4" (feq (vector-ref (cadr q) 3) 1.1)))
(db-exec db "update unittest set name=? where id = ?" "bob" id)
(let ((q (db-exec db "select * from unittest where id = ?" id)))
(asserteq "sql update" (vector-ref (cadr q) 1) "bob"))
(db-exec db "update unittest set name=? where id = ?" "Robert'); DROP TABLE unittest;--" id)
(let ((q (db-exec db "select * from unittest where id = ?" id)))
(asserteq "bobby tables sql injection" (vector-ref (cadr q) 1) "Robert'); DROP TABLE unittest;--"))
;; test the entity attribute value system
(define table "eavunittest")
(setup db table)
(asserteq "ktv one" (stringify-value (ktv "one" "varchar" "two")) "'two'")
(asserteq "ktv 2" (stringify-value (ktv "one" "int" 3)) "3")
(asserteq "ktv 3" (stringify-value-url (ktv "one" "varchar" "two")) "two")
(asserteq "ktv 4" (stringify-value-url (ktv "one" "int" 3)) "3")
(asserteq "select first" (select-first db "select name from unittest where id = ?" (+ id 1))
"hello2")
(define e (insert-entity db table "thing" "me" (list (ktv "param1" "varchar" "bob")
(ktv "param2" "int" 30)
(ktv "param3" "real" 3.141))))
(asserteq "eav ent type" (get-entity-type db table e) "thing")
(let ((e (get-entity db table e)))
(asserteq "entity get 1" (ktv-get e "param1") "bob")
(asserteq "entity get 2" (ktv-get e "param2") 30)
(assert "entity get 3" (feq (ktv-get e "param3") 3.141)))
(update-value db table e (ktv "param1" "varchar" "fred"))
(let ((e (get-entity db table e)))
(asserteq "update value 1" (ktv-get e "param1") "fred")
(asserteq "update value 2" (ktv-get e "param2") 30))
(assert "all-entities" (> (length (all-entities db table "thing")) 0))
(update-entity db table e (list (ktv "param1" "varchar" "wotzit")
(ktv "param2" "int" 1)))
(let ((e (get-entity db table e)))
(asserteq "update-entity 1" (ktv-get e "param1") "wotzit")
(asserteq "update-entity 2" (ktv-get e "param2") 1))
(update-entity db table e (list (ktv "param3" "real" 3.3)))
(let ((e (get-entity db table e)))
(asserteq "update-entity 3" (ktv-get e "param1") "wotzit")
(asserteq "update-entity 4" (ktv-get e "param2") 1)
(assert "update-entity 5" (feq (ktv-get e "param3") 3.3)))
(define e2 (insert-entity db table "thing" "me"
(list (ktv "param1" "varchar" "bob")
(ktv "param2" "int" 30)
(ktv "param3" "real" 3.141)
(ktv "param4" "int" 0))))
(let ((e (get-entity db table e2)))
(msg e)
(asserteq "new entity 1" (ktv-get e "param1") "bob")
(asserteq "new entity 2" (ktv-get e "param2") 30)
(assert "new entity 3" (feq (ktv-get e "param3") 3.141))
(asserteq "new entity 3" (ktv-get e "param4") 0))
;; test the versioning
(asserteq "dirty flag" (get-entity-dirty db table e2) 1)
(let ((uid (get-unique-id db table e2)))
(update-entity-clean db table uid))
(asserteq "dirty flag post clean" (get-entity-dirty db table e2) 0)
(asserteq "versioning" (get-entity-version db table e) 2)
(assert "dirty" (> (length (dirty-entities db table)) 0))
(for-each
(lambda (e)
(update-entity-clean
db table
(list-ref (car e) 1)))
(dirty-entities db table))
(asserteq "cleaning" (length (dirty-entities db table)) 0)
(msg (db-status db))
(msg "testing some interface building...")
(setup db "sync")
(define i (insert-entity
db "sync" "pack" "user"
(list (ktv "name" "varchar" "pack one"))))
(define p (get-entity db "sync" i))
(msg (ktv-get p "unique_id"))
(define (make-mongoose name)
(insert-entity
db "sync" "mongoose" (ktv-get p "unique_id")
(list
(ktv "name" "varchar" name)
(ktv "gender" "varchar" "Female")
(ktv "litter-code" "varchar" "34")
(ktv "chip-code" "varchar" "34")
(ktv "pack-id" "varchar" "unique_id")
)))
(make-mongoose "bob")
(make-mongoose "fred")
(make-mongoose "arnold")
(make-mongoose "lucy")
(make-mongoose "doris")
(make-mongoose "kylie")
(make-mongoose "jenny")
(for-each
(lambda (fragment)
(msg "calling fragment" fragment)
(fragment-callback 'on-create fragment '("")))
(build-list
(lambda (i)
(choose (list
"pf-timer"
"pf-scan1"
"events"
"pf-timer"
"ev-pupfeed"
"ev-pupcare"
"ev-pupfind"
"ev-pupaggr"
"ev-grpint"
"ev-grpalarm"
"ev-grpmov")))
100))
<?xml version="1.0" encoding="UTF-8"?>
<project name="opensauces" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>
/home/dave/code/open-sauces/android2/gen/foam/opensauces/R.java \
: /home/dave/code/starwisp/res/drawable-hdpi/ic_launcher.png \
/home/dave/code/starwisp/res/layout/toggle_button_maybe.xml \
/home/dave/code/starwisp/res/layout/main_fragment.xml \
/home/dave/code/starwisp/res/layout/main.xml \
/home/dave/code/starwisp/res/layout/spinner_item.xml \
/home/dave/code/starwisp/res/layout/toggle_button_fancy.xml \
/home/dave/code/starwisp/res/layout/spinner_layout.xml \
/home/dave/code/starwisp/res/layout/debug_text.xml \
/home/dave/code/starwisp/res/layout/toggle_button_no.xml \
/home/dave/code/starwisp/res/layout/toggle_button_yes.xml \
/home/dave/code/starwisp/res/drawable-ldpi/ic_launcher.png \
/home/dave/code/starwisp/res/drawable/draggable.xml \
/home/dave/code/starwisp/res/drawable/bg_style.xml \
/home/dave/code/starwisp/res/drawable/bgpaw.png \
/home/dave/code/starwisp/res/drawable/seekprogress.xml \
/home/dave/code/starwisp/res/drawable/swarmspinner.xml \
/home/dave/code/starwisp/res/drawable/yes_on.png \
/home/dave/code/starwisp/res/drawable/seekprogress_fill.xml \
/home/dave/code/starwisp/res/drawable/maybe_off.png \
/home/dave/code/starwisp/res/drawable/arrow_left.png \
/home/dave/code/starwisp/res/drawable/no_on.png \
/home/dave/code/starwisp/res/drawable/seekbg_fill.xml \
/home/dave/code/starwisp/res/drawable/maybe_on.png \
/home/dave/code/starwisp/res/drawable/swarmtoggle.xml \
/home/dave/code/starwisp/res/drawable/swarmtoggledrawable_maybe.xml \
/home/dave/code/starwisp/res/drawable/logo.png \
/home/dave/code/starwisp/res/drawable/bg.png \
/home/dave/code/starwisp/res/drawable/no_off.png \
/home/dave/code/starwisp/res/drawable/arrow_right.png \
/home/dave/code/starwisp/res/drawable/swarmtoggledrawable.xml \
/home/dave/code/starwisp/res/drawable/cross.png \
/home/dave/code/starwisp/res/drawable/yes_off.png \
/home/dave/code/starwisp/res/drawable/tick.png \
/home/dave/code/starwisp/res/drawable/swarmtoggledrawable_no.xml \
/home/dave/code/starwisp/res/drawable/swarmtoggledrawable_yes.xml \
/home/dave/code/starwisp/res/drawable/swarmbutton.xml \
/home/dave/code/starwisp/res/drawable/seekthumb.xml \
/home/dave/code/starwisp/res/drawable-mdpi/ic_launcher.png \
/home/dave/code/starwisp/res/drawable-xhdpi/ic_launcher.png \
/home/dave/code/starwisp/res/values/strings.xml \
/home/dave/code/starwisp/res/values/styles.xml \
/home/dave/code/starwisp/res/raw/ping.wav \
/home/dave/code/starwisp/res/raw/active.wav \
/home/dave/code/starwisp/bin/res/drawable-hdpi/ic_launcher.png \
/home/dave/code/starwisp/bin/res/drawable-ldpi/ic_launcher.png \
/home/dave/code/starwisp/bin/res/drawable/bgpaw.png \
/home/dave/code/starwisp/bin/res/drawable/yes_on.png \
/home/dave/code/starwisp/bin/res/drawable/maybe_off.png \
/home/dave/code/starwisp/bin/res/drawable/arrow_left.png \
/home/dave/code/starwisp/bin/res/drawable/no_on.png \
/home/dave/code/starwisp/bin/res/drawable/maybe_on.png \
/home/dave/code/starwisp/bin/res/drawable/logo.png \
/home/dave/code/starwisp/bin/res/drawable/bg.png \
/home/dave/code/starwisp/bin/res/drawable/no_off.png \
/home/dave/code/starwisp/bin/res/drawable/arrow_right.png \
/home/dave/code/starwisp/bin/res/drawable/cross.png \
/home/dave/code/starwisp/bin/res/drawable/yes_off.png \
/home/dave/code/starwisp/bin/res/drawable/tick.png \
/home/dave/code/starwisp/bin/res/drawable-mdpi/ic_launcher.png \
/home/dave/code/starwisp/bin/res/drawable-xhdpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/res/drawable-hdpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/res/drawable-hdpi/logo.png \
/home/dave/code/open-sauces/android2/res/drawable-ldpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/res/drawable-mdpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/res/drawable-xhdpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/res/values/strings.xml \
/home/dave/code/open-sauces/android2/res/raw/ping.wav \
/home/dave/code/open-sauces/android2/res/raw/active.wav \
/home/dave/code/open-sauces/android2/res/animator/card_flip_right_in.xml \
/home/dave/code/open-sauces/android2/res/animator/card_flip_left_out.xml \
/home/dave/code/open-sauces/android2/res/animator/card_flip_right_out.xml \
/home/dave/code/open-sauces/android2/res/animator/card_flip_left_in.xml \
/home/dave/code/open-sauces/android2/bin/res/drawable-hdpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/bin/res/drawable-hdpi/logo.png \
/home/dave/code/open-sauces/android2/bin/res/drawable-ldpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/bin/res/drawable-mdpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/bin/res/drawable-xhdpi/ic_launcher.png \
/home/dave/code/open-sauces/android2/bin/AndroidManifest.xml \
/** Automatically generated file. DO NOT MODIFY */
package foam.opensauces;
public final class BuildConfig {