Commit 1806cff8 authored by Dave Griffiths's avatar Dave Griffiths
Browse files

sorted layout more or less

parent 53834c24
...@@ -108,6 +108,9 @@ ...@@ -108,6 +108,9 @@
(define (mbutton2 id title fn) (define (mbutton2 id title fn)
(button (make-id id) title 20 (layout 150 100 1 'centre 5) fn)) (button (make-id id) title 20 (layout 150 100 1 'centre 5) fn))
(define (mbutton-small id title fn)
(button (make-id id) title 30 (layout 'wrap-content 'wrap-content -1 'right 5) fn))
(define (mtoggle-button id title fn) (define (mtoggle-button id title fn)
(toggle-button (make-id id) title 20 (layout 'fill-parent 'wrap-content 1 'centre 5) "fancy" fn)) (toggle-button (make-id id) title 20 (layout 'fill-parent 'wrap-content 1 'centre 5) "fancy" fn))
...@@ -478,22 +481,27 @@ ...@@ -478,22 +481,27 @@
(string-append (number->string (get-current 'timer-seconds 59)))) (string-append (number->string (get-current 'timer-seconds 59))))
))) )))
(define (next-button id dialog-msg next-frag fn) (define (next-button id dialog-msg last-frag next-frag fn)
(mbutton (string-append id "-nextb") "Next" (horiz
(lambda () (mbutton (string-append id "-backb") "Back"
(list (lambda ()
(alert-dialog (list (replace-fragment (get-id "gc-top") last-frag))))
(string-append id "-d")
dialog-msg (mbutton (string-append id "-nextb") "Next"
(lambda (v) (lambda ()
(cond (list
((eqv? v 1) (alert-dialog
(msg "recording from next button") (string-append id "-d")
(entity-update-values!) dialog-msg
(append (lambda (v)
(fn) (list (replace-fragment (cond
(get-id "gc-top") next-frag)))) ((eqv? v 1)
(else '())))))))) (msg "recording from next button")
(entity-update-values!)
(append
(fn) (list (replace-fragment
(get-id "gc-top") next-frag))))
(else '())))))))))
(define (force-pause) (define (force-pause)
(list (list
...@@ -992,7 +1000,7 @@ ...@@ -992,7 +1000,7 @@
(edit-text (make-id "gc-start-code") "" 30 "numeric" fillwrap (edit-text (make-id "gc-start-code") "" 30 "numeric" fillwrap
(lambda (v) (entity-set-value! "group-comp-code" "varchar" v) '())) (lambda (v) (entity-set-value! "group-comp-code" "varchar" v) '()))
(build-grid-selector "gc-start-present" "toggle" "Who's present?") (build-grid-selector "gc-start-present" "toggle" "Who's present?")
(next-button "gc-start-" "Go to weighing, have you finished here?" "gc-weights" (next-button "gc-start-" "Go to weighing, have you finished here?" "gc-start" "gc-weights"
(lambda () '())) (lambda () '()))
)) ))
...@@ -1037,7 +1045,7 @@ ...@@ -1037,7 +1045,7 @@
'())))) '()))))
(mtoggle-button "gc-weigh-accurate" "Accurate?" (lambda (v) '())) (mtoggle-button "gc-weigh-accurate" "Accurate?" (lambda (v) '()))
(next-button "gc-weigh-" "Go to pregnancies, have you finished here?" "gc-preg" (next-button "gc-weigh-" "Go to pregnancies, have you finished here?" "gc-start" "gc-preg"
(lambda () '())))) (lambda () '()))))
(lambda (fragment arg) (lambda (fragment arg)
...@@ -1077,7 +1085,7 @@ ...@@ -1077,7 +1085,7 @@
(list (list
(mtitle "title" "Pregnant females") (mtitle "title" "Pregnant females")
(build-grid-selector "gc-preg-choose" "toggle" "Choose") (build-grid-selector "gc-preg-choose" "toggle" "Choose")
(next-button "gc-preg-" "Going to pup associations, have you finished here?" "gc-pup-assoc" (next-button "gc-preg-" "Going to pup associations, have you finished here?" "gc-weights" "gc-pup-assoc"
(lambda () '())))) (lambda () '()))))
(lambda (fragment arg) (lambda (fragment arg)
...@@ -1113,7 +1121,7 @@ ...@@ -1113,7 +1121,7 @@
(spinner (make-id "gc-pup-accuracy") (list "Weak" "Medium" "Strong") fillwrap (spinner (make-id "gc-pup-accuracy") (list "Weak" "Medium" "Strong") fillwrap
(lambda (v) '())))) (lambda (v) '()))))
(build-grid-selector "gc-pup-escort" "toggle" "Escort") (build-grid-selector "gc-pup-escort" "toggle" "Escort")
(next-button "gc-pup-assoc-" "Going to oestrus, have you finished here?" "gc-oestrus" (next-button "gc-pup-assoc-" "Going to oestrus, have you finished here?" "gc-preg" "gc-oestrus"
(lambda () '())))) (lambda () '()))))
(lambda (fragment arg) (lambda (fragment arg)
...@@ -1151,7 +1159,7 @@ ...@@ -1151,7 +1159,7 @@
(spinner (make-id "gc-oestrus-accuracy") (list "Weak" "Medium" "Strong") fillwrap (spinner (make-id "gc-oestrus-accuracy") (list "Weak" "Medium" "Strong") fillwrap
(lambda (v) '())))) (lambda (v) '()))))
(build-grid-selector "gc-oestrus-guard" "single" "Choose mate guard") (build-grid-selector "gc-oestrus-guard" "single" "Choose mate guard")
(next-button "gc-pup-oestrus-" "Going to babysitters, have you finished here?" "gc-babysitting" (next-button "gc-pup-oestrus-" "Going to babysitters, have you finished here?" "gc-pup-assoc" "gc-babysitting"
(lambda () '())))) (lambda () '()))))
(lambda (fragment arg) (lambda (fragment arg)
(activity-layout fragment)) (activity-layout fragment))
...@@ -1178,7 +1186,7 @@ ...@@ -1178,7 +1186,7 @@
(make-id "") 'vertical fill gc-col (make-id "") 'vertical fill gc-col
(list (list
(mtitle "" "Babysitters") (mtitle "" "Babysitters")
(next-button "gc-pup-baby-" "Ending, have you finished here?" "gc-end" (next-button "gc-pup-baby-" "Ending, have you finished here?" "gc-oestrus" "gc-end"
(lambda () '())))) (lambda () '()))))
(lambda (fragment arg) (lambda (fragment arg)
(activity-layout fragment)) (activity-layout fragment))
...@@ -1195,7 +1203,7 @@ ...@@ -1195,7 +1203,7 @@
(make-id "") 'vertical fill gc-col (make-id "") 'vertical fill gc-col
(list (list
(mtitle "" "Finish group composition") (mtitle "" "Finish group composition")
(next-button "gc-pup-baby-" "Ending, have you finished here?" "gc-end" (next-button "gc-pup-baby-" "Ending, have you finished here?" "gc-babysitting" "gc-end"
(lambda () (list (finish-activity 0)))))) (lambda () (list (finish-activity 0))))))
(lambda (fragment arg) (lambda (fragment arg)
(activity-layout fragment)) (activity-layout fragment))
...@@ -1371,12 +1379,27 @@ ...@@ -1371,12 +1379,27 @@
(activity (activity
"group-composition" "group-composition"
(linear-layout (linear-layout
0 'vertical fillwrap gc-bgcol 0 'vertical (layout 'fill-parent 'fill-parent 1 'left 0)
gc-col
(list (list
(text-view (make-id "obs-title") "" 40 fillwrap) (relative
(build-fragment "gc-start" (make-id "gc-top") (layout 'fill-parent 520 1 'left 0)) '(("parent-top"))
(build-fragment "events" (make-id "event-holder") (layout 'fill-parent 520 1 'left 0)) (list 0 0 0 0)
(mbutton "gc-done" "Done" (lambda () (list (finish-activity 0)))))) (horiz
(text-view (make-id "obs-title") "" 40 fillwrap)
(mbutton-small "gc-done" "Exit" (lambda () (list (finish-activity 0))))))
(build-fragment "gc-start" (make-id "gc-top") (layout 'fill-parent 'wrap-content -1 'left 0))
(linear-layout
0 'vertical (layout 'fill-parent 'fill-parent 1 'left 0)
(list 0 0 0 0) (list (spacer 10)))
(relative
'(("parent-bottom"))
(list 0 0 0 0)
(build-fragment "events" (make-id "event-holder") (layout 'fill-parent 'wrap-content -1 'left 0)))))
(lambda (activity arg) (lambda (activity arg)
(activity-layout activity)) (activity-layout activity))
(lambda (activity arg) (lambda (activity arg)
...@@ -1395,38 +1418,34 @@ ...@@ -1395,38 +1418,34 @@
(activity (activity
"pup-focal-start" "pup-focal-start"
(linear-layout (vert
0 'vertical fillwrap pf-bgcol (mtitle "" "Pup focal setup")
(list (mtext "pf1-pack" "Pack")
(vert (build-grid-selector "pf1-grid" "single" "Select pup")
(mtitle "" "Pup focal setup") (horiz
(mtext "pf1-pack" "Pack") (medit-text "pf1-width" "Pack width - left to right" "numeric"
(build-grid-selector "pf1-grid" "single" "Select pup") (lambda (v) (entity-set-value! "pack-width" "int" v) '()))
(horiz (medit-text "pf1-height" "Pack depth - front to back" "numeric"
(medit-text "pf1-width" "Pack width - left to right" "numeric" (lambda (v) (entity-set-value! "pack-depth" "int" v) '())))
(lambda (v) (entity-set-value! "pack-width" "int" v) '())) (medit-text "pf1-count" "How many mongooses can you see?" "numeric"
(medit-text "pf1-height" "Pack depth - front to back" "numeric" (lambda (v) (entity-set-value! "pack-count" "int" v) '()))
(lambda (v) (entity-set-value! "pack-depth" "int" v) '()))) (horiz
(medit-text "pf1-count" "How many mongooses can you see?" "numeric" (mbutton2 "pf1-back" "Back" (lambda () (list (finish-activity 1))))
(lambda (v) (entity-set-value! "pack-count" "int" v) '())) (mbutton2 "pf1-done" "Done"
(horiz (lambda ()
(mbutton2 "pf1-back" "Back" (lambda () (list (finish-activity 1)))) (cond
(mbutton2 "pf1-done" "Done" ((current-exists? 'individual)
(lambda () (set-current! 'pup-focal-id (entity-record-values!))
(cond (set-current! 'timer-minutes pf-length)
((current-exists? 'individual) (set-current! 'timer-seconds 0)
(set-current! 'pup-focal-id (entity-record-values!)) (list
(set-current! 'timer-minutes pf-length) (start-activity "pup-focal" 2 "")))
(set-current! 'timer-seconds 0) (else
(list (list
(start-activity "pup-focal" 2 ""))) (alert-dialog
(else "pup-focal-check"
(list "You need to specify an pup for the focal"
(alert-dialog (lambda () '())))))))))
"pup-focal-check"
"You need to specify an pup for the focal"
(lambda () '()))))))))
)))
(lambda (activity arg) (lambda (activity arg)
(activity-layout activity)) (activity-layout activity))
(lambda (activity arg) (lambda (activity arg)
...@@ -1448,9 +1467,13 @@ ...@@ -1448,9 +1467,13 @@
(activity (activity
"pup-focal" "pup-focal"
(linear-layout (linear-layout
0 'vertical fillwrap pf-bgcol 0 'vertical (layout 'fill-parent 'fill-parent 1 'left 0)
(list pf-col
(list
(relative
'(("parent-top"))
(list 0 0 0 0)
(horiz (horiz
(mtitle "title" "Pup Focal") (mtitle "title" "Pup Focal")
(linear-layout (linear-layout
...@@ -1470,46 +1493,53 @@ ...@@ -1470,46 +1493,53 @@
(msg "pausing") (msg "pausing")
(if v (if v
(list (delayed "timer" 1000 (lambda () '()))) (list (delayed "timer" 1000 (lambda () '())))
(list (delayed "timer" 1000 timer-cb)))))) (list (delayed "timer" 1000 timer-cb)))))
(build-fragment "pf-timer" (make-id "pf-top") (layout 'fill-parent 515 1 'left 0)) (mbutton-small "pf-done" "Exit"
(build-fragment "events" (make-id "event-holder") (layout 'fill-parent 515 1 'left 0)) (lambda ()
(mbutton "pf-done" "Done" (list
(lambda () (alert-dialog
(list "pup-focal-end-done"
(alert-dialog "Finish pup focal are you sure?"
"pup-focal-end-done" (lambda (v)
"Finish pup focal are you sure?" (cond
(lambda (v) ((eqv? v 1)
(cond (list (finish-activity 1)))
((eqv? v 1) (else
(list (finish-activity 1))) (list))))))))))
(else
(list)))))))))) (build-fragment "pf-timer" (make-id "pf-top") (layout 'fill-parent 'wrap-content -1 'left 0))
(lambda (activity arg) (linear-layout
(activity-layout activity)) 0 'vertical (layout 'fill-parent 'fill-parent 1 'left 0)
(lambda (activity arg) (list 0 0 0 0) (list (spacer 10)))
(list
(update-widget 'text-view (get-id "pf-timer-time-minutes") 'text (relative
(number->string (get-current 'timer-minutes pf-length))) '(("parent-bottom"))
(update-widget 'text-view (get-id "pf-timer-time") 'text (list 0 0 0 0)
(number->string (get-current 'timer-seconds 60))) (build-fragment "events" (make-id "event-holder") (layout 'fill-parent 'wrap-content 1 'left 0)))))
(delayed "timer" 1000 timer-cb)))
(lambda (activity) '()) (lambda (activity arg)
(lambda (activity) '()) (activity-layout activity))
(lambda (activity) (list (delayed "timer" 1000 (lambda () '())))) (lambda (activity arg)
(lambda (activity) '()) (list
(lambda (activity requestcode resultcode) '())) (update-widget 'text-view (get-id "pf-timer-time-minutes") 'text
(number->string (get-current 'timer-minutes pf-length)))
(update-widget 'text-view (get-id "pf-timer-time") 'text
(number->string (get-current 'timer-seconds 60)))
(delayed "timer" 1000 timer-cb)))
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) (list (delayed "timer" 1000 (lambda () '()))))
(lambda (activity) '())
(lambda (activity requestcode resultcode) '()))
(activity (activity
"group-events" "group-events"
(linear-layout (vert
0 'vertical fill gp-col (build-fragment "events" (make-id "event-holder") (layout 'fill-parent 'wrap-content 1 'left 0))
(list (horiz
(build-fragment "events" (make-id "event-holder") (layout 'fill-parent 515 1 'left 0)) (mbutton "gpe-done" "Done" (lambda () (list (finish-activity 0))))))
(horiz
(mbutton "gpe-done" "Done" (lambda () (list (finish-activity 0)))))))
(lambda (activity arg) (lambda (activity arg)
(activity-layout activity)) (activity-layout activity))
(lambda (activity arg) (list)) (lambda (activity arg) (list))
......
<?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="fill_parent">
<!-- Dummy item to prevent TextView from receiving focus -->
<LinearLayout
android:focusable="true" android:focusableInTouchMode="true"
android:layout_width="0px" android:layout_height="0px"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/main"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/debug"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</LinearLayout>
</LinearLayout>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment