Example #1
0
 // TODO(user): we need a designer property for lists
 @SimpleProperty
 public void Elements(YailList itemList) {
   Object[] objects = itemList.toStringArray();
   for (int i = 0; i < objects.length; i++) {
     if (!(objects[i] instanceof String)) {
       throw new YailRuntimeError("Items passed to ListPicker must be Strings", "Error");
     }
   }
   items = itemList;
 }
Example #2
0
 @Override
 public Intent getIntent() {
   Intent intent = new Intent();
   intent.setClassName(container.$context(), LIST_ACTIVITY_CLASS);
   intent.putExtra(LIST_ACTIVITY_ARG_NAME, items.toStringArray());
   // Get the current Form's opening transition anim type,
   // and pass it to the list picker activity. For consistency,
   // the closing animation will be the same (but in reverse)
   String openAnim = container.$form().getOpenAnimType();
   intent.putExtra(LIST_ACTIVITY_ANIM_TYPE, openAnim);
   return intent;
 }
Example #3
0
  /*
   * This is for survey that is of type: MultipleChoice, ChooseList, CheckBox and Scale
   * Note that for Scale, only three options will
   */
  @SimpleFunction(
      description =
          "For survey style MultipleChoice, ChooseList, CheckBox and ScalePass"
              + "use this to pass in options for survey answers. Note for Scale, "
              + "only three options should be passed in and in the order of \"min\", \"max\", "
              + "\"default\" value of the scale")
  public void SetOptions(YailList options) {
    String[] objects = options.toStringArray();

    for (int i = 0; i < objects.length; i++) {
      this.options.add(objects[i]);
    }
  }