AI2 Component  (Version nb184)
ButtonBase.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright 2009-2011 Google, All Rights reserved
3 // Copyright 2011-2018 MIT, All rights reserved
4 // Released under the Apache License, Version 2.0
5 // http://www.apache.org/licenses/LICENSE-2.0
6 
7 package com.google.appinventor.components.runtime;
8 
9 import android.graphics.drawable.RippleDrawable;
10 import android.os.Build;
24 import android.view.MotionEvent;
25 import android.content.res.ColorStateList;
26 import android.graphics.Color;
27 import android.graphics.drawable.Drawable;
28 import android.graphics.drawable.ShapeDrawable;
29 import android.graphics.drawable.shapes.OvalShape;
30 import android.graphics.drawable.shapes.RectShape;
31 import android.graphics.drawable.shapes.RoundRectShape;
32 import android.graphics.PorterDuff;
33 import android.util.Log;
34 import android.view.View;
35 import android.view.View.OnClickListener;
36 import android.view.View.OnFocusChangeListener;
37 import android.view.View.OnLongClickListener;
38 
39 import java.io.IOException;
40 
45 @SimpleObject
46 @UsesPermissions(permissionNames = "android.permission.INTERNET")
47 public abstract class ButtonBase extends AndroidViewComponent
48  implements OnClickListener, OnFocusChangeListener, OnLongClickListener, View.OnTouchListener {
49 
50  private static final String LOG_TAG = "ButtonBase";
51 
52  private final android.widget.Button view;
53 
54  // Constant for shape
55  // 10px is the radius of the rounded corners.
56  // 10px was chosen for esthetic reasons.
57  private static final float ROUNDED_CORNERS_RADIUS = 10f;
58  private static final float[] ROUNDED_CORNERS_ARRAY = new float[] { ROUNDED_CORNERS_RADIUS,
59  ROUNDED_CORNERS_RADIUS, ROUNDED_CORNERS_RADIUS, ROUNDED_CORNERS_RADIUS,
60  ROUNDED_CORNERS_RADIUS, ROUNDED_CORNERS_RADIUS, ROUNDED_CORNERS_RADIUS,
61  ROUNDED_CORNERS_RADIUS };
62 
63  // Constant background color for buttons with a Shape other than default
64  private static final int SHAPED_DEFAULT_BACKGROUND_COLOR = Color.LTGRAY;
65 
66  // Backing for text alignment
67  private int textAlignment;
68 
69  // Backing for background color
70  private int backgroundColor;
71 
72  // Backing for font typeface
73  private int fontTypeface;
74 
75  // Backing for font bold
76  private boolean bold;
77 
78  // Used for determining if visual feedback should be provided for buttons that have images
79  private boolean showFeedback=true;
80 
81  // Backing for font italic
82  private boolean italic;
83 
84  // Backing for text color
85  private int textColor;
86 
87  // Backing for button shape
88  private int shape;
89 
90  // Image path
91  private String imagePath = "";
92 
93  // This is our handle on Android's nice 3-d default button.
94  private Drawable defaultButtonDrawable;
95 
96  private Drawable myBackgroundDrawable = null;
97 
98  // This is our handle in Android's default button color states;
99  private ColorStateList defaultColorStateList;
100 
101  // This is the Drawable corresponding to the Image property.
102  // If an Image has never been set or if the most recent Image
103  // could not be loaded, this is null.
104  private Drawable backgroundImageDrawable;
105 
111  private static int defaultButtonMinWidth = 0;
112 
118  private static int defaultButtonMinHeight = 0;
119 
125  public ButtonBase(ComponentContainer container) {
126  super(container);
127  view = new android.widget.Button(container.$context());
128 
129  // Save the default values in case the user wants them back later.
130  defaultButtonDrawable = view.getBackground();
131  defaultColorStateList = view.getTextColors();
132  defaultButtonMinWidth = KitkatUtil.getMinWidth(view);
133  defaultButtonMinHeight = KitkatUtil.getMinHeight(view);
134 
135  // Adds the component to its designated container
136  container.$add(this);
137 
138  // Listen to clicks and focus changes
139  view.setOnClickListener(this);
140  view.setOnFocusChangeListener(this);
141  view.setOnLongClickListener(this);
142  view.setOnTouchListener(this);
143  IceCreamSandwichUtil.setAllCaps(view, false);
144 
145  // Default property values
146  TextAlignment(Component.ALIGNMENT_CENTER);
147  // BackgroundColor and Image are dangerous properties:
148  // Once either of them is set, the 3D bevel effect for the button is
149  // irretrievable, except by reloading defaultButtonDrawable, defined above.
150  BackgroundColor(Component.COLOR_DEFAULT);
151  Image("");
152  Enabled(true);
153  fontTypeface = Component.TYPEFACE_DEFAULT;
154  TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
155  FontSize(Component.FONT_DEFAULT_SIZE);
156  Text("");
157  TextColor(Component.COLOR_DEFAULT);
159  }
160 
168  @Override
169  public boolean onTouch(View view, MotionEvent me) {
170  //NOTE: We ALWAYS return false because we want to indicate that this listener has not
171  //been consumed. Using this approach, other listeners (e.g. OnClick) can process as normal.
172  if (me.getAction() == MotionEvent.ACTION_DOWN) {
173  //button pressed, provide visual feedback AND return false
174  if (ShowFeedback() && (AppInventorCompatActivity.isClassicMode() || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)) {
175  view.getBackground().setAlpha(70); // translucent
176  view.invalidate();
177  }
178  TouchDown();
179  } else if (me.getAction() == MotionEvent.ACTION_UP ||
180  me.getAction() == MotionEvent.ACTION_CANCEL) {
181  //button released, set button back to normal AND return false
182  if (ShowFeedback() && (AppInventorCompatActivity.isClassicMode() || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)) {
183  view.getBackground().setAlpha(255); // opaque
184  view.invalidate();
185  }
186  TouchUp();
187  }
188 
189  return false;
190  }
191 
192  @Override
193  public View getView() {
194  return view;
195  }
196 
200  @SimpleEvent(description = "Indicates that the %type% was pressed down.")
201  public void TouchDown() {
202  EventDispatcher.dispatchEvent(this, "TouchDown");
203  }
204 
208  @SimpleEvent(description = "Indicates that the %type% has been released.")
209  public void TouchUp() {
210  EventDispatcher.dispatchEvent(this, "TouchUp");
211  }
212 
217  @SimpleEvent(description = "Indicates the cursor moved over the %type% so " +
218  "it is now possible to click it.")
219  public void GotFocus() {
220  EventDispatcher.dispatchEvent(this, "GotFocus");
221  }
222 
227  @SimpleEvent(description = "Indicates the cursor moved away from " +
228  "the %type% so it is now no longer possible to click it.")
229  public void LostFocus() {
230  EventDispatcher.dispatchEvent(this, "LostFocus");
231  }
232 
243  category = PropertyCategory.APPEARANCE,
244  description = "Left, center, or right.",
245  userVisible = false)
246  public int TextAlignment() {
247  return textAlignment;
248  }
249 
261  defaultValue = Component.ALIGNMENT_CENTER + "")
262  @SimpleProperty(userVisible = false)
263  public void TextAlignment(int alignment) {
264  this.textAlignment = alignment;
265  TextViewUtil.setAlignment(view, alignment, true);
266  }
267 
277  category = PropertyCategory.APPEARANCE,
278  userVisible = false)
279  public int Shape() {
280  return shape;
281  }
282 
299  defaultValue = Component.BUTTON_SHAPE_DEFAULT + "")
300  @SimpleProperty(description = "Specifies the shape of the %type% (default, rounded," +
301  " rectangular, oval). The shape will not be visible if an Image is being displayed.",
302  userVisible = false)
303  public void Shape(int shape) {
304  this.shape = shape;
305  updateAppearance();
306  }
307 
314  category = PropertyCategory.APPEARANCE,
315  description = "Image to display on button.")
316  public String Image() {
317  return imagePath;
318  }
319 
331  defaultValue = "")
332  @SimpleProperty(description = "Specifies the path of the image of the %type%. " +
333  "If there is both an Image and a BackgroundColor, only the Image will be " +
334  "visible.")
335  public void Image(String path) {
336  // If it's the same as on the prior call and the prior load was successful,
337  // do nothing.
338  if (path.equals(imagePath) && backgroundImageDrawable != null) {
339  return;
340  }
341 
342  imagePath = (path == null) ? "" : path;
343 
344  // Clear the prior background image.
345  backgroundImageDrawable = null;
346 
347  // Load image from file.
348  if (imagePath.length() > 0) {
349  try {
350  backgroundImageDrawable = MediaUtil.getBitmapDrawable(container.$form(), imagePath);
351  } catch (IOException ioe) {
352  // TODO(user): Maybe raise Form.ErrorOccurred.
353  Log.e(LOG_TAG, "Unable to load " + imagePath);
354  // Fall through with a value of null for backgroundImageDrawable.
355  }
356  }
357 
358  // Update the appearance based on the new value of backgroundImageDrawable.
359  updateAppearance();
360  }
361 
369  category = PropertyCategory.APPEARANCE,
370  description = "Returns the button's background color")
371  @IsColor
372  public int BackgroundColor() {
373  return backgroundColor;
374  }
375 
387  defaultValue = Component.DEFAULT_VALUE_COLOR_DEFAULT)
388  @SimpleProperty(description = "Specifies the background color of the %type%. " +
389  "The background color will not be visible if an Image is being displayed.")
390  public void BackgroundColor(int argb) {
391  backgroundColor = argb;
392  updateAppearance();
393  }
394 
395  // Update appearance based on values of backgroundImageDrawable, backgroundColor and shape.
396  // Images take precedence over background colors.
397  private void updateAppearance() {
398  // If there is no background image,
399  // the appearance depends solely on the background color and shape.
400  if (backgroundImageDrawable == null) {
401  if (shape == Component.BUTTON_SHAPE_DEFAULT) {
402  if (backgroundColor == Component.COLOR_DEFAULT) {
403  // If there is no background image and color is default,
404  // restore original 3D bevel appearance.
405  ViewUtil.setBackgroundDrawable(view, defaultButtonDrawable);
406  } else if (backgroundColor == Component.COLOR_NONE) {
407  // Clear the background image.
408  ViewUtil.setBackgroundDrawable(view, null);
409  //Now we set again the default drawable
410  ViewUtil.setBackgroundDrawable(view, getSafeBackgroundDrawable());
411  view.getBackground().setColorFilter(backgroundColor, PorterDuff.Mode.CLEAR);
412  } else {
413  // Clear the background image.
414  ViewUtil.setBackgroundDrawable(view, null);
415  //Now we set again the default drawable
416  ViewUtil.setBackgroundDrawable(view, getSafeBackgroundDrawable());
417  //@Author NMD (Next Mobile Development) [nmdofficialhelp@gmail.com]
418  view.getBackground().setColorFilter(backgroundColor, PorterDuff.Mode.SRC_ATOP);
419  }
420  } else {
421  // If there is no background image and the shape is something other than default,
422  // create a drawable with the appropriate shape and color.
423  setShape();
424  }
425  TextViewUtil.setMinSize(view, defaultButtonMinWidth, defaultButtonMinHeight);
426  } else {
427  // If there is a background image
428  ViewUtil.setBackgroundImage(view, backgroundImageDrawable);
429  TextViewUtil.setMinSize(view, 0, 0);
430  }
431  }
432 
433  private Drawable getSafeBackgroundDrawable() {
434  if (myBackgroundDrawable == null) {
435  Drawable.ConstantState state = defaultButtonDrawable.getConstantState();
436  if (state != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
437  try {
438  myBackgroundDrawable = state.newDrawable().mutate();
439  } catch (NullPointerException e) {
440  // We see this on SDK 7, but given we can't easily test every version
441  // this is meant as a safeguard.
442  Log.e(LOG_TAG, "Unable to clone button drawable", e);
443  myBackgroundDrawable = defaultButtonDrawable;
444  }
445  } else {
446  // Since we can't make a copy of the default we'll just use it directly
447  myBackgroundDrawable = defaultButtonDrawable;
448  }
449  }
450  return myBackgroundDrawable;
451  }
452 
453  private ColorStateList createRippleState () {
454 
455  int[][] states = new int[][] { new int[] { android.R.attr.state_enabled} };
456  int enabled_color = defaultColorStateList.getColorForState(view.getDrawableState(), android.R.attr.state_enabled);
457  int[] colors = new int[] { Color.argb(70, Color.red(enabled_color), Color.green(enabled_color),
458  Color.blue(enabled_color)) };
459 
460  return new ColorStateList(states, colors);
461  }
462 
463  // Throw IllegalArgumentException if shape has illegal value.
464  private void setShape() {
465  ShapeDrawable drawable = new ShapeDrawable();
466 
467  // Set shape of drawable.
468  switch (shape) {
469  case Component.BUTTON_SHAPE_ROUNDED:
470  drawable.setShape(new RoundRectShape(ROUNDED_CORNERS_ARRAY, null, null));
471  break;
472  case Component.BUTTON_SHAPE_RECT:
473  drawable.setShape(new RectShape());
474  break;
475  case Component.BUTTON_SHAPE_OVAL:
476  drawable.setShape(new OvalShape());
477  break;
478  default:
479  throw new IllegalArgumentException();
480  }
481 
482  // Set drawable to the background of the button.
483  if (!AppInventorCompatActivity.isClassicMode() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
484  ViewUtil.setBackgroundDrawable(view, new RippleDrawable(createRippleState(), drawable, drawable));
485  } else {
486  ViewUtil.setBackgroundDrawable(view, drawable);
487  }
488 
489  if (backgroundColor == Component.COLOR_NONE) {
490  view.getBackground().setColorFilter(backgroundColor, PorterDuff.Mode.CLEAR);
491  }
492  else if (backgroundColor == Component.COLOR_DEFAULT) {
493  view.getBackground().setColorFilter(SHAPED_DEFAULT_BACKGROUND_COLOR, PorterDuff.Mode.SRC_ATOP);
494  }
495  else {
496  view.getBackground().setColorFilter(backgroundColor, PorterDuff.Mode.SRC_ATOP);
497  }
498 
499  view.invalidate();
500  }
501 
507  @SimpleProperty(
508  category = PropertyCategory.BEHAVIOR,
509  description = "If set, user can tap %type% to cause action.")
510  public boolean Enabled() {
511  return TextViewUtil.isEnabled(view);
512  }
513 
520  defaultValue = "True")
522  public void Enabled(boolean enabled) {
523  TextViewUtil.setEnabled(view, enabled);
524  }
525 
534  category = PropertyCategory.APPEARANCE,
535  description = "If set, %type% text is displayed in bold.")
536  public boolean FontBold() {
537  return bold;
538  }
539 
547  defaultValue = "False")
549  category = PropertyCategory.APPEARANCE)
550  public void FontBold(boolean bold) {
551  this.bold = bold;
552  TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
553  }
554 
563  defaultValue = "True")
564  @SimpleProperty(description = "Specifies if a visual feedback should be shown " +
565  " for a %type% that has an image as background.")
566 
567  public void ShowFeedback(boolean showFeedback) {
568  this.showFeedback =showFeedback;
569  }
570 
581  category = PropertyCategory.APPEARANCE,
582  description = "Returns the visual feedback state of the %type%")
583  public boolean ShowFeedback() {
584  return showFeedback;
585  }
586 
595  category = PropertyCategory.APPEARANCE,
596  description = "If set, %type% text is displayed in italics.")
597  public boolean FontItalic() {
598  return italic;
599  }
600 
608  defaultValue = "False")
610  category = PropertyCategory.APPEARANCE)
611  public void FontItalic(boolean italic) {
612  this.italic = italic;
613  TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
614  }
615 
625  category = PropertyCategory.APPEARANCE,
626  description = "Point size for %type% text.")
627  public float FontSize() {
628  return TextViewUtil.getFontSize(view, container.$context());
629  }
630 
637  defaultValue = Component.FONT_DEFAULT_SIZE + "")
639  category = PropertyCategory.APPEARANCE)
640  public void FontSize(float size) {
641  TextViewUtil.setFontSize(view, size);
642  }
643 
654  category = PropertyCategory.APPEARANCE,
655  description = "Font family for %type% text.",
656  userVisible = false)
657  public int FontTypeface() {
658  return fontTypeface;
659  }
660 
671  defaultValue = Component.TYPEFACE_DEFAULT + "")
673  userVisible = false)
674  public void FontTypeface(int typeface) {
675  fontTypeface = typeface;
676  TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
677  }
678 
685  category = PropertyCategory.APPEARANCE,
686  description = "Text to display on %type%.")
687  public String Text() {
688  return TextViewUtil.getText(view);
689  }
690 
697  defaultValue = "")
699  public void Text(String text) {
700  TextViewUtil.setText(view, text);
701  }
702 
710  category = PropertyCategory.APPEARANCE,
711  description = "Color for button text.")
712  @IsColor
713  public int TextColor() {
714  return textColor;
715  }
716 
724  defaultValue = Component.DEFAULT_VALUE_COLOR_DEFAULT)
726  public void TextColor(int argb) {
727  // TODO(user): I think there is a way of only setting the color for the enabled state
728  textColor = argb;
729  if (argb != Component.COLOR_DEFAULT) {
730  TextViewUtil.setTextColor(view, argb);
731  } else {
732  TextViewUtil.setTextColors(view, defaultColorStateList);
733  }
734  }
735 
736  public abstract void click();
737 
738  // Override this if your component actually will consume a long
739  // click. A 'false' returned from this function will cause a long
740  // click to be interpreted as a click (and the click function will
741  // be called).
742  public boolean longClick() {
743  return false;
744  }
745 
746  // OnClickListener implementation
747 
748  @Override
749  public void onClick(View view) {
750  click();
751  }
752 
753  // OnFocusChangeListener implementation
754 
755  @Override
756  public void onFocusChange(View previouslyFocused, boolean gainFocus) {
757  if (gainFocus) {
758  GotFocus();
759  } else {
760  LostFocus();
761  }
762  }
763 
764  // OnLongClickListener implementation
765 
766  @Override
767  public boolean onLongClick(View view) {
768  return longClick();
769  }
770 
771 }
com.google.appinventor.components.runtime.EventDispatcher
Definition: EventDispatcher.java:22
com.google.appinventor.components.runtime.util.KitkatUtil.getMinHeight
static int getMinHeight(TextView view)
Definition: KitkatUtil.java:65
com.google.appinventor.components.runtime.util.MediaUtil.getBitmapDrawable
static BitmapDrawable getBitmapDrawable(Form form, String mediaPath)
Definition: MediaUtil.java:419
com.google.appinventor.components.runtime.util.TextViewUtil.setText
static void setText(TextView textview, String text)
Definition: TextViewUtil.java:188
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_TEXTALIGNMENT
static final String PROPERTY_TYPE_TEXTALIGNMENT
Definition: PropertyTypeConstants.java:260
com.google.appinventor.components.runtime.ButtonBase.getView
View getView()
Definition: ButtonBase.java:193
com.google.appinventor.components.runtime.ButtonBase.ButtonBase
ButtonBase(ComponentContainer container)
Definition: ButtonBase.java:125
com.google.appinventor.components.runtime.Component.COLOR_DEFAULT
static final int COLOR_DEFAULT
Definition: Component.java:68
com.google.appinventor.components.runtime.ButtonBase.BackgroundColor
int BackgroundColor()
Definition: ButtonBase.java:372
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_TYPEFACE
static final String PROPERTY_TYPE_TYPEFACE
Definition: PropertyTypeConstants.java:272
com.google.appinventor.components.runtime.util
-*- mode: java; c-basic-offset: 2; -*-
Definition: AccountChooser.java:7
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_BUTTON_SHAPE
static final String PROPERTY_TYPE_BUTTON_SHAPE
Definition: PropertyTypeConstants.java:57
com.google.appinventor.components.annotations.DesignerProperty
Definition: DesignerProperty.java:25
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_STRING
static final String PROPERTY_TYPE_STRING
Definition: PropertyTypeConstants.java:237
com.google.appinventor.components
com.google.appinventor.components.runtime.ButtonBase.onLongClick
boolean onLongClick(View view)
Definition: ButtonBase.java:767
com.google.appinventor.components.runtime.ButtonBase.TextColor
int TextColor()
Definition: ButtonBase.java:713
com.google.appinventor.components.runtime.ButtonBase.TextColor
void TextColor(int argb)
Definition: ButtonBase.java:726
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN
static final String PROPERTY_TYPE_BOOLEAN
Definition: PropertyTypeConstants.java:35
com.google.appinventor.components.runtime.util.IceCreamSandwichUtil.setAllCaps
static void setAllCaps(TextView view, boolean allCaps)
Definition: IceCreamSandwichUtil.java:27
com.google.appinventor.components.runtime.util.MediaUtil
Definition: MediaUtil.java:53
com.google.appinventor.components.annotations.SimpleEvent
Definition: SimpleEvent.java:20
com.google.appinventor.components.runtime.util.TextViewUtil.setFontTypeface
static void setFontTypeface(TextView textview, int typeface, boolean bold, boolean italic)
Definition: TextViewUtil.java:126
com.google.appinventor.components.runtime.util.KitkatUtil
Definition: KitkatUtil.java:24
com.google.appinventor.components.runtime.util.TextViewUtil.getText
static String getText(TextView textview)
Definition: TextViewUtil.java:167
com.google.appinventor.components.runtime.ComponentContainer.$add
void $add(AndroidViewComponent component)
com.google.appinventor.components.runtime.ButtonBase.Enabled
void Enabled(boolean enabled)
Definition: ButtonBase.java:522
com.google.appinventor.components.runtime.util.TextViewUtil.setAlignment
static void setAlignment(TextView textview, int alignment, boolean centerVertically)
Definition: TextViewUtil.java:35
com.google.appinventor.components.runtime.util.TextViewUtil.getFontSize
static float getFontSize(TextView textview, Context context)
Definition: TextViewUtil.java:99
com.google.appinventor.components.annotations.UsesPermissions
Definition: UsesPermissions.java:21
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_DEFAULT
static final String DEFAULT_VALUE_COLOR_DEFAULT
Definition: Component.java:84
com.google.appinventor.components.runtime.util.KitkatUtil.getMinWidth
static int getMinWidth(TextView view)
Definition: KitkatUtil.java:51
com.google.appinventor.components.runtime.util.TextViewUtil
Definition: TextViewUtil.java:22
com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent
static boolean dispatchEvent(Component component, String eventName, Object...args)
Definition: EventDispatcher.java:188
com.google.appinventor.components.runtime.Component.BUTTON_SHAPE_DEFAULT
static final int BUTTON_SHAPE_DEFAULT
Definition: Component.java:46
com.google.appinventor.components.annotations.SimpleProperty
Definition: SimpleProperty.java:23
com.google.appinventor.components.runtime.util.TextViewUtil.setFontSize
static void setFontSize(TextView textview, float size)
Definition: TextViewUtil.java:110
com.google.appinventor.components.annotations.PropertyCategory
Definition: PropertyCategory.java:13
com.google.appinventor.components.runtime.util.ViewUtil.setBackgroundDrawable
static void setBackgroundDrawable(View view, Drawable drawable)
Definition: ViewUtil.java:200
com.google.appinventor.components.runtime.ComponentContainer
Definition: ComponentContainer.java:16
com.google.appinventor.components.runtime
Copyright 2009-2011 Google, All Rights reserved.
Definition: AccelerometerSensor.java:8
com.google.appinventor.components.runtime.util.TextViewUtil.isEnabled
static boolean isEnabled(TextView textview)
Definition: TextViewUtil.java:77
com.google.appinventor.components.runtime.Component
Definition: Component.java:17
com.google.appinventor.components.runtime.util.TextViewUtil.setTextColors
static void setTextColors(TextView textview, ColorStateList colorStateList)
Definition: TextViewUtil.java:215
com.google.appinventor.components.common
Definition: ComponentCategory.java:7
com.google.appinventor.components.runtime.util.IceCreamSandwichUtil
Definition: IceCreamSandwichUtil.java:17
com.google.appinventor.components.runtime.ButtonBase.onClick
void onClick(View view)
Definition: ButtonBase.java:749
com.google.appinventor.components.runtime.Component.TYPEFACE_DEFAULT
static final int TYPEFACE_DEFAULT
Definition: Component.java:106
com.google.appinventor.components.runtime.ButtonBase.longClick
boolean longClick()
Definition: ButtonBase.java:742
com.google.appinventor.components.runtime.ButtonBase.onTouch
boolean onTouch(View view, MotionEvent me)
Definition: ButtonBase.java:169
com.google.appinventor.components.annotations.SimpleObject
Definition: SimpleObject.java:23
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_COLOR
static final String PROPERTY_TYPE_COLOR
Definition: PropertyTypeConstants.java:63
com.google.appinventor.components.runtime.AppInventorCompatActivity
Definition: AppInventorCompatActivity.java:40
com.google
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_NON_NEGATIVE_FLOAT
static final String PROPERTY_TYPE_NON_NEGATIVE_FLOAT
Definition: PropertyTypeConstants.java:200
com.google.appinventor.components.runtime.ButtonBase
Definition: ButtonBase.java:47
com
com.google.appinventor.components.runtime.ButtonBase.Text
void Text(String text)
Definition: ButtonBase.java:699
com.google.appinventor.components.runtime.AppInventorCompatActivity.isClassicMode
static boolean isClassicMode()
Definition: AppInventorCompatActivity.java:237
com.google.appinventor.components.runtime.ComponentContainer.$context
Activity $context()
com.google.appinventor.components.runtime.util.TextViewUtil.setEnabled
static void setEnabled(TextView textview, boolean enabled)
Definition: TextViewUtil.java:87
com.google.appinventor.components.runtime.AndroidViewComponent
Definition: AndroidViewComponent.java:27
com.google.appinventor.components.runtime.util.TextViewUtil.setTextColor
static void setTextColor(TextView textview, int argb)
Definition: TextViewUtil.java:210
com.google.appinventor.components.annotations.IsColor
Definition: IsColor.java:13
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_ASSET
static final String PROPERTY_TYPE_ASSET
Definition: PropertyTypeConstants.java:22
com.google.appinventor.components.runtime.ButtonBase.onFocusChange
void onFocusChange(View previouslyFocused, boolean gainFocus)
Definition: ButtonBase.java:756
com.google.appinventor.components.annotations.PropertyCategory.APPEARANCE
APPEARANCE
Definition: PropertyCategory.java:16
com.google.appinventor.components.common.PropertyTypeConstants
Definition: PropertyTypeConstants.java:14
com.google.appinventor.components.runtime.Component.FONT_DEFAULT_SIZE
static final float FONT_DEFAULT_SIZE
Definition: Component.java:89
com.google.appinventor.components.annotations
com.google.appinventor.components.runtime.Image
Definition: Image.java:52
com.google.appinventor
com.google.appinventor.components.runtime.Component.ALIGNMENT_CENTER
static final int ALIGNMENT_CENTER
Definition: Component.java:33
com.google.appinventor.components.runtime.util.ViewUtil
Definition: ViewUtil.java:22