Java Code Examples for android.support.v7.app.AlertDialog#BUTTON_POSITIVE

The following examples show how to use android.support.v7.app.AlertDialog#BUTTON_POSITIVE . 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: OMADownloadHandler.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Shows a warning dialog indicating that download has failed. When user confirms
 * the warning, a message will be sent to the notification server to  inform about the
 * error.
 *
 * @param titleId The resource identifier for the title.
 * @param omaInfo Information about the OMA content.
 * @param downloadInfo Information about the download.
 * @param statusMessage Message to be sent to the notification server.
 */
private void showDownloadWarningDialog(
        int titleId, final OMAInfo omaInfo, final DownloadInfo downloadInfo,
        final String statusMessage) {
    DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                sendInstallNotificationAndNextStep(omaInfo, downloadInfo,
                        DownloadItem.INVALID_DOWNLOAD_ID, statusMessage);
            }
        }
    };
    new AlertDialog.Builder(
            ApplicationStatus.getLastTrackedFocusedActivity(), R.style.AlertDialogTheme)
            .setTitle(titleId)
            .setPositiveButton(R.string.ok, clickListener)
            .setCancelable(false)
            .show();
}
 
Example 2
Source File: OMADownloadHandler.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Shows a warning dialog indicating that download has failed. When user confirms
 * the warning, a message will be sent to the notification server to  inform about the
 * error.
 *
 * @param titleId The resource identifier for the title.
 * @param omaInfo Information about the OMA content.
 * @param downloadInfo Information about the download.
 * @param statusMessage Message to be sent to the notification server.
 */
private void showDownloadWarningDialog(
        int titleId, final OMAInfo omaInfo, final DownloadInfo downloadInfo,
        final String statusMessage) {
    DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                sendInstallNotificationAndNextStep(omaInfo, downloadInfo,
                        DownloadItem.INVALID_DOWNLOAD_ID, statusMessage);
            }
        }
    };
    new AlertDialog.Builder(
            ApplicationStatus.getLastTrackedFocusedActivity(), R.style.AlertDialogTheme)
            .setTitle(titleId)
            .setPositiveButton(R.string.ok, clickListener)
            .setCancelable(false)
            .show();
}
 
Example 3
Source File: OMADownloadHandler.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Shows a warning dialog indicating that download has failed. When user confirms
 * the warning, a message will be sent to the notification server to  inform about the
 * error.
 *
 * @param titleId The resource identifier for the title.
 * @param omaInfo Information about the OMA content.
 * @param downloadInfo Information about the download.
 * @param statusMessage Message to be sent to the notification server.
 */
private void showDownloadWarningDialog(
        int titleId, final OMAInfo omaInfo, final DownloadInfo downloadInfo,
        final String statusMessage) {
    DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                sendInstallNotificationAndNextStep(omaInfo, downloadInfo,
                        DownloadItem.INVALID_DOWNLOAD_ID, statusMessage);
            }
        }
    };
    new AlertDialog.Builder(
            ApplicationStatus.getLastTrackedFocusedActivity(), R.style.AlertDialogTheme)
            .setTitle(titleId)
            .setPositiveButton(R.string.ok, clickListener)
            .setCancelable(false)
            .show();
}
 
Example 4
Source File: CredentialsDialogFragment.java    From Cirrus_depricated with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) { 

        String username = mUsernameET.getText().toString();
        String password = mPasswordET.getText().toString();

        // Proceed with the authentication
        mHandler.proceed(username, password);

    } else if (which == AlertDialog.BUTTON_NEGATIVE) {
        mWebView.stopLoading();
        ((AuthenticatorActivity)getActivity()).doNegativeAuthenticatioDialogClick();
    }

    dialog.dismiss();
}
 
Example 5
Source File: OMADownloadHandler.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Shows a dialog to ask whether user wants to open the nextURL.
 *
 * @param omaInfo Information about the OMA content.
 */
