Exemplo n.º 1
0
 /**
  * Returns the text displayed by the checkbox.
  *
  * @return checkbox caption
  */
 public String Text() {
   if (resourceId != -1) {
     return TextViewUtil.getText(
         (android.widget.CheckBox) container.$context().findViewById(resourceId));
   } else {
     return TextViewUtil.getText(view);
   }
 }
Exemplo n.º 2
0
 /**
  * Specifies the textbox's text color as an alpha-red-green-blue integer.
  *
  * @param argb text RGB color with alpha
  */
 public void TextColor(int argb) {
   textColor = argb;
   if (argb != Component.COLOR_DEFAULT) {
     TextViewUtil.setTextColor(view, argb);
   } else {
     TextViewUtil.setTextColor(view, Component.COLOR_BLACK);
   }
 }
Exemplo n.º 3
0
 /**
  * Specifies the text displayed by the checkbox.
  *
  * @param text new caption for checkbox
  */
 public void Text(String text) {
   if (resourceId != -1) {
     TextViewUtil.setText(
         (android.widget.CheckBox) container.$context().findViewById(resourceId), text);
   } else {
     TextViewUtil.setText(view, text);
   }
 }
Exemplo n.º 4
0
 /**
  * Specifies the checkbox's text's font size, measured in pixels.
  *
  * @param size font size in pixel
  */
 public void FontSize(float size) {
   if (resourceId != -1) {
     TextViewUtil.setFontSize(
         (android.widget.CheckBox) container.$context().findViewById(resourceId), size);
   } else {
     TextViewUtil.setFontSize(view, size);
   }
 }
Exemplo n.º 5
0
 /**
  * Returns the checkbox's text's font size, measured in pixels.
  *
  * @return font size in pixel
  */
 public float FontSize() {
   if (resourceId != -1) {
     return TextViewUtil.getFontSize(
         (android.widget.CheckBox) container.$context().findViewById(resourceId));
   } else {
     return TextViewUtil.getFontSize(view);
   }
 }
Exemplo n.º 6
0
 /**
  * Specifies whether the checkbox should be active and clickable.
  *
  * @param enabled {@code true} for enabled, {@code false} disabled
  */
 public void Enabled(boolean enabled) {
   if (resourceId != -1) {
     TextViewUtil.setEnabled(
         (android.widget.CheckBox) container.$context().findViewById(resourceId), enabled);
   } else {
     TextViewUtil.setEnabled(view, enabled);
   }
 }
Exemplo n.º 7
0
 /**
  * Specifies whether the checkbox's text should be italic. Some fonts do not support italic.
  *
  * @param italic {@code true} indicates italic, {@code false} normal
  */
 public void FontItalic(boolean italic) {
   this.italic = italic;
   if (resourceId != -1) {
     TextViewUtil.setFontTypeface(
         (android.widget.CheckBox) container.$context().findViewById(resourceId),
         fontTypeface,
         bold,
         italic);
   } else {
     TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
   }
 }
Exemplo n.º 8
0
 /**
  * Specifies the checkbox's text's font face as default, serif, sans serif, or monospace.
  *
  * @param typeface one of {@link Component#TYPEFACE_DEFAULT}, {@link Component#TYPEFACE_SERIF},
  *     {@link Component#TYPEFACE_SANSSERIF} or {@link Component#TYPEFACE_MONOSPACE}
  */
 public void FontTypeface(int typeface) {
   fontTypeface = typeface;
   if (resourceId != -1) {
     TextViewUtil.setFontTypeface(
         (android.widget.CheckBox) container.$context().findViewById(resourceId),
         fontTypeface,
         bold,
         italic);
   } else {
     TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
   }
 }
Exemplo n.º 9
0
 /**
  * Specifies the textbox's background color as an alpha-red-green-blue integer.
  *
  * @param argb background RGB color with alpha
  */
 public void BackgroundColor(int argb) {
   backgroundColor = argb;
   if (argb != Component.COLOR_DEFAULT) {
     TextViewUtil.setBackgroundColor(view, argb);
   } else {
     ViewUtil.setBackgroundDrawable(view, defaultTextBoxDrawable);
   }
 }
Exemplo n.º 10
0
 /**
  * Specifies the checkbox's text color as an alpha-red-green-blue integer.
  *
  * @param argb text RGB color with alpha
  */
 public void TextColor(int argb) {
   textColor = argb;
   if (argb != Component.COLOR_DEFAULT) {
     if (resourceId != -1) {
       TextViewUtil.setTextColor(
           (android.widget.CheckBox) container.$context().findViewById(resourceId), argb);
     } else {
       TextViewUtil.setTextColor(view, argb);
     }
   } else {
     if (resourceId != -1) {
       TextViewUtil.setTextColor(
           (android.widget.CheckBox) container.$context().findViewById(resourceId),
           Component.COLOR_BLACK);
     } else {
       TextViewUtil.setTextColor(view, Component.COLOR_BLACK);
     }
   }
 }
