Esempio n. 1
0
  /**
   * Creates a new ButtonBase component.
   *
   * @param container container, component will be placed in
   */
  public ButtonBase(ComponentContainer container) {
    super(container);
    view = new android.widget.Button(container.$context());

    // Save the default values in case the user wants them back later.
    defaultButtonDrawable = view.getBackground();
    defaultColorStateList = view.getTextColors();

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

    // Listen to clicks and focus changes
    view.setOnClickListener(this);
    view.setOnFocusChangeListener(this);
    view.setOnLongClickListener(this);
    view.setOnTouchListener(this);

    // Default property values
    TextAlignment(Component.ALIGNMENT_CENTER);
    // BackgroundColor and Image are dangerous properties:
    // Once either of them is set, the 3D bevel effect for the button is
    // irretrievable, except by reloading defaultButtonDrawable, defined above.
    BackgroundColor(Component.COLOR_DEFAULT);
    Image("");
    Enabled(true);
    fontTypeface = Component.TYPEFACE_DEFAULT;
    TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
    FontSize(Component.FONT_DEFAULT_SIZE);
    Text("");
    TextColor(Component.COLOR_DEFAULT);
    Shape(Component.BUTTON_SHAPE_DEFAULT);
  }
Esempio n. 2
0
 /**
  * Specifies the button'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}
  */
 @DesignerProperty(
     editorType = PropertyTypeConstants.PROPERTY_TYPE_TYPEFACE,
     defaultValue = Component.TYPEFACE_DEFAULT + "")
 @SimpleProperty(userVisible = false)
 public void FontTypeface(int typeface) {
   fontTypeface = typeface;
   TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
 }
Esempio n. 3
0
 /**
  * Specifies whether the button's text should be italic. Some fonts do not support italic.
  *
  * @param italic {@code true} indicates italic, {@code false} normal
  */
 @DesignerProperty(
     editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
     defaultValue = "False")
 @SimpleProperty(userVisible = false)
 public void FontItalic(boolean italic) {
   this.italic = italic;
   TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
 }