Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

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

Prototype

int BLACK

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

Click Source Link

Usage

From source file:com.lifehackinnovations.siteaudit.FloorPlanActivity.java

public static AlertDialog getaddtextdialog(String title, final int itemnumber, Context ctx) {

    AlertDialog.Builder getaddtext = new AlertDialog.Builder(ctx);

    final LinearLayout linearlayout = new LinearLayout(ctx);
    linearlayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    linearlayout.setOrientation(LinearLayout.VERTICAL);

    final EditText nameet = new EditText(ctx);
    nameet.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

    final TextView fontname = new TextView(ctx);
    fontname.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

    final TextView colorname = new TextView(ctx);
    colorname.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

    final Spinner fontsizespinner = new Spinner(ctx);
    fontsizespinner.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    final Spinner colorspinner = new Spinner(ctx);
    fontsizespinner.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

    List<String> fontsizelist = new ArrayList<String>();
    for (int t = 1; t < 200; t++) {
        fontsizelist.add(u.s(t));//  w  w  w  .  j a v  a  2s . c  o  m
    }
    ArrayAdapter<String> fontsizearrayadapter = new ArrayAdapter<String>(ctx, R.layout.spinnertextview,
            fontsizelist);
    fontsizearrayadapter.setDropDownViewResource(R.layout.spinnertextview);

    List<String> colorlist = new ArrayList<String>();
    {
        colorlist.add("RED");
        colorlist.add("BLACK");
        colorlist.add("BLUE");
        colorlist.add("GREEN");
        colorlist.add("WHITE");
        colorlist.add("GRAY");
    }
    ArrayAdapter<String> colorlistarrayadapter = new ArrayAdapter<String>(ctx, R.layout.spinnertextview,
            colorlist);
    fontsizearrayadapter.setDropDownViewResource(R.layout.spinnertextview);
    colorspinner.setAdapter(colorlistarrayadapter);
    fontsizespinner.setAdapter(fontsizearrayadapter);
    fontsizespinner.setSelection(getIndexofSpinner(fontsizespinner, "25"));

    fontname.setText("Select Font Size");
    fontname.setTextSize(20f);
    colorname.setText("Select Color");
    colorname.setTextSize(20f);

    linearlayout.addView(nameet);
    linearlayout.addView(fontname);
    linearlayout.addView(fontsizespinner);
    linearlayout.addView(colorname);
    linearlayout.addView(colorspinner);

    if (!(itemnumber == view.i)) {
        nameet.setText(view.ITEMstring[itemnumber]);
        fontsizespinner.setSelection(getIndexofSpinner(fontsizespinner, u.s(view.ITEMfontsize[itemnumber])));
        colorspinner.setSelection(getIndexofSpinner(colorspinner, u.s(view.ITEMfontcolor[itemnumber])));
    }

    getaddtext.setView(linearlayout);
    getaddtext.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            dialog.cancel();
        }
    });
    getaddtext.setTitle(title);
    getaddtext.setPositiveButton("OK", new DialogInterface.OnClickListener() {

        @Override

        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub
            String string = nameet.getText().toString();

            float fontsize = fontsizespinner.getSelectedItemPosition() + 1;
            //ITEMelcnumber[itemselectednumber]=u.i(string);
            int colpos = colorspinner.getSelectedItemPosition();
            int[] col = new int[] { Color.RED, Color.BLACK, Color.BLUE, Color.GREEN, Color.WHITE, Color.GRAY };
            int color = col[colpos];

            Log.d("addtext", u.s((int) fontsize) + colpos + color);

            view.ITEMstring[itemnumber] = string;
            view.ITEMfontsize[itemnumber] = (int) fontsize;
            view.ITEMfontcolor[itemnumber] = color;

            view.itemname = string;
            view.fontsize = (int) fontsize;
            view.color = color;
            view.invalidate();
            dialog.dismiss();
            FloorPlanActivity.writeonedbitem(itemnumber);
        }

    });

    return getaddtext.create();
}

From source file:com.google.samples.apps.iosched.ui.BaseActivity.java

protected void onActionBarAutoShowOrHide(boolean shown) {
    if (mStatusBarColorAnimator != null) {
        mStatusBarColorAnimator.cancel();
    }//from  w w  w. j  a  v  a  2  s  . c o  m
    mStatusBarColorAnimator = ObjectAnimator
            .ofInt((mDrawerLayout != null) ? mDrawerLayout : mLUtils,
                    (mDrawerLayout != null) ? "statusBarBackgroundColor" : "statusBarColor",
                    shown ? Color.BLACK : mNormalStatusBarColor, shown ? mNormalStatusBarColor : Color.BLACK)
            .setDuration(250);
    if (mDrawerLayout != null) {
        mStatusBarColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                ViewCompat.postInvalidateOnAnimation(mDrawerLayout);
            }
        });
    }
    mStatusBarColorAnimator.setEvaluator(ARGB_EVALUATOR);
    mStatusBarColorAnimator.start();

    updateSwipeRefreshProgressBarTop();

    for (final View view : mHideableHeaderViews) {
        if (shown) {
            ViewCompat.animate(view).translationY(0).alpha(1).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator())
                    // Setting Alpha animations should be done using the
                    // layer_type set to layer_type_hardware for the duration of the animation.
                    .withLayer();
        } else {
            ViewCompat.animate(view).translationY(-view.getBottom()).alpha(0)
                    .setDuration(HEADER_HIDE_ANIM_DURATION).setInterpolator(new DecelerateInterpolator())
                    // Setting Alpha animations should be done using the
                    // layer_type set to layer_type_hardware for the duration of the animation.
                    .withLayer();
        }
    }
}

