// 夜间模式
  @Override
  protected void onStart() {
    // TODO Auto-generated method stub
    super.onStart();
    mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);

    Myapp = (MyApplication) getApplication();
    if (nightView != null) {
      mWindowManager.removeView(nightView);
      nightView = null;
    }
    if (Myapp.getlunaMode()) {
      WindowManager.LayoutParams params =
          new WindowManager.LayoutParams(
              LayoutParams.MATCH_PARENT,
              LayoutParams.MATCH_PARENT,
              android.view.WindowManager.LayoutParams.TYPE_APPLICATION,
              WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                  | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
              PixelFormat.TRANSLUCENT);
      params.gravity = Gravity.BOTTOM;

      if (nightView == null) {
        nightView = new TextView(this);
        nightView.setBackgroundColor(0xa0000000);
        mWindowManager.addView(nightView, params);
      }

    } else {
      if (nightView != null) {
        mWindowManager.removeView(nightView);
      }
    }
  }
Exemple #2
0
 public void destroy() {
   for (int x = 0; x < xGrids; x++)
     for (int y = 0; y < yGrids; y++)
       if (menuItems[y * xGrids + x] != null) {
         if (menuItems[y * xGrids + x].isShown())
           mWindowManager.removeView(menuItems[y * xGrids + x]);
       }
   if (navigator.isShown()) mWindowManager.removeView(navigator);
 }
 /** @Method: clearTopWindow @Description: 移除最顶层view */
 public void clearTopWindow(View view) {
   if (view != null && view.isShown()) {
     WindowManager windowManager =
         (WindowManager) getApplicationContext().getSystemService(WINDOW_SERVICE);
     windowManager.removeView(view);
   }
 }
 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);
   }
 }
 /**
  * 将小悬浮窗从屏幕上移除。
  *
  * @param context 必须为应用程序的Context.
  */
 public static void removeSmallWindow(Context context) {
   if (mFloatView != null) {
     WindowManager windowManager = getWindowManager(context);
     windowManager.removeView(mFloatView);
     mFloatView = null;
   }
 }
 public void destory() {
   try {
     windowManager.removeView(dialogPosition);
   } catch (Exception e) {
     Log.d("GROUPPINGLIST", "dupliation remove : " + dialogPosition.hashCode());
   }
 }
 private void dismissInternally() {
   if (dismissed && emojiKeyboardView != null) {
     final View emojiKeyboardViewCopy = emojiKeyboardView;
     //            emojiKeyboardView
     //                    .animate()
     //                    .y(140)
     //                    .alpha(0.2f)
     //                    .setDuration(200)
     //                    .setStartDelay(0)
     //                    .setInterpolator(new AccelerateInterpolator(1.5f))
     //                    .setListener(new AnimatorListenerAdapter() {
     //                        @Override
     //                        public void onAnimationEnd(Animator animation) {
     //                            emojiKeyboardViewCopy.setVisibility(View.GONE);
     //                            windowManager.removeView(emojiKeyboardViewCopy);
     //                        }
     //                    })
     //                    .start();
     emojiKeyboardViewCopy.setVisibility(View.GONE);
     windowManager.removeView(emojiKeyboardViewCopy);
     showing = false;
     emojiKeyboardView = null;
     if (keyboardStatusListener != null) keyboardStatusListener.onDismiss();
     onDismiss();
   }
 }
Exemple #8
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (mFloatView != null) {
     mWindowManager.removeView(mFloatView);
   }
 }
 @Override
 public void dismiss() {
   if (mWindowVisible) {
     mDisplayManager.unregisterDisplayListener(mDisplayListener);
     mWindowManager.removeView(mWindowContent);
     mWindowVisible = false;
   }
 }
 @Override
 public void onExit() {
   mWindowManager.removeView(mPieContainer);
   mPieActivationListener.restoreListenerState();
   if (mIsDetaching) {
     detachContainer(true);
   }
 }
 private void stopDragging() {
   if (dragView != null) {
     dragView.setVisibility(GONE);
     WindowManager windowManager = getWindowManager();
     windowManager.removeView(dragView);
     dragView.setImageDrawable(null);
     dragView = null;
   }
 }
