Java Code Examples for org.chromium.base.ApplicationStatus#unregisterActivityStateListener()

The following examples show how to use org.chromium.base.ApplicationStatus#unregisterActivityStateListener() . 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: ChromeFullscreenManager.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityStateChange(Activity activity, int newState) {
    if (newState == ActivityState.STOPPED) {
        // Exit fullscreen in onStop to ensure the system UI flags are set correctly when
        // showing again (on JB MR2+ builds, the omnibox would be covered by the
        // notification bar when this was done in onStart()).
        setPersistentFullscreenMode(false);
    } else if (newState == ActivityState.STARTED) {
        // Force the controls to be shown until we get an update from a Tab.  This is a
        // workaround for when the renderer is killed but the Tab is not notified.
        mActivityShowToken = showControlsPersistentAndClearOldToken(mActivityShowToken);
    } else if (newState == ActivityState.DESTROYED) {
        ApplicationStatus.unregisterActivityStateListener(this);
        ((BaseChromiumApplication) mWindow.getContext().getApplicationContext())
                .unregisterWindowFocusChangedListener(this);
    }
}
 
Example 2
Source File: ChromeFullscreenManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityStateChange(Activity activity, int newState) {
    if (newState == ActivityState.STOPPED && mExitFullscreenOnStop) {
        // Exit fullscreen in onStop to ensure the system UI flags are set correctly when
        // showing again (on JB MR2+ builds, the omnibox would be covered by the
        // notification bar when this was done in onStart()).
        setPersistentFullscreenMode(false);
    } else if (newState == ActivityState.STARTED) {
        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
            @Override
            public void run() {
                mBrowserVisibilityDelegate.showControlsTransient();
            }
        }, ACTIVITY_RETURN_SHOW_REQUEST_DELAY_MS);
    } else if (newState == ActivityState.DESTROYED) {
        ApplicationStatus.unregisterActivityStateListener(this);
        ((BaseChromiumApplication) mWindow.getContext().getApplicationContext())
                .unregisterWindowFocusChangedListener(this);

        mTabModelObserver.destroy();
    }
}
 
Example 3
Source File: PrintShareActivity.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private static void unregisterActivity(final Activity activity) {
    ThreadUtils.assertOnUiThread();

    sPendingShareActivities.remove(activity);
    if (!sPendingShareActivities.isEmpty()) return;
    ApplicationStatus.unregisterActivityStateListener(sStateListener);

    waitForPendingStateChangeTask();
    sStateChangeTask = new AsyncTask<Void, Void, Void>() {
        @Override
        protected Void doInBackground(Void... params) {
            if (!sPendingShareActivities.isEmpty()) return null;

            activity.getPackageManager().setComponentEnabledSetting(
                    new ComponentName(activity, PrintShareActivity.class),
                    PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                    PackageManager.DONT_KILL_APP);
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            if (sStateChangeTask == this) sStateChangeTask = null;
        }
    }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example 4
Source File: ChromeFullscreenManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityStateChange(Activity activity, int newState) {
    if (newState == ActivityState.STOPPED) {
        // Exit fullscreen in onStop to ensure the system UI flags are set correctly when
        // showing again (on JB MR2+ builds, the omnibox would be covered by the
        // notification bar when this was done in onStart()).
        setPersistentFullscreenMode(false);
    } else if (newState == ActivityState.STARTED) {
        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
            @Override
            public void run() {
                mBrowserVisibilityDelegate.showControlsTransient();
            }
        }, ACTIVITY_RETURN_SHOW_REQUEST_DELAY_MS);
    } else if (newState == ActivityState.DESTROYED) {
        ApplicationStatus.unregisterActivityStateListener(this);
        ((BaseChromiumApplication) mWindow.getContext().getApplicationContext())
                .unregisterWindowFocusChangedListener(this);

        mTabModelObserver.destroy();
    }
}
 
Example 5
Source File: PermissionUpdateInfoBarDelegate.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void onNativeDestroyed() {
    mNativePtr = 0;
    if (mActivityStateListener != null) {
        ApplicationStatus.unregisterActivityStateListener(mActivityStateListener);
        mActivityStateListener = null;
    }
}
 
