Java Code Examples for org.chromium.chrome.browser.multiwindow.MultiWindowUtils#isActivityVisible()

The following examples show how to use org.chromium.chrome.browser.multiwindow.MultiWindowUtils#isActivityVisible() . 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: ClearBrowsingDataPreferences.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Called when clearing browsing data completes.
 * Implements the ChromePreferences.OnClearBrowsingDataListener interface.
 */
@Override
public void onBrowsingDataCleared() {
    if (getActivity() == null) return;

    // If the user deleted their browsing history, the dialog about other forms of history
    // is enabled, and it has never been shown before, show it. Note that opening a new
    // DialogFragment is only possible if the Activity is visible.
    //
    // If conditions to show the dialog about other forms of history are not met, just close
    // this preference screen.
    if (MultiWindowUtils.isActivityVisible(getActivity())
            && getSelectedOptions().contains(DialogOption.CLEAR_HISTORY)
            && mIsDialogAboutOtherFormsOfBrowsingHistoryEnabled
            && !OtherFormsOfHistoryDialogFragment.wasDialogShown(getActivity())) {
        mDialogAboutOtherFormsOfBrowsingHistory = new OtherFormsOfHistoryDialogFragment();
        mDialogAboutOtherFormsOfBrowsingHistory.show(getActivity());
        dismissProgressDialog();
        RecordHistogram.recordBooleanHistogram(DIALOG_HISTOGRAM, true);
    } else {
        dismissProgressDialog();
        getActivity().finish();
        RecordHistogram.recordBooleanHistogram(DIALOG_HISTOGRAM, false);
    }
}
 
Example 2
Source File: ClearBrowsingDataPreferences.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Called when clearing browsing data completes.
 * Implements the ChromePreferences.OnClearBrowsingDataListener interface.
 */
@Override
public void onBrowsingDataCleared() {
    if (getActivity() == null) return;

    // If the user deleted their browsing history, the dialog about other forms of history
    // is enabled, and it has never been shown before, show it. Note that opening a new
    // DialogFragment is only possible if the Activity is visible.
    //
    // If conditions to show the dialog about other forms of history are not met, just close
    // this preference screen.
    if (MultiWindowUtils.isActivityVisible(getActivity())
            && getSelectedOptions().contains(DialogOption.CLEAR_HISTORY)
            && mIsDialogAboutOtherFormsOfBrowsingHistoryEnabled
            && !OtherFormsOfHistoryDialogFragment.wasDialogShown(getActivity())) {
        mDialogAboutOtherFormsOfBrowsingHistory = new OtherFormsOfHistoryDialogFragment();
        mDialogAboutOtherFormsOfBrowsingHistory.show(getActivity());
        dismissProgressDialog();
        RecordHistogram.recordBooleanHistogram(DIALOG_HISTOGRAM, true);
    } else {
        dismissProgressDialog();
        getActivity().finish();
        RecordHistogram.recordBooleanHistogram(DIALOG_HISTOGRAM, false);
    }
}