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.MapsActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/*from ww w. j a 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); 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(MapsActivity.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(); dialogCrear.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.eveningoutpost.dexdrip.Home.java
private void displayCurrentInfoFromReading(BgReading lastBgReading, boolean predictive) { double estimate = 0; double estimated_delta = 0; String slope_arrow = lastBgReading.slopeArrow(); String extrastring = ""; if ((new Date().getTime()) - stale_data_millis() - lastBgReading.timestamp > 0) { notificationText.setText(R.string.signal_missed); if (!predictive) { estimate = lastBgReading.calculated_value; } else {// ww w . ja v a 2s .c o m estimate = BgReading.estimated_bg(lastBgReading.timestamp + (6000 * 7)); } currentBgValueText.setText(bgGraphBuilder.unitized_string(estimate)); currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); dexbridgeBattery.setPaintFlags(dexbridgeBattery.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { if (notificationText.getText().length() == 0) { notificationText.setTextColor(Color.WHITE); } boolean bg_from_filtered = prefs.getBoolean("bg_from_filtered", false); if (!predictive) { estimate = lastBgReading.calculated_value; // normal currentBgValueText.setTypeface(null, Typeface.NORMAL); // if noise has settled down then switch off filtered mode if ((bg_from_filtered) && (BgGraphBuilder.last_noise < BgGraphBuilder.NOISE_FORGIVE) && (prefs.getBoolean("bg_compensate_noise", false))) { bg_from_filtered = false; prefs.edit().putBoolean("bg_from_filtered", false).apply(); } if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_TRIGGER) && (BgGraphBuilder.best_bg_estimate > 0) && (BgGraphBuilder.last_bg_estimate > 0) && (prefs.getBoolean("bg_compensate_noise", false))) { estimate = BgGraphBuilder.best_bg_estimate; // this maybe needs scaling based on noise intensity estimated_delta = BgGraphBuilder.best_bg_estimate - BgGraphBuilder.last_bg_estimate; slope_arrow = BgReading .slopeToArrowSymbol(estimated_delta / (BgGraphBuilder.DEXCOM_PERIOD / 60000)); // delta by minute currentBgValueText.setTypeface(null, Typeface.ITALIC); extrastring = "\u26A0"; // warning symbol ! } if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_HIGH) && (DexCollectionType.hasFiltered())) { bg_from_filtered = true; // force filtered mode } if (bg_from_filtered) { currentBgValueText .setPaintFlags(currentBgValueText.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); estimate = lastBgReading.filtered_calculated_value; } else { currentBgValueText .setPaintFlags(currentBgValueText.getPaintFlags() & ~Paint.UNDERLINE_TEXT_FLAG); } String stringEstimate = bgGraphBuilder.unitized_string(estimate); if ((lastBgReading.hide_slope) || (bg_from_filtered)) { slope_arrow = ""; } currentBgValueText.setText(stringEstimate + " " + slope_arrow); } else { estimate = BgReading.activePrediction(); String stringEstimate = bgGraphBuilder.unitized_string(estimate); currentBgValueText.setText(stringEstimate + " " + BgReading.activeSlopeArrow()); } if (extrastring.length() > 0) currentBgValueText.setText(extrastring + currentBgValueText.getText()); } int minutes = (int) (System.currentTimeMillis() - lastBgReading.timestamp) / (60 * 1000); if ((!small_width) || (notificationText.length() > 0)) notificationText.append("\n"); if (!small_width) { notificationText.append(minutes + ((minutes == 1) ? getString(R.string.space_minute_ago) : getString(R.string.space_minutes_ago))); } else { // small screen notificationText.append(minutes + getString(R.string.space_mins)); currentBgValueText.setPadding(0, 0, 0, 0); } if (small_screen) { if (currentBgValueText.getText().length() > 4) currentBgValueText.setTextSize(25); } // do we actually need to do this query here if we again do it in unitizedDeltaString List<BgReading> bgReadingList = BgReading.latest(2, is_follower); if (bgReadingList != null && bgReadingList.size() == 2) { // same logic as in xDripWidget (refactor that to BGReadings to avoid redundancy / later inconsistencies)? display_delta = bgGraphBuilder.unitizedDeltaString(true, true, is_follower); // TODO reduce duplication of logic if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_TRIGGER) && (BgGraphBuilder.best_bg_estimate > 0) && (BgGraphBuilder.last_bg_estimate > 0) && (prefs.getBoolean("bg_compensate_noise", false))) { //final double estimated_delta = BgGraphBuilder.best_bg_estimate - BgGraphBuilder.last_bg_estimate; display_delta = bgGraphBuilder.unitizedDeltaStringRaw(true, true, estimated_delta); addDisplayDelta(); if (!prefs.getBoolean("show_noise_workings", false)) { notificationText.append("\nNoise: " + bgGraphBuilder.noiseString(BgGraphBuilder.last_noise)); } } else { addDisplayDelta(); } } if (bgGraphBuilder.unitized(estimate) <= bgGraphBuilder.lowMark) { currentBgValueText.setTextColor(Color.parseColor("#C30909")); } else if (bgGraphBuilder.unitized(estimate) >= bgGraphBuilder.highMark) { currentBgValueText.setTextColor(Color.parseColor("#FFBB33")); } else { currentBgValueText.setTextColor(Color.WHITE); } }
From source file:com.skytree.epubtest.BookViewActivity.java
public void fillBookmarkList() { this.listView.removeAllViews(); ArrayList<PageInformation> pis = sd.fetchBookmarks(this.bookCode); for (int i = 0; i < pis.size(); i++) { int textColor = Color.BLACK; Theme theme = getCurrentTheme(); textColor = theme.foregroundColor; PageInformation pi = pis.get(i); SkyLayout item = new SkyLayout(this); setFrame(item, 0, 0, listBox.getWidth(), ps(80)); ImageButton mark = this.makeImageButton(9898, R.drawable.bookmarked2x, ps(50), ps(90)); item.addView(mark);/*from w ww . j a v a2s .co m*/ setFrame(mark, ps(10), ps(5), ps(60), ps(120)); int ci = pi.chapterIndex; if (rv.isRTL()) { ci = rv.getNumberOfChapters() - ci - 1; } String chapterTitle = rv.getChapterTitle(ci); if (chapterTitle == null || chapterTitle.isEmpty()) chapterTitle = "Chapter " + ci; TextView chapterLabel = this.makeLabel(9899, chapterTitle, Gravity.LEFT, 16, textColor); setFrame(chapterLabel, ps(80), ps(5), this.listBox.getWidth() - ps(80), ps(40)); item.addView(chapterLabel); TextView dateLabel = this.makeLabel(9899, pi.datetime, Gravity.LEFT, 12, textColor); setFrame(dateLabel, this.listBox.getWidth() - ps(50 + 250), ps(48), this.listBox.getWidth() - ps(40), ps(40)); View lineView = new View(this); lineView.setBackgroundColor(Color.LTGRAY); setFrame(lineView, 0, ps(79), this.listBox.getWidth(), ps(1)); item.addView(dateLabel); item.addView(lineView); item.setSkyLayoutListener(bookmarkListDelegate); item.setId(pi.code); item.data = pi; Button deleteButton = new Button(this); GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM, new int[] { 0xffcf666e, 0xff671521 }); grad.setStroke(ps(2), 0xff282828); deleteButton.setBackgroundDrawable(grad); deleteButton.setText(getString(R.string.delete)); deleteButton.setTextSize(12); deleteButton.setTypeface(null, Typeface.BOLD); deleteButton.setTextColor(Color.WHITE); deleteButton.setId(pi.code); deleteButton.setVisibility(View.INVISIBLE); deleteButton.setVisibility(View.GONE); deleteButton.setOnClickListener(deleteBookmarkDelegate); int dw = ps(120); int dh = ps(50); setFrame(deleteButton, this.listView.getWidth() - dw, (ps(80) - dh) / 2, dw, dh); item.deleteControl = deleteButton; item.addView(deleteButton); this.listView.addView(item); } }
From source file:com.android.launcher3.Utilities.java
public static Bitmap getNotificationBadgeIcon(Context context, Bitmap appIcon, int number) { Paint paint;//from w w w.j a va 2 s . co m Paint circlePaint; String text = "" + String.valueOf(number); Bitmap canvasBitmap = Bitmap.createBitmap(appIcon.getWidth(), appIcon.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(canvasBitmap); paint = new Paint(); circlePaint = new Paint(); paint.setColor(Color.WHITE); paint.setTextSize(45); paint.setAntiAlias(true); paint.setTextAlign(Paint.Align.CENTER); Rect bounds = new Rect(); paint.getTextBounds(text, 0, text.length(), bounds); circlePaint.setColor(ContextCompat.getColor(context, R.color.colorPrimary)); circlePaint.setAntiAlias(true); canvas.drawCircle(appIcon.getWidth() / 4, appIcon.getHeight() / 4, 45, circlePaint); canvas.drawText(text, appIcon.getWidth() / 4, appIcon.getHeight() / 3, paint); return overlay(appIcon, canvasBitmap); }
From source file:cl.gisred.android.CatastroActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/* w w w . 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); //TODO buscar tramo 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(CatastroActivity.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.amaze.carbonfilemanager.activities.MainActivity.java
void initialiseViews() { appBarLayout = (AppBarLayout) findViewById(R.id.lin); mScreenLayout = (CoordinatorLayout) findViewById(R.id.main_frame); buttonBarFrame = (FrameLayout) findViewById(R.id.buttonbarframe); //buttonBarFrame.setBackgroundColor(Color.parseColor(currentTab==1 ? skinTwo : skin)); drawerHeaderLayout = getLayoutInflater().inflate(R.layout.drawerheader, null); drawerHeaderParent = (RelativeLayout) drawerHeaderLayout.findViewById(R.id.drawer_header_parent); drawerHeaderView = drawerHeaderLayout.findViewById(R.id.drawer_header); drawerHeaderView.setOnLongClickListener(new View.OnLongClickListener() { @Override//from w w w . j a v a 2 s . c o m public boolean onLongClick(View v) { Intent intent; if (SDK_INT < 19) { intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); } else { intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); } intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("image/*"); startActivityForResult(intent, image_selector_request_code); return false; } }); drawerProfilePic = (RoundedImageView) drawerHeaderLayout.findViewById(R.id.profile_pic); mGoogleName = (TextView) drawerHeaderLayout.findViewById(R.id.account_header_drawer_name); mGoogleId = (TextView) drawerHeaderLayout.findViewById(R.id.account_header_drawer_email); toolbar = (Toolbar) findViewById(R.id.action_bar); /* For SearchView, see onCreateOptionsMenu(Menu menu)*/ TOOLBAR_START_INSET = toolbar.getContentInsetStart(); setSupportActionBar(toolbar); frameLayout = (FrameLayout) findViewById(R.id.content_frame); indicator_layout = findViewById(R.id.indicator_layout); mDrawerLinear = (ScrimInsetsRelativeLayout) findViewById(R.id.left_drawer); if (getAppTheme().equals(AppTheme.DARK)) mDrawerLinear.setBackgroundColor(Utils.getColor(this, R.color.holo_dark_background)); else mDrawerLinear.setBackgroundColor(Color.WHITE); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); //mDrawerLayout.setStatusBarBackgroundColor(Color.parseColor((currentTab==1 ? skinTwo : skin))); mDrawerList = (ListView) findViewById(R.id.menu_drawer); drawerHeaderView.setBackgroundResource(R.drawable.amaze_header); //drawerHeaderParent.setBackgroundColor(Color.parseColor((currentTab==1 ? skinTwo : skin))); if (findViewById(R.id.tab_frame) != null) { mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN, mDrawerLinear); mDrawerLayout.openDrawer(mDrawerLinear); mDrawerLayout.setScrimColor(Color.TRANSPARENT); isDrawerLocked = true; } else if (findViewById(R.id.tab_frame) == null) { mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, mDrawerLinear); mDrawerLayout.closeDrawer(mDrawerLinear); isDrawerLocked = false; } mDrawerList.addHeaderView(drawerHeaderLayout); getSupportActionBar().setDisplayShowTitleEnabled(false); fabBgView = findViewById(R.id.fab_bg); if (getAppTheme().equals(AppTheme.DARK)) { fabBgView.setBackgroundResource(R.drawable.fab_shadow_dark); } fabBgView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { floatingActionButton.close(true); if (isSearchViewEnabled) hideSearchView(); } }); pathbar = (LinearLayout) findViewById(R.id.pathbar); buttons = (LinearLayout) findViewById(R.id.buttons); scroll = (HorizontalScrollView) findViewById(R.id.scroll); scroll1 = (HorizontalScrollView) findViewById(R.id.scroll1); scroll.setSmoothScrollingEnabled(true); scroll1.setSmoothScrollingEnabled(true); ImageView divider = (ImageView) findViewById(R.id.divider1); if (getAppTheme().equals(AppTheme.LIGHT)) divider.setImageResource(R.color.divider); else divider.setImageResource(R.color.divider_dark); setDrawerHeaderBackground(); View settingsButton = findViewById(R.id.settingsbutton); if (getAppTheme().equals(AppTheme.DARK)) { settingsButton.setBackgroundResource(R.drawable.safr_ripple_black); ((ImageView) settingsButton.findViewById(R.id.settingicon)) .setImageResource(R.drawable.ic_settings_white_48dp); ((TextView) settingsButton.findViewById(R.id.settingtext)) .setTextColor(Utils.getColor(this, android.R.color.white)); } settingsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(MainActivity.this, PreferencesActivity.class); startActivity(in); finish(); } }); View appButton = findViewById(R.id.appbutton); if (getAppTheme().equals(AppTheme.DARK)) { appButton.setBackgroundResource(R.drawable.safr_ripple_black); ((ImageView) appButton.findViewById(R.id.appicon)).setImageResource(R.drawable.ic_doc_apk_white); ((TextView) appButton.findViewById(R.id.apptext)) .setTextColor(Utils.getColor(this, android.R.color.white)); } appButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { android.support.v4.app.FragmentTransaction transaction2 = getSupportFragmentManager() .beginTransaction(); transaction2.replace(R.id.content_frame, new AppsList()); findViewById(R.id.lin).animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)) .start(); pending_fragmentTransaction = transaction2; if (!isDrawerLocked) mDrawerLayout.closeDrawer(mDrawerLinear); else onDrawerClosed(); selectedStorage = SELECT_MINUS_2; adapter.toggleChecked(false); } }); View ftpButton = findViewById(R.id.ftpbutton); if (getAppTheme().equals(AppTheme.DARK)) { ftpButton.setBackgroundResource(R.drawable.safr_ripple_black); ((ImageView) ftpButton.findViewById(R.id.ftpicon)).setImageResource(R.drawable.ic_ftp_dark); ((TextView) ftpButton.findViewById(R.id.ftptext)) .setTextColor(Utils.getColor(this, android.R.color.white)); } ftpButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { android.support.v4.app.FragmentTransaction transaction2 = getSupportFragmentManager() .beginTransaction(); transaction2.replace(R.id.content_frame, new FTPServerFragment()); findViewById(R.id.lin).animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)) .start(); pending_fragmentTransaction = transaction2; if (!isDrawerLocked) mDrawerLayout.closeDrawer(mDrawerLinear); else onDrawerClosed(); selectedStorage = SELECT_MINUS_2; adapter.toggleChecked(false); } }); //getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor((currentTab==1 ? skinTwo : skin)))); // status bar0 if (SDK_INT == 20 || SDK_INT == 19) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); //tintManager.setStatusBarTintColor(Color.parseColor((currentTab==1 ? skinTwo : skin))); FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.drawer_layout) .getLayoutParams(); SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); if (!isDrawerLocked) p.setMargins(0, config.getStatusBarHeight(), 0, 0); } else if (SDK_INT >= 21) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); //window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (isDrawerLocked) { window.setStatusBarColor((skinStatusBar)); } else window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (colourednavigation) window.setNavigationBarColor(skinStatusBar); } searchViewLayout = (RelativeLayout) findViewById(R.id.search_view); searchViewEditText = (AppCompatEditText) findViewById(R.id.search_edit_text); ImageView clear = (ImageView) findViewById(R.id.search_close_btn); clear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { searchViewEditText.setText(""); } }); findViewById(R.id.img_view_back).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { hideSearchView(); } }); searchViewEditText.setOnKeyListener(new TextView.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN)) { // Perform action on key press mainActivityHelper.search(searchViewEditText.getText().toString()); hideSearchView(); return true; } return false; } }); // searchViewEditText.setTextColor(Utils.getColor(this, android.R.color.black)); // searchViewEditText.setHintTextColor(Color.parseColor(BaseActivity.accentSkin)); }
From source file:cl.gisred.android.OtRouteActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override//w w w .j a va2 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(OtRouteActivity.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 fillHighlightList() { Theme theme = getCurrentTheme();//from ww w . j a v a 2s. co m int textColor = theme.foregroundColor; this.listView.removeAllViews(); Highlights highlights = sd.fetchAllHighlights(this.bookCode); for (int i = 0; i < highlights.getSize(); i++) { Highlight highlight = highlights.getHighlight(i); SkyLayout item = new SkyLayout(this); int ci = highlight.chapterIndex; if (rv.isRTL()) { ci = rv.getNumberOfChapters() - ci - 1; } String chapterTitle = rv.getChapterTitle(ci); if (chapterTitle == null || chapterTitle.isEmpty()) chapterTitle = "Chapter " + ci; TextView chapterLabel = this.makeLabel(9899, chapterTitle, Gravity.LEFT, 16, textColor); setFrame(chapterLabel, ps(20), ps(5), this.listView.getWidth() - ps(20), ps(40)); item.addView(chapterLabel); GradientDrawable textGrad = new GradientDrawable(Orientation.TOP_BOTTOM, new int[] { getBrighterColor(highlight.color), getDarkerColor(highlight.color) }); TextView textLabel = this.makeLabel(9899, highlight.text, Gravity.LEFT, 16, Color.BLACK); setFrame(textLabel, ps(20), ps(5 + 40 + 5), this.listView.getWidth() - ps(20), ps(70)); textLabel.setBackgroundDrawable(textGrad); textLabel.getBackground().setAlpha(180); item.addView(textLabel); int noteHeight = 0; if (highlight.isNote && highlight.note != null && highlight.note.length() != 0 && !highlight.note.equalsIgnoreCase("null")) { TextView noteLabel = this.makeLabel(9899, highlight.note, Gravity.LEFT, 16, Color.BLACK); noteLabel.setTextColor(getDarkerColor(highlight.color)); noteHeight = 70; setFrame(noteLabel, ps(20), ps(5 + 40 + 5 + 70 + 5), this.listView.getWidth() - ps(20), ps(noteHeight)); item.addView(noteLabel); } TextView dateLabel = this.makeLabel(9899, highlight.datetime, Gravity.RIGHT, 12, textColor); int lw = this.listView.getWidth(); setFrame(dateLabel, 0, ps(5 + 40 + 5 + 70 + 5 + noteHeight + 5), lw, ps(40)); item.addView(dateLabel); int itemHeight = ps(5 + 40 + 5 + 90 + 5 + noteHeight + 5 + 15 + 5); View lineView = new View(this); lineView.setBackgroundColor(Color.LTGRAY); setFrame(lineView, 0, itemHeight - ps(1), this.listView.getWidth(), ps(1)); item.addView(lineView); setFrame(item, 0, 0, listView.getWidth(), itemHeight); item.setSkyLayoutListener(highlightListDelegate); item.setId(highlight.code); item.data = highlight; Button deleteButton = new Button(this); GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM, new int[] { 0xffcf666e, 0xff671521 }); grad.setStroke(ps(2), 0xff282828); deleteButton.setBackgroundDrawable(grad); deleteButton.setText(getString(R.string.delete)); deleteButton.setTypeface(null, Typeface.BOLD); deleteButton.setTextColor(Color.WHITE); deleteButton.setTextSize(12); deleteButton.setId(highlight.code); deleteButton.setVisibility(View.INVISIBLE); deleteButton.setVisibility(View.GONE); deleteButton.setOnClickListener(deleteHighlightDelegate); int dw = ps(120); int dh = ps(50); setFrame(deleteButton, this.listView.getWidth() - dw, (itemHeight - dh) / 2, dw, dh); item.deleteControl = deleteButton; item.addView(deleteButton); this.listView.addView(item); } }
From source file:cl.gisred.android.MedidorActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override//from w w w . 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); //TODO buscar tramo 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(MedidorActivity.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.bookkos.bircle.CaptureActivity.java
private void setScanUnregisterBookView() { int registSelectShelfRelativeLayout_width = displayWidth; int registSelectShelfRelativeLayout_height = displayHeight / 3; int registSelectShelfRelativeLayout_x = 0; int registSelectShelfRelativeLayout_y = displayHeight; registSelectShelfRelativeLayout.setTranslationX(registSelectShelfRelativeLayout_x); registSelectShelfRelativeLayout.setTranslationY(registSelectShelfRelativeLayout_y); registSelectShelfRelativeLayout.setLayoutParams(new FrameLayout.LayoutParams( registSelectShelfRelativeLayout_width, registSelectShelfRelativeLayout_height)); //registSelectShelfRelativeLayout.setVisibility(View.GONE); int textViewLinearLayout_width = displayWidth; int textViewLinearLayout_height = registSelectShelfRelativeLayout_height / 4; textViewLinearLayout.setLayoutParams( new RelativeLayout.LayoutParams(textViewLinearLayout_width, textViewLinearLayout_height)); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) textViewLinearLayout.getLayoutParams(); // params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params1.addRule(RelativeLayout.ALIGN_PARENT_TOP); textViewLinearLayout.setLayoutParams(params1); String tempText = "<font color=#3498db>?????!</font><br />?????????QR???, ?????\"\"????"; tempTextView.setText(Html.fromHtml(tempText)); tempTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f); int buttonLinearLayout_width = displayWidth; int buttonLinearLayout_height = registSelectShelfRelativeLayout_height / 4; int buttonLinearLayout_x = 0; int buttonLinearLayout_y = displayHeight; // buttonLinearLayout.setTranslationX(buttonLinearLayout_x); // buttonLinearLayout.setTranslationY(buttonLinearLayout_y); buttonLinearLayout.setLayoutParams(//from ww w .j a v a 2 s .c o m new RelativeLayout.LayoutParams(buttonLinearLayout_width, buttonLinearLayout_height)); RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) buttonLinearLayout.getLayoutParams(); params2.addRule(RelativeLayout.BELOW, R.id.text_view_linear_layout); buttonLinearLayout.setLayoutParams(params2); int listViewLinearLayout_width = displayWidth; int listViewLinearLayout_height = registSelectShelfRelativeLayout_height / 2; int listViewLinearLayout_x = 0; int listViewLinearLayout_y = displayHeight; // listViewLinearLayout.setTranslationX(listViewLinearLayout_x); // listViewLinearLayout.setTranslationY(listViewLinearLayout_y); listViewLinearLayout.setLayoutParams( new RelativeLayout.LayoutParams(listViewLinearLayout_width, listViewLinearLayout_height)); RelativeLayout.LayoutParams params3 = (RelativeLayout.LayoutParams) listViewLinearLayout.getLayoutParams(); params3.addRule(RelativeLayout.BELOW, R.id.button_linear_layout); listViewLinearLayout.setLayoutParams(params3); // listViewLinearLayout.setVisibility(View.GONE); int decisionButton_width = displayWidth / 5 * 2; // int decisionButton_height = displayHeight / 10; int decisionButton_height = registSelectShelfRelativeLayout_height / 4; int decisionButton_x = ((displayWidth / 2) - decisionButton_width) / 2; int decisionButton_y = displayHeight - (titleBarHeight * 4); decisionButton.setTranslationX(decisionButton_x); // decisionButton.setTranslationY(decisionButton_y); decisionButton.setLayoutParams(new LinearLayout.LayoutParams(decisionButton_width, decisionButton_height)); decisionButton.setBackgroundColor(Color.argb(255, 230, 126, 34)); decisionButton.setTextColor(Color.WHITE); decisionButton.setText(""); decisionButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { doDecideClick(registSelectShelfIsbn, registSelectShelfId, registSelectShelfName); registButton.setEnabled(true); borrowReturnButton.setEnabled(true); } }); int cancelButton_width = displayWidth / 5 * 2; // int cancelButton_height = displayHeight / 10; int cancelButton_height = registSelectShelfRelativeLayout_height / 4; int cancelButton_x = ((displayWidth / 2) + decisionButton_x) - decisionButton_width; int cancelButton_y = displayHeight - (titleBarHeight * 4); cancelButton.setTranslationX(cancelButton_x); // cancelButton.setTranslationY(cancelButton_y); cancelButton.setLayoutParams(new LinearLayout.LayoutParams(cancelButton_width, cancelButton_height)); cancelButton.setBackgroundColor(Color.argb(255, 127, 140, 141)); cancelButton.setText(""); cancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { resetRegistSelectShelfData(); animateTranslationY(registSelectShelfRelativeLayout, displayHeight - displayHeight / 3 - titleBarHeight, displayHeight); registFlag = 0; registButton.setEnabled(true); borrowReturnButton.setEnabled(true); } }); }