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.goldcoin.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_GLD_PRECISION, Integer.toString(Constants.GLD_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);

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

                updateAppearance();/*w  ww. j  a  va 2s . 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 {
                gldAmountView.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.litecoin.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_LTC_PRECISION, Integer.toString(Constants.LTC_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  ww. j  a v a  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.vuze.android.remote.AndroidUtilsUI.java

public static AlertDialog.Builder createTextBoxDialog(Context context, int newtag_title, int newtag_hint,
        final OnTextBoxDialogClick onClickListener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);

    FrameLayout container = new FrameLayout(context);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER_VERTICAL;
    container.setMinimumHeight(AndroidUtilsUI.dpToPx(100));
    int padding = AndroidUtilsUI.dpToPx(20);
    params.leftMargin = padding;/*w ww.ja va2s  .  com*/
    params.rightMargin = padding;

    final MaterialEditText textView = AndroidUtilsUI.createFancyTextView(context);
    textView.setHint(newtag_hint);
    textView.setFloatingLabelText(context.getResources().getString(newtag_hint));
    textView.setSingleLine();
    textView.setLayoutParams(params);

    container.addView(textView);

    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
        builder.setInverseBackgroundForced(true);
    }

    builder.setView(container);
    builder.setTitle(newtag_title);
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            onClickListener.onClick(dialog, which, textView);
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    return builder;
}

From source file:com.zerobyte.lifesync.EventDisplayActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.editEvent_option:
        // LOGIC TO EDIT EVENT
        Intent EditEventIntent = new Intent(EventDisplayActivity.this, EventInputActivity.class);
        int currentPage = mPager.getCurrentItem();
        ScheduleEvent se = schedule_data.get(schedule_id_list.get(currentPage));

        HashMap<String, String> event_data = new HashMap<String, String>();
        event_data.put("event_id", "" + se.getEvent_id());
        event_data.put("event_name", se.getEvent_name());
        event_data.put("event_start_time", se.getEvent_start_time());
        event_data.put("event_end_time", se.getEvent_end_time());
        event_data.put("event_location", se.getEvent_location());
        event_data.put("event_description", se.getEvent_description());
        EditEventIntent.putExtra("event_data", event_data);
        startActivityForResult(EditEventIntent, EDIT_EVENT);

        return true;

    case R.id.deleteEvent_option:
        // LOGIC TO DELETE EVENT
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setCancelable(true);//from  www .  ja v  a2 s. c  o m
        builder.setMessage("Delete Event?");
        builder.setInverseBackgroundForced(true);
        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                final LifeSyncHttpClient httpClient = new LifeSyncHttpClient();
                ParameterMap params = httpClient.newParams();
                final int currentPage = mPager.getCurrentItem();
                ScheduleEvent se = schedule_data.get(schedule_id_list.get(currentPage));
                int eventID = se.getEvent_id();

                params.add("event_id", "" + eventID);

                httpClient.post("/removeEvent", params, new AsyncCallback() {
                    @Override
                    public void onComplete(HttpResponse httpResponse) {
                        int status = httpResponse.getStatus();

                        if (status == httpClient.HTTP_OK) {
                            showToast("Event successfully removed!");
                            schedule_data.remove(schedule_id_list.get(currentPage));
                            lfapp.saveSchedule(schedule_data);
                            onBackPressed();
                        } else {
                            showToast("Error removing event.");
                        }
                    }

                    @Override
                    public void onError(Exception e) {
                        showToast("Sorry, a server error occurred. Please try again. ");
                        showToast(e.getMessage());
                        e.printStackTrace();
                    }
                });

                // schedule_id_list.remove(currentPage);
                //mPager.removeViewAt(currentPage);

            }
        });
        AlertDialog alert = builder.create();
        alert.show();

        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.vuze.android.remote.AndroidUtils.java

/**
 * Creates an AlertDialog.Builder that has the proper theme for Gingerbread
 *//*from w ww  .ja va  2s. com*/
public static AndroidUtils.AlertDialogBuilder createAlertDialogBuilder(Activity activity, int resource) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);

    // Not sure if we need this anymore, but once upon a time, pre-honeycomb
    // (2.x) had dialog color issues
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
        builder.setInverseBackgroundForced(true);
    }

    View view = View.inflate(activity, resource, null);
    builder.setView(view);

    return new AndroidUtils.AlertDialogBuilder(view, builder);
}

From source file:th.in.ffc.person.visit.VisitDiagActivity.java

