forms (android)

Contains functions for working with forms

Constants

Gravity : map =

14 elements
{
  NONE=0,
  NO_GRAVITY=0,
  CENTER_HORIZONTAL=1,
  LEFT=3,
  RIGHT=5,
  FILL_HORIZONTAL=7,
  CLIP_HORIZONTAL=8,
  CENTER_VERTICAL=16,
  CENTER=17,
  TOP=48,
  BOTTOM=80,
  FILL_VERTICAL=112,
  FILL=119,
  CLIP_VERTICAL=128
}

InputType : map =

38 elements
{
  TYPE_CLASS_DATETIME=4,
  TYPE_CLASS_NUMBER=2,
  TYPE_CLASS_PHONE=3,
  TYPE_CLASS_TEXT=1,
  TYPE_DATETIME_VARIATION_DATE=16,
  TYPE_DATETIME_VARIATION_NORMAL=0,
  TYPE_DATETIME_VARIATION_TIME=32,
  TYPE_MASK_CLASS=15,
  TYPE_MASK_FLAGS=16773120,
  TYPE_MASK_VARIATION=4080,
  TYPE_NULL=0,
  TYPE_NUMBER_FLAG_DECIMAL=8192,
  TYPE_NUMBER_FLAG_SIGNED=4096,
  TYPE_NUMBER_VARIATION_NORMAL=0,
  TYPE_NUMBER_VARIATION_PASSWORD=16,
  TYPE_TEXT_FLAG_AUTO_COMPLETE=65536,
  TYPE_TEXT_FLAG_AUTO_CORRECT=32768,
  TYPE_TEXT_FLAG_CAP_CHARACTERS=4096,
  TYPE_TEXT_FLAG_CAP_SENTENCES=16384,
  TYPE_TEXT_FLAG_CAP_WORDS=8192,
  TYPE_TEXT_FLAG_IME_MULTI_LINE=262144,
  TYPE_TEXT_FLAG_MULTI_LINE=131072,
  TYPE_TEXT_FLAG_NO_SUGGESTIONS=524288,
  TYPE_TEXT_VARIATION_EMAIL_ADDRESS=32,
  TYPE_TEXT_VARIATION_EMAIL_SUBJECT=48,
  TYPE_TEXT_VARIATION_FILTER=176,
  TYPE_TEXT_VARIATION_LONG_MESSAGE=80,
  TYPE_TEXT_VARIATION_NORMAL=0,
  TYPE_TEXT_VARIATION_PASSWORD=128,
  TYPE_TEXT_VARIATION_PERSON_NAME=96,
  TYPE_TEXT_VARIATION_PHONETIC=192,
  TYPE_TEXT_VARIATION_POSTAL_ADDRESS=112,
  TYPE_TEXT_VARIATION_SHORT_MESSAGE=64,
  TYPE_TEXT_VARIATION_URI=16,
  TYPE_TEXT_VARIATION_VISIBLE_PASSWORD=144,
  TYPE_TEXT_VARIATION_WEB_EDIT_TEXT=160,
  TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS=208,
  TYPE_TEXT_VARIATION_WEB_PASSWORD=224
}

LinearLayout : map = {HORIZONTAL=0, VERTICAL=1}

MATCH_PARENT : number = -1

PorterDuff : map =

18 elements
{
  ADD=16,
  CLEAR=0,
  DARKEN=12,
  DST=2,
  DST_ATOP=10,
  DST_IN=6,
  DST_OUT=8,
  DST_OVER=4,
  LIGHTEN=13,
  MULTIPLY=14,
  OVERLAY=17,
  SCREEN=15,
  SRC=1,
  SRC_ATOP=9,
  SRC_IN=5,
  SRC_OUT=7,
  SRC_OVER=3,
  XOR=11
}

ScaleType : map =

8 elements
{
  MATRIX=0,
  FIT_XY=1,
  FIT_START=2,
  FIT_CENTER=3,
  FIT_END=4,
  CENTER=5,
  CENTER_CROP=6,
  CENTER_INSIDE=7
}

WRAP_CONTENT : number = -2

Functions

showForm(view, layoutParams = {}) — shows view

inflate(resourceId, rootView = null, attachToRoot = false) — Inflates view from resource xml

newArrayAdapter(resourceId = R.layout.simple_list_item_1, elements = []) — Creates ArrayAdapter to use in ListView

