import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
// If we don't use android.support.v7.app.AlertDialog instead of android.app.AlertDialog then the dialog will be covered by the keyboard.
import android.support.v7.app.AlertDialog;
import android.view.KeyEvent;
// If we don't use android.support.v7.app.AlertDialog instead of android.app.AlertDialog then the dialog will be covered by the keyboard.
import android.support.v7.app.AlertDialog;
import android.view.KeyEvent;
public class CreateHomeScreenShortcut extends DialogFragment {
// The public interface is used to send information back to the parent activity.
public interface CreateHomeScreenSchortcutListener {
public class CreateHomeScreenShortcut extends DialogFragment {
// The public interface is used to send information back to the parent activity.
public interface CreateHomeScreenSchortcutListener {
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Create a drawable version of the favorite icon.
Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebViewActivity.favoriteIcon);
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Create a drawable version of the favorite icon.
Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebViewActivity.favoriteIcon);
LayoutInflater customDialogInflater = getActivity().getLayoutInflater();
// Use AlertDialog.Builder to create the AlertDialog. The style formats the color of the button text.
LayoutInflater customDialogInflater = getActivity().getLayoutInflater();
// Use AlertDialog.Builder to create the AlertDialog. The style formats the color of the button text.
- AlertDialog.Builder createHomeScreenShorcutDialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowser_AlertDialog);
- createHomeScreenShorcutDialogBuilder.setTitle(R.string.create_shortcut);
- createHomeScreenShorcutDialogBuilder.setIcon(favoriteIconDrawable);
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
+ dialogBuilder.setTitle(R.string.create_shortcut);
+ dialogBuilder.setIcon(favoriteIconDrawable);
assert shortcutNameEditText != null; // Remove the warning below that shortcutNameEditText might be null.
shortcutNameEditText.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down on the "enter" button, select the PositiveButton "Create".
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
// Trigger the create listener.
assert shortcutNameEditText != null; // Remove the warning below that shortcutNameEditText might be null.
shortcutNameEditText.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down on the "enter" button, select the PositiveButton "Create".
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
// Trigger the create listener.