private void dialogAskGoHouse(String title, final boolean viewHouse, final Cursor c) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setCancelable(true);//from  w  w  w. j  ava2 s.  co  m
    builder.setTitle(title);
    builder.setInverseBackgroundForced(true);
    builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (viewHouse) {
                Double tempLat = Double.parseDouble(c.getString(c.getColumnIndex("ygis")));
                Double tempLng = Double.parseDouble(c.getString(c.getColumnIndex("xgis")));
                Intent a = new Intent(Action.VIEW);
                a.addCategory(Category.MAP506);
                a.putExtra("hcode", c.getString(c.getColumnIndex("hcode")));
                a.putExtra("pid", c.getString(c.getColumnIndex("pid")));
                a.putExtra("pcucodeperson", c.getString(c.getColumnIndex("pcucodeperson")));
                a.putExtra("lat", tempLat);
                a.putExtra("lng", tempLng);
                startActivity(a);
                finish();
            } else {
                Intent a = new Intent(Action.INSERT);
                a.addCategory(Category.ADD_EDITPOSITION);
                a.putExtra("pid", c.getString(c.getColumnIndex("pid")));
                a.putExtra("hno", c.getString(c.getColumnIndex("hno")));
                a.putExtra("villno", c.getString(c.getColumnIndex("villno")));
                a.putExtra("villname", c.getString(c.getColumnIndex("villname")));
                a.putExtra("pcucodeperson", c.getString(c.getColumnIndex("pcucodeperson")));
                a.putExtra("hcode", c.getString(c.getColumnIndex("hcode")));
                a.putExtra("visitno", c.getString(c.getColumnIndex("visitno")));
                startActivity(a);
                finish();
            }
        }
    });
    builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            finish();
            //onBackPresseds();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.irccloud.android.activity.UploadsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (ColorFormatter.file_uri_template != null)
        template = UriTemplate.fromTemplate(ColorFormatter.file_uri_template);
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 21) {
        Bitmap cloud = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
        setTaskDescription(new ActivityManager.TaskDescription(getResources().getString(R.string.app_name),
                cloud, 0xFFF2F7FC));//from   ww  w .j a va 2 s.  c om
        cloud.recycle();
    }

    if (Build.VERSION.SDK_INT >= 14) {
        try {
            java.io.File httpCacheDir = new java.io.File(getCacheDir(), "http");
            long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
            HttpResponseCache.install(httpCacheDir, httpCacheSize);
        } catch (IOException e) {
            Log.i("IRCCloud", "HTTP response cache installation failed:" + e);
        }
    }
    setContentView(R.layout.ignorelist);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
        getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar));
        getSupportActionBar().setElevation(0);
    }

    if (savedInstanceState != null && savedInstanceState.containsKey("cid")) {
        cid = savedInstanceState.getInt("cid");
        to = savedInstanceState.getString("to");
        msg = savedInstanceState.getString("msg");
        page = savedInstanceState.getInt("page");
        File[] files = (File[]) savedInstanceState.getSerializable("adapter");
        for (File f : files) {
            adapter.addFile(f);
        }
        adapter.notifyDataSetChanged();
    }

    footer = getLayoutInflater().inflate(R.layout.messageview_header, null);
    ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(adapter);
    listView.addFooterView(footer);
    listView.setOnScrollListener(new AbsListView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView absListView, int i) {

        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (canLoadMore && firstVisibleItem + visibleItemCount > totalItemCount - 4) {
                canLoadMore = false;
                new FetchFilesTask().execute((Void) null);
            }
        }
    });
    listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {

        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            final File f = (File) adapter.getItem(i);

            AlertDialog.Builder builder = new AlertDialog.Builder(UploadsActivity.this);
            builder.setInverseBackgroundForced(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB);
            final View v = getLayoutInflater().inflate(R.layout.dialog_upload, null);
            final EditText messageinput = (EditText) v.findViewById(R.id.message);
            messageinput.setText(msg);
            final ImageView thumbnail = (ImageView) v.findViewById(R.id.thumbnail);

            v.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    if (messageinput.hasFocus()) {
                        v.post(new Runnable() {
                            @Override
                            public void run() {
                                v.scrollTo(0, v.getBottom());
                            }
                        });
                    }
                }
            });

            if (f.mime_type.startsWith("image/")) {
                try {
                    thumbnail.setImageBitmap(f.image);
                    thumbnail.setVisibility(View.VISIBLE);
                    thumbnail.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            Intent i = new Intent(UploadsActivity.this, ImageViewerActivity.class);
                            i.setData(Uri.parse(f.url));
                            startActivity(i);
                        }
                    });
                    thumbnail.setClickable(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } else {
                thumbnail.setVisibility(View.GONE);
            }

            ((TextView) v.findViewById(R.id.filesize)).setText(f.metadata);
            v.findViewById(R.id.filename).setVisibility(View.GONE);
            v.findViewById(R.id.filename_heading).setVisibility(View.GONE);

            builder.setTitle("Send A File To " + to);
            builder.setView(v);
            builder.setPositiveButton("Send", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String message = messageinput.getText().toString();
                    if (message.length() > 0)
                        message += " ";
                    message += f.url;

                    dialog.dismiss();
                    if (getParent() == null) {
                        setResult(Activity.RESULT_OK);
                    } else {
                        getParent().setResult(Activity.RESULT_OK);
                    }
                    finish();

                    NetworkConnection.getInstance().say(cid, to, message);
                }
            });
            builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            });
            AlertDialog d = builder.create();
            d.setOwnerActivity(UploadsActivity.this);
            d.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
            d.show();
        }
    });
}

