Example usage for android.app AlertDialog.Builder setInverseBackgroundForced

List of usage examples for android.app AlertDialog.Builder setInverseBackgroundForced

Introduction

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

Prototype

public void setInverseBackgroundForced(boolean forceInverseBackground) 

Source Link

Usage

From source file:de.schildbach.wallet.ui.EditAddressBookEntryFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final String address = args.getString(KEY_ADDRESS);
    final String suggestedAddressLabel = args.getString(KEY_SUGGESTED_ADDRESS_LABEL);

    final LayoutInflater inflater = LayoutInflater.from(activity);

    final Uri uri = AddressBookProvider.contentUri(activity.getPackageName()).buildUpon().appendPath(address)
            .build();//w ww  . j a v a 2s .  co  m

    final String label = AddressBookProvider.resolveLabel(activity, address);

    final boolean isAdd = label == null;

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    dialog.setTitle(isAdd ? R.string.edit_address_book_entry_dialog_title_add
            : R.string.edit_address_book_entry_dialog_title_edit);

    final View view = inflater.inflate(R.layout.edit_address_book_entry_dialog, null);

    final TextView viewAddress = (TextView) view.findViewById(R.id.edit_address_book_entry_address);
    viewAddress.setText(WalletUtils.formatHash(address, Constants.ADDRESS_FORMAT_GROUP_SIZE,
            Constants.ADDRESS_FORMAT_LINE_SIZE));

    final TextView viewLabel = (TextView) view.findViewById(R.id.edit_address_book_entry_label);
    viewLabel.setText(label != null ? label : suggestedAddressLabel);

    dialog.setView(view);

    final DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                final String newLabel = viewLabel.getText().toString().trim();

                if (!newLabel.isEmpty()) {
                    final ContentValues values = new ContentValues();
                    values.put(AddressBookProvider.KEY_LABEL, newLabel);

                    if (isAdd)
                        contentResolver.insert(uri, values);
                    else
                        contentResolver.update(uri, values, null, null);
                } else if (!isAdd) {
                    contentResolver.delete(uri, null, null);
                }
            } else if (which == DialogInterface.BUTTON_NEUTRAL) {
                contentResolver.delete(uri, null, null);
            }

            dismiss();
        }
    };

    dialog.setPositiveButton(isAdd ? R.string.button_add : R.string.edit_address_book_entry_dialog_button_edit,
            onClickListener);
    if (!isAdd)
        dialog.setNeutralButton(R.string.button_delete, onClickListener);
    dialog.setNegativeButton(R.string.button_cancel, onClickListener);

    return dialog.create();
}

From source file:de.schildbach.litecoinwallet.ui.EditAddressBookEntryFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final String address = args.getString(KEY_ADDRESS);
    final String suggestedAddressLabel = args.getString(KEY_SUGGESTED_ADDRESS_LABEL);

    final LayoutInflater inflater = LayoutInflater.from(activity);

    final Uri uri = AddressBookProvider.contentUri(activity.getPackageName()).buildUpon().appendPath(address)
            .build();/*from   ww  w . j  av a2 s  . c  om*/

    final String label = AddressBookProvider.resolveLabel(activity, address);

    final boolean isAdd = label == null;

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    dialog.setTitle(isAdd ? R.string.edit_address_book_entry_dialog_title_add
            : R.string.edit_address_book_entry_dialog_title_edit);

    final View view = inflater.inflate(R.layout.edit_address_book_entry_dialog, null);

    final TextView viewAddress = (TextView) view.findViewById(R.id.edit_address_book_entry_address);
    viewAddress.setText(WalletUtils.formatHash(address, Constants.ADDRESS_FORMAT_GROUP_SIZE,
            Constants.ADDRESS_FORMAT_LINE_SIZE));

    final TextView viewLabel = (TextView) view.findViewById(R.id.edit_address_book_entry_label);
    viewLabel.setText(label != null ? label : suggestedAddressLabel);

    dialog.setView(view);

    final DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                final String newLabel = viewLabel.getText().toString().trim();

                if (!newLabel.isEmpty()) {
                    final ContentValues values = new ContentValues();
                    values.put(AddressBookProvider.KEY_LABEL, newLabel);

                    if (isAdd)
                        contentResolver.insert(uri, values);
                    else
                        contentResolver.update(uri, values, null, null);
                } else if (!isAdd) {
                    contentResolver.delete(uri, null, null);
                }
            } else if (which == DialogInterface.BUTTON_NEUTRAL) {
                contentResolver.delete(uri, null, null);
            }

            dismiss();
        }
    };

    dialog.setPositiveButton(isAdd ? R.string.button_add : R.string.edit_address_book_entry_dialog_button_edit,
            onClickListener);
    if (!isAdd)
        dialog.setNeutralButton(R.string.button_delete, onClickListener);
    dialog.setNegativeButton(R.string.button_cancel, onClickListener);

    return dialog.create();
}