newBaseAdapter(mapWithFunctions)

use std, android, forms

img1 = assetBitmap("ownlang.png")
img2 = img1

items = [
  {"img" : img1, "text" : "Item 1"},
  {"img" : img2, "text" : "Item 2"}
]
adapter = newBaseAdapter({
  "getCount": def() = length(items)
  "getItem": def(pos) = items[pos]
  "getItemId": def(pos) = pos
  "getView": def(pos, view, parent) {
     if (view == 0) {
        view = newLinearLayout()
        view.setOrientation(LinearLayout.HORIZONTAL)
        imageView = newImageView()
        view.addView(imageView)
        textView = newTextView()
        view.addView(textView)
        view.setTag([imageView, textView])
     } else {
        extract(imageView, textView) = view.getTag()
     }

     imageView.setImageBitmap(items[pos].img);
     textView.setText(items[pos].text);
     return view
  }
});

listView = newListView()
listView.setAdapter(adapter)
listView.onItemClick(def(v, pos, id) {
  toast(adapter.getItem(pos).text + " selected")
})

panel = newLinearLayout()
panel.addView(newTextView("ListView with BaseAdapter demo"))
panel.addView(listView)

showForm(panel)

newButton(text = "") — creates Button

newCheckBox() — creates CheckBox

newEditText() — creates EditText

newFrameLayout() — creates FrameLayout container

newImageButton() — creates ImageButton

newImageView() — creates ImageView

newLinearLayout() — creates LinearLayout container

newListView() — creates ListView

newProgressBar(style = R.attr.progressBarStyle) — creates ProgressBar

use android, forms
pb1 = newProgressBar(R.attr.progressBarStyleHorizontal)
pb1.setMax(100)
pb1.setProgress(10)
pb2 = newProgressBar()
pb2.setIndeterminate(true)

panel = newLinearLayout()
panel.addView(pb1)
panel.addView(pb2)
showForm(panel)

newRadioButton() — creates RadioButton

newRadioGroup() — creates RadioGroup container

newRelativeLayout() — creates RelativeLayout container

newScrollView() — creates ScrollView container

newSeekBar() — creates SeekBar

newSwitch() — creates Switch (available for SDK_INT >= 14)

newTextView(text = "") — creates TextView

newToggleButton() — creates ToggleButton

Types

ViewValue

Functions

bringToFront()

buildDrawingCache()

callOnClick() — available for SDK_INT >= 15

cancelLongPress()

clearAnimation()

clearFocus()

computeScroll()

destroyDrawingCache()

dispatchDisplayHint()

findFocus()

findViewById()

focusSearch()

forceLayout()

getAlpha() — available for SDK_INT >= 11

getBaseline()

getBottom()

getContentDescription()

getDrawingCacheBackgroundColor()

getDrawingCacheQuality()

getDrawingTime()

getHeight()

getHorizontalFadingEdgeLength()

getId()

getKeepScreenOn()

getLeft()

getMeasuredHeight()

getMeasuredHeightAndState() — available for SDK_INT >= 11

getMeasuredState() — available for SDK_INT >= 11

getMeasuredWidth()

getMeasuredWidthAndState() — available for SDK_INT >= 11

getNextFocusDownId()

getNextFocusForwardId() — available for SDK_INT >= 11

getNextFocusLeftId()

getNextFocusRightId()

getNextFocusUpId()

getOverScrollMode()

getPaddingBottom()

getPaddingEnd() — available for SDK_INT >= 17

getPaddingLeft()

getPaddingRight()

getPaddingStart() — available for SDK_INT >= 17

getPaddingTop()

getPivotX() — available for SDK_INT >= 11

getPivotY() — available for SDK_INT >= 11

getRight()

getRootView()

getRotation() — available for SDK_INT >= 11

getRotationX() — available for SDK_INT >= 11

getRotationY() — available for SDK_INT >= 11

getScaleX() — available for SDK_INT >= 11

getScaleY() — available for SDK_INT >= 11

getScrollBarFadeDuration() — available for SDK_INT >= 16

getScrollBarSize() — available for SDK_INT >= 16

getScrollBarStyle()

getScrollX()

getScrollY()

getSolidColor()

getSystemUiVisibility() — available for SDK_INT >= 11

getTag()

getTextAlignment() — available for SDK_INT >= 17