private void showNextUrlDialog(OMAInfo omaInfo) {
    if (omaInfo.isValueEmpty(OMA_NEXT_URL)) {
        return;
    }
    final String nextUrl = omaInfo.getValue(OMA_NEXT_URL);
    final Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
    DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(nextUrl));
                intent.putExtra(Browser.EXTRA_APPLICATION_ID, activity.getPackageName());
                intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true);
                intent.setPackage(mContext.getPackageName());
                activity.startActivity(intent);
            }
        }
    };
    new AlertDialog.Builder(activity)
            .setTitle(R.string.open_url_post_oma_download)
            .setPositiveButton(R.string.ok, clickListener)
            .setNegativeButton(R.string.cancel, clickListener)
            .setMessage(nextUrl)
            .setCancelable(false)
            .show();
}
 
Example 6
Source File: ExportGPXTask.java    From android_maplibui with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
        case AlertDialog.BUTTON_POSITIVE:
            mSeparateFiles = false;
            break;
        case AlertDialog.BUTTON_NEUTRAL:
            mIsCanceled = true;
            break;
    }
    mIsChosen = true;
}
 
Example 7
Source File: SignOutDialogFragment.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT, mGaiaServiceType);

        mSignOutClicked = true;
        SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
        targetFragment.onSignOutClicked();
    }
}
 
Example 8
Source File: OMADownloadHandler.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Shows a dialog to ask whether user wants to open the nextURL.
 *
 * @param omaInfo Information about the OMA content.
 */
private void showNextUrlDialog(OMAInfo omaInfo) {
    if (omaInfo.isValueEmpty(OMA_NEXT_URL)) {
        return;
    }
    final String nextUrl = omaInfo.getValue(OMA_NEXT_URL);
    final Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
    DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(nextUrl));
                intent.putExtra(Browser.EXTRA_APPLICATION_ID, activity.getPackageName());
                intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true);
                intent.setPackage(mContext.getPackageName());
                activity.startActivity(intent);
            }
        }
    };
    new AlertDialog.Builder(activity)
            .setTitle(R.string.open_url_post_oma_download)
            .setPositiveButton(R.string.ok, clickListener)
            .setNegativeButton(R.string.cancel, clickListener)
            .setMessage(nextUrl)
            .setCancelable(false)
            .show();
}
 
Example 9
Source File: RenameFileDialogFragment.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        String newFileName = 
            ((TextView)(getDialog().findViewById(R.id.user_input)))
                .getText().toString().trim();
        
        if (newFileName.length() <= 0) {
            Toast.makeText(
                    getActivity(),
                    R.string.filename_empty, 
                    Toast.LENGTH_LONG).show();
            return;
        }

        boolean serverWithForbiddenChars = ((ComponentsGetter)getActivity()).
                getFileOperationsHelper().isVersionWithForbiddenCharacters();

        if (!FileUtils.isValidName(newFileName, serverWithForbiddenChars)) {
            int messageId = 0;
            if (serverWithForbiddenChars) {
                messageId = R.string.filename_forbidden_charaters_from_server;
            } else {
                messageId = R.string.filename_forbidden_characters;
            }
            Toast.makeText(getActivity(), messageId, Toast.LENGTH_LONG).show();
            return;
        }

        ((ComponentsGetter)getActivity()).getFileOperationsHelper().
                renameFile(mTargetFile, newFileName);

    }
}
 
Example 10
Source File: CreateFolderDialogFragment.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        String newFolderName = 
                ((TextView)(getDialog().findViewById(R.id.user_input)))
                    .getText().toString().trim();
        
        if (newFolderName.length() <= 0) {
            Toast.makeText(
                    getActivity(),
                    R.string.filename_empty, 
                    Toast.LENGTH_LONG).show();
            return;
        }
        boolean serverWithForbiddenChars = ((ComponentsGetter)getActivity()).
                getFileOperationsHelper().isVersionWithForbiddenCharacters();

        if (!FileUtils.isValidName(newFolderName, serverWithForbiddenChars)) {
            int messageId = 0;
            if (serverWithForbiddenChars) {
                messageId = R.string.filename_forbidden_charaters_from_server;
            } else {
                messageId = R.string.filename_forbidden_characters;
            }
            Toast.makeText(getActivity(), messageId, Toast.LENGTH_LONG).show();

            return;
        }
        
        String path = mParentFolder.getRemotePath();
        path += newFolderName + OCFile.PATH_SEPARATOR;
        ((ComponentsGetter)getActivity()).
            getFileOperationsHelper().createFolder(path, false);
    }
}
 