Exemple #12
0
  public void day() {
    try {
      if (mNightView != null) {
        mWindowManager.removeView(mNightView);
      }
    } catch (Exception ex) {

    }
  }
 @Override
 public void onDestroy() {
   Log.v(TAG, "onDestroy");
   WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
   while (!mTouchAreas.isEmpty()) {
     wm.removeView(mTouchAreas.pop());
   }
   unregisterReceiver(mBarShownReceiver);
 }
    @Override
    public void dismiss() {
      if (mWindowVisible) {
        mListener.onWindowDestroyed();

        mWindowManager.removeView(mSurfaceView);
        mWindowVisible = false;
      }
    }
  @Override
  public void onDestroy() {
    super.onDestroy();

    mServiceLooper.quit();
    mTimerTask.cancel();
    mTimer.cancel();

    mWM.removeView(mTextView);
  }
 private void removeView() {
   try {
     windowManager.removeView(toastLayout);
   } catch (IllegalArgumentException | IllegalStateException e) {
     // This can happen if the Service is killed by the system.  If this happens the View will have
     // already
     // been removed but the runnable will have been kept alive.
     Log.e(LOGTAG, "Error removing Tab Queue toast from service", e);
   }
 }
 // destroy drag view
 private void stopDrag(int itemIndex) {
   if (mDragView != null) {
     if (mDragListener != null) mDragListener.onStopDrag(getChildAt(itemIndex));
     mDragView.setVisibility(GONE);
     WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
     wm.removeView(mDragView);
     mDragView.setImageDrawable(null);
     mDragView = null;
   }
 }
  public void hide() {
    if (_frontView == null) {
      return;
    }

    _windowManager.removeView(_frontView);
    _frontView = null;

    stopTimeoutTimer();
  }
 public void destroy() {
   showing = false;
   dismissed = true;
   if (emojiKeyboardView != null) {
     windowManager.removeView(emojiKeyboardView);
     emojiKeyboardView = null;
   }
   if (keyboardStatusListener != null) {
     keyboardStatusListener.onDismiss();
   }
 }
 @Override
 public void onDestroy() {
   //		handler.removeCallbacks(task);
   Log.d("FloatService", "onDestroy");
   if (floatView != null) {
     windowManager.removeView(floatView);
     floatView = null;
   }
   //		mShare.edit().putBoolean("use_suspend_icon", false).commit();
   super.onDestroy();
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (mStreams != null) {
     mStreams.clear();
   }
   this.mSubscriber = null;
   if (mSession != null) {
     mSession.disconnect();
   }
   if (videoFlyHead != null) windowManager.removeView(videoFlyHead);
 }
Exemple #22
0
 private void stopDragging() {
   if (this.mDragView != null) {
     WindowManager wm = (WindowManager) this.getContext().getSystemService("window");
     wm.removeView(this.mDragView);
     this.mDragView.setImageDrawable(null);
     this.mDragView = null;
   }
   if (this.mDragBitmap != null) {
     this.mDragBitmap.recycle();
     this.mDragBitmap = null;
   }
 }
Exemple #23
0
 /** Removes the system overlay for PTT. */
 public void dismissPTTOverlay() {
   WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
   if (overlayView != null) {
     try {
       wm.removeView(overlayView);
     } catch (Exception e) {
       // We do a catchall here because removing a view from a
       // WindowManager can be unreliable.
       // http://stackoverflow.com/questions/6515004/keeping-track-of-view-added-to-windowmanager-no-findviewbyid-function
     }
   }
 }
 public void d() {
   if (c != null) {
     c.setVisibility(8);
   }
   try {
     d.removeView(c);
     f = false;
     a();
     return;
   } catch (Exception localException) {
     for (; ; ) {}
   }
 }
Exemple #25
0
  /** Remove the controller from the screen. */
  public void hide() {
    if (mAnchor == null) return;

    if (mShowing) {
      try {
        mHandler.removeMessages(SHOW_PROGRESS);
        mWindowManager.removeView(mDecor);
      } catch (IllegalArgumentException ex) {
        Log.w("MmsMediaController", "already removed");
      }
      mShowing = false;
    }
  }
 private void stopDragging() {
   if (mDragView != null) {
     mDragView.setVisibility(GONE);
     WindowManager wm = (WindowManager) getContext().getSystemService("window");
     wm.removeView(mDragView);
     mDragView.setImageDrawable(null);
     mDragView = null;
   }
   if (mDragBitmap != null) {
     mDragBitmap.recycle();
     mDragBitmap = null;
   }
 }
Exemple #27
0
    public void handleHide() {
      if (localLOGV) Log.v(TAG, "HANDLE HIDE: " + this + " mView=" + mView);
      if (mView != null) {
        // note: checking parent() just to make sure the view has
        // been added...  i have seen cases where we get here when
        // the view isn't yet added, so let's try not to crash.
        if (mView.getParent() != null) {
          if (localLOGV) Log.v(TAG, "REMOVE! " + mView + " in " + this);
          mWM.removeView(mView);
        }

        mView = null;
      }
    }
Exemple #28
0
 private void stopDrag() {
   // doTask = false;
   ha.removeMessages(0);
   doTask = false;
   if (dragView != null) {
     mWindowManager.removeView(dragView);
     dragView.setBackgroundDrawable(null);
     dragView = null;
   }
   if (dragBitmap != null) {
     if (!dragBitmap.isRecycled()) dragBitmap.recycle();
     dragBitmap = null;
   }
 }
  /**
   * Dispose of the popup window. This method can be invoked only after {@link
   * #showAsDropDown(android.view.View)} has been executed. Failing that, calling this method will
   * have no effect.
   *
   * @see #showAsDropDown(android.view.View)
   */
  public void dismiss() {
    if (isShowing() && mPopupView != null) {
      mWindowManager.removeView(mPopupView);
      if (mPopupView != mContentView && mPopupView instanceof ViewGroup) {
        ((ViewGroup) mPopupView).removeView(mContentView);
      }
      mPopupView = null;
      mIsShowing = false;

      if (mOnDismissListener != null) {
        mOnDismissListener.onDismiss();
      }
    }
  }
 public void dismiss() {
   if (!mAttached) {
     return;
   }
   // Immediately set to false, to prevent .cancel() calls
   // below from immediately calling into dismiss() again.
   mAttached = false;
   mPreAnimator.cancel();
   mSlowSendAnimator.cancel();
   mFastCloneAnimator.cancel();
   mSuccessAnimatorSet.cancel();
   mScaleUpAnimator.cancel();
   mWindowManager.removeView(mScreenshotLayout);
   mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
   releaseScreenshot();
 }