From source file:de.langerhans.wallet.ui.ImportKeysQrFragment.java

private void importPrivateKeys(final List<ECKey> keys) {
    final int numKeysToImport = keys.size();
    final int numKeysImported = wallet.addKeys(keys);

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    final StringBuilder message = new StringBuilder();
    if (numKeysImported > 0)
        message.append(getString(R.string.import_keys_dialog_success_imported, numKeysImported));
    if (numKeysImported < numKeysToImport) {
        if (message.length() > 0)
            message.append('\n');
        message.append(/*  w  w w  .j  a v  a2s . c o  m*/
                getString(R.string.import_keys_dialog_success_existing, numKeysToImport - numKeysImported));
    }
    if (numKeysImported > 0) {
        if (message.length() > 0)
            message.append("\n\n");
        message.append(getString(R.string.import_keys_dialog_success_reset));
    }
    dialog.setMessage(message);
    if (numKeysImported > 0) {
        dialog.setPositiveButton(R.string.import_keys_dialog_button_reset_blockchain,
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(final DialogInterface dialog, final int id) {
                        application.resetBlockchain();
                        activity.finish();
                    }
                });
        dialog.setNegativeButton(R.string.button_dismiss, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(final DialogInterface dialog, final int id) {
                activity.finish();
            }
        });
    } else {
        dialog.setNeutralButton(R.string.button_dismiss, null);
    }
    dialog.setOnCancelListener(null);
    dialog.show();

    log.info("imported " + numKeysImported + " of " + numKeysToImport + " private keys");
}

From source file:de.schildbach.wallet.ui.AmountCalculatorFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    precision = Integer.parseInt(
            prefs.getString(Constants.PREFS_KEY_BTC_PRECISION, Integer.toString(Constants.BTC_PRECISION)));

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    dialog.setTitle(R.string.amount_calculator_dialog_title);

    final View view = inflater.inflate(R.layout.amount_calculator_dialog, null);

    btcAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_btc);
    btcAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (btcAmountView.getAmount() != null) {
                exchangeDirection = true;

                updateAppearance();//from w w  w. j  a v  a 2 s.c  o m
            } else {
                localAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    localAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_local);
    localAmountView.setPrecision(Constants.LOCAL_PRECISION);
    localAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (localAmountView.getAmount() != null) {
                exchangeDirection = false;

                updateAppearance();
            } else {
                btcAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    exchangeRateView = (TextView) view.findViewById(R.id.amount_calculator_rate);

    dialog.setView(view);

    dialog.setPositiveButton(R.string.amount_calculator_dialog_button_use,
            new DialogInterface.OnClickListener() {
                public void onClick(final DialogInterface dialog, final int whichButton) {
                    done();
                }
            });
    dialog.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int whichButton) {
            dismiss();
        }
    });

    updateAppearance();

    loaderManager.initLoader(0, null, this);

    return dialog.create();
}

From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivity.java