Example 11
Source File: SharePasswordDialogFragment.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        String password =
                ((TextView)(getDialog().findViewById(R.id.share_password)))
                        .getText().toString();

        if (password.length() <= 0) {
            Toast.makeText(
                    getActivity(),
                    R.string.share_link_empty_password,
                    Toast.LENGTH_LONG).show();
            return;
        }

        if (mCreateShare) {
            // Share the file
            ((FileActivity) getActivity()).getFileOperationsHelper().
                    shareFileViaLink(mFile, password);

        } else {
            // updat existing link
            ((FileActivity) getActivity()).getFileOperationsHelper().
                    setPasswordToShareViaLink(mFile, password);
        }
    }
}
 
Example 12
Source File: SignOutDialogFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT, mGaiaServiceType);

        mSignOutClicked = true;
        SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
        targetFragment.onSignOutClicked();
    }
}
 
Example 13
Source File: OMADownloadHandler.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Shows a dialog to ask whether user wants to open the nextURL.
 *
 * @param omaInfo Information about the OMA content.
 */
private void showNextUrlDialog(OMAInfo omaInfo) {
    if (omaInfo.isValueEmpty(OMA_NEXT_URL)) {
        return;
    }
    final String nextUrl = omaInfo.getValue(OMA_NEXT_URL);
    final Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
    DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(nextUrl));
                intent.putExtra(Browser.EXTRA_APPLICATION_ID, activity.getPackageName());
                intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true);
                intent.setPackage(mContext.getPackageName());
                activity.startActivity(intent);
            }
        }
    };
    new AlertDialog.Builder(activity)
            .setTitle(R.string.open_url_post_oma_download)
            .setPositiveButton(R.string.ok, clickListener)
            .setNegativeButton(R.string.cancel, clickListener)
            .setMessage(nextUrl)
            .setCancelable(false)
            .show();
}
 
Example 14
Source File: GeneratedQRCodeDialog.java    From android-wallet-app with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialogInterface, int which) {
    switch (which) {
        case AlertDialog.BUTTON_POSITIVE:
            shareQRCode(getActivity(), bitmap);
            getDialog().dismiss();
    }
}
 
Example 15
Source File: ForgotPasswordDialog.java    From android-wallet-app with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialogInterface, int which) {
    switch (which) {
        case AlertDialog.BUTTON_POSITIVE:
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
            prefs.edit().remove(Constants.PREFERENCE_ENC_SEED).apply();
            getDialog().dismiss();
            Intent intent = new Intent(getActivity().getIntent());
            getActivity().startActivityForResult(intent, Constants.REQUEST_CODE_LOGIN);
    }
}
 
Example 16
Source File: SignOutDialogFragment.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT, mGaiaServiceType);

        mSignOutClicked = true;
        SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
        targetFragment.onSignOutClicked();
    }
}
 
