Java Code Examples for android.view.WindowManager#removeViewImmediate()
The following examples show how to use
android.view.WindowManager#removeViewImmediate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecretMediaViewer.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void destroyPhotoViewer() { NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagesDeleted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateMessageMedia); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.didCreatedNewDeleteTask); isVisible = false; currentProvider = null; if (currentThumb != null) { currentThumb.release(); currentThumb = null; } releasePlayer(); if (parentActivity != null && windowView != null) { try { if (windowView.getParent() != null) { WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE); wm.removeViewImmediate(windowView); } windowView = null; } catch (Exception e) { FileLog.e(e); } } Instance = null; }
Example 2
Source File: SecretMediaViewer.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void destroyPhotoViewer() { NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagesDeleted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateMessageMedia); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.didCreatedNewDeleteTask); isVisible = false; currentProvider = null; if (currentThumb != null) { currentThumb.release(); currentThumb = null; } releasePlayer(); if (parentActivity != null && windowView != null) { try { if (windowView.getParent() != null) { WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE); wm.removeViewImmediate(windowView); } windowView = null; } catch (Exception e) { FileLog.e(e); } } Instance = null; }
Example 3
Source File: ToastHelper.java From ToastUtils with Apache License 2.0 | 6 votes |
/** * 取消吐司弹窗 */ void cancel() { // 移除之前移除吐司的任务 removeMessages(hashCode()); if (isShow()) { try { Activity topActivity = mWindowHelper.getTopActivity(); if (topActivity != null) { WindowManager windowManager = (WindowManager) topActivity.getSystemService(Context.WINDOW_SERVICE); if (windowManager != null) { windowManager.removeViewImmediate(mToast.getView()); } } } catch (IllegalArgumentException ignored) { // 如果当前 WindowManager 没有附加这个 View 则会抛出异常 // java.lang.IllegalArgumentException: View=android.widget.TextView not attached to window manager } // 当前没有显示 setShow(false); } }
Example 4
Source File: SecretMediaViewer.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void destroyPhotoViewer() { NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagesDeleted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateMessageMedia); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.didCreatedNewDeleteTask); isVisible = false; currentProvider = null; if (currentThumb != null) { currentThumb.release(); currentThumb = null; } releasePlayer(); if (parentActivity != null && windowView != null) { try { if (windowView.getParent() != null) { WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE); wm.removeViewImmediate(windowView); } windowView = null; } catch (Exception e) { FileLog.e(e); } } Instance = null; }
Example 5
Source File: PhotoViewer.java From KrGallery with GNU General Public License v2.0 | 6 votes |
public void destroyPhotoViewer() { if (parentActivity == null || windowView == null) { return; } try { if (windowView.getParent() != null) { WindowManager wm = (WindowManager) parentActivity .getSystemService(Context.WINDOW_SERVICE); wm.removeViewImmediate(windowView); } windowView = null; } catch (Exception e) { e.printStackTrace(); } parentActivity = null; Instance = null; }
Example 6
Source File: SecretMediaViewer.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public void destroyPhotoViewer() { NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagesDeleted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateMessageMedia); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.didCreatedNewDeleteTask); isVisible = false; currentProvider = null; if (currentThumb != null) { currentThumb.release(); currentThumb = null; } releasePlayer(); if (parentActivity != null && windowView != null) { try { if (windowView.getParent() != null) { WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE); wm.removeViewImmediate(windowView); } windowView = null; } catch (Exception e) { FileLog.e(e); } } Instance = null; }
Example 7
Source File: FloatBall.java From FloatBall with Apache License 2.0 | 5 votes |
public void detachFromWindow(WindowManager windowManager) { this.windowManager = null; if (isAdded) { removeSleepRunnable(); if (getContext() instanceof Activity) { windowManager.removeViewImmediate(this); } else { windowManager.removeView(this); } isAdded = false; sleep = false; } }
Example 8
Source File: StatusBarView.java From FloatBall with Apache License 2.0 | 5 votes |
public void detachFromWindow(WindowManager windowManager) { if (!isAdded) return; isAdded = false; removeOnLayoutChangeListener(layoutChangeListener); if (getContext() instanceof Activity) { windowManager.removeViewImmediate(this); } else { windowManager.removeView(this); } }
Example 9
Source File: FloatMenu.java From FloatBall with Apache License 2.0 | 5 votes |
public void detachFromWindow(WindowManager windowManager) { if (isAdded) { toggle(0); mMenuLayout.setVisibility(GONE); if (getContext() instanceof Activity) { windowManager.removeViewImmediate(this); } else { windowManager.removeView(this); } isAdded = false; } }
Example 10
Source File: StarshineAnimationProcess.java From MainScreenShow with GNU General Public License v2.0 | 4 votes |
@Override public void StopAnimation(WindowManager Wm) { win.mLoop = false; // 控制结束 Wm.removeViewImmediate(win); }
Example 11
Source File: LinphoneTextureViewOverlay.java From linphone-android with GNU General Public License v3.0 | 4 votes |
@Override public void removeFromWindowManager(WindowManager windowManager) { windowManager.removeViewImmediate(this); }
Example 12
Source File: LinphoneGL2JNIViewOverlay.java From linphone-android with GNU General Public License v3.0 | 4 votes |
@Override public void removeFromWindowManager(WindowManager windowManager) { windowManager.removeViewImmediate(this); }
Example 13
Source File: LockDeviceActivity.java From PhoneProfilesPlus with Apache License 2.0 | 4 votes |
@Override protected void onDestroy() { super.onDestroy(); //PPApplication.logE("LockDeviceActivity.onDestroy", "displayed="+displayed); final Context appContext = getApplicationContext(); boolean canWriteSettings;// = true; //if (android.os.Build.VERSION.SDK_INT >= 23) canWriteSettings = Settings.System.canWrite(appContext); if (displayed && (PhoneProfilesService.getInstance() != null) && canWriteSettings) { displayed = false; if (view != null) try { WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); if (windowManager != null) windowManager.removeViewImmediate(view); } catch (Exception e) { PPApplication.recordException(e); } LockDeviceActivityFinishBroadcastReceiver.removeAlarm(appContext); PPApplication.lockDeviceActivity = null; Settings.System.putInt(appContext.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, PPApplication.screenTimeoutBeforeDeviceLock); // change screen timeout //final DataWrapper dataWrapper = new DataWrapper(appContext, false, 0, false); final int screenTimeout = ApplicationPreferences.prefActivatedProfileScreenTimeout; //PPApplication.logE("LockDeviceActivity.onDestroy", "screenTimeout="+screenTimeout); if ((screenTimeout > 0) && (Permissions.checkScreenTimeout(appContext))) { //PPApplication.logE("LockDeviceActivity.onDestroy", "permission ok"); if (PPApplication.screenTimeoutHandler != null) { PPApplication.screenTimeoutHandler.post(new Runnable() { public void run() { //PPApplication.logE("LockDeviceActivity.onDestroy", "call ActivateProfileHelper.setScreenTimeout"); ActivateProfileHelper.setScreenTimeout(screenTimeout, appContext); } }); }/* else { dataWrapper.getActivateProfileHelper().setScreenTimeout(screenTimeout); }*/ } //dataWrapper.invalidateDataWrapper(); } }
Example 14
Source File: PictureWallAnimationProcess.java From MainScreenShow with GNU General Public License v2.0 | 4 votes |
@Override public void StopAnimation(WindowManager Wm) { pwv.mLoop = false; Wm.removeViewImmediate(pwv); pwv = null; }
Example 15
Source File: RainAnimationProcess.java From MainScreenShow with GNU General Public License v2.0 | 4 votes |
@Override public void StopAnimation(WindowManager Wm) { // Wm.removeView(win); Wm.removeViewImmediate(win); }
Example 16
Source File: BubbleAnimationProcess.java From MainScreenShow with GNU General Public License v2.0 | 4 votes |
@Override public void StopAnimation(WindowManager Wm) { Wm.removeViewImmediate(win); }
Example 17
Source File: ActivityThread.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private void handleDestroyActivity(IBinder token, boolean finishing, int configChanges, boolean getNonConfigInstance) { ActivityClientRecord r = performDestroyActivity(token, finishing, configChanges, getNonConfigInstance); if (r != null) { cleanUpPendingRemoveWindows(r); WindowManager wm = r.activity.getWindowManager(); View v = r.activity.mDecor; if (v != null) { if (r.activity.mVisibleFromServer) { mNumVisibleActivities--; } IBinder wtoken = v.getWindowToken(); if (r.activity.mWindowAdded) { if (r.onlyLocalRequest) { // Hold off on removing this until the new activity's // window is being added. r.mPendingRemoveWindow = v; r.mPendingRemoveWindowManager = wm; } else { wm.removeViewImmediate(v); } } if (wtoken != null && r.mPendingRemoveWindow == null) { WindowManagerImpl.getDefault().closeAll(wtoken, r.activity.getClass().getName(), "Activity"); } r.activity.mDecor = null; } if (r.mPendingRemoveWindow == null) { // If we are delaying the removal of the activity window, then // we can't clean up all windows here. Note that we can't do // so later either, which means any windows that aren't closed // by the app will leak. Well we try to warning them a lot // about leaking windows, because that is a bug, so if they are // using this recreate facility then they get to live with leaks. WindowManagerImpl.getDefault().closeAll(token, r.activity.getClass().getName(), "Activity"); } // Mocked out contexts won't be participating in the normal // process lifecycle, but if we're running with a proper // ApplicationContext we need to have it tear down things // cleanly. Context c = r.activity.getBaseContext(); if (c instanceof ContextImpl) { ((ContextImpl) c).scheduleFinalCleanup( r.activity.getClass().getName(), "Activity"); } } if (finishing) { try { ActivityManagerNative.getDefault().activityDestroyed(token); } catch (RemoteException ex) { // If the system process has died, it's game over for everyone. } } }
Example 18
Source File: ActivityThread.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private void handleDestroyActivity(IBinder token, boolean finishing, int configChanges, boolean getNonConfigInstance) { ActivityClientRecord r = performDestroyActivity(token, finishing, configChanges, getNonConfigInstance); if (r != null) { cleanUpPendingRemoveWindows(r); WindowManager wm = r.activity.getWindowManager(); View v = r.activity.mDecor; if (v != null) { if (r.activity.mVisibleFromServer) { mNumVisibleActivities--; } IBinder wtoken = v.getWindowToken(); if (r.activity.mWindowAdded) { if (r.onlyLocalRequest) { // Hold off on removing this until the new activity's // window is being added. r.mPendingRemoveWindow = v; r.mPendingRemoveWindowManager = wm; } else { wm.removeViewImmediate(v); } } if (wtoken != null && r.mPendingRemoveWindow == null) { WindowManagerImpl.getDefault().closeAll(wtoken, r.activity.getClass().getName(), "Activity"); } r.activity.mDecor = null; } if (r.mPendingRemoveWindow == null) { // If we are delaying the removal of the activity window, then // we can't clean up all windows here. Note that we can't do // so later either, which means any windows that aren't closed // by the app will leak. Well we try to warning them a lot // about leaking windows, because that is a bug, so if they are // using this recreate facility then they get to live with leaks. WindowManagerImpl.getDefault().closeAll(token, r.activity.getClass().getName(), "Activity"); } // Mocked out contexts won't be participating in the normal // process lifecycle, but if we're running with a proper // ApplicationContext we need to have it tear down things // cleanly. Context c = r.activity.getBaseContext(); if (c instanceof ContextImpl) { ((ContextImpl) c).scheduleFinalCleanup( r.activity.getClass().getName(), "Activity"); } } if (finishing) { try { ActivityManagerNative.getDefault().activityDestroyed(token); } catch (RemoteException ex) { // If the system process has died, it's game over for everyone. } } }