public void notififyGuestUsedKey(final String guestUser, final String guestService) {
    AlertDialog.Builder builder = new AlertDialog.Builder(LockActivity.this);
    builder.setInverseBackgroundForced(true);
    builder.setMessage("Remote key used by " + guestUser + "!").setCancelable(true).setPositiveButton("OK",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();//from   w  w  w . j av a2s .c om
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivity.java

public void keyUpdate(final UserCredentials userCredentials) {
    AlertDialog.Builder builder = new AlertDialog.Builder(LockActivity.this);
    builder.setInverseBackgroundForced(true);
    builder.setMessage("Key updates have been made").setCancelable(false).setPositiveButton("OK",
            new DialogInterface.OnClickListener() {
                @Override/* w  w w.j av a  2s. com*/
                public void onClick(DialogInterface dialog, int which) {
                    lock_fragment.setButtons(userCredentials);
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.feathercoin.wallet.feathercoin.ui.AmountCalculatorFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    exchangeCurrency = prefs.getString(Constants.PREFS_KEY_EXCHANGE_CURRENCY,
            Constants.DEFAULT_EXCHANGE_CURRENCY);
    precision = Integer.parseInt(
            prefs.getString(Constants.PREFS_KEY_FTC_PRECISION, Integer.toString(Constants.FTC_PRECISION)));

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    dialog.setTitle(R.string.amount_calculator_dialog_title);

    final View view = inflater.inflate(R.layout.amount_calculator_dialog, null);

    ltcAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_ltc);
    ltcAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (ltcAmountView.getAmount() != null) {
                exchangeDirection = true;

                updateAppearance();//from  w w w  .  j a va 2  s .  co  m
            } else {
                localAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    localAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_local);
    localAmountView.setCurrencyCode(exchangeCurrency);
    localAmountView.setPrecision(Constants.LOCAL_PRECISION);
    localAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (localAmountView.getAmount() != null) {
                exchangeDirection = false;

                updateAppearance();
            } else {
                ltcAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    exchangeRateView = (TextView) view.findViewById(R.id.amount_calculator_rate);

    dialog.setView(view);

    dialog.setPositiveButton(R.string.amount_calculator_dialog_button_use,
            new DialogInterface.OnClickListener() {
                public void onClick(final DialogInterface dialog, final int whichButton) {
                    done();
                }
            });
    dialog.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int whichButton) {
            dismiss();
        }
    });

    updateAppearance();

    loaderManager.initLoader(0, null, this);

    return dialog.create();
}

From source file:com.kncwallet.wallet.ui.EditAddressBookEntryFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final String address = args.getString(KEY_ADDRESS);
    final String suggestedAddressLabel = args.getString(KEY_SUGGESTED_ADDRESS_LABEL);
    final String imageUrl = args.getString(KEY_IMAGE_URL);
    final String argsSource = args.getString(KEY_SOURCE);
    final String username = args.getString(KEY_USERNAME);

    final LayoutInflater inflater = LayoutInflater.from(activity);

    final Uri uri = AddressBookProvider.contentUri(activity.getPackageName()).buildUpon().appendPath(address)
            .build();/*from w  ww . j  av  a 2s .  c  om*/

    final String label = AddressBookProvider.resolveLabel(activity, address);

    final boolean isAdd = label == null;

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    dialog.setTitle(isAdd ? R.string.edit_address_book_entry_dialog_title_add
            : R.string.edit_address_book_entry_dialog_title_edit);

    final View view = inflater.inflate(R.layout.edit_address_book_entry_dialog, null);

    final TextView viewAddress = (TextView) view.findViewById(R.id.edit_address_book_entry_address);
    viewAddress.setText(WalletUtils.formatHash(address, Constants.ADDRESS_FORMAT_GROUP_SIZE,
            Constants.ADDRESS_FORMAT_LINE_SIZE));

    final TextView viewLabel = (TextView) view.findViewById(R.id.edit_address_book_entry_label);
    viewLabel.setText(label != null ? label : suggestedAddressLabel);

    dialog.setView(view);

    final DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                final String newLabel = viewLabel.getText().toString().trim();

                if (!newLabel.isEmpty()) {
                    final ContentValues values = new ContentValues();
                    values.put(AddressBookProvider.KEY_LABEL, newLabel);
                    values.put(AddressBookProvider.KEY_USERNAME, username);
                    values.put(AddressBookProvider.KEY_STATE, AddressBookProvider.STATE_ACTIVE);
                    if (isAdd) {
                        contentResolver.insert(uri, values);
                        AddressBookProvider.ContactData contactData = AddressBookProvider
                                .resolveContactData(activity, address);
                        KnownAddressProvider.saveKnownAddress(activity, contactData.id,
                                contactData.rawTelephone, address, argsSource);
                    } else {
                        AddressBookProvider.ContactData contactData = AddressBookProvider
                                .resolveContactData(activity, address);

                        contentResolver.update(uri, values, null, null);
                        if (contactData != null) {
                            KnownAddressProvider.saveKnownAddress(activity, contactData.id,
                                    contactData.rawTelephone, address, null);
                        }
                    }

                    saveImage(imageUrl, newLabel, address);
                } else if (!isAdd) {
                    contentResolver.delete(uri, null, null);
                }
            } else if (which == DialogInterface.BUTTON_NEUTRAL) {
                contentResolver.delete(uri, null, null);
            }

            dismiss();
        }
    };

    dialog.setPositiveButton(isAdd ? R.string.button_add : R.string.edit_address_book_entry_dialog_button_edit,
            onClickListener);
    if (!isAdd)
        dialog.setNeutralButton(R.string.button_delete, onClickListener);
    dialog.setNegativeButton(R.string.button_cancel, onClickListener);

    return dialog.create();
}