Example 17
Source File: ConfirmImportantSitesDialogFragment.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // We check the domains and urls as well due to crbug.com/622879.
    if (savedInstanceState != null) {
        // The important domains and favicon URLs aren't currently saved, so if this dialog
        // is recreated from a saved instance they will be null. This method must return a
        // valid dialog, so these two array's are initialized, then the dialog is dismissed.
        // TODO(dmurph): save mImportantDomains and mFaviconURLs so that they can be restored
        // from a savedInstanceState and the dialog can be properly recreated rather than
        // dismissed.
        mImportantDomains = new String[0];
        mFaviconURLs = new String[0];
        dismiss();
    }
    mProfile = Profile.getLastUsedProfile().getOriginalProfile();
    mLargeIconBridge = new LargeIconBridge(mProfile);
    ActivityManager activityManager =
            ((ActivityManager) ContextUtils.getApplicationContext().getSystemService(
                    Context.ACTIVITY_SERVICE));
    int maxSize = Math.min(
            activityManager.getMemoryClass() / 16 * 25 * 1024, FAVICON_MAX_CACHE_SIZE_BYTES);
    mLargeIconBridge.createCache(maxSize);

    mAdapter = new ClearBrowsingDataAdapter(mImportantDomains, mFaviconURLs, getResources());
    DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                Intent data = new Intent();
                List<String> deselectedDomains = new ArrayList<>();
                List<Integer> deselectedDomainReasons = new ArrayList<>();
                List<String> ignoredDomains = new ArrayList<>();
                List<Integer> ignoredDomainReasons = new ArrayList<>();
                for (Entry<String, Boolean> entry : mCheckedState.entrySet()) {
                    Integer reason = mImportantDomainsReasons.get(entry.getKey());
                    if (entry.getValue()) {
                        ignoredDomains.add(entry.getKey());
                        ignoredDomainReasons.add(reason);
                    } else {
                        deselectedDomains.add(entry.getKey());
                        deselectedDomainReasons.add(reason);
                    }
                }
                data.putExtra(DESELECTED_DOMAINS_TAG, deselectedDomains.toArray(new String[0]));
                data.putExtra(
                        DESELECTED_DOMAIN_REASONS_TAG, toIntArray(deselectedDomainReasons));
                data.putExtra(IGNORED_DOMAINS_TAG, ignoredDomains.toArray(new String[0]));
                data.putExtra(IGNORED_DOMAIN_REASONS_TAG, toIntArray(ignoredDomainReasons));
                getTargetFragment().onActivityResult(
                        getTargetRequestCode(), Activity.RESULT_OK, data);
            } else {
                getTargetFragment().onActivityResult(getTargetRequestCode(),
                        Activity.RESULT_CANCELED, getActivity().getIntent());
            }
        }
    };
    // We create our own ListView, as AlertDialog doesn't let us set a message and a list
    // adapter at the same time.
    View messageAndListView = getActivity().getLayoutInflater().inflate(
            R.layout.clear_browsing_important_dialog_listview, null);
    mSitesListView = (ListView) messageAndListView.findViewById(R.id.select_dialog_listview);
    mSitesListView.setAdapter(mAdapter);
    mSitesListView.setOnItemClickListener(mAdapter);
    final AlertDialog.Builder builder =
            new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
                    .setTitle(R.string.storage_clear_site_storage_title)
                    .setPositiveButton(R.string.clear_browsing_data_important_dialog_button,
                            listener)
                    .setNegativeButton(R.string.cancel, listener)
                    .setView(messageAndListView);
    mDialog = builder.create();

    return mDialog;
}
 
Example 18
Source File: ConfirmImportantSitesDialogFragment.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // We check the domains and urls as well due to crbug.com/622879.
    if (savedInstanceState != null || mImportantDomains == null || mFaviconURLs == null) {
        dismiss();
    }
    mProfile = Profile.getLastUsedProfile().getOriginalProfile();
    mLargeIconBridge = new LargeIconBridge(mProfile);
    ActivityManager activityManager =
            ((ActivityManager) ContextUtils.getApplicationContext().getSystemService(
                    Context.ACTIVITY_SERVICE));
    int maxSize = Math.min(
            activityManager.getMemoryClass() / 16 * 25 * 1024, FAVICON_MAX_CACHE_SIZE_BYTES);
    mLargeIconBridge.createCache(maxSize);

    mAdapter = new ClearBrowsingDataAdapter(mImportantDomains, mFaviconURLs, getResources());
    DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                // Return our deselected domains.
                Intent data = new Intent();
                String[] deselectedDomains = mDeselectedDomains.toArray(new String[0]);
                data.putExtra(DESELECTED_DOMAINS_TAG, deselectedDomains);
                getTargetFragment().onActivityResult(
                        getTargetRequestCode(), Activity.RESULT_OK, data);
            } else {
                getTargetFragment().onActivityResult(getTargetRequestCode(),
                        Activity.RESULT_CANCELED, getActivity().getIntent());
            }
        }
    };
    // We create our own ListView, as AlertDialog doesn't let us set a message and a list
    // adapter at the same time.
    View messageAndListView = getActivity().getLayoutInflater().inflate(
            R.layout.clear_browsing_important_dialog_listview, null);
    mSitesListView = (ListView) messageAndListView.findViewById(R.id.select_dialog_listview);
    mSitesListView.setAdapter(mAdapter);
    mSitesListView.setOnItemClickListener(mAdapter);
    final AlertDialog.Builder builder =
            new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
                    .setTitle(R.string.storage_clear_site_storage_title)
                    .setPositiveButton(R.string.clear_browsing_data_important_dialog_button,
                            listener)
                    .setNegativeButton(R.string.cancel, listener)
                    .setView(messageAndListView);
    mDialog = builder.create();

    return mDialog;
}
 
