Exemple #1
0
 public void handleShow() {
   if (localLOGV)
     Log.v(TAG, "HANDLE SHOW: " + this + " mView=" + mView + " mNextView=" + mNextView);
   if (mView != mNextView) {
     // remove the old view if necessary
     handleHide();
     mView = mNextView;
     mWM = WindowManagerImpl.getDefault();
     final int gravity = mGravity;
     mParams.gravity = gravity;
     if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) {
       mParams.horizontalWeight = 1.0f;
     }
     if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) {
       mParams.verticalWeight = 1.0f;
     }
     mParams.x = mX;
     mParams.y = mY;
     mParams.verticalMargin = mVerticalMargin;
     mParams.horizontalMargin = mHorizontalMargin;
     if (mView.getParent() != null) {
       if (localLOGV) Log.v(TAG, "REMOVE! " + mView + " in " + this);
       mWM.removeView(mView);
     }
     if (localLOGV) Log.v(TAG, "ADD! " + mView + " in " + this);
     mWM.addView(mView, mParams);
     trySendAccessibilityEvent();
   }
 }
Exemple #2
0
 public void handleShow() {
   if (localLOGV)
     Log.v(TAG, "HANDLE SHOW: " + this + " mView=" + mView + " mNextView=" + mNextView);
   if (mView != mNextView) {
     // remove the old view if necessary
     handleHide();
     mView = mNextView;
     Context context = mView.getContext();
     if (context.getApplicationContext() != null) {
       // Use application context, except when called from system
       // service where there is no application context.
       context = context.getApplicationContext();
     }
     mWM = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
     // We can resolve the Gravity here by using the Locale for getting
     // the layout direction
     final Configuration config = mView.getContext().getResources().getConfiguration();
     final int gravity = Gravity.getAbsoluteGravity(mGravity, config.getLayoutDirection());
     mParams.gravity = gravity;
     if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) {
       mParams.horizontalWeight = 1.0f;
     }
     if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) {
       mParams.verticalWeight = 1.0f;
     }
     mParams.x = mX;
     mParams.y = mY;
     mParams.verticalMargin = mVerticalMargin;
     mParams.horizontalMargin = mHorizontalMargin;
     if (mView.getParent() != null) {
       if (localLOGV) Log.v(TAG, "REMOVE! " + mView + " in " + this);
       mWM.removeView(mView);
     }
     if (localLOGV) Log.v(TAG, "ADD! " + mView + " in " + this);
     mWM.addView(mView, mParams);
     trySendAccessibilityEvent();
   }
 }