Exemplo n.º 11
0
  /**
   * Creates a new TextBoxBase component
   *
   * @param container container that the component will be placed in
   * @param textview the underlying EditText object that maintains the text
   */
  public TextBoxBase(ComponentContainer container, EditText textview) {
    super(container);

    view = textview;

    // Listen to focus changes
    view.setOnFocusChangeListener(this);

    defaultTextBoxDrawable = view.getBackground();

    // Add a transformation method to provide input validation
    /*
     * TODO(user): see comment above) setTransformationMethod(new
     * ValidationTransformationMethod());
     */

    // Adds the component to its designated container
    container.$add(this);

    container.setChildWidth(this, ComponentConstants.TEXTBOX_PREFERRED_WIDTH);

    TextAlignment(Component.ALIGNMENT_NORMAL);
    // Leave the nice default background color. Users can change it to
    // "none" if they like
    //
    // TODO(user): if we make a change here we also need to change the
    // default property value.
    // Eventually I hope to simplify this so it has to be changed in one
    // location
    // only). Maybe we need another color value which would be
    // 'SYSTEM_DEFAULT' which
    // will not attempt to explicitly initialize with any of the properties
    // with any
    // particular value.
    // BackgroundColor(Component.COLOR_NONE);
    Enabled(true);
    fontTypeface = Component.TYPEFACE_DEFAULT;
    TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
    FontSize(Component.FONT_DEFAULT_SIZE);
    Hint("");
    Text("");
    TextColor(Component.COLOR_BLACK);
  }
Exemplo n.º 12
0
  /**
   * Creates a new CheckBox component.
   *
   * @param container container, component will be placed in
   */
  public CheckBox(ComponentContainer container) {
    super(container);

    view = new android.widget.CheckBox(container.$context());

    // Listen to focus changes
    view.setOnFocusChangeListener(this);
    view.setOnCheckedChangeListener(this);

    // Adds the component to its designated container
    container.$add(this);
    BackgroundColor(Component.COLOR_NONE);
    Enabled(true);
    fontTypeface = Component.TYPEFACE_DEFAULT;
    TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
    FontSize(Component.FONT_DEFAULT_SIZE);
    Text("");
    TextColor(Component.COLOR_BLACK);
    Checked(false);
  }
Exemplo n.º 13
0
 /**
  * Returns true if the textbox is active and useable.
  *
  * @return {@code true} indicates enabled, {@code false} disabled
  */
 public boolean Enabled() {
   return TextViewUtil.isEnabled(view);
 }
Exemplo n.º 14
0
 /**
  * Returns the textbox contents.
  *
  * @return text box contents
  */
 public String Text() {
   return TextViewUtil.getText(view);
 }
Exemplo n.º 15
0
 /**
  * Specifies the textbox contents.
  *
  * @param text new text in text box
  */
 public void Text(String text) {
   TextViewUtil.setText(view, text);
 }
Exemplo n.º 16
0
 /**
  * Specifies the textbox's text's font size, measured in pixels.
  *
  * @param size font size in pixel
  */
 public void FontSize(float size) {
   TextViewUtil.setFontSize(view, size);
 }
Exemplo n.º 17
0
 /**
  * Specifies the textbox's text's font face as default, serif, sans serif, or monospace.
  *
  * @param typeface one of {@link Component#TYPEFACE_DEFAULT}, {@link Component#TYPEFACE_SERIF},
  *     {@link Component#TYPEFACE_SANSSERIF} or {@link Component#TYPEFACE_MONOSPACE}
  */
 public void FontTypeface(int typeface) {
   fontTypeface = typeface;
   TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
 }
Exemplo n.º 18
0
 /**
  * Returns the textbox's text's font size, measured in pixels.
  *
  * @return font size in pixel
  */
 public float FontSize() {
   return TextViewUtil.getFontSize(view);
 }
Exemplo n.º 19
0
 /**
  * Specifies whether the textbox's text should be italic. Some fonts do not support italic.
  *
  * @param italic {@code true} indicates italic, {@code false} normal
  */
 public void FontItalic(boolean italic) {
   this.italic = italic;
   TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
 }
Exemplo n.º 20
0
 /**
  * Specifies whether the textbox's text should be bold. Some fonts do not support bold.
  *
  * @param bold {@code true} indicates bold, {@code false} normal
  */
 public void FontBold(boolean bold) {
   this.bold = bold;
   TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
 }
Exemplo n.º 21
0
 /**
  * Specifies whether the textbox should be active and useable.
  *
  * @param enabled {@code true} for enabled, {@code false} disabled
  */
 public void Enabled(boolean enabled) {
   TextViewUtil.setEnabled(view, enabled);
 }
Exemplo n.º 22
0
 /**
  * Specifies the alignment of the textbox's text: center, normal (e.g., left-justified if text is
  * written left to right), or opposite (e.g., right-justified if text is written left to right).
  *
  * @param alignment one of {@link Component#ALIGNMENT_NORMAL}, {@link Component#ALIGNMENT_CENTER}
  *     or {@link Component#ALIGNMENT_OPPOSITE}
  */
 public void TextAlignment(int alignment) {
   this.textAlignment = alignment;
   TextViewUtil.setAlignment(view, alignment, false);
 }