Example 6
Source File: VrShellDelegate.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void destroy() {
    if (sInstance == null) return;
    shutdownVr(false /* disableVrMode */, false /* canReenter */, false /* stayingInChrome */);
    if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate);
    mNativeVrShellDelegate = 0;
    ApplicationStatus.unregisterActivityStateListener(this);
    sInstance = null;
}
 
Example 7
Source File: DownloadPage.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void destroy() {
    mManager.onDestroyed();
    mManager = null;
    ApplicationStatus.unregisterActivityStateListener(mActivityStateListener);
    super.destroy();
}
 
Example 8
Source File: OptionalShareTargetsManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Handles when the triggering activity has finished the sharing operation. If all
 * pending shares have been complete then it will disable all enabled components.
 * @param triggeringActivity The activity that is triggering the share action.
 */
public static void handleShareFinish(final Activity triggeringActivity) {
    ThreadUtils.assertOnUiThread();

    sPendingShareActivities.remove(triggeringActivity);
    if (!sPendingShareActivities.isEmpty()) return;
    ApplicationStatus.unregisterActivityStateListener(sStateListener);

    waitForPendingStateChangeTask();
    sStateChangeTask = new AsyncTask<Void, Void, Void>() {
        @Override
        protected Void doInBackground(Void... params) {
            if (!sPendingShareActivities.isEmpty()) return null;
            for (int i = 0; i < sEnabledComponents.size(); i++) {
                triggeringActivity.getPackageManager().setComponentEnabledSetting(
                        sEnabledComponents.get(i),
                        PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                        PackageManager.DONT_KILL_APP);
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            if (sStateChangeTask == this) sStateChangeTask = null;
        }
    }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example 9
Source File: PermissionUpdateInfoBarDelegate.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void onNativeDestroyed() {
    mNativePtr = 0;
    if (mActivityStateListener != null) {
        ApplicationStatus.unregisterActivityStateListener(mActivityStateListener);
        mActivityStateListener = null;
    }
}
 
Example 10
Source File: DownloadPage.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void destroy() {
    mManager.onDestroyed();
    mManager = null;
    ApplicationStatus.unregisterActivityStateListener(mActivityStateListener);
    super.destroy();
}
 
Example 11
Source File: PermissionUpdateInfoBarDelegate.java    From delion with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void onNativeDestroyed() {
    mNativePtr = 0;
    if (mActivityStateListener != null) {
        ApplicationStatus.unregisterActivityStateListener(mActivityStateListener);
        mActivityStateListener = null;
    }
}
 
Example 12
Source File: AlwaysDismissedDialog.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void dismiss() {
    super.dismiss();
    ApplicationStatus.unregisterActivityStateListener(this);
}
 
Example 13
Source File: AlwaysDismissedDialog.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void dismiss() {
    super.dismiss();
    ApplicationStatus.unregisterActivityStateListener(this);
}
 
Example 14
Source File: OverlayPanel.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Destroy the native components associated with this panel's content.
 */
public void destroy() {
    closePanel(StateChangeReason.UNKNOWN, false);
    ApplicationStatus.unregisterActivityStateListener(this);
}
 
Example 15
Source File: OverlayPanel.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Destroy the native components associated with this panel's content.
 */
public void destroy() {
    closePanel(StateChangeReason.UNKNOWN, false);
    ApplicationStatus.unregisterActivityStateListener(this);
}
 
Example 16
Source File: AlwaysDismissedDialog.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void dismiss() {
    super.dismiss();
    ApplicationStatus.unregisterActivityStateListener(this);
}
 
Example 17
Source File: SuggestionsSheetVisibilityChangeObserver.java    From 365browser with Apache License 2.0 4 votes vote down vote up
public void onDestroy() {
    ApplicationStatus.unregisterActivityStateListener(this);
    mBottomSheet.removeObserver(this);
}
 
Example 18
Source File: DownloadSheetContent.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void destroy() {
    mDownloadManager.onDestroyed();
    mDownloadManager = null;
    ApplicationStatus.unregisterActivityStateListener(mActivityStateListener);
}
 
Example 19
Source File: TabModelSelectorUma.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Cleans up any external dependencies of this class.
 */
public void destroy() {
    ApplicationStatus.unregisterActivityStateListener(this);
}
 
Example 20
Source File: OverlayPanel.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Destroy the native components associated with this panel's content.
 */
public void destroy() {
    closePanel(StateChangeReason.UNKNOWN, false);
    ApplicationStatus.unregisterActivityStateListener(this);
}