Example usage for android.graphics Color CYAN

List of usage examples for android.graphics Color CYAN

Introduction

In this page you can find the example usage for android.graphics Color CYAN.

Prototype

int CYAN

To view the source code for android.graphics Color CYAN.

Click Source Link

Usage

From source file:com.nps.micro.view.TestsSectionFragment.java

private void createDeviceChooser(View rootView, final Button runButton) {
    availableDevicesListView = (ListView) rootView.findViewById(R.id.availableDevicesListView);
    availableDevicesAdapter = new ArrayAdapter<String>(getActivity(), R.layout.text_view, devicesList);
    availableDevicesListView.setAdapter(availableDevicesAdapter);
    availableDevicesListView.setTextFilterEnabled(true);
    availableDevicesListView.setOnItemClickListener(new OnItemClickListener() {
        @Override//www .j a v  a2  s  . com
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
            String item = (String) parent.getItemAtPosition(position);
            selectedDevices.add(ensureUniqueItem(item));
            selectedDevicesAdapter = new StableArrayAdapter(getActivity(), R.layout.text_view, selectedDevices);
            selectedDevicesListView.setAdapter(selectedDevicesAdapter);
            setListViewHeightBasedOnChildren(selectedDevicesListView);
            updateModelSelectedDevices();
        }

        private String ensureUniqueItem(String item) {
            if (selectedDevices.contains(item)) {
                return ensureUniqueItem(item + "'");
            } else {
                return item;
            }
        }
    });
    availableDevicesListView.setOnItemLongClickListener(new OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, final View view, int position, long id) {
            view.setBackgroundColor(Color.CYAN);
            final String item = (String) parent.getItemAtPosition(position);
            final String msg = getResources().getString(R.string.ping_device_info);
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setTitle(R.string.ping_device_title).setMessage(String.format(msg, item))
                    .setPositiveButton(R.string.ping, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            view.setBackgroundColor(Color.BLACK);
                            if (listener != null) {
                                listener.pingDevice(item);
                            }
                            dialog.dismiss();
                        }
                    }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            view.setBackgroundColor(Color.BLACK);
                            dialog.dismiss();
                        }
                    });
            builder.create().show();
            return true;
        }
    });
    setListViewHeightBasedOnChildren(availableDevicesListView);

    selectedDevicesListView = (DynamicListView) rootView.findViewById(R.id.selectedDevicesListView);
    selectedDevicesListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    selectedDevicesAdapter = new StableArrayAdapter(getActivity(), R.layout.text_view, selectedDevices);
    selectedDevicesListView.setListItems(selectedDevices);
    selectedDevicesListView.setAdapter(selectedDevicesAdapter);
    selectedDevicesListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
            final String item = (String) parent.getItemAtPosition(position);
            selectedDevices.remove(item);
            selectedDevicesAdapter = new StableArrayAdapter(getActivity(), R.layout.text_view, selectedDevices);
            selectedDevicesListView.setAdapter(selectedDevicesAdapter);
            setListViewHeightBasedOnChildren(selectedDevicesListView);
            updateModelSelectedDevices();
        }
    });
    selectedDevicesListView.setOnTouchListener(new ListView.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            int action = event.getAction();
            switch (action) {
            case MotionEvent.ACTION_DOWN:
                v.getParent().requestDisallowInterceptTouchEvent(true);
                break;
            case MotionEvent.ACTION_UP:
                v.getParent().requestDisallowInterceptTouchEvent(false);
                break;
            }
            v.onTouchEvent(event);
            return true;
        }
    });
    setListViewHeightBasedOnChildren(selectedDevicesListView);
}

From source file:com.fvd.nimbus.PaintActivity.java

private int colorToId(int c) {
    int res = 0;/*from ww w .ja v a 2  s .co  m*/
    switch (c) {
    case Color.CYAN:
        res = 2;
        break;
    case Color.RED:
        res = 5;
        break;
    case Color.GREEN:
        res = 3;
        break;
    case Color.WHITE:
        res = 0;
        break;
    case Color.BLACK:
        res = 7;
        break;
    }
    return res;
}