From source file:com.almalence.opencam.SavingService.java

protected void addTimestamp(File file, int exif_orientation) {
    try {//w w w  .j a  v  a 2 s  . c  om
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

        int dateFormat = Integer.parseInt(prefs.getString(ApplicationScreen.sTimestampDate, "0"));
        boolean abbreviation = prefs.getBoolean(ApplicationScreen.sTimestampAbbreviation, false);
        int saveGeo = Integer.parseInt(prefs.getString(ApplicationScreen.sTimestampGeo, "0"));
        int timeFormat = Integer.parseInt(prefs.getString(ApplicationScreen.sTimestampTime, "0"));
        int separator = Integer.parseInt(prefs.getString(ApplicationScreen.sTimestampSeparator, "0"));
        String customText = prefs.getString(ApplicationScreen.sTimestampCustomText, "");
        int color = Integer.parseInt(prefs.getString(ApplicationScreen.sTimestampColor, "1"));
        int fontSizeC = Integer.parseInt(prefs.getString(ApplicationScreen.sTimestampFontSize, "80"));

        String formattedCurrentDate = "";
        if (dateFormat == 0 && timeFormat == 0 && customText.equals("") && saveGeo == 0)
            return;

        String geoText = "";
        // show geo data on time stamp
        if (saveGeo != 0) {
            Location l = MLocation.getLocation(getApplicationContext());

            if (l != null) {
                if (saveGeo == 2) {
                    Geocoder geocoder = new Geocoder(MainScreen.getMainContext(), Locale.getDefault());
                    List<Address> list = geocoder.getFromLocation(l.getLatitude(), l.getLongitude(), 1);
                    if (!list.isEmpty()) {
                        String country = list.get(0).getCountryName();
                        String locality = list.get(0).getLocality();
                        String adminArea = list.get(0).getSubAdminArea();// city
                        // localized
                        String street = list.get(0).getThoroughfare();// street
                        // localized
                        String address = list.get(0).getAddressLine(0);

                        // replace street and city with localized name
                        if (street != null)
                            address = street;
                        if (adminArea != null)
                            locality = adminArea;

                        geoText = (country != null ? country : "") + (locality != null ? (", " + locality) : "")
                                + (address != null ? (", \n" + address) : "");

                        if (geoText.equals(""))
                            geoText = "lat:" + l.getLatitude() + "\nlng:" + l.getLongitude();
                    }
                } else
                    geoText = "lat:" + l.getLatitude() + "\nlng:" + l.getLongitude();
            }
        }

        String dateFormatString = "";
        String timeFormatString = "";
        String separatorString = ".";
        String monthString = abbreviation ? "MMMM" : "MM";

        switch (separator) {
        case 0:
            separatorString = "/";
            break;
        case 1:
            separatorString = ".";
            break;
        case 2:
            separatorString = "-";
            break;
        case 3:
            separatorString = " ";
            break;
        default:
            separatorString = " ";
        }

        switch (dateFormat) {
        case 1:
            dateFormatString = "yyyy" + separatorString + monthString + separatorString + "dd";
            break;
        case 2:
            dateFormatString = "dd" + separatorString + monthString + separatorString + "yyyy";
            break;
        case 3:
            dateFormatString = monthString + separatorString + "dd" + separatorString + "yyyy";
            break;
        default:
        }

        switch (timeFormat) {
        case 1:
            timeFormatString = " hh:mm:ss a";
            break;
        case 2:
            timeFormatString = " HH:mm:ss";
            break;
        default:
        }

        Date currentDate = Calendar.getInstance().getTime();
        java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat(
                dateFormatString + timeFormatString);
        formattedCurrentDate = simpleDateFormat.format(currentDate);

        formattedCurrentDate += (customText.isEmpty() ? "" : ("\n" + customText))
                + (geoText.isEmpty() ? "" : ("\n" + geoText));

        if (formattedCurrentDate.equals(""))
            return;

        Bitmap sourceBitmap;
        Bitmap bitmap;

        int rotation = 0;
        Matrix matrix = new Matrix();
        if (exif_orientation == ExifInterface.ORIENTATION_ROTATE_90) {
            rotation = 90;
        } else if (exif_orientation == ExifInterface.ORIENTATION_ROTATE_180) {
            rotation = 180;
        } else if (exif_orientation == ExifInterface.ORIENTATION_ROTATE_270) {
            rotation = 270;
        }
        matrix.postRotate(rotation);

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inMutable = true;

        sourceBitmap = BitmapFactory.decodeFile(file.getAbsolutePath(), options);
        bitmap = Bitmap.createBitmap(sourceBitmap, 0, 0, sourceBitmap.getWidth(), sourceBitmap.getHeight(),
                matrix, false);

        sourceBitmap.recycle();

        int width = bitmap.getWidth();
        int height = bitmap.getHeight();

        Paint p = new Paint();

        Canvas canvas = new Canvas(bitmap);

        final float scale = getResources().getDisplayMetrics().density;

        p.setColor(Color.WHITE);
        switch (color) {
        case 0:
            color = Color.BLACK;
            p.setColor(Color.BLACK);
            break;
        case 1:
            color = Color.WHITE;
            p.setColor(Color.WHITE);
            break;
        case 2:
            color = Color.YELLOW;
            p.setColor(Color.YELLOW);
            break;

        }

        if (width > height) {
            p.setTextSize(height / fontSizeC * scale + 0.5f); // convert dps
            // to pixels
        } else {
            p.setTextSize(width / fontSizeC * scale + 0.5f); // convert dps
            // to pixels
        }
        p.setTextAlign(Align.RIGHT);
        drawTextWithBackground(canvas, p, formattedCurrentDate, color, Color.BLACK, width, height);

        Matrix matrix2 = new Matrix();
        matrix2.postRotate(360 - rotation);
        sourceBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix2, false);

        bitmap.recycle();

        FileOutputStream outStream;
        outStream = new FileOutputStream(file);
        sourceBitmap.compress(Bitmap.CompressFormat.JPEG, jpegQuality, outStream);
        sourceBitmap.recycle();
        outStream.flush();
        outStream.close();
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    } catch (OutOfMemoryError e) {
        e.printStackTrace();
    }
}