getTextDirection() — available for SDK_INT >= 17

getTop()

getTranslationX() — available for SDK_INT >= 11

getTranslationY() — available for SDK_INT >= 11

getTranslationZ() — available for SDK_INT >= 21

getVerticalFadingEdgeLength()

getVerticalScrollbarPosition() — available for SDK_INT >= 11

getVerticalScrollbarWidth()

getVisibility()

getWidth()

getWindowSystemUiVisibility() — available for SDK_INT >= 16

getWindowVisibility()

getX() — available for SDK_INT >= 11

getY() — available for SDK_INT >= 11

getZ() — available for SDK_INT >= 21

hasFocus()

hasFocusable()

hasNestedScrollingParent() — available for SDK_INT >= 21

hasOnClickListeners() — available for SDK_INT >= 15

hasOverlappingRendering() — available for SDK_INT >= 16

hasTransientState() — available for SDK_INT >= 16

hasWindowFocus()

invalidate()

invalidateDrawable()

invalidateOutline() — available for SDK_INT >= 21

isAccessibilityFocused() — available for SDK_INT >= 21

isActivated() — available for SDK_INT >= 11

isAttachedToWindow() — available for SDK_INT >= 19

isClickable()

isContextClickable() — available for SDK_INT >= 23

isDirty() — available for SDK_INT >= 11

isDrawingCacheEnabled()

isDuplicateParentStateEnabled()

isEnabled()

isFocusable()

isFocusableInTouchMode()

isFocused()

isHapticFeedbackEnabled()

isHardwareAccelerated() — available for SDK_INT >= 11

isHorizontalFadingEdgeEnabled()

isHorizontalScrollBarEnabled()

isHovered() — available for SDK_INT >= 14

isImportantForAccessibility() — available for SDK_INT >= 21

isInEditMode()

isInLayout() — available for SDK_INT >= 18

isInTouchMode()

isLaidOut() — available for SDK_INT >= 19

isLayoutDirectionResolved() — available for SDK_INT >= 19

isLayoutRequested()

isLongClickable()

isNestedScrollingEnabled() — available for SDK_INT >= 21

isOpaque()

isPaddingRelative() — available for SDK_INT >= 17

isPressed()

isSaveEnabled()

isSaveFromParentEnabled() — available for SDK_INT >= 11

isScrollContainer() — available for SDK_INT >= 16

isScrollbarFadingEnabled()

isSelected()

isShown()

isSoundEffectsEnabled()

isTextAlignmentResolved() — available for SDK_INT >= 19

isTextDirectionResolved() — available for SDK_INT >= 19

isVerticalFadingEdgeEnabled()

isVerticalScrollBarEnabled()

jumpDrawablesToCurrentState() — available for SDK_INT >= 11

offsetLeftAndRight()

offsetTopAndBottom()

onClick()

onFocusChange()

onKey()

onLongClick()

performClick()

performHapticFeedback()

performLongClick()

playSoundEffect()

post()

postDelayed()

postInvalidate()

refreshDrawableState()

requestFocus()

requestFocusFromTouch()

requestLayout()

scrollBy()

scrollTo()

sendAccessibilityEvent()

setActivated() — available for SDK_INT >= 11

setAlpha() — available for SDK_INT >= 11

setBackground()

setBackgroundColor()

setBackgroundDrawable()

setBackgroundResource()

setBottom() — available for SDK_INT >= 11

setCameraDistance() — available for SDK_INT >= 12

setClickable()

setClipToOutline() — available for SDK_INT >= 21

setContentDescription()

setContextClickable() — available for SDK_INT >= 23

setDrawingCacheBackgroundColor()

setDrawingCacheEnabled()

setDrawingCacheQuality()

setDuplicateParentStateEnabled()

setEnabled()

setFadingEdgeLength()

setFilterTouchesWhenObscured()

setFitsSystemWindows() — available for SDK_INT >= 14

setFocusable()

setFocusableInTouchMode()

setForeground()

setHapticFeedbackEnabled()

setHorizontalFadingEdgeEnabled()

setHorizontalScrollBarEnabled()

setHovered() — available for SDK_INT >= 14

setId()

setImportantForAccessibility() — available for SDK_INT >= 16

setKeepScreenOn()

setLabelFor() — available for SDK_INT >= 17

