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:com.abc.driver.TruckActivity.java

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

    GridView gridView1 = new GridView(this);
    gridView1.setNumColumns(3);/*  w  w w  . j  a v a  2 s .  c o  m*/
    // (GridView)findViewById(R.id.gridView1);
    SimpleAdapter adapter = new SimpleAdapter(this, mTruckLengthList, R.layout.truck_length_griditem,
            new String[] { "TITLE", "TLENGTH" }, new int[] { R.id.griditem_title, R.id.griditem_length, });

    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) {
            mTLtv.setText(((TextView) view.findViewById(R.id.griditem_title)).getText());
            mTruckLength = ((TextView) view.findViewById(R.id.griditem_length)).getText().toString();
            mUpdateTruckTask = new UpdateTruckTask();
            mUpdateTruckTask.execute("" + app.getUser().getMyTruck().getTruckId(),
                    "" + app.getUser().getMyTruck().getTypeId(), mTruckLength,
                    "" + app.getUser().getMyTruck().getWeightId(),
                    "" + app.getUser().getMyTruck().getStatusId(), "" + app.getUser().getId());

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

From source file:com.inter.trade.ui.fragment.buylicensekey.BuyLicenseKeyPayConfirmFragment.java

/**
 * ???UIManagerActivity::onActivityResult???
 *///w  w w  . jav a2  s.c om
@Override
public void requestBuySuccess(final ResultData resultData, String msg) {
    resultData.putValue(ResultData.bkntno, mBkntno);

    /**
     * ??
     */
    //      new BuySuccessTask(getActivity(), resultData,"ApiQQRechangeInfo","checkRechaMoneyStatus").execute("");

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle("");
    builder.setMessage(msg);
    builder.setInverseBackgroundForced(true);
    builder.setCancelable(false);
    //builder.setCustomTitle();
    builder.setNegativeButton("", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            if (resultData.getValue(ResultData.result).equalsIgnoreCase("success")) {
                gotoPaySuccess();
            } else {
                //                   getActivity().finish();
                //                   gotoPaySuccess();
            }

        }
    });
    builder.create().show();
}

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

public void chooseTruckType(View v) {

    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    GridView gridView1 = new GridView(this);
    gridView1.setNumColumns(3);/*from w  w w. j  av a 2  s.  c om*/
    // (GridView)findViewById(R.id.gridView1);
    SimpleAdapter adapter = new SimpleAdapter(this, mTruckTypeList, R.layout.truck_type_griditem,
            new String[] { "PIC", "TITLE", "TTYPE" },
            new int[] { R.id.griditem_pic, R.id.griditem_title, R.id.griditem_type, });

    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) {
            mTTtv.setText(((TextView) view.findViewById(R.id.griditem_title)).getText());
            mTruckType = ((TextView) view.findViewById(R.id.griditem_type)).getText().toString();

            mUpdateTruckTask = new UpdateTruckTask();
            mUpdateTruckTask.execute("" + app.getUser().getMyTruck().getTruckId(), mTruckType,
                    "" + app.getUser().getMyTruck().getLengthId(),
                    "" + app.getUser().getMyTruck().getWeightId(),
                    "" + app.getUser().getMyTruck().getStatusId(), "" + app.getUser().getId());
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:com.inter.trade.ui.fragment.buylicensekey.BuyLicenseKeyPayConfirmFragment.java

private void payResult(Intent data) {
    /*//from  w w w  .  java 2 s .  c  o  m
       * :success?fail?cancel
       *      ??
       */
    if (data == null) {
        return;
    }
    String msg = "";
    String str = data.getExtras().getString("pay_result");
    if (null == str) {
        return;
    }
    if (str.equalsIgnoreCase("success")) {
        msg = "??";
    } else if (str.equalsIgnoreCase("fail")) {
        msg = "?";
    } else if (str.equalsIgnoreCase("cancel")) {
        msg = "?";
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle("");
    builder.setMessage(msg);
    builder.setInverseBackgroundForced(true);
    //builder.setCustomTitle();
    builder.setNegativeButton("", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    builder.create().show();
}

From source file:net.granoeste.commons.ui.IconContextMenuDialogFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    final Bundle args = getArguments();
    if (mTitle == null && args != null) {
        mTitle = args.getString(ICON_CONTEXT_MENU_TITLE);
    }/*from w w w. j  ava 2s  . c om*/

    if (args != null) {
        mMenuItems = (ArrayList<IconContextMenuItem>) args.getSerializable(ICON_CONTEXT_MENU_ITEMS);
    }
    if (mMenuAdapter == null) {
        if (mMenuItems != null) {
            mMenuAdapter = new IconMenuAdapter(getActivity());
            for (final IconContextMenuItem iconContextMenuItem : mMenuItems) {
                mMenuAdapter.addItem(iconContextMenuItem);
            }
        }
    }

    if (!TextUtils.isEmpty(mTitle)) {
        builder.setTitle(mTitle);
    }

    builder.setAdapter(mMenuAdapter, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialoginterface, final int i) {
            final IconContextMenuItem item = (IconContextMenuItem) mMenuAdapter.getItem(i);

            mCallbacks.onIconContextMenuOnItemSelected(item);

            dismiss();
        }
    });

    builder.setInverseBackgroundForced(true);

    final AlertDialog dialog = builder.create();
    dialog.setOnCancelListener(this);
    dialog.setOnDismissListener(this);
    return dialog;
}

