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:cl.gisred.android.MantCatastroActivity.java

private void singleTapOnMap() {
    myMapView.setOnSingleTapListener(new OnSingleTapListener() {
        @Override//from   w ww  . j  a v  a  2  s  . co m
        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);

                        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(MantCatastroActivity.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;

                                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();
                    }
                }
            }
        }
    });

    myMapView.setOnLongPressListener(new OnLongPressListener() {
        @Override
        public boolean onLongPress(float v, float v1) {

            Point oPoint = myMapView.toMapPoint(v, v1);

            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);

            getInfoPoste(oPoint);

            return false;
        }
    });
}

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

public void makePagingView() {
    Theme theme = getCurrentTheme();/*from w w w  . j  av  a2 s . c o  m*/
    pagingView = new View(this);
    pagingView.setBackgroundDrawable(new DottedDrawable(Color.BLACK, theme.seekBarColor, 100));
    ePubView.addView(pagingView);
    this.hidePagingView();
}

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

private void singleTapOnMap() {
    myMapView.setOnSingleTapListener(new OnSingleTapListener() {
        @Override//from   w  ww .  j  a  v  a  2 s .  c  om
        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);

                        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(RegEquipoActivity.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_micro_med == idResLayoutSelect) {
                        LyPOSTES.setVisible(true);
                        LyREDBT.setVisible(true);
                        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:cl.gisred.android.MicroMedidaActivity.java

private void singleTapOnMap() {
    myMapView.setOnSingleTapListener(new OnSingleTapListener() {
        @Override/*from  www. j a  v  a 2s.c om*/
        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);

                        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(MicroMedidaActivity.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_micro_med == idResLayoutSelect) {
                        LyPOSTES.setVisible(true);
                        LyREDBT.setVisible(true);
                        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:cl.gisred.android.InspActivity.java

private void singleTapOnMap() {
    myMapView.setOnSingleTapListener(new OnSingleTapListener() {
        @Override//from   ww w  . j a  v a 2s  .  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("MapsActivity", "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(InspActivity.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;

                                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.skytree.epubtest.BookViewActivity.java

public void checkSettings() {
    if (this.setting.fontSize == 0) {
        decreaseButton.setTextColor(Color.LTGRAY);
    } else {//from ww  w . java2  s  . c  om
        decreaseButton.setTextColor(Color.BLACK);
    }

    if (this.setting.fontSize == 4) {
        increaseButton.setTextColor(Color.LTGRAY);
    } else {
        increaseButton.setTextColor(Color.BLACK);
    }

    increaseLineSpaceButton.setEnabled(true);
    decreaseLineSpaceButton.setEnabled(true);
    increaseLineSpaceButton.setColorFilter(Color.BLACK);
    decreaseLineSpaceButton.setColorFilter(Color.BLACK);
    if (this.setting.lineSpacing == 4) {
        increaseLineSpaceButton.setEnabled(false);
        increaseLineSpaceButton.setColorFilter(Color.LTGRAY);
    }

    if (this.setting.lineSpacing == 0) {
        decreaseLineSpaceButton.setEnabled(false);
        decreaseLineSpaceButton.setColorFilter(Color.LTGRAY);
    }

    int fontIndex = this.getFontIndex(setting.fontName);
    for (int i = 0; i < fontListView.getChildCount(); i++) {
        Button button = (Button) fontListView.getChildAt(i);
        button.setTextColor(Color.BLACK);

    }
    for (int i = 0; i < fontListView.getChildCount(); i++) {
        Button button = (Button) fontListView.getChildAt(i);
        if (button.getId() == (fontIndex + 5100)) {
            button.setTextColor(Color.BLUE);
        }
    }

    for (int i = 0; i < themesView.getChildCount(); i++) {
        Button button = (Button) themesView.getChildAt(i);
        Typeface tf = null;
        int size = 13;
        if (button.getId() == (themeIndex + 7000)) {
            tf = this.getTypeface(setting.fontName, Typeface.BOLD);
            size = 18;
        } else {
            tf = this.getTypeface(setting.fontName, Typeface.NORMAL);
        }
        button.setTypeface(tf);
        button.setTextSize(size);
    }
}

From source file:com.nttec.everychan.ui.presentation.BoardFragment.java

/**
 *  ?  ? ?//from www .  jav  a  2 s . c o  m
 * @param itemPosition ? ? (?)   listView
 * @param isTablet true, ?   (??   ? ??)
 * @param coordinates   ??
 */
private void showPostPopupDialog(final int itemPosition, final boolean isTablet, final Point coordinates,
        final String refererPost) {
    final int bgShadowResource = ThemeUtils.getThemeResId(activity.getTheme(), R.attr.dialogBackgroundShadow);
    final int bgColor = ThemeUtils.getThemeColor(activity.getTheme(), R.attr.activityRootBackground,
            Color.BLACK);
    final int measuredWidth = isTablet ? adapter.measureViewWidth(itemPosition) : -1; //? ??  ? 
    final View tmpV = new View(activity);
    final Dialog tmpDlg = new Dialog(activity);
    tmpDlg.getWindow().setBackgroundDrawableResource(bgShadowResource);
    tmpDlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
    tmpDlg.setCanceledOnTouchOutside(true);
    tmpDlg.setContentView(tmpV);
    final Rect activityWindowRect;
    final int dlgWindowWidth;
    final int dlgWindowHeight;
    if (isTablet) {
        activityWindowRect = new Rect();
        activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(activityWindowRect);
        dlgWindowWidth = Math.max(coordinates.x, activityWindowRect.width() - coordinates.x);
        dlgWindowHeight = Math.max(coordinates.y, activityWindowRect.height() - coordinates.y);
        tmpDlg.getWindow().setLayout(dlgWindowWidth, dlgWindowHeight);
    } else {
        activityWindowRect = null;
        dlgWindowWidth = -1;
        dlgWindowHeight = -1;
    }
    tmpDlg.show();

    Runnable next = new Runnable() {
        @SuppressLint("RtlHardcoded")
        @Override
        public void run() {
            int dlgWidth = tmpV.getWidth();
            int dlgHeight = tmpV.getHeight();
            tmpDlg.hide();
            tmpDlg.cancel();
            int newWidth = isTablet ? Math.min(measuredWidth, dlgWidth) : dlgWidth;

            View view = adapter.getView(itemPosition, null, null, newWidth, refererPost);
            view.setBackgroundColor(bgColor);
            //Logger.d(TAG, "measured: "+view.findViewById(R.id.post_frame_main).getMeasuredWidth()+
            //        "x"+view.findViewById(R.id.post_frame_main).getMeasuredHeight());

            Dialog dialog = new Dialog(activity);
            dialog.getWindow().setBackgroundDrawableResource(bgShadowResource);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setCanceledOnTouchOutside(true);
            dialog.setContentView(view);
            if (isTablet) {
                view.findViewById(R.id.post_frame_main).measure(
                        MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY),
                        MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
                int newWindowWidth = dlgWindowWidth - dlgWidth + newWidth;
                int newWindowHeight = dlgWindowHeight - dlgHeight
                        + Math.min(view.findViewById(R.id.post_frame_main).getMeasuredHeight(), dlgHeight);
                dialog.getWindow().setLayout(newWindowWidth, newWindowHeight);
                WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
                if (coordinates.x > activityWindowRect.width() - coordinates.x
                        && coordinates.x + newWindowWidth > activityWindowRect.width()) {
                    params.x = activityWindowRect.width() - coordinates.x;
                    params.gravity = Gravity.RIGHT;
                } else {
                    params.x = coordinates.x;
                    params.gravity = Gravity.LEFT;
                }
                if (coordinates.y > activityWindowRect.height() - coordinates.y
                        && coordinates.y + newWindowHeight > activityWindowRect.height()) {
                    params.y = activityWindowRect.height() - coordinates.y;
                    params.gravity |= Gravity.BOTTOM;
                } else {
                    params.y = coordinates.y;
                    params.gravity |= Gravity.TOP;
                }
                dialog.getWindow().setAttributes(params);

                //     
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    CompatibilityImpl.setDimAmount(dialog.getWindow(), 0.1f);
                } else {
                    dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
                }
            }
            dialog.show();
            dialogs.add(dialog);
        }
    };

    if (tmpV.getWidth() != 0) {
        next.run();
    } else {
        AppearanceUtils.callWhenLoaded(tmpDlg.getWindow().getDecorView(), next);
    }
}

From source file:com.nttec.everychan.ui.presentation.BoardFragment.java

private void showThreadPreviewDialog(final int position) {
    final List<PresentationItemModel> items = new ArrayList<>();
    final int bgShadowResource = ThemeUtils.getThemeResId(activity.getTheme(), R.attr.dialogBackgroundShadow);
    final int bgColor = ThemeUtils.getThemeColor(activity.getTheme(), R.attr.activityRootBackground,
            Color.BLACK);
    final View tmpV = new View(activity);
    final Dialog tmpDlg = new Dialog(activity);
    tmpDlg.getWindow().setBackgroundDrawableResource(bgShadowResource);
    tmpDlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
    tmpDlg.setCanceledOnTouchOutside(true);
    tmpDlg.setContentView(tmpV);/*from   w  w  w .  j a v  a  2s.  c o  m*/
    tmpDlg.show();
    Runnable next = new Runnable() {
        @Override
        public void run() {
            final int dlgWidth = tmpV.getWidth();
            tmpDlg.hide();
            tmpDlg.cancel();
            final Dialog dialog = new Dialog(activity);

            if (presentationModel.source != null && presentationModel.source.threads != null
                    && presentationModel.source.threads.length > position
                    && presentationModel.source.threads[position].posts != null
                    && presentationModel.source.threads[position].posts.length > 0) {

                final String threadNumber = presentationModel.source.threads[position].posts[0].number;

                ClickableURLSpan.URLSpanClickListener spanClickListener = new ClickableURLSpan.URLSpanClickListener() {
                    @Override
                    public void onClick(View v, ClickableURLSpan span, String url, String referer) {
                        if (url.startsWith("#")) {
                            try {
                                UrlPageModel threadPageModel = new UrlPageModel();
                                threadPageModel.chanName = chan.getChanName();
                                threadPageModel.type = UrlPageModel.TYPE_THREADPAGE;
                                threadPageModel.boardName = tabModel.pageModel.boardName;
                                threadPageModel.threadNumber = threadNumber;
                                url = chan.buildUrl(threadPageModel) + url;
                                dialog.dismiss();
                                UrlHandler.open(chan.fixRelativeUrl(url), activity);
                            } catch (Exception e) {
                                Logger.e(TAG, e);
                            }
                        } else {
                            dialog.dismiss();
                            UrlHandler.open(chan.fixRelativeUrl(url), activity);
                        }
                    }
                };

                AndroidDateFormat.initPattern();
                String datePattern = AndroidDateFormat.getPattern();
                DateFormat dateFormat = datePattern == null
                        ? DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)
                        : new SimpleDateFormat(datePattern, Locale.US);
                dateFormat.setTimeZone(settings.isLocalTime() ? TimeZone.getDefault()
                        : TimeZone.getTimeZone(presentationModel.source.boardModel.timeZoneId));

                int postsCount = presentationModel.source.threads[position].postsCount;
                boolean showIndex = presentationModel.source.threads[position].posts.length <= postsCount;
                int curPostIndex = postsCount - presentationModel.source.threads[position].posts.length + 1;

                boolean openSpoilers = settings.openSpoilers();

                for (int i = 0; i < presentationModel.source.threads[position].posts.length; ++i) {
                    PresentationItemModel model = new PresentationItemModel(
                            presentationModel.source.threads[position].posts[i], chan.getChanName(),
                            presentationModel.source.pageModel.boardName,
                            presentationModel.source.pageModel.threadNumber, dateFormat, spanClickListener,
                            imageGetter, ThemeUtils.ThemeColors.getInstance(activity.getTheme()), openSpoilers,
                            floatingModels, null);
                    model.buildSpannedHeader(showIndex ? (i == 0 ? 1 : ++curPostIndex) : -1,
                            presentationModel.source.boardModel.bumpLimit,
                            presentationModel.source.boardModel.defaultUserName, null, false);
                    items.add(model);
                }
            } else {
                items.add(presentationModel.presentationList.get(position));
            }
            ListView dlgList = new ListView(activity);
            dlgList.setAdapter(new ArrayAdapter<PresentationItemModel>(activity, 0, items) {
                @Override
                public View getView(int position, View convertView, ViewGroup parent) {
                    View view = adapter.getView(position, convertView, parent, dlgWidth, getItem(position));
                    view.setBackgroundColor(bgColor);
                    return view;
                }
            });
            dialog.getWindow().setBackgroundDrawableResource(bgShadowResource);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setCanceledOnTouchOutside(true);
            dialog.setContentView(dlgList);
            dialog.show();
            dialogs.add(dialog);
        }
    };
    if (tmpV.getWidth() != 0) {
        next.run();
    } else {
        AppearanceUtils.callWhenLoaded(tmpDlg.getWindow().getDecorView(), next);
    }
}

From source file:com.nttec.everychan.ui.presentation.BoardFragment.java

private void openReferencesList(final String from) {
    final List<Integer> positions = new ArrayList<>();
    int position = -1;
    for (int i = 0; i < presentationModel.presentationList.size(); ++i) {
        if (presentationModel.presentationList.get(i).sourceModel.number.equals(from)) {
            position = i;/*from  w  w  w  .j a v  a 2  s .  c o  m*/
            break;
        }
    }
    if (position != -1) {
        Spanned referencesString = presentationModel.presentationList.get(position).referencesString;
        if (referencesString == null) {
            Logger.e(TAG, "null referencesString");
            return;
        }
        ClickableURLSpan[] spans = referencesString.getSpans(0, referencesString.length(),
                ClickableURLSpan.class);
        for (ClickableURLSpan span : spans) {
            String url = span.getURL();
            try {
                //url    , .. ???  PresentationItemModel ( )
                UrlPageModel model = UrlHandler.getPageModel(url);
                for (; position < presentationModel.presentationList.size(); ++position) {
                    if (presentationModel.presentationList.get(position).sourceModel.number
                            .equals(model.postNumber)) {
                        break;
                    }
                }
                if (position < presentationModel.presentationList.size())
                    positions.add(position);
            } catch (Exception e) {
                Logger.e(TAG, e);
            }
        }
    }

    if (positions.size() == 0) {
        Logger.e(TAG, "no references");
        return;
    }

    final int bgShadowResource = ThemeUtils.getThemeResId(activity.getTheme(), R.attr.dialogBackgroundShadow);
    final int bgColor = ThemeUtils.getThemeColor(activity.getTheme(), R.attr.activityRootBackground,
            Color.BLACK);
    final View tmpV = new View(activity);
    final Dialog tmpDlg = new Dialog(activity);
    tmpDlg.getWindow().setBackgroundDrawableResource(bgShadowResource);
    tmpDlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
    tmpDlg.setCanceledOnTouchOutside(true);
    tmpDlg.setContentView(tmpV);
    tmpDlg.show();
    Runnable next = new Runnable() {
        @Override
        public void run() {
            final int dlgWidth = tmpV.getWidth();
            tmpDlg.hide();
            tmpDlg.cancel();

            ListView dlgList = new ListView(activity);
            dlgList.setAdapter(new ArrayAdapter<Integer>(activity, 0, positions) {
                @Override
                public View getView(int position, View convertView, ViewGroup parent) {
                    try {
                        int adapterPositon = getItem(position);
                        View view = adapter.getView(adapterPositon, convertView, parent, dlgWidth,
                                adapter.getItem(adapterPositon), from);
                        view.setBackgroundColor(bgColor);
                        return view;
                    } catch (Exception e) {
                        Logger.e(TAG, e);
                        Toast.makeText(activity, R.string.error_unknown, Toast.LENGTH_LONG).show();
                        return new View(activity);
                    }
                }
            });

            Dialog dialog = new Dialog(activity);
            dialog.getWindow().setBackgroundDrawableResource(bgShadowResource);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setCanceledOnTouchOutside(true);
            dialog.setContentView(dlgList);
            dialog.show();
            dialogs.add(dialog);
        }
    };
    if (tmpV.getWidth() != 0) {
        next.run();
    } else {
        AppearanceUtils.callWhenLoaded(tmpDlg.getWindow().getDecorView(), next);
    }
}