List of usage examples for android.graphics Color WHITE
int WHITE
To view the source code for android.graphics Color WHITE.
Click Source Link
From source file:cl.gisred.android.LectorActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/*w ww . ja 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(LectorActivity.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.ichi2.anki2.Reviewer.java
public void fillFlashcard(boolean flip) { if (!flip) {/* w w w .ja v a 2 s . com*/ Log.i(AnkiDroidApp.TAG, "base url = " + mBaseUrl); if (mCurrentSimpleInterface && mSimpleCard != null) { mSimpleCard.setText(mCardContent); } else if (mRefreshWebview && mCard != null && mNextCard != null) { mNextCard.setBackgroundColor(mCurrentBackgroundColor); mNextCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null); mNextCard.setVisibility(View.VISIBLE); mCardFrame.removeView(mCard); mCard.destroy(); mCard = mNextCard; mNextCard = createWebView(); mNextCard.setVisibility(View.GONE); mCardFrame.addView(mNextCard, 0); // hunt for input issue 720, like android issue 3341 if (AnkiDroidApp.SDK_VERSION <= 7) { mCard.setFocusableInTouchMode(true); } } else if (mCard != null) { mCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null); mCard.setBackgroundColor(mCurrentBackgroundColor); } if (mChangeBorderStyle) { switch (mCurrentBackgroundColor) { case Color.WHITE: if (mInvertedColors) { mInvertedColors = false; invertColors(false); } break; case Color.BLACK: if (!mInvertedColors) { mInvertedColors = true; invertColors(true); } break; default: if (Themes.getTheme() != Themes.THEME_BLUE) { mMainLayout.setBackgroundColor(mCurrentBackgroundColor); } if (mInvertedColors != mNightMode) { mInvertedColors = mNightMode; invertColors(mNightMode); } } } if (!mShowAnimations && mCardTimer.getVisibility() == View.INVISIBLE) { switchTopBarVisibility(View.VISIBLE); } if (!sDisplayAnswer) { updateForNewCard(); if (mShowWhiteboard) { mWhiteboard.clear(); } setNextCardAnimation(false); } } else { Animation3D rotation; boolean directionToLeft = true; switch (mNextAnimation) { case ANIMATION_TURN: rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 9, Animation3D.ANIMATION_TURN, true, true, this); rotation.setDuration(mAnimationDurationTurn); rotation.setInterpolator(new AccelerateDecelerateInterpolator()); break; case ANIMATION_NEXT_CARD_FROM_LEFT: directionToLeft = false; case ANIMATION_NEXT_CARD_FROM_RIGHT: rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_EXCHANGE_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new AccelerateDecelerateInterpolator()); break; case ANIMATION_SLIDE_OUT_TO_RIGHT: directionToLeft = false; case ANIMATION_SLIDE_OUT_TO_LEFT: fillFlashcard(false); rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_OUT_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new AccelerateInterpolator()); switchTopBarVisibility(View.INVISIBLE); break; case ANIMATION_SLIDE_IN_FROM_LEFT: directionToLeft = false; case ANIMATION_SLIDE_IN_FROM_RIGHT: fillFlashcard(false); rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_IN_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new DecelerateInterpolator()); switchTopBarVisibility(View.VISIBLE); break; case ANIMATION_NO_ANIMATION: default: return; } rotation.reset(); mCardContainer.setDrawingCacheEnabled(true); mCardContainer.setDrawingCacheBackgroundColor(Themes.getBackgroundColor()); mCardContainer.clearAnimation(); mCardContainer.startAnimation(rotation); } }
From source file:com.bookkos.bircle.CaptureActivity.java
private void setBookRegistView() { int bookRegistRelativeLayout_width = displayWidth; int bookRegistRelativeLayout_height = displayHeight / 4; int bookRegistRelativeLayout_x = 0; int bookRegistRelativeLayout_y = displayHeight; bookRegistRelativeLayout.setTranslationX(bookRegistRelativeLayout_x); bookRegistRelativeLayout.setTranslationY(bookRegistRelativeLayout_y); bookRegistRelativeLayout.setLayoutParams( new FrameLayout.LayoutParams(bookRegistRelativeLayout_width, bookRegistRelativeLayout_height)); int bookRegistLinearLayout_width = displayWidth; int bookRegistLinearLayout_height = bookRegistRelativeLayout_height / 3; bookRegistLinearLayout.setLayoutParams( new RelativeLayout.LayoutParams(bookRegistLinearLayout_width, bookRegistLinearLayout_height)); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) bookRegistLinearLayout .getLayoutParams();/* w w w. j a v a 2 s . com*/ params1.addRule(RelativeLayout.ALIGN_PARENT_TOP); bookRegistLinearLayout.setLayoutParams(params1); int bookRegistListViewLinearLayout_width = displayWidth; int bookRegistListViewLinearLayout_height = bookRegistRelativeLayout_height * 2 / 3; bookRegistListViewLinearLayout.setLayoutParams(new RelativeLayout.LayoutParams( bookRegistListViewLinearLayout_width, bookRegistListViewLinearLayout_height)); RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) bookRegistListViewLinearLayout .getLayoutParams(); params2.addRule(RelativeLayout.BELOW, R.id.book_regist_linear_layout); bookRegistListViewLinearLayout.setLayoutParams(params2); int bookRegistListView_width = bookRegistListViewLinearLayout_width; int bookRegistListView_height = bookRegistListViewLinearLayout_height; bookRegistListView.setLayoutParams( new LinearLayout.LayoutParams(bookRegistListView_width, bookRegistListView_height)); bookRegistListView.setAdapter(bookListViewAdapter); int bookRegistTextView_width = displayWidth * 4 / 5; int bookRegistTextView_height = bookRegistLinearLayout_height; int bookRegistTextView_x = 0; int bookRegistTextView_y = displayHeight; bookRegistTextView.setLayoutParams( new LinearLayout.LayoutParams(bookRegistTextView_width, bookRegistTextView_height, Gravity.LEFT)); bookRegistTextView.setText("??"); bookRegistTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f); int bookRegistCancelButton_width = displayWidth / 5; int bookRegistCancelButton_height = bookRegistLinearLayout_height; int bookRegistCancelButton_x = 0; int bookRegistCancelButton_y = displayHeight; bookRegistCancelButton.setLayoutParams(new LinearLayout.LayoutParams(bookRegistCancelButton_width, bookRegistCancelButton_height, Gravity.RIGHT)); bookRegistCancelButton.setText(""); bookRegistCancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f); bookRegistCancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { animateTranslationY(bookRegistRelativeLayout, displayHeight - displayHeight / 4 - titleBarHeight, displayHeight); arrayList.clear(); bookListViewAdapter.clear(); registButton.setEnabled(true); borrowReturnButton.setEnabled(true); registButton.setTextColor(Color.WHITE); } }); }
From source file:cl.gisred.android.MantCatastroActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/* www .ja va2 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(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.hichinaschool.flashcards.anki.Reviewer.java
public void fillFlashcard(boolean flip) { if (!flip) {/*from w ww. j a v a2s.c o m*/ // Log.i(AnkiDroidApp.TAG, "base url = " + mBaseUrl); if (mCurrentSimpleInterface && mSimpleCard != null) { mSimpleCard.setText(mCardContent); } else if (!mUseQuickUpdate && mCard != null && mNextCard != null) { mNextCard.setBackgroundColor(mCurrentBackgroundColor); mNextCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null); mNextCard.setVisibility(View.VISIBLE); mCardFrame.removeView(mCard); mCard.destroy(); mCard = mNextCard; mNextCard = createWebView(); mNextCard.setVisibility(View.GONE); mCardFrame.addView(mNextCard, 0); // hunt for input issue 720, like android issue 3341 if (AnkiDroidApp.SDK_VERSION <= 7) { mCard.setFocusableInTouchMode(true); } } else if (mCard != null) { mCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null); mCard.setBackgroundColor(mCurrentBackgroundColor); } if (mChangeBorderStyle) { switch (mCurrentBackgroundColor) { case Color.WHITE: if (mInvertedColors) { mInvertedColors = false; invertColors(false); } break; case Color.BLACK: if (!mInvertedColors) { mInvertedColors = true; invertColors(true); } break; default: if (Themes.getTheme() != Themes.THEME_BLUE) { mMainLayout.setBackgroundColor(mCurrentBackgroundColor); } if (mInvertedColors != mNightMode) { mInvertedColors = mNightMode; invertColors(mNightMode); } } } if (!mShowAnimations && mShowTimer && mCardTimer.getVisibility() == View.INVISIBLE) { switchTopBarVisibility(View.VISIBLE); } if (!sDisplayAnswer) { updateForNewCard(); if (mShowWhiteboard) { mWhiteboard.clear(); } setNextCardAnimation(false); } } else { Animation3D rotation; boolean directionToLeft = true; switch (mNextAnimation) { case ANIMATION_TURN: rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 9, Animation3D.ANIMATION_TURN, true, true, this); rotation.setDuration(mAnimationDurationTurn); rotation.setInterpolator(new AccelerateDecelerateInterpolator()); break; case ANIMATION_NEXT_CARD_FROM_LEFT: directionToLeft = false; case ANIMATION_NEXT_CARD_FROM_RIGHT: rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_EXCHANGE_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new AccelerateDecelerateInterpolator()); break; case ANIMATION_SLIDE_OUT_TO_RIGHT: directionToLeft = false; case ANIMATION_SLIDE_OUT_TO_LEFT: fillFlashcard(false); rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_OUT_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new AccelerateInterpolator()); switchTopBarVisibility(View.INVISIBLE); break; case ANIMATION_SLIDE_IN_FROM_LEFT: directionToLeft = false; case ANIMATION_SLIDE_IN_FROM_RIGHT: fillFlashcard(false); rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_IN_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new DecelerateInterpolator()); switchTopBarVisibility(View.VISIBLE); break; case ANIMATION_NO_ANIMATION: default: return; } rotation.reset(); mCardContainer.setDrawingCacheEnabled(true); mCardContainer.setDrawingCacheBackgroundColor(Themes.getBackgroundColor()); mCardContainer.clearAnimation(); mCardContainer.startAnimation(rotation); } }
From source file:cl.gisred.android.RegEquipoActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/*from w ww. ja v 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); 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 w w w . j a va 2 s. c o 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(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// www .ja v a 2s. 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); 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.if3games.chessonline.DroidFish.java
void gameTick() { if (mSecondsLeft > 0) { if (myTurn) --mSecondsLeft;//from ww w. ja va 2s. c o m else mSecondsLeft = GAME_DURATION; if (mSecondsLeft <= 10) ((TextView) findViewById(R.id.countdown)).setTextColor(Color.RED); else ((TextView) findViewById(R.id.countdown)).setTextColor(Color.WHITE); } // update countdown ((TextView) findViewById(R.id.countdown)).setText(getCountDownText(mSecondsLeft)); if (mSecondsLeft <= 0) { // finish game timeOutGMSGame(); } }