Example usage for android.app AlertDialog setTitle

List of usage examples for android.app AlertDialog setTitle

Introduction

In this page you can find the example usage for android.app AlertDialog setTitle.

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:org.adaway.ui.WhitelistFragment.java

/**
 * Add new entry based on input//from ww w  . j  a  va2 s .c  om
 *
 * @param input
 */
private void addEntry(String input) {
    if (input != null) {
        if (RegexUtils.isValidWhitelistHostname(input)) {
            ProviderHelper.insertWhitelistItem(mActivity, input);
        } else {
            AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create();
            alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
            alertDialog.setTitle(R.string.no_hostname_title);
            alertDialog.setMessage(getString(org.adaway.R.string.no_hostname));
            alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dlg, int sum) {
                    dlg.dismiss();
                }
            });
            alertDialog.show();
        }
    }
}

From source file:org.adawaycn.ui.WhitelistFragment.java

/**
 * Add new entry based on input//from w ww. j a  va  2s .c om
 *
 * @param input
 */
private void addEntry(String input) {
    if (input != null) {
        if (RegexUtils.isValidWhitelistHostname(input)) {
            ProviderHelper.insertWhitelistItem(mActivity, input);
        } else {
            AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create();
            alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
            alertDialog.setTitle(R.string.no_hostname_title);
            alertDialog.setMessage(getString(R.string.no_hostname));
            alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dlg, int sum) {
                    dlg.dismiss();
                }
            });
            alertDialog.show();
        }
    }
}

From source file:org.adawaycn.ui.BlacklistFragment.java

/**
 * Add new entry based on input//w  w w . j a v a 2s  .co m
 *
 * @param input
 */
private void addEntry(String input) {
    if (input != null) {
        if (org.adawaycn.util.RegexUtils.isValidHostname(input)) {
            org.adawaycn.provider.ProviderHelper.insertBlacklistItem(mActivity, input);
        } else {
            AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create();
            alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
            alertDialog.setTitle(R.string.no_hostname_title);
            alertDialog.setMessage(getString(R.string.no_hostname));
            alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dlg, int sum) {
                    dlg.dismiss();
                }
            });
            alertDialog.show();
        }
    }
}

From source file:org.fdroid.fdroid.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_login:
        if (mService != null) {
            com.skubit.Utils.startAuthorization(this, mService);
        } else {/*w  w  w.j av  a 2s .co  m*/
            if (!com.skubit.Utils.isIabInstalled(getPackageManager())) {
                startActivityForResult(com.skubit.Utils.getIabIntent(), com.skubit.Utils.PLAY_CODE);
            }
        }
        return true;
    case R.id.action_update_repo:
        updateRepos();
        return true;

    case R.id.action_manage_repos:
        Intent i = new Intent(this, ManageReposActivity.class);
        startActivityForResult(i, REQUEST_MANAGEREPOS);
        return true;

    case R.id.action_settings:
        Intent prefs = new Intent(getBaseContext(), PreferencesActivity.class);
        startActivityForResult(prefs, REQUEST_PREFS);
        return true;

    case R.id.action_swap:
        startActivity(new Intent(this, SwapActivity.class));
        return true;

    case R.id.action_search:
        onSearchRequested();
        return true;

    case R.id.action_bluetooth_apk:
        /*
         * If Bluetooth has not been enabled/turned on, then enabling
         * device discoverability will automatically enable Bluetooth
         */
        Intent discoverBt = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
        discoverBt.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 121);
        startActivityForResult(discoverBt, REQUEST_ENABLE_BLUETOOTH);
        // if this is successful, the Bluetooth transfer is started
        return true;

    case R.id.action_about:
        View view = null;
        if (Build.VERSION.SDK_INT >= 11) {
            LayoutInflater li = LayoutInflater.from(this);
            view = li.inflate(R.layout.about, null);
        } else {
            view = View.inflate(new ContextThemeWrapper(this, R.style.AboutDialogLight), R.layout.about, null);
        }

        // Fill in the version...
        try {
            PackageInfo pi = getPackageManager().getPackageInfo(getApplicationContext().getPackageName(), 0);
            ((TextView) view.findViewById(R.id.version)).setText(pi.versionName);
        } catch (Exception e) {
        }

        AlertDialog.Builder p = null;
        if (Build.VERSION.SDK_INT >= 11) {
            p = new AlertDialog.Builder(this).setView(view);
        } else {
            p = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AboutDialogLight)).setView(view);
        }
        final AlertDialog alrt = p.create();
        alrt.setIcon(R.drawable.ic_launcher_market);
        alrt.setTitle(getString(R.string.about_title));
        alrt.setButton(AlertDialog.BUTTON_NEUTRAL, getString(R.string.about_website),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int whichButton) {
                        Uri uri = Uri.parse("https://f-droid.org");
                        startActivity(new Intent(Intent.ACTION_VIEW, uri));
                    }
                });
        alrt.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.ok),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                });
        alrt.show();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.github.sgelb.booket.SearchResultActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search_results);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    noResults = (TextView) findViewById(R.id.noResultsTextView);
    defaultThumbnail = BitmapFactory.decodeResource(getResources(), R.drawable.ic_default_cover);

    bookList = new ArrayList<>();
    resultList = (ListView) findViewById(R.id.searchResultsList);
    downloadProgressBar = (ProgressBar) findViewById(R.id.downloadProgressBar);
    datasource = new BooksDataSource(this);

    BookInfos bookInfos = new BookInfos();
    bookInfos.execute(createUrl());//from  www .  j  a  v  a  2 s. co  m
    adapter = new BookResultAdapter(bookList, this);
    resultList.setAdapter(adapter);

    // Save book in database
    resultList.setOnItemLongClickListener(new OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {

            AlertDialog alert = new AlertDialog.Builder(SearchResultActivity.this).create();
            alert.setTitle(
                    Html.fromHtml(getString(R.string.dialog_save_book, bookList.get(position).getTitle())));
            alert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.ok), new OnClickListener() {
                public void onClick(final DialogInterface dialog, final int which) {
                    saveBook(position);
                }
            });
            alert.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel), new OnClickListener() {
                public void onClick(final DialogInterface dialog, final int which) {
                }
            });
            alert.show();

            return true;
        }
    });

    // Expand list row
    resultList.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            adapter.toggleExpand(view, position);
        }
    });

}

