private synchronized void handleShow() { if (mView != mNextView) { // remove the old view if necessary handleHide(); mView = mNextView; // / M: we set hint center_horizontal and bottom in xml. // 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; mParams.x = 0; mParams.y = 0; mParams.height = WindowManager.LayoutParams.MATCH_PARENT; mParams.width = WindowManager.LayoutParams.MATCH_PARENT; try { if (mView.getParent() != null) { mWM.removeView(mView); } mWM.addView(mView, mParams); } catch (BadTokenException ex) { ex.printStackTrace(); } Util.fadeIn(mView); } }
public static void fadeIn(View view) { fadeIn(view, 0F, 1F, 400); // We disabled the button in fadeOut(), so enable it here. view.setEnabled(true); }