From source file:org.mozilla.gecko.PromptService.java

public void Show(String aTitle, String aText, PromptButton[] aButtons, PromptListItem[] aMenuList,
        boolean aMultipleSelection) {
    AlertDialog.Builder builder = new AlertDialog.Builder(GeckoApp.mAppContext);
    if (!aTitle.equals("")) {
        builder.setTitle(aTitle);//from w w  w .jav  a  2 s.  co m
    }

    if (!aText.equals("")) {
        builder.setMessage(aText);
    }

    int length = mInputs.length;
    if (aMenuList.length > 0) {
        int resourceId = android.R.layout.select_dialog_item;
        if (mSelected != null && mSelected.length > 0) {
            if (aMultipleSelection) {
                resourceId = android.R.layout.select_dialog_multichoice;
            } else {
                resourceId = android.R.layout.select_dialog_singlechoice;
            }
        }
        PromptListAdapter adapter = new PromptListAdapter(GeckoApp.mAppContext, resourceId, aMenuList);
        if (mSelected != null && mSelected.length > 0) {
            if (aMultipleSelection) {
                adapter.listView = (ListView) mInflater.inflate(R.layout.select_dialog_list, null);
                adapter.listView.setOnItemClickListener(this);
                builder.setInverseBackgroundForced(true);
                adapter.listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
                adapter.listView.setAdapter(adapter);
                builder.setView(adapter.listView);
            } else {
                int selectedIndex = -1;
                for (int i = 0; i < mSelected.length; i++) {
                    if (mSelected[i]) {
                        selectedIndex = i;
                        break;
                    }
                }
                mSelected = null;
                builder.setSingleChoiceItems(adapter, selectedIndex, this);
            }
        } else {
            builder.setAdapter(adapter, this);
            mSelected = null;
        }
    } else if (length == 1) {
        builder.setView(mInputs[0].getView());
    } else if (length > 1) {
        LinearLayout linearLayout = new LinearLayout(GeckoApp.mAppContext);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
        for (int i = 0; i < length; i++) {
            View content = mInputs[i].getView();
            linearLayout.addView(content);
        }
        builder.setView((View) linearLayout);
    }

    length = aButtons.length;
    if (length > 0) {
        builder.setPositiveButton(aButtons[0].label, this);
    }
    if (length > 1) {
        builder.setNeutralButton(aButtons[1].label, this);
    }
    if (length > 2) {
        builder.setNegativeButton(aButtons[2].label, this);
    }

    mDialog = builder.create();
    mDialog.setOnCancelListener(this);
    mDialog.show();
}

From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (!isFromBuilder) {
        throw new RuntimeException("Use AlertDialogFragment$Builder");
    }//from  w  ww.ja v  a 2 s  .  c  o  m

    final Bundle args = getArguments();
    final int theme = args.getInt(THEME);

    AlertDialog.Builder builder;
    if (theme == VALUE_NULL || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        builder = new AlertDialog.Builder(getActivity());
    } else {
        builder = newDialogBuilder(theme);
    }

    iconId = args.getInt(ICON_ID, VALUE_NULL);
    if (iconId != VALUE_NULL) {
        builder.setIcon(iconId);
    }

    final CharSequence title = args.getCharSequence(TITLE);
    boolean useCustomTitle = args.getBoolean(CUSTOM_TITLE);
    if (title != null) {
        builder.setTitle(title);
    } else if (useCustomTitle) {
        setCustomTitle(builder);
    }

    final CharSequence message = args.getCharSequence(MESSAGE);
    if (message != null) {
        builder.setMessage(message);
    }

    final int useInverseBackground = args.getInt(INVERSE_BACKGROUND);
    if (useInverseBackground != VALUE_NULL) {
        builder.setInverseBackgroundForced(useInverseBackground == VALUE_TRUE);
    }

    // View
    setView(builder);

    // List
    setItems(builder);
    setAdapter(builder);
    setSingleChoiceItems(builder);
    setMultiChoiceItems(builder);

    // Buttons
    setPositiveButton(builder);
    setNeutralButton(builder);
    setNegativeButton(builder);

    // Build
    return builder.create();
}