From source file:com.t2.compassionMeditation.Graphs1Activity.java

/**
 * Sets up all parameters for display of both the chart on the screen 
 * AND a color coded display of the parameters and their values 
 *//*ww w  .j  av  a2  s.  c o  m*/
private void generateChart() {
    // Set up chart
    XYMultipleSeriesDataset deviceDataset = new XYMultipleSeriesDataset();
    XYMultipleSeriesRenderer deviceRenderer = new XYMultipleSeriesRenderer();

    LinearLayout layout = (LinearLayout) findViewById(R.id.deviceChart);
    if (mDeviceChartView != null) {
        layout.removeView(mDeviceChartView);
    }
    if (true) {
        mDeviceChartView = ChartFactory.getLineChartView(this, deviceDataset, deviceRenderer);
        mDeviceChartView.setBackgroundColor(Color.BLACK);
        layout.addView(mDeviceChartView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    }

    deviceRenderer.setShowLabels(false);
    deviceRenderer.setMargins(new int[] { 0, 5, 5, 0 });
    deviceRenderer.setShowAxes(true);
    deviceRenderer.setShowLegend(false);

    deviceRenderer.setZoomEnabled(false, false);
    deviceRenderer.setPanEnabled(false, false);
    deviceRenderer.setYAxisMin(0);
    deviceRenderer.setYAxisMax(100);

    SpannableStringBuilder sMeasuresText = new SpannableStringBuilder("Displaying: ");

    ArrayList<Long> visibleIds = getVisibleIds(KEY_NAME);

    int keyCount = mBioParameters.size();
    keyCount = mBioParameters.size();

    int lineNum = 0;
    for (int i = 0; i < mBioParameters.size(); ++i) {
        GraphBioParameter item = mBioParameters.get(i);

        item.visible = visibleIds.contains(item.id);
        if (!item.visible) {
            continue;
        }

        deviceDataset.addSeries(item.series);
        item.color = getKeyColor(i, keyCount);

        // Add name of the measure to the displayed text field
        ForegroundColorSpan fcs = new ForegroundColorSpan(item.color);
        int start = sMeasuresText.length();
        sMeasuresText.append(mBioParameters.get(i).title1 + ", ");
        int end = sMeasuresText.length();
        sMeasuresText.setSpan(fcs, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
        if (sMeasuresText.length() > 40 && lineNum == 0) {
            lineNum++;
        }

        XYSeriesRenderer seriesRenderer = new XYSeriesRenderer();
        seriesRenderer.setColor(item.color);
        seriesRenderer.setPointStyle(PointStyle.CIRCLE);

        deviceRenderer.addSeriesRenderer(seriesRenderer);
    }

    mMeasuresDisplayText.setText(sMeasuresText);
}

From source file:com.google.samples.apps.sergio.ui.BaseActivity.java

protected void onActionBarAutoShowOrHide(boolean shown) {
    if (mStatusBarColorAnimator != null) {
        mStatusBarColorAnimator.cancel();
    }//from   w w w.j ava 2s  .c o m
    mStatusBarColorAnimator = ObjectAnimator
            .ofInt((mDrawerLayout != null) ? mDrawerLayout : mLUtils,
                    (mDrawerLayout != null) ? "statusBarBackgroundColor" : "statusBarColor",
                    shown ? Color.BLACK : mNormalStatusBarColor, shown ? mNormalStatusBarColor : Color.BLACK)
            .setDuration(250);
    if (mDrawerLayout != null) {
        mStatusBarColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                ViewCompat.postInvalidateOnAnimation(mDrawerLayout);
            }
        });
    }
    mStatusBarColorAnimator.setEvaluator(ARGB_EVALUATOR);
    mStatusBarColorAnimator.start();

    updateSwipeRefreshProgressBarTop();

    for (View view : mHideableHeaderViews) {
        if (shown) {
            view.animate().translationY(0).alpha(1).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        } else {
            view.animate().translationY(-view.getBottom()).alpha(0).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        }
    }
}