setLayoutDirection() — available for SDK_INT >= 17

setLeft() — available for SDK_INT >= 11

setLongClickable()

setMinimumHeight()

setMinimumWidth()

setNestedScrollingEnabled() — available for SDK_INT >= 21

setNextFocusDownId()

setNextFocusForwardId() — available for SDK_INT >= 11

setNextFocusLeftId()

setNextFocusRightId()

setNextFocusUpId()

setOnClickListener()

setOnFocusChangeListener()

setOnKeyListener()

setOnLongClickListener()

setOverScrollMode()

setPadding()

setPaddingRelative() — available for SDK_INT >= 17

setPivotX() — available for SDK_INT >= 11

setPivotY() — available for SDK_INT >= 11

setPressed()

setRight() — available for SDK_INT >= 11

setRotation() — available for SDK_INT >= 11

setRotationX() — available for SDK_INT >= 11

setRotationY() — available for SDK_INT >= 11

setSaveEnabled()

setSaveFromParentEnabled() — available for SDK_INT >= 11

setScaleX() — available for SDK_INT >= 11

setScaleY() — available for SDK_INT >= 11

setScrollBarDefaultDelayBeforeFade() — available for SDK_INT >= 16

setScrollBarFadeDuration() — available for SDK_INT >= 16

setScrollBarSize() — available for SDK_INT >= 16

setScrollBarStyle()

setScrollContainer()

setScrollX() — available for SDK_INT >= 14

setScrollY() — available for SDK_INT >= 14

setSelected()

setSoundEffectsEnabled()

setSystemUiVisibility() — available for SDK_INT >= 11

setTag()

setTextAlignment() — available for SDK_INT >= 17

setTextDirection() — available for SDK_INT >= 17

setTop() — available for SDK_INT >= 11

setTranslationX() — available for SDK_INT >= 11

setTranslationY() — available for SDK_INT >= 11

setTranslationZ() — available for SDK_INT >= 21

setVerticalFadingEdgeEnabled()

setVerticalScrollbarPosition()

setVisibility()

setWillNotCacheDrawing()

setWillNotDraw()

setX() — available for SDK_INT >= 11

setY() — available for SDK_INT >= 11

setZ() — available for SDK_INT >= 21

showContextMenu()

willNotCacheDrawing()

willNotDraw()

TextViewValueInheritance hierarchy: ViewValue

Functions

beginBatchEdit()

endBatchEdit()

getAutoLinkMask()

getCompoundDrawablePadding()

getCompoundPaddingBottom()

getCompoundPaddingLeft()

getCompoundPaddingRight()

getCompoundPaddingTop()

getCurrentHintTextColor()

getCurrentTextColor()

getEditableText()

getEllipsize()

getError()

getExtendedPaddingBottom()

getExtendedPaddingTop()

getFreezesText()

getGravity()

getHighlightColor()

getHint()

getImeActionId()

getImeActionLabel()

getImeOptions()

getInputType()

getLineCount()

getLineHeight()

getLinksClickable()

getSelectionEnd()

getSelectionStart()

getText()

getTextScaleX()

getTextSize()

getTotalPaddingBottom()

getTotalPaddingLeft()

getTotalPaddingRight()

getTotalPaddingTop()

hasSelection()

isCursorVisible()

isInputMethodTarget()

isSuggestionsEnabled()

isTextSelectable()

length()

moveCursorToVisibleOffset()

setAllCaps()

setAutoLinkMask()

setBreakStrategy()

setCompoundDrawablePadding()

setCompoundDrawables()

setCursorVisible()

setEllipsize()

setEms()

setError()

setFreezesText()

setGravity()

setHeight()

setHighlightColor()

setHint()

setHintTextColor()

setHorizontallyScrolling()

setImeOptions()

setInputType()

setLines()

setLinkTextColor()

setLinksClickable()

setMaxEms()

setMaxHeight()

setMaxLines()

setMaxWidth()

setMinEms()

setMinHeight()

setMinLines()

setMinWidth()

setPaintFlags()

setRawInputType()

setSelectAllOnFocus()

setSingleLine()

setText()

setTextColor()

setTextIsSelectable()

setTextScaleX()

setTextSize()

setWidth()

EditTextValueInheritance hierarchy: TextViewValue < ViewValue

Functions

extendSelection()

selectAll()

setSelection()