Example 19
Source File: ConfirmImportantSitesDialogFragment.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // We check the domains and urls as well due to crbug.com/622879.
    if (savedInstanceState != null) {
        // The important domains and favicon URLs aren't currently saved, so if this dialog
        // is recreated from a saved instance they will be null. This method must return a
        // valid dialog, so these two array's are initialized, then the dialog is dismissed.
        // TODO(dmurph): save mImportantDomains and mFaviconURLs so that they can be restored
        // from a savedInstanceState and the dialog can be properly recreated rather than
        // dismissed.
        mImportantDomains = new String[0];
        mFaviconURLs = new String[0];
        dismiss();
    }
    mProfile = Profile.getLastUsedProfile().getOriginalProfile();
    mLargeIconBridge = new LargeIconBridge(mProfile);
    ActivityManager activityManager =
            ((ActivityManager) ContextUtils.getApplicationContext().getSystemService(
                    Context.ACTIVITY_SERVICE));
    int maxSize = Math.min(
            activityManager.getMemoryClass() / 16 * 25 * 1024, FAVICON_MAX_CACHE_SIZE_BYTES);
    mLargeIconBridge.createCache(maxSize);

    mAdapter = new ClearBrowsingDataAdapter(mImportantDomains, mFaviconURLs, getResources());
    DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                Intent data = new Intent();
                List<String> deselectedDomains = new ArrayList<>();
                List<Integer> deselectedDomainReasons = new ArrayList<>();
                List<String> ignoredDomains = new ArrayList<>();
                List<Integer> ignoredDomainReasons = new ArrayList<>();
                for (Entry<String, Boolean> entry : mCheckedState.entrySet()) {
                    Integer reason = mImportantDomainsReasons.get(entry.getKey());
                    if (entry.getValue()) {
                        ignoredDomains.add(entry.getKey());
                        ignoredDomainReasons.add(reason);
                    } else {
                        deselectedDomains.add(entry.getKey());
                        deselectedDomainReasons.add(reason);
                    }
                }
                data.putExtra(DESELECTED_DOMAINS_TAG, deselectedDomains.toArray(new String[0]));
                data.putExtra(
                        DESELECTED_DOMAIN_REASONS_TAG, toIntArray(deselectedDomainReasons));
                data.putExtra(IGNORED_DOMAINS_TAG, ignoredDomains.toArray(new String[0]));
                data.putExtra(IGNORED_DOMAIN_REASONS_TAG, toIntArray(ignoredDomainReasons));
                getTargetFragment().onActivityResult(
                        getTargetRequestCode(), Activity.RESULT_OK, data);
            } else {
                getTargetFragment().onActivityResult(getTargetRequestCode(),
                        Activity.RESULT_CANCELED, getActivity().getIntent());
            }
        }
    };
    // We create our own ListView, as AlertDialog doesn't let us set a message and a list
    // adapter at the same time.
    View messageAndListView = getActivity().getLayoutInflater().inflate(
            R.layout.clear_browsing_important_dialog_listview, null);
    mSitesListView = (ListView) messageAndListView.findViewById(R.id.select_dialog_listview);
    mSitesListView.setAdapter(mAdapter);
    mSitesListView.setOnItemClickListener(mAdapter);
    final AlertDialog.Builder builder =
            new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
                    .setTitle(R.string.storage_clear_site_storage_title)
                    .setPositiveButton(R.string.clear_browsing_data_important_dialog_button,
                            listener)
                    .setNegativeButton(R.string.cancel, listener)
                    .setView(messageAndListView);
    mDialog = builder.create();

    return mDialog;
}