From source file:android.webkit.cts.WebViewTest.java

public void testCapturePicture() throws Exception, Throwable {
    if (!NullWebViewUtils.isWebViewAvailable()) {
        return;//  w w  w . j a  va2  s .co  m
    }
    final TestPictureListener listener = new TestPictureListener();

    startWebServer(false);
    final String url = mWebServer.getAssetUrl(TestHtmlConstants.BLANK_PAGE_URL);
    mOnUiThread.setPictureListener(listener);
    // Showing the blank page will fill the picture with the background color.
    mOnUiThread.loadUrlAndWaitForCompletion(url);
    // The default background color is white.
    Picture oldPicture = waitForPictureToHaveColor(Color.WHITE, listener);

    runTestOnUiThread(new Runnable() {
        @Override
        public void run() {
            mWebView.setBackgroundColor(Color.CYAN);
        }
    });
    mOnUiThread.reloadAndWaitForCompletion();
    waitForPictureToHaveColor(Color.CYAN, listener);

    // The content of the previously captured picture will not be updated automatically.
    assertTrue(isPictureFilledWithColor(oldPicture, Color.WHITE));
}

From source file:com.fvd.nimbus.PaintActivity.java

public void onClick(View v) {
    //ImageButton b = (ImageButton)findViewById(R.id.bToolColor);
    ImageButton bs = (ImageButton) findViewById(R.id.bToolShape);
    int zcolor = 123;
    switch (v.getId()) {
    case R.id.bSave2Nimbus:
        drawView.deselectShapes();//w  w  w  .  j  a  v  a 2 s.  c o m
        drawView.hideCrop();
        ((ImageButton) findViewById(R.id.bToolCrop)).setSelected(false);
        drawView.startEdit();
        setSelectedFoot(0);
        if (sessionId.length() == 0)
            showSettings();
        else {
            v.postDelayed(new Runnable() {
                @Override
                public void run() {
                    sendShot();
                }
            }, 200);
        }
        break;
    case R.id.bSave2SD:
        drawView.deselectShapes();
        drawView.hideCrop();
        ((ImageButton) findViewById(R.id.bToolCrop)).setSelected(false);
        drawView.startEdit();
        setSelectedFoot(0);
        v.postDelayed(new Runnable() {
            @Override
            public void run() {
                screenCapture();
            }
        }, 200);
        break;
    case R.id.btnBack:
        drawView.hideCrop();
        if (isTabletLandscape)
            ((ViewAnimator) findViewById(R.id.top_switcher)).setDisplayedChild(2);
        else
            ((ViewAnimator) findViewById(R.id.top_switcher)).setDisplayedChild(0);
        break;
    case R.id.bToolShape:

        if (findViewById(R.id.flTools).getVisibility() == View.VISIBLE) {
            if (findViewById(R.id.draw_tools).getVisibility() != View.VISIBLE) {
                drawView.hideCrop();
                drawView.reset();
                findViewById(R.id.draw_tools).setVisibility(View.VISIBLE);
                setSelectedFoot(1);
                updateColorDialog(dWidth, fWidth, dColor);
            } else {
                findViewById(R.id.draw_tools).setVisibility(View.GONE);
                drawView.hideCrop();
                drawView.startEdit();
                setSelectedFoot(0);
            }
            return;
        }
        if (findViewById(R.id.draw_tools).getVisibility() != View.VISIBLE) {
            drawView.hideCrop();
            drawView.reset();
            showToolsPopup(findViewById(R.id.bEditPage));
            setSelectedFoot(1);
            updateColorDialog(dWidth, fWidth, dColor);
        } else {
            findViewById(R.id.draw_tools).setVisibility(View.GONE);
            drawView.hideCrop();
            drawView.startEdit();
            setSelectedFoot(0);
        }
        break;
    case R.id.bToolCrop:
        hideTools();
        drawView.setShape(10);
        ImageButton iv = (ImageButton) findViewById(R.id.bToolCrop);
        if (iv.isSelected()) {
            iv.setSelected(false);
            drawView.startEdit();
            setSelectedFoot(0);
        } else
            setSelectedFoot(4);
        break;
    case R.id.bToolText:
        if (findViewById(R.id.text_field).getVisibility() != View.VISIBLE) {
            drawView.hideCrop();
            drawView.setShape(8);
            hideTools();
            setSelectedFoot(2);
            updateColorDialog(dWidth, fWidth, dColor);
        } else {

            findViewById(R.id.text_field).setVisibility(View.GONE);
            drawView.hideCrop();
            drawView.startEdit();
            setSelectedFoot(0);
        }
        break;
    case R.id.bApplyText:
        drawView.setText(((EditText) findViewById(R.id.etEditorText)).getText().toString(),
                (boolean) findViewById(R.id.bStroke).isSelected());
        drawView.startEdit();
        findViewById(R.id.text_field).setVisibility(View.GONE);
        setSelectedFoot(0);
        InputMethodManager im = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        im.hideSoftInputFromWindow(findViewById(R.id.etEditorText).getWindowToken(), 0);

        break;
    case R.id.bEditPage:
        drawView.hideCrop();
        drawView.startEdit();
        hideTools();
        setSelectedFoot(0);
        break;
    case R.id.bToolColor:
        if (findViewById(R.id.color_menu).getVisibility() != View.VISIBLE) {
            drawView.hideCrop();
            showColorPopup(findViewById(R.id.bToolColor));
            setSelectedFoot(3);
        } else {
            findViewById(R.id.color_menu).setVisibility(View.GONE);
            drawView.hideCrop();
            drawView.startEdit();
            setSelectedFoot(0);
        }
        break;
    case R.id.bErase:
        drawView.hideCrop();
        drawView.startEdit();
        hideTools();
        drawView.setShape(11);
        //findViewById(R.id.draw_tools).setVisibility(View.GONE);
        setSelectedFoot(5);
        break;
    case R.id.bDraw1:
        drawView.setShape(0);
        bs.setImageResource(R.drawable.draw_tools_01);
        setSelectedFoot(1);
        findViewById(R.id.draw_tools).setVisibility(View.GONE);
        break;
    case R.id.bDraw2:
        drawView.setShape(5);
        bs.setImageResource(R.drawable.draw_tools_03);
        setSelectedFoot(1);
        findViewById(R.id.draw_tools).setVisibility(View.GONE);
        break;
    case R.id.bDraw3:
        drawView.setShape(3);
        bs.setImageResource(R.drawable.draw_tools_02);
        findViewById(R.id.draw_tools).setVisibility(View.GONE);
        break;
    case R.id.bDraw4:
        drawView.setShape(7);
        findViewById(R.id.draw_tools).setVisibility(View.GONE);
        bs.setImageResource(R.drawable.draw_tools_04);
        break;
    case R.id.bDraw5:
        drawView.setShape(6);
        findViewById(R.id.draw_tools).setVisibility(View.GONE);
        bs.setImageResource(R.drawable.draw_tools_06);
        break;
    case R.id.bDraw6:
        drawView.setShape(1);
        findViewById(R.id.draw_tools).setVisibility(View.GONE);
        bs.setImageResource(R.drawable.draw_tools_07);
        break;
    case R.id.bDraw8:
        drawView.setShape(9);
        findViewById(R.id.draw_tools).setVisibility(View.GONE);
        bs.setImageResource(R.drawable.draw_tools_05);
        break;
    case R.id.ls_bColor1:
    case R.id.bColor1:
        drawView.setColour(Color.CYAN);
        setPaletteColor(Color.CYAN);
        zcolor = Color.CYAN;
        /*b.setImageResource(R.drawable.icon_color_blue);
        ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_blue);
        ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_blue);*/
        setLandColorSelected(R.id.ls_bColor1);
        findViewById(R.id.color_menu).setVisibility(View.GONE);
        break;
    case R.id.ls_bColor2:
    case R.id.bColor2:
        drawView.setColour(Color.RED);
        setPaletteColor(Color.RED);
        zcolor = Color.RED;
        /*b.setImageResource(R.drawable.icon_color_red);
        ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_red);
        ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_red);*/
        setLandColorSelected(R.id.ls_bColor2);
        findViewById(R.id.color_menu).setVisibility(View.GONE);
        break;
    case R.id.ls_bColor3:
    case R.id.bColor3:
        drawView.setColour(Color.GREEN);

        setPaletteColor(Color.GREEN);
        zcolor = Color.GREEN;
        /*b.setImageResource(R.drawable.icon_color_yellow);
        ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_yellow);
        ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_yellow);*/
        setLandColorSelected(R.id.ls_bColor3);
        findViewById(R.id.color_menu).setVisibility(View.GONE);
        break;
    case R.id.ls_bColor4:
    case R.id.bColor4:
        drawView.setColour(Color.BLACK);
        setPaletteColor(Color.BLACK);
        zcolor = Color.BLACK;
        /*b.setImageResource(R.drawable.icon_color_black);
        ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_black);
        ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_black);*/
        setLandColorSelected(R.id.ls_bColor4);
        findViewById(R.id.color_menu).setVisibility(View.GONE);
        break;
    case R.id.ls_bColor5:
    case R.id.bColor5:
        openDialog(false);
        /*drawView.setColour(7);
        color=7;
        b.setImageResource(R.drawable.icon_color_black);
        ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_black);
        ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_black);
        setLandColorSelected(R.id.ls_bColor5);*/
        findViewById(R.id.color_menu).setVisibility(View.GONE);
        break;
    case R.id.bUndo:
        drawView.undo();
        break;

    case R.id.btnShare:
        drawView.deselectShapes();
        drawView.hideCrop();
        v.postDelayed(new Runnable() {
            @Override
            public void run() {
                shareCapture();
            }
        }, 200);

        break;
    case R.id.bDone:
        if (storePath.length() > 0) {
            drawView.deselectShapes();
            drawView.hideCrop();
            ((ImageButton) findViewById(R.id.bToolCrop)).setSelected(false);
            drawView.startEdit();
            setSelectedFoot(0);
            v.postDelayed(new Runnable() {
                @Override
                public void run() {
                    screenCapture();
                }
            }, 200);
        } else {
            ((ViewAnimator) findViewById(R.id.top_switcher)).setDisplayedChild(1);
        }

        break;
    case R.id.bClearAll:
        drawView.clear();
        break;
    case R.id.bTurnLeft:
        drawView.deselectShapes();
        drawView.setAngle(-90);
        break;
    case R.id.bTurnRight:
        drawView.deselectShapes();
        drawView.setAngle(90);
        break;
    }
    if (zcolor != 123) {
        ccolor = zcolor;
        dColor = zcolor;
        Editor e = prefs.edit();
        e.putInt(pColor, dColor);
        e.commit();
    }
}