From source file:com.FluksoViz.FluksoVizActivity.java

private void make_graph_pretty(XYPlot p) {

    p.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 56); // Reduce the number
    // of range labels
    // Plot1.setTicksPerDomainLabel(1);
    p.setDomainValueFormat(new DateFormat_p1());

    p.setRangeStep(XYStepMode.SUBDIVIDE, 5);// Skala Y pionowa
    // Plot1.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 1);
    // Plot1.setTicksPerRangeLabel(1);
    p.getTitleWidget().setClippingEnabled(false);

    p.getTitleWidget().pack();//from   w  w w .ja v  a2 s .c  o  m
    int axis_font_size = 15;
    int title_font_size = 15;
    int domain_font_size = 12;

    if (screen_width == 320) {
        axis_font_size = 12;
        title_font_size = 9;
        domain_font_size = 10;
    }

    p.getTitleWidget().getLabelPaint().setTextSize(title_font_size);
    p.getGraphWidget().getDomainLabelPaint().setTextSize(domain_font_size);
    p.getGraphWidget().getDomainLabelPaint().setColor(Color.WHITE);
    p.getGraphWidget().getRangeLabelPaint().setColor(Color.WHITE);
    p.getGraphWidget().getRangeLabelPaint().setTextSize(axis_font_size);
    p.getGraphWidget().getDomainOriginLabelPaint().setTextSize(domain_font_size);
    p.getGraphWidget().getRangeOriginLabelPaint().setTextSize(axis_font_size);
    p.getGraphWidget().setClippingEnabled(false);

    p.setDomainValueFormat(new DecimalFormat("#"));

    p.getLegendWidget().setVisible(false);
    p.getDomainLabelWidget().setVisible(false);
    p.getRangeLabelWidget().setVisible(false);
    p.getGraphWidget().getGridLinePaint().setPathEffect(new DashPathEffect(new float[] { 1, 2, 1, 2 }, 0));
    p.getBackgroundPaint().setColor(Color.TRANSPARENT);
    p.getGraphWidget().getBackgroundPaint().setColor(Color.TRANSPARENT);
    p.getGraphWidget().getGridBackgroundPaint().setColor(Color.TRANSPARENT);
    p.setGridPadding(0, 10, 0, 0); // left top right bottom
    p.getGraphWidget().getGridLinePaint().setColor(Color.TRANSPARENT);

    if (sensor_number != 4) {
        p.setRangeLowerBoundary(0, BoundaryMode.GROW);// to ustawia
    }

    if (sensor_number == 4) {
        p.addMarker(new YValueMarker(0, "0", new XPositionMetric(-11, XLayoutStyle.ABSOLUTE_FROM_LEFT),
                Color.WHITE, Color.WHITE));
        p.setRangeStep(XYStepMode.SUBDIVIDE, 2);
        p.getGraphWidget().getRangeOriginLinePaint().setAlpha(0);

        series1mFormat = new LineAndPointFormatter( // FAZA
                Color.rgb(0, 220, 0), // line color
                Color.rgb(0, 150, 0), // point color
                null);

        line1mFill.setShader(
                new LinearGradient(0, 0, 0, 200, Color.rgb(0, 200, 0), Color.BLACK, Shader.TileMode.MIRROR));
        series1mFormat.getLinePaint().setStrokeWidth(4);
        series1mFormat.setFillPaint(line1mFill);

        series2mFormat = new LineAndPointFormatter( // faza 2 solar
                Color.rgb(200, 200, 0), // line
                Color.rgb(100, 100, 0), // point color
                null);
        line2mFill.setShader(
                new LinearGradient(0, 150, 0, 120, Color.rgb(250, 250, 0), Color.BLACK, Shader.TileMode.CLAMP));
        series2mFormat.setFillDirection(FillDirection.TOP);
        series2mFormat.setFillPaint(line2mFill);
        series2mFormat.getLinePaint().setStrokeWidth(5);

        series3mFormat = new LineAndPointFormatter( // FAZA 3 formater
                Color.rgb(0, 220, 0), // line color
                Color.rgb(0, 150, 0), // point color
                null);
        line3mFill.setAlpha(255);
        line3mFill.setShader(new LinearGradient(0, 0, 0, 50, Color.BLACK, Color.BLACK, Shader.TileMode.MIRROR));
        series3mFormat.getLinePaint().setStrokeWidth(7);
        series3mFormat.setFillPaint(line3mFill);

        series4mFormat = new LineAndPointFormatter(Color.rgb(0, 140, 220), // line
                Color.rgb(0, 120, 190), // point color
                null);
        line4mFill = new Paint();
        line4mFill.setAlpha(190);
        line4mFill.setShader(new LinearGradient(0, 0, 0, 50, Color.BLACK, Color.BLACK, Shader.TileMode.MIRROR));
        series4mFormat.getLinePaint().setStrokeWidth(5);
        series4mFormat.setFillPaint(line4mFill);
        series4mFormat.setFillDirection(FillDirection.TOP);

        // XYRegionFormatter region4Formatter = new
        // XYRegionFormatter(Color.BLUE);
        // series4mFormat.addRegion(new RectRegion(Double.NEGATIVE_INFINITY,
        // Double.POSITIVE_INFINITY, 0, -1000, "R1"), region4Formatter);

    }

    // p.setRangeLowerBoundary(0, BoundaryMode.GROW);// to ustawia
    // min i max
    // Plot1.setRangeUpperBoundary(11, BoundaryMode.FIXED);

    p.setRangeValueFormat(new DecimalFormat("#"));
    p.setBorderStyle(Plot.BorderStyle.SQUARE, null, null);
    p.setBorderPaint(null);
    p.disableAllMarkup(); // To get rid of them call disableAllMarkup():

}

