protected void buildView() {
    final Context context = getContext();

    mProgressBar = new ProgressBar(context);
    final LayoutParams progressLayoutParams = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
    progressLayoutParams.gravity = Gravity.CENTER;
    mProgressBar.setLayoutParams(progressLayoutParams);
    mProgressBar.setId(INTERNAL_PROGRESS_ID);
    mProgressBar.setIndeterminate(true);
    mProgressBar.setVisibility(View.GONE);

    addView(mProgressBar);

    mIsLoading = false;

    mImageView = new ImageView(context);
    final LayoutParams imageViewLayoutParams = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
    imageViewLayoutParams.gravity = Gravity.CENTER;
    mImageView.setLayoutParams(imageViewLayoutParams);
    mImageView.setId(INTERNAL_IMAGEVIEW_ID);
    mImageView.setVisibility(View.VISIBLE);

    addView(mImageView);

    setLayoutParams(new LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
  }
 private void a(AVPlayer aVPlayer, Dimensions dimensions) {
   int density = (int) (-99999.0f * this.a.getDensity());
   if (aVPlayer.isInlineVideo()) {
     LayoutParams layoutParams = new FrameLayout.LayoutParams(dimensions.width, dimensions.height);
     FrameLayout.LayoutParams layoutParams2 =
         (FrameLayout.LayoutParams) aVPlayer.getLayoutParams();
     if (dimensions.x == density && dimensions.y == density) {
       layoutParams.leftMargin = layoutParams2.leftMargin;
       layoutParams.topMargin = layoutParams2.topMargin;
     } else {
       layoutParams.leftMargin = dimensions.x;
       layoutParams.topMargin = dimensions.y;
     }
     layoutParams.gravity = 3;
     aVPlayer.setLayoutParams(layoutParams);
   }
 }
示例#3
0
 protected LayoutParams createSurfaceViewLayoutParams() {
   final LayoutParams layoutParams = new LayoutParams(FILL_PARENT, FILL_PARENT);
   layoutParams.gravity = Gravity.CENTER;
   return layoutParams;
 }
 public void playVideoImpl(Bundle bundle, Activity activity) {
   PlayerProperties playerProperties =
       (PlayerProperties) bundle.getParcelable(IMWebView.PLAYER_PROPERTIES);
   Dimensions dimensions = (Dimensions) bundle.getParcelable(IMWebView.DIMENSIONS);
   Log.debug(Constants.RENDERING_LOG_TAG, "Final dimensions: " + dimensions);
   String string = bundle.getString(IMWebView.EXPAND_URL);
   if (a(playerProperties.id, string, activity, dimensions)) {
     PlayerProperties playerProperties2;
     this.a.setBusy(true);
     if (string.length() == 0) {
       playerProperties = this.videoPlayer.getProperties();
       dimensions = this.videoPlayer.getPlayDimensions();
       this.videoPlayer.getMediaURL();
       playerProperties2 = playerProperties;
     } else {
       this.videoPlayer.setPlayData(playerProperties, string);
       this.videoPlayer.setPlayDimensions(dimensions);
       playerProperties2 = playerProperties;
     }
     if (this.videoPlayer.getState() == playerState.HIDDEN) {
       this.videoPlayer.pseudoPause = true;
       this.videoPlayer.show();
     } else {
       FrameLayout frameLayout = (FrameLayout) activity.findViewById(16908290);
       if (playerProperties2.isFullScreen()) {
         LayoutParams layoutParams =
             new RelativeLayout.LayoutParams(
                 WrapperFunctions.getParamFillParent(), WrapperFunctions.getParamFillParent());
         layoutParams.addRule(R.styleable.MapAttrs_zOrderOnTop);
         this.videoPlayer.setLayoutParams(layoutParams);
         View relativeLayout = new RelativeLayout(activity);
         relativeLayout.setOnTouchListener(new b());
         relativeLayout.setBackgroundColor(-16777216);
         frameLayout.addView(
             relativeLayout,
             new FrameLayout.LayoutParams(
                 WrapperFunctions.getParamFillParent(), WrapperFunctions.getParamFillParent()));
         relativeLayout.addView(this.videoPlayer);
         this.videoPlayer.setBackGroundLayout(relativeLayout);
         this.videoPlayer.requestFocus();
         this.videoPlayer.setOnKeyListener(new e());
       } else {
         LayoutParams layoutParams2 =
             new FrameLayout.LayoutParams(dimensions.width, dimensions.height);
         View frameLayout2 = new FrameLayout(activity);
         if (this.a.mExpandController.expandProperties == null) {
           layoutParams2.leftMargin = dimensions.x;
           layoutParams2.topMargin = dimensions.y;
         } else {
           layoutParams2.leftMargin =
               dimensions.x + this.a.mExpandController.expandProperties.currentX;
           layoutParams2.topMargin =
               dimensions.y + this.a.mExpandController.expandProperties.currentY;
         }
         layoutParams2.gravity = 3;
         this.videoPlayer.setLayoutParams(layoutParams2);
         frameLayout.addView(
             frameLayout2,
             new FrameLayout.LayoutParams(
                 WrapperFunctions.getParamFillParent(), WrapperFunctions.getParamFillParent()));
         this.videoPlayer.setBackGroundLayout(frameLayout2);
         frameLayout2.addView(this.videoPlayer);
       }
       this.videoPlayer.setListener(new f());
       this.videoPlayer.play();
     }
   }
 }