From source file:com.acrylicgoat.devchat.MainActivity.java

private void displayPopup() {
    //retrieve yesterday's data
    String yData = getYesterday(currentOwner);
    if (yData.equals("")) {
        yData = getString(R.string.no_yesterday);
    }//  w  w  w  .j av  a2 s .com
    //display in popup
    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle("Last Chat");
    alertDialog.setMessage(yData);
    alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "Done", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            //do nothing

        }
    });
    alertDialog.show();
}

From source file:sssemil.com.hostsaway.ui.HostsSourcesFragment.java

/**
 * Add new entry based on input/* w ww .java 2  s .com*/
 *
 * @param input
 */
private void addEntry(String input) {
    if (input != null) {
        if (RegexUtils.isValidUrl(input)) {

            // insert hosts source into database
            ProviderHelper.insertHostsSource(mActivity, input);
        } else {
            AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create();
            alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
            alertDialog.setTitle(R.string.no_url_title);
            alertDialog.setMessage(getString(sssemil.com.hostsaway.R.string.no_url));
            alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dlg, int sum) {
                    dlg.dismiss();
                }
            });
            alertDialog.show();
        }
    }
}

From source file:org.adaway.ui.HostsSourcesFragment.java

/**
 * Add new entry based on input/*  w w  w.j  a va2 s .  c o m*/
 *
 * @param input
 */
private void addEntry(String input) {
    if (input != null) {
        if (RegexUtils.isValidUrl(input)) {

            // insert hosts source into database
            ProviderHelper.insertHostsSource(mActivity, input);
        } else {
            AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create();
            alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
            alertDialog.setTitle(R.string.no_url_title);
            alertDialog.setMessage(getString(org.adaway.R.string.no_url));
            alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dlg, int sum) {
                    dlg.dismiss();
                }
            });
            alertDialog.show();
        }
    }
}

From source file:org.adawaycn.ui.HostsSourcesFragment.java

/**
 * Add new entry based on input/* w  ww  .j a v  a2s  .  c  o  m*/
 *
 * @param input
 */
private void addEntry(String input) {
    if (input != null) {
        if (RegexUtils.isValidUrl(input)) {

            // insert hosts source into database
            ProviderHelper.insertHostsSource(mActivity, input);
        } else {
            AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create();
            alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
            alertDialog.setTitle(R.string.no_url_title);
            alertDialog.setMessage(getString(R.string.no_url));
            alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dlg, int sum) {
                    dlg.dismiss();
                }
            });
            alertDialog.show();
        }
    }
}

From source file:com.acrylicgoat.scrumnotes.MainActivity.java

private void displayPopup() {
    //retrieve yesterday's data
    String yData = getYesterday(currentOwner);
    if (yData.equals("")) {
        yData = getString(R.string.no_yesterday);
    }/* w  w  w .  jav  a2  s . c om*/
    //display in popup
    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle("Yesterday");
    alertDialog.setMessage(yData);
    alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "Done", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            //do nothing

        }
    });
    alertDialog.show();
}