From source file:cl.gisred.android.PowerOnActivity.java

private void singleTapOnMap() {
    myMapView.setOnSingleTapListener(new OnSingleTapListener() {
        @Override/* www .  j  av  a2 s. com*/
        public void onSingleTap(float x, float y) {

            if (bMapTap) {

                Point oPoint = myMapView.toMapPoint(x, y);

                if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null)
                    myMapView.removeLayer(mBusquedaLayer);

                if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null)
                    myMapView.removeLayer(mSeleccionLayer);

                if (bCallOut) {

                    if (nIndentify > 0) {

                        mSeleccionLayer = new GraphicsLayer();
                        SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12,
                                SimpleMarkerSymbol.STYLE.CIRCLE);
                        Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol);
                        mSeleccionLayer.addGraphic(resultLocGraphic);

                        myMapView.addLayer(mSeleccionLayer);

                        switch (nIndentify) {
                        case 1:
                            getCalleToDialog(oPoint);
                            break;
                        case 2:
                            getTramoToDialog(oPoint);
                            break;
                        }

                    } else {
                        mSeleccionLayer = new GraphicsLayer();
                        int[] selectedFeatures = oLySelectAsoc.getGraphicIDs(x, y, calcRadio(), 1000);

                        // select the features
                        oLySelectAsoc.clearSelection();
                        oLySelectAsoc.setSelectedGraphics(selectedFeatures, true);
                        Log.w("PowerOnActivity", "Selected Graphics " + selectedFeatures.length);

                        if (selectedFeatures.length > 0) {
                            Graphic[] results = oLySelectAsoc.getSelectedFeatures();
                            Callout mapCallout = myMapView.getCallout();
                            mapCallout.hide();

                            for (Graphic graphic : results) {

                                Map<String, Object> attr = graphic.getAttributes();
                                Util oUtil = new Util();
                                CalloutTvClass oCall = oUtil.getCalloutValues(attr);

                                GisTextView tv = new GisTextView(PowerOnActivity.this);
                                tv.setText(oCall.getVista());
                                tv.setHint(oCall.getValor());
                                tv.setIdObjeto(oCall.getIdObjeto());
                                tv.setPoint((Point) graphic.getGeometry());
                                tv.setTipo("nueva");
                                tv.setTextColor(Color.WHITE);

                                tv.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        oTxtAsoc.setIdObjeto(((GisTextView) v).getIdObjeto());
                                        oTxtAsoc.setText(((GisTextView) v).getHint());
                                        oTxtAsoc.setTipo(((GisTextView) v).getTipo());
                                        oTxtAsoc.setPoint(myMapView.getCallout().getCoordinates());
                                        bCallOut = false;
                                        bMapTap = false;
                                        myMapView.getCallout().hide();
                                        oLySelectAsoc.clearSelection();
                                        dialogCur.show();
                                        if (mSeleccionLayer != null
                                                && myMapView.getLayerByID(mSeleccionLayer.getID()) != null)
                                            myMapView.removeLayer(mSeleccionLayer);

                                        // LINE PRINT
                                        if (mUbicacionLayer != null && oUbicacion != null) {
                                            SimpleLineSymbol lineSymbol = new SimpleLineSymbol(Color.BLUE, 4,
                                                    SimpleLineSymbol.STYLE.DASH);
                                            Polyline oLine = new Polyline();
                                            oLine.startPath(oUbicacion);
                                            oLine.lineTo(oTxtAsoc.getPoint());
                                            Graphic graphicDireccion = new Graphic(oLine, lineSymbol, null);
                                            mUbicacionLayer.addGraphic(graphicDireccion);
                                        }
                                    }
                                });

                                Point point = (Point) graphic.getGeometry();

                                mapCallout.setOffset(0, -3);
                                mapCallout.setCoordinates(point);
                                mapCallout.setMaxHeight(100);
                                mapCallout.setMaxWidth(400);
                                mapCallout.setStyle(R.xml.mycalloutprefs);
                                mapCallout.setContent(tv);

                                mapCallout.show();
                            }
                        } else {
                            getAsocObject(oPoint);
                        }

                        SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12,
                                SimpleMarkerSymbol.STYLE.CIRCLE);
                        Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol);
                        mSeleccionLayer.addGraphic(resultLocGraphic);

                        myMapView.addLayer(mSeleccionLayer);
                    }

                } else {
                    if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null)
                        myMapView.removeLayer(mUbicacionLayer);

                    oUbicacion = oPoint;
                    mUbicacionLayer = new GraphicsLayer();

                    SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.RED, 12,
                            SimpleMarkerSymbol.STYLE.DIAMOND);
                    Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol);
                    mUbicacionLayer.addGraphic(resultLocGraphic);

                    myMapView.addLayer(mUbicacionLayer);

                    if (R.layout.dialog_poste == idResLayoutSelect) {
                        LyPOSTES.setVisible(true);
                        if (LyPOSTES.getMinScale() < myMapView.getScale())
                            myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9);
                    } else if (R.layout.dialog_direccion == idResLayoutSelect) {
                        LyDIRECCIONES.setVisible(true);
                        if (LyDIRECCIONES.getMinScale() < myMapView.getScale())
                            myMapView.zoomToScale(oPoint, LyDIRECCIONES.getMinScale() * 0.9);
                    } else if (R.layout.dialog_cliente == idResLayoutSelect
                            || R.layout.dialog_cliente_cnr == idResLayoutSelect) {
                        LyPOSTES.setVisible(true);
                        LyDIRECCIONES.setVisible(true);
                        LyCLIENTES.setVisible(true);

                        if (idResLayoutSelect == R.layout.dialog_cliente_cnr)
                            LyREDBT.setVisible(true);

                        if (LyPOSTES.getMinScale() < myMapView.getScale())
                            myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9);
                    } else if (R.layout.form_lectores == idResLayoutSelect) {
                        if (LyPOSTES.getMinScale() < myMapView.getScale())
                            myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9);
                    }
                }
            } else {
                if (bVerData) {
                    double nExtendScale = myMapView.getScale();
                    double layerScala = 0;

                    ArrayList<ArcGISDynamicMapServiceLayer> arrayLay = new ArrayList<>();
                    Point oPoint = myMapView.toMapPoint(x, y);

                    if (oLyViewGraphs != null && myMapView.getLayerByID(oLyViewGraphs.getID()) != null)
                        myMapView.removeLayer(oLyViewGraphs);

                    oLyViewGraphs = new GraphicsLayer();
                    SimpleMarkerSymbol oMarketSymbol = new SimpleMarkerSymbol(Color.BLACK, 10,
                            SimpleMarkerSymbol.STYLE.CIRCLE);
                    oMarketSymbol.setOutline(new SimpleLineSymbol(Color.RED, 1, SimpleLineSymbol.STYLE.SOLID));
                    Graphic oGraph = new Graphic(oPoint, oMarketSymbol);
                    oLyViewGraphs.addGraphic(oGraph);

                    myMapView.addLayer(oLyViewGraphs);

                    for (Layer oLayer : myMapView.getLayers()) {

                        if ((oLayer.getName() != null && !oLayer.getName().equalsIgnoreCase("MapaBase"))
                                && oLayer.isVisible()) {

                            if (oLayer.getClass().equals(ArcGISDynamicMapServiceLayer.class)) {
                                for (ArcGISLayerInfo arcGISLayerInfo : ((ArcGISDynamicMapServiceLayer) oLayer)
                                        .getLayers()) {
                                    if (arcGISLayerInfo.isVisible()) {
                                        layerScala = (arcGISLayerInfo.getMinScale() > 0)
                                                ? arcGISLayerInfo.getMinScale()
                                                : 0;
                                        break;
                                    }
                                }

                                layerScala = (layerScala > 0) ? layerScala : nExtendScale;

                                Log.w("layerScala " + layerScala, "nExtendScale " + nExtendScale);

                                if (nExtendScale <= layerScala) {
                                    arrayLay.add((ArcGISDynamicMapServiceLayer) oLayer);
                                }
                            }
                        }
                    }

                    if (arrayLay.size() > 0) {
                        ArcGISDynamicMapServiceLayer[] aLay = new ArcGISDynamicMapServiceLayer[arrayLay.size()];
                        aLay = arrayLay.toArray(aLay);
                        getInfoObject(oPoint, aLay);
                    } else {
                        Toast.makeText(getApplicationContext(), "No hay capas visibles", Toast.LENGTH_SHORT)
                                .show();
                    }
                }
            }
        }
    });
}