From source file:com.nest5.businessClient.Initialactivity.java

private void makeDailyTable(int TABLE_TYPE) {
    dailyTable.removeAllViews();// w w  w  .  ja v a 2  s .c  o  m
    Double total = 0.0;
    DecimalFormat dec = new DecimalFormat("$###,###,###");
    TextView tv = new TextView(mContext);
    tv.setBackgroundColor(Color.parseColor("#80808080"));
    tv.setHeight(2);
    TableRow tr1 = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null);
    TextView tDate1 = (TextView) tr1.findViewById(R.id.cell_date);
    TextView tItem1 = (TextView) tr1.findViewById(R.id.cell_item);
    TextView tAccount1 = (TextView) tr1.findViewById(R.id.cell_account);
    TextView tVal1 = (TextView) tr1.findViewById(R.id.cell_value);
    TextView tTot1 = (TextView) tr1.findViewById(R.id.cell_total);
    tDate1.setText("FECHA");
    tAccount1.setText("CUENTA");
    tItem1.setText("ITEM");
    tVal1.setText("VALOR");
    tTot1.setText("TOTAL");
    tr1.setBackgroundColor(Color.CYAN);
    dailyTable.addView(tr1);
    dailyTable.addView(tv);

    //actualizar sales de hoy
    Calendar today = Calendar.getInstance();
    Calendar tomorrow = Calendar.getInstance();
    today.set(Calendar.HOUR, 0);
    today.set(Calendar.HOUR_OF_DAY, 0);
    today.set(Calendar.MINUTE, 0);
    today.set(Calendar.SECOND, 0);
    today.set(Calendar.MILLISECOND, 0);
    tomorrow.roll(Calendar.DATE, 1);
    tomorrow.set(Calendar.HOUR, 0);
    tomorrow.set(Calendar.HOUR_OF_DAY, 0);
    tomorrow.set(Calendar.MINUTE, 0);
    tomorrow.set(Calendar.SECOND, 0);
    tomorrow.set(Calendar.MILLISECOND, 0);

    init = today.getTimeInMillis();
    end = tomorrow.getTimeInMillis();
    Log.d("GUARDANDOVENTA", today.toString());
    Log.d("GUARDANDOVENTA", tomorrow.toString());
    Calendar now = Calendar.getInstance();
    now.setTimeInMillis(System.currentTimeMillis());
    Log.d(TAG, now.toString());

    Log.d(TAG, "Diferencia entre tiempos: " + String.valueOf(end - init));
    salesFromToday = saleDataSource.getAllSalesWithin(init, end);

    List<Sale> usingSales = salesFromToday;

    switch (TABLE_TYPE) {
    case TABLE_TYPE_TODAY:
        usingSales = salesFromToday;
        break;
    case TABLE_TYPE_ALL:
        usingSales = saleList;
        break;
    }

    for (Sale currentSale : usingSales) {

        double totalLocal = 0.0;
        LinkedHashMap<Combo, Double> combos = currentSale.getCombos();
        LinkedHashMap<Product, Double> products = currentSale.getProducts();
        LinkedHashMap<Ingredient, Double> ingredients = currentSale.getIngredients();
        Log.w("DAYILETABLES", " " + combos.size() + " " + products.size() + " " + ingredients.size());
        Iterator<Entry<Combo, Double>> it = combos.entrySet().iterator();
        Calendar date = Calendar.getInstance();
        date.setTimeInMillis(currentSale.getDate());
        String fecha = date.get(Calendar.MONTH) + "/" + date.get(Calendar.DAY_OF_MONTH) + "/"
                + date.get(Calendar.YEAR) + "\n" + date.get(Calendar.HOUR_OF_DAY) + ":"
                + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND);
        String account = currentSale.getPaymentMethod();
        while (it.hasNext()) {
            TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null);
            TextView tDate = (TextView) tr.findViewById(R.id.cell_date);
            TextView tItem = (TextView) tr.findViewById(R.id.cell_item);
            TextView tAccount = (TextView) tr.findViewById(R.id.cell_account);
            TextView tVal = (TextView) tr.findViewById(R.id.cell_value);
            TextView tTot = (TextView) tr.findViewById(R.id.cell_total);
            Map.Entry<Combo, Double> pair = (Map.Entry<Combo, Double>) it.next();
            Double value = pair.getValue() * pair.getKey().getPrice();

            tDate.setText(fecha);
            tAccount.setText(account);
            tItem.setText(pair.getKey().getName() + " en Combo");
            tVal.setText(dec.format(value));
            tTot.setText("----");
            total += value;
            totalLocal += value;
            dailyTable.addView(tr);

            // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue());
        }

        Iterator<Entry<Product, Double>> it2 = products.entrySet().iterator();

        while (it2.hasNext()) {
            Map.Entry<Product, Double> pair = (Map.Entry<Product, Double>) it2.next();
            TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null);
            TextView tDate = (TextView) tr.findViewById(R.id.cell_date);
            TextView tItem = (TextView) tr.findViewById(R.id.cell_item);
            TextView tAccount = (TextView) tr.findViewById(R.id.cell_account);
            TextView tVal = (TextView) tr.findViewById(R.id.cell_value);
            TextView tTot = (TextView) tr.findViewById(R.id.cell_total);

            Double value = pair.getValue() * pair.getKey().getPrice();

            tDate.setText(fecha);
            tAccount.setText(account);
            tItem.setText(pair.getKey().getName());
            tVal.setText(dec.format(value));
            tTot.setText("----");
            total += value;
            totalLocal += value;
            dailyTable.addView(tr);

            // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue());
        }

        Iterator<Entry<Ingredient, Double>> it3 = ingredients.entrySet().iterator();

        while (it3.hasNext()) {
            Map.Entry<Ingredient, Double> pair = (Map.Entry<Ingredient, Double>) it3.next();
            TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null);
            TextView tDate = (TextView) tr.findViewById(R.id.cell_date);
            TextView tItem = (TextView) tr.findViewById(R.id.cell_item);
            TextView tAccount = (TextView) tr.findViewById(R.id.cell_account);
            TextView tVal = (TextView) tr.findViewById(R.id.cell_value);
            TextView tTot = (TextView) tr.findViewById(R.id.cell_total);

            Double value = pair.getValue() * pair.getKey().getPrice();

            tDate.setText(fecha);
            tAccount.setText(account);
            tItem.setText(pair.getKey().getName());
            tVal.setText(dec.format(value));
            tTot.setText("----");
            total += value;
            totalLocal += value;
            dailyTable.addView(tr);

            // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue());
        }

        TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null);
        TextView tDate = (TextView) tr.findViewById(R.id.cell_date);
        TextView tItem = (TextView) tr.findViewById(R.id.cell_item);
        TextView tAccount = (TextView) tr.findViewById(R.id.cell_account);
        TextView tVal = (TextView) tr.findViewById(R.id.cell_value);
        TextView tTot = (TextView) tr.findViewById(R.id.cell_total);

        tDate.setText(fecha);
        tAccount.setText("-------");
        tItem.setText("Ingreso por Ventas");
        tVal.setText("----");
        tTot.setText(dec.format(totalLocal));
        tr.setBackgroundColor(Color.LTGRAY);
        dailyTable.addView(tr);
        TableRow tr2 = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null);
        TextView tDate2 = (TextView) tr2.findViewById(R.id.cell_date);
        TextView tItem2 = (TextView) tr2.findViewById(R.id.cell_item);
        TextView tAccount2 = (TextView) tr2.findViewById(R.id.cell_account);
        TextView tVal2 = (TextView) tr2.findViewById(R.id.cell_value);
        TextView tTot2 = (TextView) tr2.findViewById(R.id.cell_total);

        tDate2.setText(fecha);
        tAccount2.setText("-------");
        tItem2.setText("Acumulado por Ventas");
        tVal2.setText("----");
        tTot2.setText(dec.format(total));
        tr2.setBackgroundColor(Color.GRAY);
        dailyTable.addView(tr2);

    }

}