From source file:de.schildbach.wallet.digitalcoin.ui.AmountCalculatorFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    exchangeCurrency = prefs.getString(Constants.PREFS_KEY_EXCHANGE_CURRENCY,
            Constants.DEFAULT_EXCHANGE_CURRENCY);
    precision = Integer.parseInt(
            prefs.getString(Constants.PREFS_KEY_WDC_PRECISION, Integer.toString(Constants.WDC_PRECISION)));

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    dialog.setTitle(R.string.amount_calculator_dialog_title);

    final View view = inflater.inflate(R.layout.amount_calculator_dialog, null);

    ltcAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_ltc);
    ltcAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (ltcAmountView.getAmount() != null) {
                exchangeDirection = true;

                updateAppearance();/*from  ww w  .  j  a v  a2 s  .  c  o  m*/
            } else {
                localAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    localAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_local);
    localAmountView.setCurrencyCode(exchangeCurrency);
    localAmountView.setPrecision(Constants.LOCAL_PRECISION);
    localAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (localAmountView.getAmount() != null) {
                exchangeDirection = false;

                updateAppearance();
            } else {
                ltcAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    exchangeRateView = (TextView) view.findViewById(R.id.amount_calculator_rate);

    dialog.setView(view);

    dialog.setPositiveButton(R.string.amount_calculator_dialog_button_use,
            new DialogInterface.OnClickListener() {
                public void onClick(final DialogInterface dialog, final int whichButton) {
                    done();
                }
            });
    dialog.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int whichButton) {
            dismiss();
        }
    });

    updateAppearance();

    loaderManager.initLoader(0, null, this);

    return dialog.create();
}

From source file:de.schildbach.wallet.elysium.ui.AmountCalculatorFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    exchangeCurrency = prefs.getString(Constants.PREFS_KEY_EXCHANGE_CURRENCY,
            Constants.DEFAULT_EXCHANGE_CURRENCY);
    precision = Integer.parseInt(
            prefs.getString(Constants.PREFS_KEY_ELSM_PRECISION, Integer.toString(Constants.ELSM_PRECISION)));

    final AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
    dialog.setInverseBackgroundForced(true);
    dialog.setTitle(R.string.amount_calculator_dialog_title);

    final View view = inflater.inflate(R.layout.amount_calculator_dialog, null);

    elsmAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_elsm);
    elsmAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (elsmAmountView.getAmount() != null) {
                exchangeDirection = true;

                updateAppearance();//from  w w  w. ja v a 2 s .  com
            } else {
                localAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    localAmountView = (CurrencyAmountView) view.findViewById(R.id.amount_calculator_row_local);
    localAmountView.setCurrencyCode(exchangeCurrency);
    localAmountView.setPrecision(Constants.LOCAL_PRECISION);
    localAmountView.setListener(new CurrencyAmountView.Listener() {
        public void changed() {
            if (localAmountView.getAmount() != null) {
                exchangeDirection = false;

                updateAppearance();
            } else {
                elsmAmountView.setHint(null);
            }
        }

        public void done() {
            AmountCalculatorFragment.this.done();
        }

        public void focusChanged(final boolean hasFocus) {
        }
    });

    exchangeRateView = (TextView) view.findViewById(R.id.amount_calculator_rate);

    dialog.setView(view);

    dialog.setPositiveButton(R.string.amount_calculator_dialog_button_use,
            new DialogInterface.OnClickListener() {
                public void onClick(final DialogInterface dialog, final int whichButton) {
                    done();
                }
            });
    dialog.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, final int whichButton) {
            dismiss();
        }
    });

    updateAppearance();

    loaderManager.initLoader(0, null, this);

    return dialog.create();
}