From source file:com.pgmacdesign.rsrtoolbox.InputSchedule.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.input_schedule);

    //Different Shared preferences, accessed via the preferences tab in the main grid
    getData = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    work_address_stored = getData.getString("work_address_stored_xml", "Address");

    //To let them know that they can go to preferenes and adjust the address preferences
    if (work_address_stored.equals("Address")) {

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setCancelable(true);//from ww  w .j a v a  2  s  .  c  o  m
        builder.setTitle("Did You Know?");
        builder.setMessage(
                "To change your work address and have it automatically fill it in for you. Edit the 'Address' field. "
                        + "It can be found via the main menu -> preferences -> Work Address");
        builder.setInverseBackgroundForced(true);
        builder.setPositiveButton("Dismiss", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.setNegativeButton("Show Me", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
                Intent intent99 = new Intent("com.pgmacdesign.rsrtoolbox.PREFS");
                startActivity(intent99);
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
    }

    //Setup all variables and listeners
    Initialize();

}

From source file:com.nineducks.hereader.HackfulReaderActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog result = null;/*from   ww  w  .  j av a 2 s.  com*/
    AlertDialog.Builder builder = null;
    switch (id) {
    case R.id.open_dialog:
        builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.open_dialog_title);
        builder.setItems(R.array.open_dialog_options, (OnClickListener) itemsController);
        builder.setCancelable(true);
        result = builder.create();
        break;
    case R.id.about_dialog:
        builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.about_dialog_title);
        ScrollView scroll = new ScrollView(this);
        TextView msg = new TextView(this);
        SpannableString s = new SpannableString(getString(R.string.about_dialog_text));
        Linkify.addLinks(s, Linkify.WEB_URLS);
        msg.setText(s);
        msg.setMovementMethod(LinkMovementMethod.getInstance());
        msg.setTextSize(16);
        msg.setPadding(15, 15, 15, 15);
        scroll.addView(msg);
        builder.setView(scroll);
        builder.setInverseBackgroundForced(true);
        result = builder.create();
        break;
    }
    return result;
}

From source file:com.abc.driver.TruckActivity.java

public void chooseTruckWeight(View v) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    GridView gridView1 = new GridView(this);
    gridView1.setNumColumns(3);/* w  w  w .ja  va 2 s.  c o  m*/
    SimpleAdapter adapter = new SimpleAdapter(this, mTruckWeightList, R.layout.truck_weight_griditem,
            new String[] { "TITLE", "TWEIGHT" }, new int[] { R.id.griditem_title, R.id.griditem_weight, });

    gridView1.setAdapter(adapter);
    builder.setTitle("Please Choose");
    builder.setInverseBackgroundForced(true);
    builder.setView(gridView1);
    final Dialog dialog = builder.create();

    gridView1.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) {
            mTWtv.setText(((TextView) view.findViewById(R.id.griditem_title)).getText());
            mTruckWeight = ((TextView) view.findViewById(R.id.griditem_weight)).getText().toString();
            mUpdateTruckTask = new UpdateTruckTask();
            mUpdateTruckTask.execute("" + app.getUser().getMyTruck().getTruckId(),
                    "" + app.getUser().getMyTruck().getTypeId(), "" + app.getUser().getMyTruck().getLengthId(),
                    mTruckWeight, "" + app.getUser().getMyTruck().getStatusId(), "" + app.getUser().getId());

            dialog.dismiss();
        }
    });
    dialog.show();
}