From source file:com.nest5.businessClient.Initialactivity.java

private void makeInventoryTable(List<Ingredient> ingredients) {
    inventoryTable.removeAllViews();/*w  w w.  j  ava  2s . c  o  m*/
    Double total = 0.0;
    DecimalFormat dec = new DecimalFormat("$###,###,###");
    TextView tv = new TextView(mContext);
    tv.setBackgroundColor(Color.parseColor("#80808080"));
    tv.setHeight(2);
    TableRow tr1 = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null);
    TextView tDate1 = (TextView) tr1.findViewById(R.id.cell_date);
    TextView tItem1 = (TextView) tr1.findViewById(R.id.cell_type);
    TextView tAccount1 = (TextView) tr1.findViewById(R.id.cell_qty);
    TextView tVal1 = (TextView) tr1.findViewById(R.id.cell_unit_value);
    TextView tTot1 = (TextView) tr1.findViewById(R.id.cell_total_value);
    TextView tTotTot1 = (TextView) tr1.findViewById(R.id.cell_total_total);
    tDate1.setText("FECHA");
    tAccount1.setText("CANTIDAD");
    tItem1.setText("TIPO");
    tVal1.setText("VALOR\nUNIDAD");
    tTot1.setText("TOTAL\nITEM");
    tTotTot1.setText("TOTAL");
    tr1.setBackgroundColor(Color.CYAN);
    inventoryTable.addView(tr1);
    inventoryTable.addView(tv);

    for (Ingredient current : ingredients) {

        Calendar date = Calendar.getInstance();
        date.setTimeInMillis(current.getDate());
        String fecha = date.get(Calendar.MONTH) + "/" + date.get(Calendar.DAY_OF_MONTH) + "/"
                + date.get(Calendar.YEAR) + "\n" + date.get(Calendar.HOUR_OF_DAY) + ":"
                + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND);

        Double localVal = current.getQty() * current.getCostPerUnit();
        total += localVal;

        TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null);
        TextView tDate = (TextView) tr.findViewById(R.id.cell_date);
        TextView tType = (TextView) tr.findViewById(R.id.cell_type);
        TextView tQty = (TextView) tr.findViewById(R.id.cell_qty);
        TextView tVal = (TextView) tr.findViewById(R.id.cell_unit_value);
        TextView tTot = (TextView) tr.findViewById(R.id.cell_total_value);
        TextView tTotTot = (TextView) tr.findViewById(R.id.cell_total_total);

        tDate.setText(fecha);
        tType.setText("E");
        tQty.setText(String.valueOf(current.getQty()));
        tVal.setText(dec.format(current.getCostPerUnit()));
        tTot.setText(dec.format(localVal));
        tTotTot.setText(" ----- ");

        inventoryTable.addView(tr);

    }

    TableRow tr2 = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null);
    TextView tDate2 = (TextView) tr2.findViewById(R.id.cell_date);
    TextView tType2 = (TextView) tr2.findViewById(R.id.cell_type);
    TextView tQty2 = (TextView) tr2.findViewById(R.id.cell_qty);
    TextView tVal2 = (TextView) tr2.findViewById(R.id.cell_unit_value);
    TextView tTot2 = (TextView) tr2.findViewById(R.id.cell_total_value);
    TextView tTotTot2 = (TextView) tr2.findViewById(R.id.cell_total_total);

    tDate2.setText("------");
    tType2.setText("-----");
    tQty2.setText("-----");
    tVal2.setText("-----");
    tTot2.setText("TOTAL GENERAL");
    tTotTot2.setText(dec.format(total));
    tr2.setBackgroundColor(Color.LTGRAY);
    inventoryTable.addView(tr2);

}

From source file:com.android.systemui.statusbar.phone.NotificationPanelView.java

@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    if (DEBUG) {/*w  w w  . j  a va2  s.  c om*/
        Paint p = new Paint();
        p.setColor(Color.RED);
        p.setStrokeWidth(2);
        p.setStyle(Paint.Style.STROKE);
        canvas.drawLine(0, getMaxPanelHeight(), getWidth(), getMaxPanelHeight(), p);
        p.setColor(Color.BLUE);
        canvas.drawLine(0, getExpandedHeight(), getWidth(), getExpandedHeight(), p);
        p.setColor(Color.GREEN);
        canvas.drawLine(0, calculatePanelHeightQsExpanded(), getWidth(), calculatePanelHeightQsExpanded(), p);
        p.setColor(Color.YELLOW);
        canvas.drawLine(0, calculatePanelHeightShade(), getWidth(), calculatePanelHeightShade(), p);
        p.setColor(Color.MAGENTA);
        canvas.drawLine(0, calculateQsTopPadding(), getWidth(), calculateQsTopPadding(), p);
        p.setColor(Color.CYAN);
        canvas.drawLine(0, mNotificationStackScroller.getTopPadding(), getWidth(),
                mNotificationStackScroller.getTopPadding(), p);
    }
}