From source file:com.ruesga.timelinechart.TimelineChartView.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setupEdgeEffectColor() {
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
        if (mGraphAreaBgPaint != null && mEdgeEffectLeft != null && mEdgeEffectRight != null) {
            int color = MaterialPaletteHelper.isDarkColor(mGraphAreaBgPaint.getColor()) ? Color.WHITE
                    : Color.BLACK;
            mEdgeEffectLeft.setColor(color);
            mEdgeEffectRight.setColor(color);
        }/*from  w w w. j a v  a 2s . co m*/
    }
}

From source file:org.smilec.smile.student.CourseList.java

private void createScoreTable(Vector<Integer> _myscore, String username) {

    int num_right = countrightquestion(_myscore);
    int total_question = LAST_SCENE_NUM;

    TableLayout tl = (TableLayout) findViewById(R.id.tableLayoutSeeR);
    TextView text1 = (TextView) findViewById(R.id.Header01);
    text1.setText(getString(R.string.name) + ": " + username);
    TextView text2 = (TextView) findViewById(R.id.Header11);
    text2.setText(getString(R.string.t_score) + ":" + num_right + "/" + total_question);

    for (int i = 0; i < _myscore.size(); i++) {
        TableRow tr = new TableRow(getApplicationContext());
        tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
                TableRow.LayoutParams.WRAP_CONTENT));
        int number = 0;
        number = i + 1;//from ww  w . j  av a  2 s  .  co m
        int score = _myscore.get(i);

        Button b = new Button(getApplicationContext());
        b.setText("(" + number + ")");
        b.setTextSize(resultSize1);
        // b.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
        TableRow.LayoutParams params = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
                TableRow.LayoutParams.WRAP_CONTENT);
        params.setMargins(returnPixels(30.0f), 0, returnPixels(30.0f), 0);
        b.setLayoutParams(params);
        b.setOnClickListener(new MyButtonListener(number));

        /* Add Button to row. */
        tr.addView(b);
        TextView text = new TextView(getApplicationContext());

        if (score == 1) { // right
            text.setText("0");
        } else { // wrong
            text.setText("X");
        }
        text.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
                TableRow.LayoutParams.WRAP_CONTENT));
        text.setTextColor(Color.BLACK);
        text.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
        text.setTextSize(resultSize2);
        tr.addView(text);

        //tr.setBackgroundResource(R.drawable.sf_gradient_03);
        tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,
                TableLayout.LayoutParams.WRAP_CONTENT));

    }

    return;
}

