コード例 #1
0
  @Override
  public void propertySet(String key, Object newValue, Object oldValue, boolean changedProperty) {
    switch (key) {
      case TiC.PROPERTY_MESSAGE:
        message = TiConvert.toString(newValue);
        break;

      case TiC.PROPERTY_DURATION:
        toast.setDuration(TiConvert.toInt(newValue));
        break;

      case "verticalMargin":
        verticalMargin = TiConvert.toFloat(newValue, verticalMargin);
        toast.setMargin(horizontalMargin, verticalMargin);
        break;

      case "horizontalMargin":
        horizontalMargin = TiConvert.toFloat(newValue, horizontalMargin);
        toast.setMargin(horizontalMargin, verticalMargin);
        break;
      case "offsetX":
        offsetX = TiConvert.toInt(newValue, offsetX);
        toast.setGravity(gravity, offsetX, offsetY);
        break;
      case "offsetY":
        offsetY = TiConvert.toInt(newValue, offsetY);
        toast.setGravity(gravity, offsetX, offsetY);
        break;
      case "gravity":
        gravity = TiConvert.toInt(newValue, gravity);
        toast.setGravity(gravity, offsetX, offsetY);
        break;
      default:
        super.propertySet(key, newValue, oldValue, changedProperty);
        break;
    }
  }
コード例 #2
0
 @Override
 public void propertySet(String key, Object newValue, Object oldValue, boolean changedProperty) {
   AlertDialog dialog = (AlertDialog) dialogWrapper.getDialog();
   if (key.startsWith(TiC.PROPERTY_ACCESSIBILITY_PREFIX)) {
     if (dialog != null) {
       ListView listView = dialog.getListView();
       if (listView != null) {
         if (key.equals(TiC.PROPERTY_ACCESSIBILITY_HIDDEN)) {
           int importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
           if (newValue != null && TiConvert.toBoolean(newValue)) {
             importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO;
           }
           ViewCompat.setImportantForAccessibility(listView, importance);
         } else {
           listView.setContentDescription(composeContentDescription());
         }
       }
     }
     return;
   }
   switch (key) {
     case TiC.PROPERTY_TITLE:
       if (dialog != null) {
         dialog.setTitle(Html.fromHtml((String) newValue));
       } else {
         getBuilder().setTitle(Html.fromHtml(TiConvert.toString(newValue)));
       }
       break;
     case TiC.PROPERTY_MESSAGE:
       if (dialog != null) {
         dialog.setMessage(Html.fromHtml((String) newValue));
       } else {
         getBuilder().setMessage(Html.fromHtml(TiConvert.toString(newValue)));
       }
       break;
     case TiC.PROPERTY_BUTTON_NAMES:
       clearDialog();
       processButtons(TiConvert.toStringArray(newValue));
       break;
     case TiC.PROPERTY_OK:
       clearDialog();
       processButtons(new String[] {TiConvert.toString(newValue)});
       break;
     case TiC.PROPERTY_CUSTOM_VIEW:
       clearDialog();
       processView(newValue);
       break;
     case TiC.PROPERTY_PERSISTENT:
       dialogWrapper.setPersistent(TiConvert.toBoolean(newValue));
       break;
     case TiC.PROPERTY_CANCEL:
       cancelIndex = TiConvert.toInt(newValue, -1);
       break;
     case TiC.PROPERTY_OPTIONS:
       {
         mProcessUpdateFlags |= TIFLAG_NEEDS_OPTIONS;
         break;
       }
     case TiC.PROPERTY_SELECTED_INDEX:
       {
         mProcessUpdateFlags |= TIFLAG_NEEDS_OPTIONS;
         break;
       }
     case TiC.PROPERTY_HIDE_ON_CLICK:
       hideOnClick = TiConvert.toBoolean(newValue);
       if (dialog != null) {
         dialog.setCancelable(hideOnClick);
       }
       break;
     case TiC.PROPERTY_TAP_OUT_DISMISS:
       tapToDismiss = TiConvert.toBoolean(newValue);
       if (dialog != null) {
         dialog.setCanceledOnTouchOutside(tapToDismiss);
       }
       break;
     default:
       super.propertySet(key, newValue, oldValue, changedProperty);
       break;
   }
 }