Beispiel #1
0
  /**
   * Sets whether the video should be shown in fullscreen or not.
   *
   * @param value If True, the video will be shown in fullscreen. If False and {@link
   *     VideoPlayer#FullScreen()} returns True, fullscreen mode will be exited. If False and {@link
   *     VideoPlayer#FullScreen()} returns False, nothing occurs.
   */
  @SimpleProperty(userVisible = true)
  public void FullScreen(boolean value) {

    if (value && (SdkLevel.getLevel() <= SdkLevel.LEVEL_DONUT)) {
      container
          .$form()
          .dispatchErrorOccurredEvent(
              this, "FullScreen(true)", ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_UNSUPPORTED);
      return;
    }

    if (value != inFullScreen) {
      if (value) {
        Bundle data = new Bundle();
        data.putInt(FullScreenVideoUtil.VIDEOPLAYER_POSITION, videoView.getCurrentPosition());
        data.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_PLAYING, videoView.isPlaying());
        videoView.pause();
        data.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_FULLSCREEN, true);
        data.putString(FullScreenVideoUtil.VIDEOPLAYER_SOURCE, sourcePath);
        Bundle result =
            container
                .$form()
                .fullScreenVideoAction(
                    FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_FULLSCREEN, this, data);
        if (result.getBoolean(FullScreenVideoUtil.ACTION_SUCESS)) {
          inFullScreen = true;
        } else {
          inFullScreen = false;
          container
              .$form()
              .dispatchErrorOccurredEvent(
                  this, "FullScreen", ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_UNAVAILBLE, "");
        }
      } else {
        Bundle values = new Bundle();
        values.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_FULLSCREEN, false);
        Bundle result =
            container
                .$form()
                .fullScreenVideoAction(
                    FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_FULLSCREEN, this, values);
        if (result.getBoolean(FullScreenVideoUtil.ACTION_SUCESS)) {
          fullScreenKilled((Bundle) result);
        } else {
          inFullScreen = true;
          container
              .$form()
              .dispatchErrorOccurredEvent(
                  this, "FullScreen", ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_CANT_EXIT, "");
        }
      }
    }
  }
Beispiel #2
0
 /**
  * ScreenOrientation property setter method: sets the screen orientation for the form.
  *
  * @param screenOrientation the screen orientation as a string
  */
 @DesignerProperty(
     editorType = DesignerProperty.PROPERTY_TYPE_SCREEN_ORIENTATION,
     defaultValue = "unspecified")
 @SimpleProperty(
     category = PropertyCategory.APPEARANCE,
     description =
         "The requested screen orientation. Commonly used values are"
             + " \"unspecified\", \"landscape\", \"portrait\", \"sensor\", and \"behind\".")
 public void ScreenOrientation(String screenOrientation) {
   if (screenOrientation.equalsIgnoreCase("behind")) {
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND);
   } else if (screenOrientation.equalsIgnoreCase("landscape")) {
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
   } else if (screenOrientation.equalsIgnoreCase("nosensor")) {
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
   } else if (screenOrientation.equalsIgnoreCase("portrait")) {
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
   } else if (screenOrientation.equalsIgnoreCase("sensor")) {
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
   } else if (screenOrientation.equalsIgnoreCase("unspecified")) {
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
   } else if (screenOrientation.equalsIgnoreCase("user")) {
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
   } else if (SdkLevel.getLevel() >= SdkLevel.LEVEL_GINGERBREAD) {
     if (screenOrientation.equalsIgnoreCase("fullSensor")) {
       setRequestedOrientation(10); // ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
     } else if (screenOrientation.equalsIgnoreCase("reverseLandscape")) {
       setRequestedOrientation(8); // ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
     } else if (screenOrientation.equalsIgnoreCase("reversePortrait")) {
       setRequestedOrientation(9); // ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
     } else if (screenOrientation.equalsIgnoreCase("sensorLandscape")) {
       setRequestedOrientation(6); // ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
     } else if (screenOrientation.equalsIgnoreCase("sensorPortrait")) {
       setRequestedOrientation(7); // ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
     } else {
       dispatchErrorOccurredEvent(
           this,
           "ScreenOrientation",
           ErrorMessages.ERROR_INVALID_SCREEN_ORIENTATION,
           screenOrientation);
     }
   } else {
     dispatchErrorOccurredEvent(
         this,
         "ScreenOrientation",
         ErrorMessages.ERROR_INVALID_SCREEN_ORIENTATION,
         screenOrientation);
   }
 }
 /**
  * If this property is true, then SendMessage will attempt to send messages over WiFi, using
  * Google voice.
  *
  * @param enabled Set to 'true' or 'false' depending on whether you want to use Google Voice to
  *     send/receive messages.
  */
 @DesignerProperty(
     editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
     defaultValue = "False")
 @SimpleProperty()
 public void GoogleVoiceEnabled(boolean enabled) {
   if (SdkLevel.getLevel() >= SdkLevel.LEVEL_ECLAIR) {
     this.googleVoiceEnabled = enabled;
     SharedPreferences prefs = activity.getSharedPreferences(PREF_FILE, Activity.MODE_PRIVATE);
     SharedPreferences.Editor editor = prefs.edit();
     editor.putBoolean(PREF_GVENABLED, enabled);
     editor.commit();
   } else {
     Toast.makeText(
             activity,
             "Sorry, your phone's system does not support this option.",
             Toast.LENGTH_LONG)
         .show();
   }
 }