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

merged in crap app fixes

parent 40374b51
...@@ -326,13 +326,14 @@ ...@@ -326,13 +326,14 @@
(define (web-view-modify-text t v) (list-replace t 2 v)) (define (web-view-modify-text t v) (list-replace t 2 v))
(define (web-view-layout t) (list-ref t 3)) (define (web-view-layout t) (list-ref t 3))
(define (edit-text id text size layout listener) (list "edit-text" id text size layout listener)) (define (edit-text id text size type layout listener) (list "edit-text" id text size type layout listener))
(define (edit-text-id t) (list-ref t 1)) (define (edit-text-id t) (list-ref t 1))
(define (edit-text-text t) (list-ref t 2)) (define (edit-text-text t) (list-ref t 2))
(define (edit-text-modify-text t v) (list-replace t 2 v)) (define (edit-text-modify-text t v) (list-replace t 2 v))
(define (edit-text-size t) (list-ref t 3)) (define (edit-text-size t) (list-ref t 3))
(define (edit-text-layout t) (list-ref t 4)) (define (edit-text-type t) (list-ref t 4))
(define (edit-text-listener t) (list-ref t 5)) (define (edit-text-layout t) (list-ref t 5))
(define (edit-text-listener t) (list-ref t 6))
(define (button id text text-size layout listener) (list "button" id text text-size layout listener)) (define (button id text text-size layout listener) (list "button" id text text-size layout listener))
(define (button-id t) (list-ref t 1)) (define (button-id t) (list-ref t 1))
...@@ -393,7 +394,7 @@ ...@@ -393,7 +394,7 @@
(define (start-activity-goto act request arg) (list "start-activity" 0 "start-activity-goto" act arg)) (define (start-activity-goto act request arg) (list "start-activity" 0 "start-activity-goto" act arg))
(define (finish-activity result) (list "finish-activity" 0 "finish-activity" result)) (define (finish-activity result) (list "finish-activity" 0 "finish-activity" result))
(define (build-fragment type id) (list "build-fragment" type id)) (define (build-fragment type id layout) (list "build-fragment" type id layout))
(define (replace-fragment id type) (list "replace-fragment" id type)) (define (replace-fragment id type) (list "replace-fragment" id type))
(define (update-widget type id token value) (list type id token value)) (define (update-widget type id token value) (list type id token value))
......
...@@ -285,7 +285,7 @@ ...@@ -285,7 +285,7 @@
(mtext "splash-about" "Advanced mongoose technology") (mtext "splash-about" "Advanced mongoose technology")
(spacer 20) (spacer 20)
(mbutton "f2" "Get started!" (lambda () (list (start-activity-goto "main" 2 "")))) (mbutton "f2" "Get started!" (lambda () (list (start-activity-goto "main" 2 ""))))
(build-fragment "test-fragment" (make-id "fragtesting")) (build-fragment "test-fragment" (make-id "fragtesting") fillwrap)
(mbutton "f3" "Frag 2" (mbutton "f3" "Frag 2"
(lambda () (list (replace-fragment (get-id "fragtesting") "test-fragment2")))) (lambda () (list (replace-fragment (get-id "fragtesting") "test-fragment2"))))
(mbutton "f4" "Frag 1" (mbutton "f4" "Frag 1"
...@@ -311,7 +311,7 @@ ...@@ -311,7 +311,7 @@
(mbutton "main-manage" "Manage Packs" (lambda () (list (start-activity "manage-packs" 2 "")))) (mbutton "main-manage" "Manage Packs" (lambda () (list (start-activity "manage-packs" 2 ""))))
(mbutton "main-tag" "Tag Location" (lambda () (list (start-activity "tag-location" 2 "")))) (mbutton "main-tag" "Tag Location" (lambda () (list (start-activity "tag-location" 2 ""))))
(mtext "foo" "Your ID") (mtext "foo" "Your ID")
(edit-text (make-id "main-id-text") "" 30 fillwrap (edit-text (make-id "main-id-text") "" 30 "text" fillwrap
(lambda (v) (lambda (v)
(set-current! 'user-id v) (set-current! 'user-id v)
(update-entity (update-entity
...@@ -602,7 +602,7 @@ ...@@ -602,7 +602,7 @@
(text-view (make-id "title") "New pack" 40 fillwrap) (text-view (make-id "title") "New pack" 40 fillwrap)
(spacer 10) (spacer 10)
(text-view (make-id "new-pack-name-text") "Pack name" 20 fillwrap) (text-view (make-id "new-pack-name-text") "Pack name" 20 fillwrap)
(edit-text (make-id "new-pack-name") "" 30 fillwrap (edit-text (make-id "new-pack-name") "" 30 "text" fillwrap
(lambda (v) (set-current! 'pack-name v) '())) (lambda (v) (set-current! 'pack-name v) '()))
(spacer 10) (spacer 10)
(horiz (horiz
...@@ -658,7 +658,7 @@ ...@@ -658,7 +658,7 @@
(text-view (make-id "title") "New Mongoose" 40 fillwrap) (text-view (make-id "title") "New Mongoose" 40 fillwrap)
(text-view (make-id "new-individual-pack-name") "Pack:" 20 fillwrap) (text-view (make-id "new-individual-pack-name") "Pack:" 20 fillwrap)
(text-view (make-id "new-individual-name-text") "Name" 20 fillwrap) (text-view (make-id "new-individual-name-text") "Name" 20 fillwrap)
(edit-text (make-id "new-individual-name") "" 30 fillwrap (edit-text (make-id "new-individual-name") "" 30 "text" fillwrap
(lambda (v) (set-current! 'individual-name v) '())) (lambda (v) (set-current! 'individual-name v) '()))
(text-view (make-id "new-individual-name-text") "Gender" 20 fillwrap) (text-view (make-id "new-individual-name-text") "Gender" 20 fillwrap)
(spinner (make-id "new-individual-gender") (list "Female" "Male") fillwrap (spinner (make-id "new-individual-gender") (list "Female" "Male") fillwrap
...@@ -668,10 +668,10 @@ ...@@ -668,10 +668,10 @@
(text-view (make-id "new-individual-dob") "00/00/00" 25 fillwrap) (text-view (make-id "new-individual-dob") "00/00/00" 25 fillwrap)
(button (make-id "date") "Set date" 20 fillwrap (lambda () '()))) (button (make-id "date") "Set date" 20 fillwrap (lambda () '())))
(text-view (make-id "new-individual-litter-text") "Litter code" 20 fillwrap) (text-view (make-id "new-individual-litter-text") "Litter code" 20 fillwrap)
(edit-text (make-id "new-individual-litter-code") "" 30 fillwrap (edit-text (make-id "new-individual-litter-code") "" 30 "text" fillwrap
(lambda (v) (set-current! 'individual-litter-code v) '())) (lambda (v) (set-current! 'individual-litter-code v) '()))
(text-view (make-id "new-individual-chip-text") "Chip code" 20 fillwrap) (text-view (make-id "new-individual-chip-text") "Chip code" 20 fillwrap)
(edit-text (make-id "new-individual-chip-code") "" 30 fillwrap (edit-text (make-id "new-individual-chip-code") "" 30 "text" fillwrap
(lambda (v) (set-current! 'individual-chip-code v) '())) (lambda (v) (set-current! 'individual-chip-code v) '()))
(horiz (horiz
(button (make-id "new-individual-cancel") "Cancel" 20 fillwrap (lambda () (list (finish-activity 2)))) (button (make-id "new-individual-cancel") "Cancel" 20 fillwrap (lambda () (list (finish-activity 2))))
...@@ -706,7 +706,7 @@ ...@@ -706,7 +706,7 @@
(text-view (make-id "title") "Update Mongoose" 40 fillwrap) (text-view (make-id "title") "Update Mongoose" 40 fillwrap)
(spacer 10) (spacer 10)
(text-view (make-id "update-individual-name-text") "Name" 20 fillwrap) (text-view (make-id "update-individual-name-text") "Name" 20 fillwrap)
(edit-text (make-id "update-individual-name") "" 30 fillwrap (lambda (v) '())) (edit-text (make-id "update-individual-name") "" 30 "text" fillwrap (lambda (v) '()))
(text-view (make-id "update-individual-name-text") "Gender" 20 fillwrap) (text-view (make-id "update-individual-name-text") "Gender" 20 fillwrap)
(spinner (make-id "update-individual-gender") (list "Female" "Male") fillwrap (lambda (v) '())) (spinner (make-id "update-individual-gender") (list "Female" "Male") fillwrap (lambda (v) '()))
(text-view (make-id "update-individual-dob-text") "Date of Birth" 20 fillwrap) (text-view (make-id "update-individual-dob-text") "Date of Birth" 20 fillwrap)
...@@ -714,9 +714,9 @@ ...@@ -714,9 +714,9 @@
(text-view (make-id "update-individual-dob") "00/00/00" 25 fillwrap) (text-view (make-id "update-individual-dob") "00/00/00" 25 fillwrap)
(button (make-id "date") "Set date" 20 fillwrap (lambda () '()))) (button (make-id "date") "Set date" 20 fillwrap (lambda () '())))
(text-view (make-id "update-individual-litter-text") "Litter code" 20 fillwrap) (text-view (make-id "update-individual-litter-text") "Litter code" 20 fillwrap)
(edit-text (make-id "update-individual-litter-code") "" 30 fillwrap (lambda (v) '())) (edit-text (make-id "update-individual-litter-code") "" 30 "text" fillwrap (lambda (v) '()))
(text-view (make-id "update-individual-chip-text") "Chip code" 20 fillwrap) (text-view (make-id "update-individual-chip-text") "Chip code" 20 fillwrap)
(edit-text (make-id "update-individual-chip-code") "" 30 fillwrap (lambda (v) '())) (edit-text (make-id "update-individual-chip-code") "" 30 "text" fillwrap (lambda (v) '()))
(spacer 10) (spacer 10)
(horiz (horiz
(button (make-id "update-individual-delete") "Delete" 20 fillwrap (lambda () (list (finish-activity 2)))) (button (make-id "update-individual-delete") "Delete" 20 fillwrap (lambda () (list (finish-activity 2))))
...@@ -745,7 +745,7 @@ ...@@ -745,7 +745,7 @@
(text-view (make-id "tag-location-gps-lng") "LNG" 20 fillwrap)) (text-view (make-id "tag-location-gps-lng") "LNG" 20 fillwrap))
(text-view (make-id "tag-location-name-text") "Name" 20 fillwrap) (text-view (make-id "tag-location-name-text") "Name" 20 fillwrap)
(edit-text (make-id "tag-location-name") "" 30 fillwrap (lambda (v) '())) (edit-text (make-id "tag-location-name") "" 30 "text" fillwrap (lambda (v) '()))
(text-view (make-id "tag-location-pack-text") "Associated pack" 20 fillwrap) (text-view (make-id "tag-location-pack-text") "Associated pack" 20 fillwrap)
(spinner (make-id "tag-location-pack") (list "Pack 1" "Pack 2") fillwrap (lambda (v) '())) (spinner (make-id "tag-location-pack") (list "Pack 1" "Pack 2") fillwrap (lambda (v) '()))
......
...@@ -72,6 +72,9 @@ import java.util.Date; ...@@ -72,6 +72,9 @@ import java.util.Date;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.List; import java.util.List;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.text.InputType;
import android.util.TypedValue;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.app.DatePickerDialog; import android.app.DatePickerDialog;
...@@ -174,7 +177,7 @@ public class StarwispBuilder ...@@ -174,7 +177,7 @@ public class StarwispBuilder
int ID = arr.getInt(2); int ID = arr.getInt(2);
Fragment fragment = ActivityManager.GetFragment(name); Fragment fragment = ActivityManager.GetFragment(name);
LinearLayout inner = new LinearLayout(ctx); LinearLayout inner = new LinearLayout(ctx);
inner.setLayoutParams(new LinearLayout.LayoutParams(300, ViewGroup.LayoutParams.FILL_PARENT)); inner.setLayoutParams(BuildLayoutParams(arr.getJSONArray(3)));
inner.setId(ID); inner.setId(ID);
FragmentTransaction fragmentTransaction = ctx.getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = ctx.getFragmentManager().beginTransaction();
fragmentTransaction.add(ID,fragment); fragmentTransaction.add(ID,fragment);
...@@ -280,32 +283,30 @@ public class StarwispBuilder ...@@ -280,32 +283,30 @@ public class StarwispBuilder
v.setId(arr.getInt(1)); v.setId(arr.getInt(1));
v.setText(arr.getString(2)); v.setText(arr.getString(2));
v.setTextSize(arr.getInt(3)); v.setTextSize(arr.getInt(3));
v.setLayoutParams(BuildLayoutParams(arr.getJSONArray(4)));
String inputtype = arr.getString(4);
if (inputtype.equals("text")) {
//v.setInputType(InputType.TYPE_CLASS_TEXT);
} else if (inputtype.equals("numeric")) {
v.setInputType(InputType.TYPE_CLASS_NUMBER);
} else if (inputtype.equals("email")) {
v.setInputType(InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS);
}
v.setLayoutParams(BuildLayoutParams(arr.getJSONArray(5)));
v.setTypeface(((StarwispActivity)ctx).m_Typeface); v.setTypeface(((StarwispActivity)ctx).m_Typeface);
final String fn = arr.getString(5); final String fn = arr.getString(5);
v.setSingleLine(true); v.setSingleLine(true);
/* v.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
v.setFocusable(true);
v.requestFocus();
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); v.addTextChangedListener(new TextWatcher() {
} public void afterTextChanged(Editable s) {
}); CallbackArgs(ctx,ctxname,v.getId(),"\""+s.toString()+"\"");
*/ }
v.setOnKeyListener(new View.OnKeyListener() { public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public boolean onKey(View a, int keyCode, KeyEvent event) { public void onTextChanged(CharSequence s, int start, int before, int count) {}
if ((event.getAction() == KeyEvent.ACTION_DOWN) && });
(keyCode == KeyEvent.KEYCODE_ENTER)) {
CallbackArgs(ctx,ctxname,v.getId(),"\""+v.getText()+"\"");
}
return false;
}
});
parent.addView(v); parent.addView(v);
} }
if (type.equals("button")) { if (type.equals("button")) {
......
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