Commit 22387655 authored by Dave Griffiths's avatar Dave Griffiths
Browse files

more review item stuff

parent 812b98e3
......@@ -33,6 +33,7 @@
<activity android:name="SyncActivity" android:configChanges="orientation"></activity>
<activity android:name="ExportActivity" android:configChanges="orientation"></activity>
<activity android:name="ReviewActivity" android:configChanges="orientation"></activity>
<activity android:name="ReviewItemActivity" android:configChanges="orientation"></activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
......
......@@ -345,6 +345,7 @@
;; review
(define (review-build-contents uid entity)
(msg "review-build-contents")
(append
(map
(lambda (ktv)
......@@ -367,7 +368,20 @@
(else (mtext "" (string-append (ktv-type ktv) " not handled")))))
entity)
(list
(mbutton (string-append uid "-save") "Save" (lambda () '())))))
(horiz
(mbutton "review-item-cancel" "Cancel" (lambda () (list (finish-activity 0))))
(mbutton (string-append uid "-save") "Save" (lambda () '()))))))
(define (review-item-build)
(let ((uid (entity-get-value "unique_id")))
(msg "review-item-build" uid)
(list
(update-widget
'linear-layout
(get-id "review-item-container")
'contents
(review-build-contents
uid (get-current 'entity-values '()))))))
(define (review-update-list)
(list
......@@ -379,28 +393,16 @@
(let* ((data (car dirty-entity))
(entity (cadr dirty-entity))
(time (ktv-get entity "time"))
(type (list-ref data 0))
(uid (list-ref data 1)))
(msg dirty-entity)
(vert
(mtoggle-button
(mbutton
(string-append "review-" uid)
(string-append (list-ref data 0) (if time (string-append "-" time) ""))
(lambda (v)
(list
(update-widget 'linear-layout
(get-id (string-append uid "-container"))
'contents
(if (not v) '() (review-build-contents uid entity)))
)))
(linear-layout
(make-id (string-append uid "-container"))
'vertical
(layout 'fill-parent 'wrap-content 1 'centre 0)
(list 0 0 0 0)
(list)))))
(string-append type (if time (string-append "-" time) ""))
(lambda ()
(entity-init! db "stream" type (get-entity-by-unique db "stream" uid))
(list (start-activity "review-item" 0 ""))))))
(dirty-entities-for-review db "stream")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
......@@ -1245,8 +1247,8 @@
'()))
(mtext "foo" "Database")
(horiz
(mbutton2 "main-sync" "Sync database" (lambda () (list (start-activity "sync" 0 ""))))
(mbutton2 "main-review" "Review changes" (lambda () (list (start-activity "review" 0 ""))))))
(mbutton2 "main-review" "Review changes" (lambda () (list (start-activity "review" 0 ""))))
(mbutton2 "main-sync" "Sync database" (lambda () (list (start-activity "sync" 0 ""))))))
(lambda (activity arg)
(activity-layout activity))
(lambda (activity arg)
......@@ -1963,4 +1965,25 @@
(lambda (activity) '())
(lambda (activity requestcode resultcode) '()))
(activity
"review-item"
(vert
(text-view (make-id "title") "Review item" 40 fillwrap)
(linear-layout
(make-id "review-item-container")
'vertical
(layout 'fill-parent 'wrap-content 1 'left 0)
(list 0 0 0 0)
(list))
)
(lambda (activity arg)
(activity-layout activity))
(lambda (activity arg)
(review-item-build))
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity) '())
(lambda (activity requestcode resultcode) '()))
)
// 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/>.
package foam.mongoose;
import android.app.Activity;
import android.os.Bundle;
import android.content.Context;
public class ReviewItemActivity extends foam.starwisp.StarwispActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
m_Name = "review-item";
super.onCreate(savedInstanceState);
}
}
......@@ -80,6 +80,7 @@ public class starwisp extends StarwispActivity
ActivityManager.RegisterActivity("sync",SyncActivity.class);
ActivityManager.RegisterActivity("export",ExportActivity.class);
ActivityManager.RegisterActivity("review",ReviewActivity.class);
ActivityManager.RegisterActivity("review-item",ReviewItemActivity.class);
};
/** Called when the activity is first created. */
......
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