From source file:com.skytree.epubtest.BookViewActivity.java

public void makeFontBox() {
    int boxColor = Color.rgb(241, 238, 229);
    int innerBoxColor = Color.rgb(246, 244, 239);
    int inlineColor = Color.rgb(133, 105, 75);

    int width = 450;
    int height = 500;
    fontBox = new SkyBox(this);
    fontBox.setBoxColor(boxColor);//from www. j  a  v a  2 s  .  c o  m
    fontBox.setArrowHeight(ps(25));
    fontBox.setArrowDirection(false);
    setFrame(fontBox, ps(50), ps(200), ps(width), ps(height));

    ScrollView fontBoxScrollView = new ScrollView(this);
    this.setFrame(fontBoxScrollView, ps(5), ps(10), ps(440), ps(height - 50));
    fontBox.contentView.addView(fontBoxScrollView); // NEW

    SkyLayout contentLayout = new SkyLayout(this);
    fontBoxScrollView.addView(contentLayout,
            new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    // #1 first make brightness controller
    // brView is the box containing the bright slider. 
    int FY = 10;
    View brView = new View(this);
    RoundRectShape rrs = new RoundRectShape(
            new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null);
    SkyDrawable srd = new SkyDrawable(rrs, innerBoxColor, inlineColor, 1);
    brView.setBackgroundDrawable(srd);
    setFrame(brView, ps(20), ps(FY), ps(width - 40), ps(53));
    contentLayout.addView(brView);
    // darker and brighter icons
    int SBS = 60;
    ImageButton sbb = this.makeImageButton(9005, R.drawable.brightness2x, ps(SBS), ps(SBS));
    setFrame(sbb, ps(50), ps(FY), ps(SBS), ps(SBS));
    sbb.setAlpha(200);
    int BBS = 70;
    ImageButton bbb = this.makeImageButton(9006, R.drawable.brightness2x, ps(BBS), ps(BBS));
    setFrame(bbb, ps(width - 110), ps(FY - 5), ps(BBS), ps(BBS));
    bbb.setAlpha(200);
    contentLayout.addView(sbb);
    contentLayout.addView(bbb);
    // making bright slider      
    brightBar = new SeekBar(this);
    brightBar.setMax(999);
    brightBar.setId(997);
    brightBar.setBackgroundColor(Color.TRANSPARENT);
    brightBar.setOnSeekBarChangeListener(new SeekBarDelegate());
    brightBar.setProgressDrawable(new LineDrawable(Color.rgb(160, 160, 160), ps(10)));
    brightBar.setThumbOffset(-1);
    setFrame(brightBar, ps(100), ps(FY + 4), ps(width - 210), ps(50));
    contentLayout.addView(brightBar);

    // #2 second make decrese/increse font size buttons
    // decrease font size Button
    int FBY = 80;
    decreaseButton = new Button(this);
    setFrame(decreaseButton, ps(20), ps(FBY), ps(width - 40 - 20) / 2, ps(60));
    decreaseButton.setText(getString(R.string.chara));
    decreaseButton.setGravity(Gravity.CENTER);
    decreaseButton.setTextSize(14);
    decreaseButton.setId(5000);
    RoundRectShape drs = new RoundRectShape(
            new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null);
    SkyDrawable drd = new SkyDrawable(drs, innerBoxColor, inlineColor, 1);
    decreaseButton.setBackgroundDrawable(drd);
    decreaseButton.setOnClickListener(listener);
    decreaseButton.setOnTouchListener(new ButtonHighlighterOnTouchListener(decreaseButton));
    contentLayout.addView(decreaseButton);
    // inccrease font size Button
    increaseButton = new Button(this);
    setFrame(increaseButton, ps(10 + width / 2), ps(FBY), ps(width - 40 - 20) / 2, ps(60));
    increaseButton.setText(getString(R.string.chara));
    increaseButton.setTextSize(18);
    increaseButton.setGravity(Gravity.CENTER);
    increaseButton.setId(5001);
    RoundRectShape irs = new RoundRectShape(
            new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null);
    SkyDrawable ird = new SkyDrawable(irs, innerBoxColor, inlineColor, 1);
    increaseButton.setBackgroundDrawable(ird);
    increaseButton.setOnClickListener(listener);
    increaseButton.setOnTouchListener(new ButtonHighlighterOnTouchListener(increaseButton));
    contentLayout.addView(increaseButton);

    // # 3 make the button to increase/decrese line spacing. 
    int LBY = 145;
    // deccrease line space Button
    decreaseLineSpaceButton = this.makeImageButton(9005, R.drawable.decline2x, ps(30), ps(30));
    setFrame(decreaseLineSpaceButton, ps(20), ps(LBY), ps(width - 40 - 20) / 2, ps(60));
    decreaseLineSpaceButton.setId(4000);
    drs = new RoundRectShape(new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null,
            null);
    drd = new SkyDrawable(drs, innerBoxColor, inlineColor, 1);
    decreaseLineSpaceButton.setBackgroundDrawable(drd);
    decreaseLineSpaceButton.setOnClickListener(listener);
    decreaseLineSpaceButton
            .setOnTouchListener(new ImageButtonHighlighterOnTouchListener(decreaseLineSpaceButton));
    contentLayout.addView(decreaseLineSpaceButton);
    // inccrease line space Button        
    increaseLineSpaceButton = this.makeImageButton(9005, R.drawable.incline2x, ps(30), ps(30));
    setFrame(increaseLineSpaceButton, ps(10 + width / 2), ps(LBY), ps(width - 40 - 20) / 2, ps(60));
    increaseLineSpaceButton.setId(4001);
    irs = new RoundRectShape(new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null,
            null);
    ird = new SkyDrawable(irs, innerBoxColor, inlineColor, 1);
    increaseLineSpaceButton.setBackgroundDrawable(ird);
    increaseLineSpaceButton.setOnClickListener(listener);
    increaseLineSpaceButton
            .setOnTouchListener(new ImageButtonHighlighterOnTouchListener(increaseLineSpaceButton));
    contentLayout.addView(increaseLineSpaceButton);

    // #4 make themes selector.  
    int TY = 220;
    int TH = 70;
    int TW = (width - 40 - 20) / 3;

    HorizontalScrollView themeScrollView = new HorizontalScrollView(this);
    themesView = new LinearLayout(this);
    themesView.setOrientation(LinearLayout.HORIZONTAL);

    themeScrollView.addView(themesView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    for (int i = 0; i < this.themes.size(); i++) {
        Theme theme = themes.get(i);
        Button themeButton = new Button(this);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ps(TW), ps(TH));
        layoutParams.setMargins(0, 0, 24, 0);
        themesView.addView(themeButton, layoutParams);
        RoundRectShape rs = new RoundRectShape(
                new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null);
        SkyDrawable brd = new SkyDrawable(rs, theme.backgroundColor, Color.BLACK, 1);
        themeButton.setBackgroundDrawable(brd);
        themeButton.setText(theme.name);
        themeButton.setTextColor(theme.foregroundColor);
        themeButton.setId(7000 + i);
        themeButton.setOnClickListener(listener);
    }

    this.setFrame(themeScrollView, ps(20), ps(TY), ps(width - 40), ps(90));
    contentLayout.addView(themeScrollView);

    // #5 font list box
    int SY = 310;
    int fontButtonHeight = 80;
    int fontListHeight;
    fontListHeight = fontButtonHeight * fonts.size();
    fontListView = new LinearLayout(this);
    fontListView.setOrientation(LinearLayout.VERTICAL);
    contentLayout.addView(fontListView);
    this.setFrame(fontListView, ps(20), ps(SY), ps(width - 40), ps(fontListHeight));
    int inlineColor2 = Color.argb(140, 133, 105, 75);

    for (int i = 0; i < fonts.size(); i++) {
        CustomFont customFont = fonts.get(i);
        Button fontButton = new Button(this);
        fontButton.setText(customFont.fontFaceName);
        fontButton.setTextSize(20);
        Typeface tf = null;
        if (customFont.fontFileName == null || customFont.fontFileName.isEmpty()) {
            tf = this.getTypeface(customFont.fontFaceName, Typeface.BOLD);
        } else {
            tf = Typeface.createFromAsset(getAssets(), "fonts/" + customFont.fontFileName);
        }
        if (tf != null)
            fontButton.setTypeface(tf);
        fontButton.setId(5100 + i);
        RoundRectShape rs = new RoundRectShape(
                new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null);
        SkyDrawable brd = new SkyDrawable(rs, innerBoxColor, inlineColor2, 1);
        fontButton.setBackgroundDrawable(brd);
        this.setFrame(fontButton, ps(0), ps(0), ps(width - 40), ps(fontButtonHeight));
        fontListView.addView(fontButton);
        fontButton.setOnClickListener(listener);
        fontButton.setOnTouchListener(new ButtonHighlighterOnTouchListener(fontButton));
    }

    this.ePubView.addView(fontBox);
    this.hideFontBox();
}