ButtonValueInheritance hierarchy: TextViewValue < ViewValue

CompoundButtonValueInheritance hierarchy: ButtonValue < TextViewValue < ViewValue

Functions

isChecked()

onCheck()

setButtonDrawable()

setChecked()

toggle()

ToggleButtonValueInheritance hierarchy: CompoundButtonValue < ButtonValue < TextViewValue < ViewValue

Functions

getTextOff()

getTextOn()

setTextOff()

setTextOn()

SwitchValueInheritance hierarchy: CompoundButtonValue < ButtonValue < TextViewValue < ViewValue

Functions

getTextOff()

getTextOn()

setTextOff()

setTextOn()

ImageViewValueInheritance hierarchy: ViewValue

Functions

clearColorFilter()

getScaleType()

setAdjustViewBounds()

setColorFilter()

setImageAlpha()

setImageBitmap()

setImageDrawable()

setImageLevel()

setImageResource()

setImageURI()

setMaxHeight()

setMaxWidth()

setScaleType()

ImageButtonValueInheritance hierarchy: ImageViewValue < ViewValue

ViewGroupValueInheritance hierarchy: ViewValue

Functions

addView()

bringChildToFront()

clearChildFocus()

getChildAt()

getChildCount()

indexOfChild()

recomputeViewAttributes()

removeAllViews()

removeAllViewsInLayout()

removeView()

removeViewAt()

removeViewInLayout()

LinearLayoutValueInheritance hierarchy: ViewGroupValue < ViewValue

Functions

getOrientation()

getWeightSum()

setGravity()

setHorizontalGravity()

setOrientation()

setVerticalGravity()

setWeightSum()

RelativeLayoutValueInheritance hierarchy: ViewGroupValue < ViewValue

Functions

getGravity()

setGravity()

setHorizontalGravity()

setIgnoreGravity()

setVerticalGravity()

FrameLayoutValueInheritance hierarchy: ViewGroupValue < ViewValue

ScrollViewValueInheritance hierarchy: FrameLayoutValue < ViewGroupValue < ViewValue

Functions

isFillViewport()

isSmoothScrollingEnabled()

setFillViewport()

setSmoothScrollingEnabled()

AdapterViewValueInheritance hierarchy: ViewGroupValue < ViewValue

Functions

getAdapter()

getCount()

getEmptyView()

getFirstVisiblePosition()

getItemAtPosition()

getItemIdAtPosition()

getLastVisiblePosition()

getPositionForView()

getSelectedItem()

getSelectedItemId()

getSelectedItemPosition()

getSelectedView()

onItemClick()

onItemLongClick()

onItemSelected()

performItemClick()

setAdapter()

setEmptyView()

ListViewValueInheritance hierarchy: AdapterViewValue < ViewGroupValue < ViewValue

Functions

addFooterView()

addHeaderView()

getDividerHeight()

getFooterViewsCount()

getHeaderViewsCount()

getItemsCanFocus()

getMaxScrollAmount()

removeFooterView()

removeHeaderView()

setCacheColorHint()

setDividerHeight()

setFooterDividersEnabled()

setHeaderDividersEnabled()

setItemsCanFocus()

setSelection()

setSelectionAfterHeaderView()

smoothScrollToPosition()

RadioGroupValueInheritance hierarchy: LinearLayoutValue < ViewGroupValue < ViewValue

Functions

check()

clearCheck()

getCheckedRadioButtonId()

onCheck()

setOnCheckedChangeListener()

ProgressBarValueInheritance hierarchy: ViewValue

Functions

getMax()

getProgress()

getSecondaryProgress()

incrementProgressBy()

incrementSecondaryProgressBy()

setIndeterminate()

setIndeterminateDrawable()

setMax()

setProgress()

setProgressDrawable()

setSecondaryProgress()

SeekBarValueInheritance hierarchy: ProgressBarValue < ViewValue

Functions

getKeyProgressIncrement()

getThumbOffset()

onSeekBarChange()

setKeyProgressIncrement()

setOnSeekBarChangeListener()

setThumb()

setThumbOffset()

AdapterValue

Functions

getCount()

getItem()

getItemId()

getItemViewType()

getView()

getViewTypeCount()

hasStableIds()

isEmpty()

ListAdapterValueInheritance hierarchy: AdapterValue

Functions

areAllItemsEnabled()

isEnabled()