From source file:com.terracom.mumbleclient.servers.ServerEditFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder adb = new AlertDialog.Builder(getActivity());
    Settings settings = Settings.getInstance(getActivity());

    int actionTitle;
    if (shouldSave() && getServer() == null) {
        actionTitle = R.string.add;/*from w  w  w .  j  av  a2s.c o m*/
    } else if (shouldSave()) {
        actionTitle = R.string.save;
    } else {
        actionTitle = R.string.connect;
    }

    adb.setPositiveButton(actionTitle, null);
    adb.setNegativeButton(android.R.string.cancel, null);

    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View view = inflater.inflate(R.layout.dialog_server_edit, null, false);

    mNameTitle = (TextView) view.findViewById(R.id.server_edit_name_title);
    mNameEdit = (EditText) view.findViewById(R.id.server_edit_name);
    mHostEdit = (EditText) view.findViewById(R.id.server_edit_host);
    mPortEdit = (EditText) view.findViewById(R.id.server_edit_port);
    mUsernameEdit = (EditText) view.findViewById(R.id.server_edit_username);
    mUsernameEdit.setHint(settings.getDefaultUsername());
    mPasswordEdit = (EditText) view.findViewById(R.id.server_edit_password);
    mErrorText = (TextView) view.findViewById(R.id.server_edit_error);
    if (getServer() != null) {
        Server oldServer = getServer();
        mNameEdit.setText(oldServer.getName());
        mHostEdit.setText(oldServer.getHost());
        mPortEdit.setText(String.valueOf(oldServer.getPort()));
        mUsernameEdit.setText(oldServer.getUsername());
        mPasswordEdit.setText(oldServer.getPassword());
    }

    if (!shouldSave()) {
        mNameTitle.setVisibility(View.GONE);
        mNameEdit.setVisibility(View.GONE);
    }

    // Fixes issues with text colour on light themes with pre-honeycomb devices.
    adb.setInverseBackgroundForced(true);

    adb.setView(view);

    return adb.create();
}

From source file:jp.co.noxi.app.NXAlertDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (!mFromBuilder) {
        throw new RuntimeException("Use NXAlertDialog$Builder");
    }/*from   w  w  w  . ja  va2 s.c o m*/

    final Bundle args = getArguments();
    final int theme = args.getInt(ARG_THEME);

    AlertDialog.Builder builder;
    if ((theme == VALUE_NULL) || (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)) {
        builder = new AlertDialog.Builder(getActivity());
    } else {
        builder = newDialogBuilder(theme);
    }

    final CharSequence title = args.getCharSequence(ARG_TITLE);
    if (title == null) {
        setCustomTitle(builder);
    } else {
        builder.setTitle(title);
    }

    final CharSequence message = args.getCharSequence(ARG_MESSAGE);
    if (message != null) {
        builder.setMessage(message);
    }

    final int iconId = args.getInt(ARG_ICON, VALUE_NULL);
    if (iconId != VALUE_NULL) {
        builder.setIcon(iconId);
    }

    final int useInverseBackground = args.getInt(ARG_INVERSE_BACKGROUND);
    if (useInverseBackground != VALUE_NULL) {
        builder.setInverseBackgroundForced(useInverseBackground == VALUE_TRUE);
    }

    // View
    setView(builder);

    // List
    setItems(builder);
    setAdapter(builder);
    setMultiChoiceItems(builder);
    setSingleChoiceItems(builder);

    // Buttons
    setPositiveButton(builder);
    setNegativeButton(builder);
    setNeutralButton(builder);

    return builder.create();
}

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

public void chooseTruckLength(View v) {
    mTLtv = (TextView) findViewById(R.id.truck_length_tv);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    GridView gridView1 = new GridView(this);
    gridView1.setNumColumns(3);//w  w  w. j a v  a  2s. c o  m
    // (GridView)findViewById(R.id.gridView1);
    SimpleAdapter adapter = new SimpleAdapter(this, mTruckLengthList, R.layout.truck_length_griditem,
            new String[] { "TITLE", "TLENGTH" }, new int[] { R.id.griditem_title, R.id.griditem_length, });

    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) {
            mTLtv.setText(((TextView) view.findViewById(R.id.griditem_title)).getText());
            mTruckLength = ((TextView) view.findViewById(R.id.griditem_length)).getText().toString();
            dialog.dismiss();
        }
    });
    // */

    dialog.show();

}