List of usage examples for android.os Bundle getStringArrayList
@Override
@Nullable
public ArrayList<String> getStringArrayList(@Nullable String key)
From source file:cl.gisred.android.InspActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LicenseResult licenseResult = ArcGISRuntime.setClientId(CLIENT_ID); LicenseLevel licenseLevel = ArcGISRuntime.License.getLicenseLevel(); if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.BASIC) { //Toast.makeText(getApplicationContext(), "Licencia bsica vlida", Toast.LENGTH_SHORT).show(); } else if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.STANDARD) { //Toast.makeText(getApplicationContext(), "Licencia standard vlida", Toast.LENGTH_SHORT).show(); }/* ww w . jav a 2 s.co m*/ setContentView(R.layout.activity_insp); Toolbar toolbar = (Toolbar) findViewById(R.id.apptool); setSupportActionBar(toolbar); /*Get Credenciales String*/ Bundle bundle = getIntent().getExtras(); usuar = bundle.getString("usuario"); passw = bundle.getString("password"); modulo = bundle.getString("modulo"); empresa = bundle.getString("empresa"); //Set Credenciales setCredenciales(usuar, passw); //Set Mapa setMap(R.id.map, 0xffffff, 0xffffff, 10, 10, false, true); choices = 0; if (Build.VERSION.SDK_INT >= 23) verifPermisos(); else initGeoposition(); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "MAPABASE"); setLayersURL(this.getResources().getString(R.string.url_token), "TOKENSRV"); setLayersURL(this.getResources().getString(R.string.url_EquiposLinea), "EQUIPOS_LINEA"); setLayersURL(this.getResources().getString(R.string.url_TRAMOS), "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_EquiposPTO), "EQUIPOS_PTO"); setLayersURL(this.getResources().getString(R.string.url_Nodos), "NODOS"); setLayersURL(this.getResources().getString(R.string.url_Luminarias), "LUMINARIAS"); setLayersURL(this.getResources().getString(R.string.url_Clientes), "CLIENTES"); setLayersURL(this.getResources().getString(R.string.url_Concesiones), "CONCESIONES"); setLayersURL(this.getResources().getString(R.string.url_Direcciones), "DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.url_medidores), "MEDIDORES"); setLayersURL(this.getResources().getString(R.string.url_Stx), "STX"); setLayersURL(this.getResources().getString(R.string.url_ECSE_varios), "ECSE"); setLayersURL(this.getResources().getString(R.string.url_Electrodependientes), "ELECTRODEP"); //Agrega layers dinmicos. addLayersToMap(credenciales, "DYNAMIC", "MAPABASECHQ", din_urlMapaBase, null, true); addLayersToMap(credenciales, "DYNAMIC", "SED", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SSEE", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SALIDAALIM", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDMT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDBT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDAP", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "POSTES", din_urlNodos, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_LINEA", din_urlEquiposLinea, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_PTO", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "LUMINARIAS", din_urlLuminarias, null, false); addLayersToMap(credenciales, "DYNAMIC", "CLIENTES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "MEDIDORES", din_urlMedidores, null, false); addLayersToMap(credenciales, "DYNAMIC", "CONCESIONES", din_urlConcesiones, null, false); addLayersToMap(credenciales, "DYNAMIC", "DIRECCIONES", din_urlDirecciones, null, false); addLayersToMap(credenciales, "DYNAMIC", "EMPALMES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "TORRESSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "ENCUESTADO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "REEMPLAZO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "ELECTRODEP", din_urlElectroDep, null, false); //Aade Layer al Mapa myMapView.addLayer(mRoadBaseMaps, 0); myMapView.addLayer(LySED, 1); myMapView.addLayer(LySSEE, 2); myMapView.addLayer(LySALIDAALIM, 3); myMapView.addLayer(LyPOSTES, 4); myMapView.addLayer(LyREDMT, 5); myMapView.addLayer(LyREDBT, 6); myMapView.addLayer(LyREDAP, 7); myMapView.addLayer(LyEQUIPOSLINEA, 8); myMapView.addLayer(LyEQUIPOSPTO, 9); myMapView.addLayer(LyLUMINARIAS, 10); myMapView.addLayer(LyCLIENTES, 11); myMapView.addLayer(LyMEDIDORES, 12); myMapView.addLayer(LyCONCESIONES, 13); myMapView.addLayer(LyDIRECCIONES, 14); myMapView.addLayer(LyEMPALMES, 15); myMapView.addLayer(LyREDSTX, 16); myMapView.addLayer(LyTORRESSTX, 17); myMapView.addLayer(LyENCUESTA, 18); myMapView.addLayer(LyREEMPLAZO, 19); myMapView.addLayer(LyELECTRODEP, 20); final FloatingActionButton btnGps = (FloatingActionButton) findViewById(R.id.action_gps); btnGps.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { alertNoGps(); } toogleGps(v); } }); btnGps.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Funcin Gps", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton btnVerData = (FloatingActionButton) findViewById(R.id.action_ver_data); btnVerData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleData(v); } }); btnVerData.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Datos", Toast.LENGTH_SHORT).show(); return true; } }); drawOk = new ShapeDrawable(new OvalShape()); drawOk.getPaint().setColor(getResources().getColor(R.color.colorPrimary)); drawNo = new ShapeDrawable(new OvalShape()); drawNo.getPaint().setColor(getResources().getColor(R.color.black_overlay)); menuInspeccionActions = (FloatingActionsMenu) findViewById(R.id.inspection_actions); menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions); fabShowDialog = (FloatingActionButton) findViewById(R.id.action_show_dialog); if (fabShowDialog != null) fabShowDialog.setVisibility(View.GONE); fabShowForm = (FloatingActionButton) findViewById(R.id.action_show_form); if (fabShowForm != null) fabShowForm.setVisibility(View.GONE); fabVerCapas = (FloatingActionButton) findViewById(R.id.action_ver_capa); if (fabVerCapas != null) fabVerCapas.setVisibility(View.GONE); fabNavRoute = (FloatingActionButton) findViewById(R.id.action_nav_route); if (fabNavRoute != null) { fabNavRoute.setVisibility(View.GONE); fabNavRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myMapView != null && myMapView.getCallout().isShowing()) { Point p = (Point) GeometryEngine.project(myMapView.getCallout().getCoordinates(), wm, egs); Util.QueryNavigation(InspActivity.this, p); } } }); fabNavRoute.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ir a Ruta", Toast.LENGTH_SHORT).show(); return true; } }); } if (modulo.replace(" ", "_").equals(modInspeccion)) { dateFormatter = new SimpleDateFormat("dd-MM-yyyy", Locale.US); arrayTipoFaseInsp = getResources().getStringArray(R.array.fase_conexion_insp); arrayMarca = getResources().getStringArray(R.array.marca); arrayTipoMarca = getResources().getStringArray(R.array.tipo_marca); arrayFirmante = getResources().getStringArray(R.array.situacion_firmante); arrayWidgets = bundle.getStringArrayList("widgets"); arrayModulos = bundle.getStringArrayList("modulos"); final String sForm = bundle.getString("form"); if (sForm.contains("TELEMEDIDA")) { arrayMarcaTM = getResources().getStringArray(R.array.marca_tm); arrayTipoMarcaTM = getResources().getStringArray(R.array.tipo_marca_tm); } formCrear = new Dialog(InspActivity.this); fabShowForm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //bMapTap = false; //bCallOut = false; //myMapView.getCallout().hide(); formCrear.show(); } }); FloatingActionButton oFabForm = (FloatingActionButton) findViewById(R.id.action_form); oFabForm.setIconDrawable(drawOk); oFabForm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { abrirFormInsp(v, sForm); } }); FloatingActionButton oFabView = (FloatingActionButton) findViewById(R.id.action_view); oFabView.setIconDrawable(drawOk); oFabView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { abrirEsquema(v); } }); FloatingActionButton oFabDenuncio = (FloatingActionButton) findViewById(R.id.action_denuncio); oFabDenuncio.setIconDrawable(drawNo); oFabDenuncio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //abrirFormDenuncio(v); Snackbar.make(v, "No tiene acceso a sta opcin", Snackbar.LENGTH_SHORT).show(); menuInspeccionActions.collapse(); } }); if (arrayModulos != null && arrayModulos.size() > 0 && arrayModulos.contains(empresa + "@" + modIngreso)) { arrayTipoPoste = getResources().getStringArray(R.array.tipo_poste); arrayTension = getResources().getStringArray(R.array.tipo_tension); arrayTipoEdif = getResources().getStringArray(R.array.tipo_edificacion); arrayMedidor = getResources().getStringArray(R.array.tipo_medidor); arrayEmpalme = getResources().getStringArray(R.array.tipo_empalme); arrayTecMedidor = getResources().getStringArray(R.array.tec_medidor); arrayTipoCnr = getResources().getStringArray(R.array.tipo_cnr); arrayTipoFase = getResources().getStringArray(R.array.fase_conexion); dialogCrear = new Dialog(InspActivity.this); fabShowDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bMapTap = false; bCallOut = false; myMapView.getCallout().hide(); if (oUbicacion != null) { btnUbicacion.setColorFilter(Color.BLACK); setEnabledDialog(true); } dialogCrear.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); } }); fabVerCapas.setVisibility(View.VISIBLE); fabVerCapas.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleCapas(v); } }); fabVerCapas.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Capas de Ingreso", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a); final FloatingActionButton actionB = (FloatingActionButton) findViewById(R.id.action_b); final FloatingActionButton actionC = (FloatingActionButton) findViewById(R.id.action_c); final FloatingActionButton actionD = (FloatingActionButton) findViewById(R.id.action_d); setOpcion(actionA, null); setOpcion(actionB, null); setOpcion(actionC, modIngreso + "_TECNO"); setOpcion(actionD, modIngreso + "_CNR"); setLayersURL(this.getResources().getString(R.string.srv_Postes), "SRV_POSTES"); setLayersURL(this.getResources().getString(R.string.srv_Direcciones), "SRV_DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.srv_Clientes), "SRV_CLIENTES"); setLayersURL(this.getResources().getString(R.string.srv_Union_012), "SRV_UNIONES"); setLayersURL(din_urlTramos, "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "SRV_CALLES"); setLayersURL(this.getResources().getString(R.string.srv_ClientesCnr), "SRV_CLIENTESCNR"); addLayersToMap(credenciales, "FEATURE", "ADDPOSTE", srv_urlPostes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDADDRESS", srv_urlDireccion, null, true); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTE", srv_urlClientes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDUNION", srv_urlUnion012, null, true); addLayersToMap(credenciales, "FEATURE", "ASOCTRAMO", LyREDBT.getUrl(), null, false); addLayersToMap(credenciales, "FEATURE", "ASOCCALLE", srv_calles, null, false); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTECNR", srv_urlClientesCnr, null, true); myMapView.addLayer(LyAddPoste, 21); myMapView.addLayer(LyAddDireccion, 22); myMapView.addLayer(LyAddCliente, 23); myMapView.addLayer(LyAddUnion, 24); myMapView.addLayer(LyAsocTramo, 25); myMapView.addLayer(LyAsocCalle, 26); myMapView.addLayer(LyAddClienteCnr, 27); setLayerAddToggle(false); } else { menuMultipleActions.setVisibility(View.GONE); } } else { menuInspeccionActions.setVisibility(View.GONE); } }
From source file:cl.gisred.android.MapsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LicenseResult licenseResult = ArcGISRuntime.setClientId(CLIENT_ID); LicenseLevel licenseLevel = ArcGISRuntime.License.getLicenseLevel(); if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.BASIC) { //Toast.makeText(getApplicationContext(), "Licencia bsica vlida", Toast.LENGTH_SHORT).show(); } else if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.STANDARD) { //Toast.makeText(getApplicationContext(), "Licencia standard vlida", Toast.LENGTH_SHORT).show(); }/*from www . jav a 2 s.co m*/ setContentView(R.layout.activity_maps); Toolbar toolbar = (Toolbar) findViewById(R.id.apptool); setSupportActionBar(toolbar); /*Get Credenciales String*/ Bundle bundle = getIntent().getExtras(); usuar = bundle.getString("usuario"); passw = bundle.getString("password"); modulo = bundle.getString("modulo"); empresa = bundle.getString("empresa"); //Set Credenciales setCredenciales(usuar, passw); //Set Mapa setMap(R.id.map, 0xffffff, 0xffffff, 10, 10, false, true); choices = 0; if (Build.VERSION.SDK_INT >= 23) verifPermisos(); else initGeoposition(); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "MAPABASE"); setLayersURL(this.getResources().getString(R.string.url_token), "TOKENSRV"); setLayersURL(this.getResources().getString(R.string.url_EquiposLinea), "EQUIPOS_LINEA"); setLayersURL(this.getResources().getString(R.string.url_TRAMOS), "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_EquiposPTO), "EQUIPOS_PTO"); setLayersURL(this.getResources().getString(R.string.url_Nodos), "NODOS"); setLayersURL(this.getResources().getString(R.string.url_Luminarias), "LUMINARIAS"); setLayersURL(this.getResources().getString(R.string.url_Clientes), "CLIENTES"); setLayersURL(this.getResources().getString(R.string.url_Concesiones), "CONCESIONES"); setLayersURL(this.getResources().getString(R.string.url_Direcciones), "DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.url_medidores), "MEDIDORES"); setLayersURL(this.getResources().getString(R.string.url_Stx), "STX"); setLayersURL(this.getResources().getString(R.string.url_ECSE_varios), "ECSE"); setLayersURL(this.getResources().getString(R.string.url_Electrodependientes), "ELECTRODEP"); //Agrega layers dinmicos. addLayersToMap(credenciales, "DYNAMIC", "MAPABASECHQ", din_urlMapaBase, null, true); addLayersToMap(credenciales, "DYNAMIC", "SED", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SSEE", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SALIDAALIM", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDMT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDBT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDAP", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "POSTES", din_urlNodos, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_LINEA", din_urlEquiposLinea, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_PTO", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "LUMINARIAS", din_urlLuminarias, null, false); addLayersToMap(credenciales, "DYNAMIC", "CLIENTES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "MEDIDORES", din_urlMedidores, null, false); addLayersToMap(credenciales, "DYNAMIC", "CONCESIONES", din_urlConcesiones, null, false); addLayersToMap(credenciales, "DYNAMIC", "DIRECCIONES", din_urlDirecciones, null, false); addLayersToMap(credenciales, "DYNAMIC", "EMPALMES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "TORRESSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "ENCUESTADO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "REEMPLAZO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "ELECTRODEP", din_urlElectroDep, null, false); //Aade Layer al Mapa myMapView.addLayer(mRoadBaseMaps, 0); myMapView.addLayer(LySED, 1); myMapView.addLayer(LySSEE, 2); myMapView.addLayer(LySALIDAALIM, 3); myMapView.addLayer(LyPOSTES, 4); myMapView.addLayer(LyREDMT, 5); myMapView.addLayer(LyREDBT, 6); myMapView.addLayer(LyREDAP, 7); myMapView.addLayer(LyEQUIPOSLINEA, 8); myMapView.addLayer(LyEQUIPOSPTO, 9); myMapView.addLayer(LyLUMINARIAS, 10); myMapView.addLayer(LyCLIENTES, 11); myMapView.addLayer(LyMEDIDORES, 12); myMapView.addLayer(LyCONCESIONES, 13); myMapView.addLayer(LyDIRECCIONES, 14); myMapView.addLayer(LyEMPALMES, 15); myMapView.addLayer(LyREDSTX, 16); myMapView.addLayer(LyTORRESSTX, 17); myMapView.addLayer(LyENCUESTA, 18); myMapView.addLayer(LyREEMPLAZO, 19); myMapView.addLayer(LyELECTRODEP, 20); final FloatingActionButton btnGps = (FloatingActionButton) findViewById(R.id.action_gps); btnGps.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { alertNoGps(); } toogleGps(v); } }); btnGps.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Funcin Gps", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton btnVerData = (FloatingActionButton) findViewById(R.id.action_ver_data); btnVerData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleData(v); } }); btnVerData.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Datos", Toast.LENGTH_SHORT).show(); return true; } }); drawOk = new ShapeDrawable(new OvalShape()); drawOk.getPaint().setColor(getResources().getColor(R.color.colorPrimary)); drawNo = new ShapeDrawable(new OvalShape()); drawNo.getPaint().setColor(getResources().getColor(R.color.black_overlay)); menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions); fabShowDialog = (FloatingActionButton) findViewById(R.id.action_show_dialog); if (fabShowDialog != null) fabShowDialog.setVisibility(View.GONE); fabVerCapas = (FloatingActionButton) findViewById(R.id.action_ver_capa); if (fabVerCapas != null) fabVerCapas.setVisibility(View.GONE); fabNavRoute = (FloatingActionButton) findViewById(R.id.action_nav_route); if (fabNavRoute != null) { fabNavRoute.setVisibility(View.GONE); fabNavRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myMapView != null && myMapView.getCallout().isShowing()) { Point p = (Point) GeometryEngine.project(myMapView.getCallout().getCoordinates(), wm, egs); Util.QueryNavigation(MapsActivity.this, p); } } }); fabNavRoute.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ir a Ruta", Toast.LENGTH_SHORT).show(); return true; } }); } if (modulo.replace(" ", "_").equals(modIngreso)) { arrayTipoPoste = getResources().getStringArray(R.array.tipo_poste); arrayTension = getResources().getStringArray(R.array.tipo_tension); arrayTipoEdif = getResources().getStringArray(R.array.tipo_edificacion); arrayMedidor = getResources().getStringArray(R.array.tipo_medidor); arrayEmpalme = getResources().getStringArray(R.array.tipo_empalme); arrayTecMedidor = getResources().getStringArray(R.array.tec_medidor); arrayTipoCnr = getResources().getStringArray(R.array.tipo_cnr); arrayTipoFase = getResources().getStringArray(R.array.fase_conexion); dialogCrear = new Dialog(MapsActivity.this); fabShowDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bMapTap = false; bCallOut = false; myMapView.getCallout().hide(); //TODO Restringir datos dialog if (oUbicacion != null) { btnUbicacion.setColorFilter(Color.BLACK); setEnabledDialog(true); } dialogCrear.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); } }); fabVerCapas.setVisibility(View.VISIBLE); fabVerCapas.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleCapas(v); } }); fabVerCapas.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Capas de Ingreso", Toast.LENGTH_SHORT).show(); return true; } }); arrayWidgets = bundle.getStringArrayList("widgets"); final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a); final FloatingActionButton actionB = (FloatingActionButton) findViewById(R.id.action_b); final FloatingActionButton actionC = (FloatingActionButton) findViewById(R.id.action_c); final FloatingActionButton actionD = (FloatingActionButton) findViewById(R.id.action_d); setOpcion(actionA, null); setOpcion(actionB, null); setOpcion(actionC, modIngreso + "_TECNO"); setOpcion(actionD, modIngreso + "_CNR"); setLayersURL(this.getResources().getString(R.string.srv_Postes), "SRV_POSTES"); setLayersURL(this.getResources().getString(R.string.srv_Direcciones), "SRV_DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.srv_Clientes), "SRV_CLIENTES"); setLayersURL(this.getResources().getString(R.string.srv_Union_012), "SRV_UNIONES"); setLayersURL(din_urlTramos, "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "SRV_CALLES"); setLayersURL(this.getResources().getString(R.string.srv_ClientesCnr), "SRV_CLIENTESCNR"); addLayersToMap(credenciales, "FEATURE", "ADDPOSTE", srv_urlPostes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDADDRESS", srv_urlDireccion, null, true); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTE", srv_urlClientes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDUNION", srv_urlUnion012, null, true); addLayersToMap(credenciales, "FEATURE", "ASOCTRAMO", LyREDBT.getUrl(), null, false); addLayersToMap(credenciales, "FEATURE", "ASOCCALLE", srv_calles, null, false); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTECNR", srv_urlClientesCnr, null, true); myMapView.addLayer(LyAddPoste, 21); myMapView.addLayer(LyAddDireccion, 22); myMapView.addLayer(LyAddCliente, 23); myMapView.addLayer(LyAddUnion, 24); myMapView.addLayer(LyAsocTramo, 25); myMapView.addLayer(LyAsocCalle, 26); myMapView.addLayer(LyAddClienteCnr, 27); setLayerAddToggle(false); } else { menuMultipleActions.setVisibility(View.GONE); } }
From source file:cl.gisred.android.RegEquipoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LicenseResult licenseResult = ArcGISRuntime.setClientId(CLIENT_ID); LicenseLevel licenseLevel = ArcGISRuntime.License.getLicenseLevel(); if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.BASIC) { //Toast.makeText(getApplicationContext(), "Licencia bsica vlida", Toast.LENGTH_SHORT).show(); } else if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.STANDARD) { //Toast.makeText(getApplicationContext(), "Licencia standard vlida", Toast.LENGTH_SHORT).show(); }/* w ww .ja v a 2 s. c o m*/ setContentView(R.layout.activity_reg_equipo); Toolbar toolbar = (Toolbar) findViewById(R.id.apptool); setSupportActionBar(toolbar); /*Get Credenciales String*/ Bundle bundle = getIntent().getExtras(); usuar = bundle.getString("usuario"); passw = bundle.getString("password"); modulo = bundle.getString("modulo"); empresa = bundle.getString("empresa"); //Set Credenciales setCredenciales(usuar, passw); //Set Mapa setMap(R.id.map, 0xffffff, 0xffffff, 10, 10, false, true); choices = 0; if (Build.VERSION.SDK_INT >= 23) verifPermisos(); else initGeoposition(); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "MAPABASE"); setLayersURL(this.getResources().getString(R.string.url_token), "TOKENSRV"); setLayersURL(this.getResources().getString(R.string.url_EquiposLinea), "EQUIPOS_LINEA"); setLayersURL(this.getResources().getString(R.string.url_TRAMOS), "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_EquiposPTO), "EQUIPOS_PTO"); setLayersURL(this.getResources().getString(R.string.url_Nodos), "NODOS"); setLayersURL(this.getResources().getString(R.string.url_Luminarias), "LUMINARIAS"); setLayersURL(this.getResources().getString(R.string.url_Clientes), "CLIENTES"); setLayersURL(this.getResources().getString(R.string.url_Concesiones), "CONCESIONES"); setLayersURL(this.getResources().getString(R.string.url_Direcciones), "DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.url_medidores), "MEDIDORES"); setLayersURL(this.getResources().getString(R.string.url_Stx), "STX"); setLayersURL(this.getResources().getString(R.string.url_ECSE_varios), "ECSE"); setLayersURL(this.getResources().getString(R.string.url_Electrodependientes), "ELECTRODEP"); //Agrega layers dinmicos. addLayersToMap(credenciales, "DYNAMIC", "MAPABASECHQ", din_urlMapaBase, null, true); addLayersToMap(credenciales, "DYNAMIC", "SED", din_urlEquiposPunto, null, true); addLayersToMap(credenciales, "DYNAMIC", "SSEE", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SALIDAALIM", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDMT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDBT", din_urlTramos, null, true); addLayersToMap(credenciales, "DYNAMIC", "REDAP", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "POSTES", din_urlNodos, null, true); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_LINEA", din_urlEquiposLinea, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_PTO", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "LUMINARIAS", din_urlLuminarias, null, false); addLayersToMap(credenciales, "DYNAMIC", "CLIENTES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "MEDIDORES", din_urlMedidores, null, false); addLayersToMap(credenciales, "DYNAMIC", "CONCESIONES", din_urlConcesiones, null, false); addLayersToMap(credenciales, "DYNAMIC", "DIRECCIONES", din_urlDirecciones, null, false); addLayersToMap(credenciales, "DYNAMIC", "EMPALMES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "TORRESSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "ENCUESTADO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "REEMPLAZO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "ELECTRODEP", din_urlElectroDep, null, false); //Aade Layer al Mapa myMapView.addLayer(mRoadBaseMaps, 0); myMapView.addLayer(LySED, 1); myMapView.addLayer(LySSEE, 2); myMapView.addLayer(LySALIDAALIM, 3); myMapView.addLayer(LyPOSTES, 4); myMapView.addLayer(LyREDMT, 5); myMapView.addLayer(LyREDBT, 6); myMapView.addLayer(LyREDAP, 7); myMapView.addLayer(LyEQUIPOSLINEA, 8); myMapView.addLayer(LyEQUIPOSPTO, 9); myMapView.addLayer(LyLUMINARIAS, 10); myMapView.addLayer(LyCLIENTES, 11); myMapView.addLayer(LyMEDIDORES, 12); myMapView.addLayer(LyCONCESIONES, 13); myMapView.addLayer(LyDIRECCIONES, 14); myMapView.addLayer(LyEMPALMES, 15); myMapView.addLayer(LyREDSTX, 16); myMapView.addLayer(LyTORRESSTX, 17); myMapView.addLayer(LyENCUESTA, 18); myMapView.addLayer(LyREEMPLAZO, 19); myMapView.addLayer(LyELECTRODEP, 20); final FloatingActionButton btnGps = (FloatingActionButton) findViewById(R.id.action_gps); btnGps.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { alertNoGps(); } toogleGps(v); } }); btnGps.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Funcin Gps", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton btnVerData = (FloatingActionButton) findViewById(R.id.action_ver_data); btnVerData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleData(v); } }); btnVerData.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Datos", Toast.LENGTH_SHORT).show(); return true; } }); drawOk = new ShapeDrawable(new OvalShape()); drawOk.getPaint().setColor(getResources().getColor(R.color.colorPrimary)); drawNo = new ShapeDrawable(new OvalShape()); drawNo.getPaint().setColor(getResources().getColor(R.color.black_overlay)); menuMicroActions = (FloatingActionsMenu) findViewById(R.id.reg_equipo_actions); menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions); fabShowDialog = (FloatingActionButton) findViewById(R.id.action_show_dialog); if (fabShowDialog != null) fabShowDialog.setVisibility(View.GONE); fabShowForm = (FloatingActionButton) findViewById(R.id.action_show_form); if (fabShowForm != null) fabShowForm.setVisibility(View.GONE); fabVerCapas = (FloatingActionButton) findViewById(R.id.action_ver_capa); if (fabVerCapas != null) fabVerCapas.setVisibility(View.GONE); fabNavRoute = (FloatingActionButton) findViewById(R.id.action_nav_route); if (fabNavRoute != null) { fabNavRoute.setVisibility(View.GONE); fabNavRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myMapView != null && myMapView.getCallout().isShowing()) { Point p = (Point) GeometryEngine.project(myMapView.getCallout().getCoordinates(), wm, egs); Util.QueryNavigation(RegEquipoActivity.this, p); } } }); fabNavRoute.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ir a Ruta", Toast.LENGTH_SHORT).show(); return true; } }); } if (modulo.replace(" ", "_").equals(modRegEquipo)) { setLayersURL(this.getResources().getString(R.string.srv_MicroMed), "SRV_MICROMED"); setLayersURL(this.getResources().getString(R.string.srv_Postes), "SRV_POSTES"); setLayersURL(this.getResources().getString(R.string.srv_Direcciones), "SRV_DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.srv_ZoneLimit), "SRV_ZONELIMIT"); addLayersToMap(credenciales, "FEATURE", "ADDMICROMED", srv_microMedida, null, true); addLayersToMap(credenciales, "FEATURE", "ADDPOSTE", srv_urlPostes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDADDRESS", srv_urlDireccion, null, true); addLayersToMap(credenciales, "FEATURE", "ADDZONELIMIT", srv_zoneLimit, null, true); myMapView.addLayer(LyAgrRegEquipo, 21); myMapView.addLayer(LyAddPoste, 22); myMapView.addLayer(LyAddDireccion, 23); myMapView.addLayer(LyRetRegEquipo, 24); arrayfaseConex = getResources().getStringArray(R.array.fase_conexion_insp); arrayWidgets = bundle.getStringArrayList("widgets"); arrayModulos = bundle.getStringArrayList("modulos"); formCrear = new Dialog(RegEquipoActivity.this); fabShowForm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { bMapTap = false; bCallOut = false; myMapView.getCallout().hide(); if (oUbicacion != null) { btnUbicacion.setColorFilter(Color.BLACK); setEnabledDialog(true); } formCrear.show(); } }); FloatingActionButton oFabAgr = (FloatingActionButton) findViewById(R.id.action_agr_equipo); oFabAgr.setIconDrawable(drawOk); oFabAgr.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { abrirFormAgr(v); } }); FloatingActionButton oFabForm = (FloatingActionButton) findViewById(R.id.action_ret_equipo); oFabForm.setIconDrawable(drawOk); oFabForm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { abrirFormRet(v); } }); /*FloatingActionButton oFabDenuncio = (FloatingActionButton) findViewById(R.id.action_denuncio); oFabDenuncio.setIconDrawable(drawNo); oFabDenuncio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //abrirFormDenuncio(v); Snackbar.make(v, "No tiene acceso a sta opcin", Snackbar.LENGTH_SHORT).show(); menuMicroActions.collapse(); } });*/ if (arrayModulos != null && arrayModulos.size() > 0 && arrayModulos.contains(empresa + "@" + modIngreso)) { arrayTipoPoste = getResources().getStringArray(R.array.tipo_poste); arrayTension = getResources().getStringArray(R.array.tipo_tension); arrayTipoEdif = getResources().getStringArray(R.array.tipo_edificacion); arrayMedidor = getResources().getStringArray(R.array.tipo_medidor); arrayEmpalme = getResources().getStringArray(R.array.tipo_empalme); arrayTecMedidor = getResources().getStringArray(R.array.tec_medidor); arrayTipoCnr = getResources().getStringArray(R.array.tipo_cnr); arrayTipoFase = getResources().getStringArray(R.array.fase_conexion); dialogCrear = new Dialog(RegEquipoActivity.this); fabShowDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bMapTap = false; bCallOut = false; myMapView.getCallout().hide(); if (oUbicacion != null) { btnUbicacion.setColorFilter(Color.BLACK); setEnabledDialog(true); } dialogCrear.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); } }); fabVerCapas.setVisibility(View.VISIBLE); fabVerCapas.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleCapas(v); } }); fabVerCapas.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Capas de Ingreso", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a); final FloatingActionButton actionB = (FloatingActionButton) findViewById(R.id.action_b); final FloatingActionButton actionC = (FloatingActionButton) findViewById(R.id.action_c); final FloatingActionButton actionD = (FloatingActionButton) findViewById(R.id.action_d); setOpcion(actionA, null); setOpcion(actionB, null); setOpcion(actionC, modIngreso + "_TECNO"); setOpcion(actionD, modIngreso + "_CNR"); setLayersURL(this.getResources().getString(R.string.srv_Clientes), "SRV_CLIENTES"); setLayersURL(this.getResources().getString(R.string.srv_Union_012), "SRV_UNIONES"); setLayersURL(din_urlTramos, "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "SRV_CALLES"); setLayersURL(this.getResources().getString(R.string.srv_ClientesCnr), "SRV_CLIENTESCNR"); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTE", srv_urlClientes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDUNION", srv_urlUnion012, null, true); addLayersToMap(credenciales, "FEATURE", "ASOCTRAMO", LyREDBT.getUrl(), null, false); addLayersToMap(credenciales, "FEATURE", "ASOCCALLE", srv_calles, null, false); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTECNR", srv_urlClientesCnr, null, true); myMapView.addLayer(LyAddCliente, 25); myMapView.addLayer(LyAddUnion, 26); myMapView.addLayer(LyAsocTramo, 27); myMapView.addLayer(LyAsocCalle, 28); myMapView.addLayer(LyAddClienteCnr, 29); setLayerAddToggle(false); } else { bIngCliente = false; menuMultipleActions.setVisibility(View.GONE); //Informar al usuario que carece de permisos para ver y usar la capa de ingreso clientes comun } } else { menuMicroActions.setVisibility(View.GONE); } }
From source file:cl.gisred.android.MicroMedidaActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LicenseResult licenseResult = ArcGISRuntime.setClientId(CLIENT_ID); LicenseLevel licenseLevel = ArcGISRuntime.License.getLicenseLevel(); if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.BASIC) { //Toast.makeText(getApplicationContext(), "Licencia bsica vlida", Toast.LENGTH_SHORT).show(); } else if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.STANDARD) { //Toast.makeText(getApplicationContext(), "Licencia standard vlida", Toast.LENGTH_SHORT).show(); }// www . j a v a 2s.c om setContentView(R.layout.activity_micro); Toolbar toolbar = (Toolbar) findViewById(R.id.apptool); setSupportActionBar(toolbar); /*Get Credenciales String*/ Bundle bundle = getIntent().getExtras(); usuar = bundle.getString("usuario"); passw = bundle.getString("password"); modulo = bundle.getString("modulo"); empresa = bundle.getString("empresa"); //Set Credenciales setCredenciales(usuar, passw); //Set Mapa setMap(R.id.map, 0xffffff, 0xffffff, 10, 10, false, true); choices = 0; if (Build.VERSION.SDK_INT >= 23) verifPermisos(); else initGeoposition(); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "MAPABASE"); setLayersURL(this.getResources().getString(R.string.url_token), "TOKENSRV"); setLayersURL(this.getResources().getString(R.string.url_EquiposLinea), "EQUIPOS_LINEA"); setLayersURL(this.getResources().getString(R.string.url_TRAMOS), "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_EquiposPTO), "EQUIPOS_PTO"); setLayersURL(this.getResources().getString(R.string.url_Nodos), "NODOS"); setLayersURL(this.getResources().getString(R.string.url_Luminarias), "LUMINARIAS"); setLayersURL(this.getResources().getString(R.string.url_Clientes), "CLIENTES"); setLayersURL(this.getResources().getString(R.string.url_Concesiones), "CONCESIONES"); setLayersURL(this.getResources().getString(R.string.url_Direcciones), "DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.url_medidores), "MEDIDORES"); setLayersURL(this.getResources().getString(R.string.url_Stx), "STX"); setLayersURL(this.getResources().getString(R.string.url_ECSE_varios), "ECSE"); setLayersURL(this.getResources().getString(R.string.url_Electrodependientes), "ELECTRODEP"); //Agrega layers dinmicos. addLayersToMap(credenciales, "DYNAMIC", "MAPABASECHQ", din_urlMapaBase, null, true); addLayersToMap(credenciales, "DYNAMIC", "SED", din_urlEquiposPunto, null, true); addLayersToMap(credenciales, "DYNAMIC", "SSEE", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SALIDAALIM", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDMT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDBT", din_urlTramos, null, true); addLayersToMap(credenciales, "DYNAMIC", "REDAP", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "POSTES", din_urlNodos, null, true); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_LINEA", din_urlEquiposLinea, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_PTO", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "LUMINARIAS", din_urlLuminarias, null, false); addLayersToMap(credenciales, "DYNAMIC", "CLIENTES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "MEDIDORES", din_urlMedidores, null, false); addLayersToMap(credenciales, "DYNAMIC", "CONCESIONES", din_urlConcesiones, null, false); addLayersToMap(credenciales, "DYNAMIC", "DIRECCIONES", din_urlDirecciones, null, false); addLayersToMap(credenciales, "DYNAMIC", "EMPALMES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "TORRESSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "ENCUESTADO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "REEMPLAZO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "ELECTRODEP", din_urlElectroDep, null, false); //Aade Layer al Mapa myMapView.addLayer(mRoadBaseMaps, 0); myMapView.addLayer(LySED, 1); myMapView.addLayer(LySSEE, 2); myMapView.addLayer(LySALIDAALIM, 3); myMapView.addLayer(LyPOSTES, 4); myMapView.addLayer(LyREDMT, 5); myMapView.addLayer(LyREDBT, 6); myMapView.addLayer(LyREDAP, 7); myMapView.addLayer(LyEQUIPOSLINEA, 8); myMapView.addLayer(LyEQUIPOSPTO, 9); myMapView.addLayer(LyLUMINARIAS, 10); myMapView.addLayer(LyCLIENTES, 11); myMapView.addLayer(LyMEDIDORES, 12); myMapView.addLayer(LyCONCESIONES, 13); myMapView.addLayer(LyDIRECCIONES, 14); myMapView.addLayer(LyEMPALMES, 15); myMapView.addLayer(LyREDSTX, 16); myMapView.addLayer(LyTORRESSTX, 17); myMapView.addLayer(LyENCUESTA, 18); myMapView.addLayer(LyREEMPLAZO, 19); myMapView.addLayer(LyELECTRODEP, 20); final FloatingActionButton btnGps = (FloatingActionButton) findViewById(R.id.action_gps); btnGps.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { alertNoGps(); } toogleGps(v); } }); btnGps.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Funcin Gps", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton btnVerData = (FloatingActionButton) findViewById(R.id.action_ver_data); btnVerData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleData(v); } }); btnVerData.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Datos", Toast.LENGTH_SHORT).show(); return true; } }); drawOk = new ShapeDrawable(new OvalShape()); drawOk.getPaint().setColor(getResources().getColor(R.color.colorPrimary)); drawNo = new ShapeDrawable(new OvalShape()); drawNo.getPaint().setColor(getResources().getColor(R.color.black_overlay)); menuMicroActions = (FloatingActionsMenu) findViewById(R.id.micro_actions); menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions); fabShowDialog = (FloatingActionButton) findViewById(R.id.action_show_dialog); if (fabShowDialog != null) fabShowDialog.setVisibility(View.GONE); fabShowForm = (FloatingActionButton) findViewById(R.id.action_show_form); if (fabShowForm != null) fabShowForm.setVisibility(View.GONE); fabVerCapas = (FloatingActionButton) findViewById(R.id.action_ver_capa); if (fabVerCapas != null) fabVerCapas.setVisibility(View.GONE); fabNavRoute = (FloatingActionButton) findViewById(R.id.action_nav_route); if (fabNavRoute != null) { fabNavRoute.setVisibility(View.GONE); fabNavRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myMapView != null && myMapView.getCallout().isShowing()) { Point p = (Point) GeometryEngine.project(myMapView.getCallout().getCoordinates(), wm, egs); Util.QueryNavigation(MicroMedidaActivity.this, p); } } }); fabNavRoute.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ir a Ruta", Toast.LENGTH_SHORT).show(); return true; } }); } if (modulo.replace(" ", "_").equals(modMicroMed)) { setLayersURL(this.getResources().getString(R.string.srv_MicroMed), "SRV_MICROMED"); setLayersURL(this.getResources().getString(R.string.srv_Postes), "SRV_POSTES"); setLayersURL(this.getResources().getString(R.string.srv_Direcciones), "SRV_DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.srv_ZoneLimit), "SRV_ZONELIMIT"); addLayersToMap(credenciales, "FEATURE", "ADDMICROMED", srv_microMedida, null, true); addLayersToMap(credenciales, "FEATURE", "ADDPOSTE", srv_urlPostes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDADDRESS", srv_urlDireccion, null, true); addLayersToMap(credenciales, "FEATURE", "ADDZONELIMIT", srv_zoneLimit, null, true); myMapView.addLayer(LyAddMicroMed, 21); myMapView.addLayer(LyAddPoste, 22); myMapView.addLayer(LyAddDireccion, 23); myMapView.addLayer(LyAddZoneLimit, 24); arrayfaseConex = getResources().getStringArray(R.array.fase_conexion_insp); arrayObservacion = getResources().getStringArray(R.array.observacion_mm); arrayMarcaMed = getResources().getStringArray(R.array.marca_mm); arrayEstado = getResources().getStringArray(R.array.estado_lectura); arrayWidgets = bundle.getStringArrayList("widgets"); arrayModulos = bundle.getStringArrayList("modulos"); formCrear = new Dialog(MicroMedidaActivity.this); fabShowForm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { bMapTap = false; bCallOut = false; myMapView.getCallout().hide(); if (oUbicacion != null) { btnUbicacion.setColorFilter(Color.BLACK); setEnabledDialog(true); } formCrear.show(); } }); FloatingActionButton oFabLimit = (FloatingActionButton) findViewById(R.id.action_limitezona); oFabLimit.setIconDrawable(drawOk); oFabLimit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { abrirFormLimite(v); } }); FloatingActionButton oFabForm = (FloatingActionButton) findViewById(R.id.action_form); oFabForm.setIconDrawable(drawOk); oFabForm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { abrirFormIngreso(v); } }); FloatingActionButton oFabDenuncio = (FloatingActionButton) findViewById(R.id.action_denuncio); oFabDenuncio.setIconDrawable(drawNo); oFabDenuncio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //abrirFormDenuncio(v); Snackbar.make(v, "No tiene acceso a sta opcin", Snackbar.LENGTH_SHORT).show(); menuMicroActions.collapse(); } }); if (arrayModulos != null && arrayModulos.size() > 0 && arrayModulos.contains(empresa + "@" + modIngreso)) { arrayTipoPoste = getResources().getStringArray(R.array.tipo_poste); arrayTension = getResources().getStringArray(R.array.tipo_tension); arrayTipoEdif = getResources().getStringArray(R.array.tipo_edificacion); arrayMedidor = getResources().getStringArray(R.array.tipo_medidor); arrayEmpalme = getResources().getStringArray(R.array.tipo_empalme); arrayTecMedidor = getResources().getStringArray(R.array.tec_medidor); arrayTipoCnr = getResources().getStringArray(R.array.tipo_cnr); arrayTipoFase = getResources().getStringArray(R.array.fase_conexion); dialogCrear = new Dialog(MicroMedidaActivity.this); fabShowDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bMapTap = false; bCallOut = false; myMapView.getCallout().hide(); if (oUbicacion != null) { btnUbicacion.setColorFilter(Color.BLACK); setEnabledDialog(true); } dialogCrear.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); } }); fabVerCapas.setVisibility(View.VISIBLE); fabVerCapas.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleCapas(v); } }); fabVerCapas.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Capas de Ingreso", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a); final FloatingActionButton actionB = (FloatingActionButton) findViewById(R.id.action_b); final FloatingActionButton actionC = (FloatingActionButton) findViewById(R.id.action_c); final FloatingActionButton actionD = (FloatingActionButton) findViewById(R.id.action_d); setOpcion(actionA, null); setOpcion(actionB, null); setOpcion(actionC, modIngreso + "_TECNO"); setOpcion(actionD, modIngreso + "_CNR"); setLayersURL(this.getResources().getString(R.string.srv_Clientes), "SRV_CLIENTES"); setLayersURL(this.getResources().getString(R.string.srv_Union_012), "SRV_UNIONES"); setLayersURL(din_urlTramos, "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "SRV_CALLES"); setLayersURL(this.getResources().getString(R.string.srv_ClientesCnr), "SRV_CLIENTESCNR"); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTE", srv_urlClientes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDUNION", srv_urlUnion012, null, true); addLayersToMap(credenciales, "FEATURE", "ASOCTRAMO", LyREDBT.getUrl(), null, false); addLayersToMap(credenciales, "FEATURE", "ASOCCALLE", srv_calles, null, false); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTECNR", srv_urlClientesCnr, null, true); myMapView.addLayer(LyAddCliente, 25); myMapView.addLayer(LyAddUnion, 26); myMapView.addLayer(LyAsocTramo, 27); myMapView.addLayer(LyAsocCalle, 28); myMapView.addLayer(LyAddClienteCnr, 29); setLayerAddToggle(false); } else { bIngCliente = false; menuMultipleActions.setVisibility(View.GONE); //Informar al usuario que carece de permisos para ver y usar la capa de ingreso clientes comun } } else { menuMicroActions.setVisibility(View.GONE); } }
From source file:cl.gisred.android.OtRouteActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LicenseResult licenseResult = ArcGISRuntime.setClientId(CLIENT_ID); LicenseLevel licenseLevel = ArcGISRuntime.License.getLicenseLevel(); if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.BASIC) { //Toast.makeText(getApplicationContext(), "Licencia bsica vlida", Toast.LENGTH_SHORT).show(); } else if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.STANDARD) { //Toast.makeText(getApplicationContext(), "Licencia standard vlida", Toast.LENGTH_SHORT).show(); }/*w ww .j a v a 2s . c o m*/ setContentView(R.layout.activity_lector); Toolbar toolbar = (Toolbar) findViewById(R.id.apptool); setSupportActionBar(toolbar); /*Get Credenciales String*/ Bundle bundle = getIntent().getExtras(); usuar = bundle.getString("usuario"); passw = bundle.getString("password"); modulo = bundle.getString("modulo"); empresa = bundle.getString("empresa"); objId = bundle.getString("objID"); sCapa = bundle.getString("typFeat"); //Set Credenciales setCredenciales(usuar, passw); //Set Mapa setMap(R.id.map, 0xffffff, 0xffffff, 10, 10, false, true); choices = 0; if (Build.VERSION.SDK_INT >= 23) verifPermisos(); else initGeoposition(); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "MAPABASE"); setLayersURL(this.getResources().getString(R.string.url_token), "TOKENSRV"); setLayersURL(this.getResources().getString(R.string.url_EquiposLinea), "EQUIPOS_LINEA"); setLayersURL(this.getResources().getString(R.string.url_TRAMOS), "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_EquiposPTO), "EQUIPOS_PTO"); setLayersURL(this.getResources().getString(R.string.url_Nodos), "NODOS"); setLayersURL(this.getResources().getString(R.string.url_Luminarias), "LUMINARIAS"); setLayersURL(this.getResources().getString(R.string.url_Clientes), "CLIENTES"); setLayersURL(this.getResources().getString(R.string.url_Concesiones), "CONCESIONES"); setLayersURL(this.getResources().getString(R.string.url_Direcciones), "DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.url_medidores), "MEDIDORES"); setLayersURL(this.getResources().getString(R.string.url_Stx), "STX"); setLayersURL(this.getResources().getString(R.string.url_ECSE_varios), "ECSE"); setLayersURL(this.getResources().getString(R.string.url_viaOpen), "OTOPEN"); setLayersURL(this.getResources().getString(R.string.url_OT), "OT"); //Agrega layers dinmicos. addLayersToMap(credenciales, "DYNAMIC", "MAPABASECHQ", din_urlMapaBase, null, true); addLayersToMap(credenciales, "DYNAMIC", "SED", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SSEE", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SALIDAALIM", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDMT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDBT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDAP", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "POSTES", din_urlNodos, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_LINEA", din_urlEquiposLinea, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_PTO", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "LUMINARIAS", din_urlLuminarias, null, false); addLayersToMap(credenciales, "DYNAMIC", "CLIENTES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "MEDIDORES", din_urlMedidores, null, false); addLayersToMap(credenciales, "DYNAMIC", "CONCESIONES", din_urlConcesiones, null, false); addLayersToMap(credenciales, "DYNAMIC", "DIRECCIONES", din_urlDirecciones, null, false); addLayersToMap(credenciales, "DYNAMIC", "EMPALMES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "TORRESSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "ENCUESTADO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "REEMPLAZO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "OTOPEN", din_urlOpen, null, true); addLayersToMap(credenciales, "DYNAMIC", "OTMICRO", din_urlOT, null, true); addLayersToMap(credenciales, "DYNAMIC", "OTDENUNCIO", din_urlOT, null, true); //Aade Layer al Mapa myMapView.addLayer(mRoadBaseMaps, 0); myMapView.addLayer(LySED, 1); myMapView.addLayer(LySSEE, 2); myMapView.addLayer(LySALIDAALIM, 3); myMapView.addLayer(LyPOSTES, 4); myMapView.addLayer(LyREDMT, 5); myMapView.addLayer(LyREDBT, 6); myMapView.addLayer(LyREDAP, 7); myMapView.addLayer(LyEQUIPOSLINEA, 8); myMapView.addLayer(LyEQUIPOSPTO, 9); myMapView.addLayer(LyLUMINARIAS, 10); myMapView.addLayer(LyCLIENTES, 11); myMapView.addLayer(LyMEDIDORES, 12); myMapView.addLayer(LyCONCESIONES, 13); myMapView.addLayer(LyDIRECCIONES, 14); myMapView.addLayer(LyEMPALMES, 15); myMapView.addLayer(LyREDSTX, 16); myMapView.addLayer(LyTORRESSTX, 17); myMapView.addLayer(LyENCUESTA, 18); myMapView.addLayer(LyREEMPLAZO, 19); myMapView.addLayer(LyOTOPEN, 20); myMapView.addLayer(LyOTMICRO, 21); myMapView.addLayer(LyOTDENUNCIO, 22); final FloatingActionButton btnGps = (FloatingActionButton) findViewById(R.id.action_gps); btnGps.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { alertNoGps(); } toogleGps(v); } }); btnGps.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Funcin Gps", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton btnVerData = (FloatingActionButton) findViewById(R.id.action_ver_data); btnVerData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleData(v); } }); btnVerData.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Datos", Toast.LENGTH_SHORT).show(); return true; } }); drawOk = new ShapeDrawable(new OvalShape()); drawOk.getPaint().setColor(getResources().getColor(R.color.colorPrimary)); drawNo = new ShapeDrawable(new OvalShape()); drawNo.getPaint().setColor(getResources().getColor(R.color.black_overlay)); menuLectorActions = (FloatingActionsMenu) findViewById(R.id.lector_actions); menuLectorActions.setVisibility(View.GONE); menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions); fabShowDialog = (FloatingActionButton) findViewById(R.id.action_show_dialog); if (fabShowDialog != null) fabShowDialog.setVisibility(View.GONE); fabShowForm = (FloatingActionButton) findViewById(R.id.action_show_form); if (fabShowForm != null) fabShowForm.setVisibility(View.GONE); fabVerCapas = (FloatingActionButton) findViewById(R.id.action_ver_capa); if (fabVerCapas != null) fabVerCapas.setVisibility(View.GONE); fabNavRoute = (FloatingActionButton) findViewById(R.id.action_nav_route); if (fabNavRoute != null) { fabNavRoute.setVisibility(View.GONE); fabNavRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myMapView != null && myMapView.getCallout().isShowing()) { Point p = (Point) GeometryEngine.project(myMapView.getCallout().getCoordinates(), wm, egs); Util.QueryNavigation(OtRouteActivity.this, p); } } }); fabNavRoute.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ir a Ruta", Toast.LENGTH_SHORT).show(); return true; } }); } setLayersURL(this.getResources().getString(R.string.srv_micromed_OT), "SRV_OTMICRO"); setLayersURL(this.getResources().getString(R.string.srv_viaopen_OT), "SRV_OTOPEN"); setLayersURL(this.getResources().getString(R.string.srv_denuncio_OT), "SRV_OTDENUNCIO"); setLayersURL(this.getResources().getString(R.string.srv_denuncio_web_OT), "SRV_OTWEBDENUNCIO"); setLayersURL(this.getResources().getString(R.string.srv_Postes), "SRV_POSTES"); setLayersURL(this.getResources().getString(R.string.srv_Direcciones), "SRV_DIRECCIONES"); addLayersToMap(credenciales, "FEATURE", "ADDOTMICRO", srv_otMicro, null, false); addLayersToMap(credenciales, "FEATURE", "ADDOTOPEN", srv_otOpen, null, false); addLayersToMap(credenciales, "FEATURE", "ADDOTDENUNCIO", srv_otDenuncio, null, false); addLayersToMap(credenciales, "FEATURE", "ADDOTWEBDENUNCIO", srv_otWebDenuncio, null, false); addLayersToMap(credenciales, "FEATURE", "ADDPOSTE", srv_urlPostes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDADDRESS", srv_urlDireccion, null, true); myMapView.addLayer(LyAddMicroOt, 23); myMapView.addLayer(LyAddOpenOt, 24); myMapView.addLayer(LyAddDenuncioOt, 25); myMapView.addLayer(LyAddWebDenuncioOt, 26); myMapView.addLayer(LyAddPoste, 27); myMapView.addLayer(LyAddDireccion, 28); arrayTipoEdif = getResources().getStringArray(R.array.tipo_edificacion); arrayEstado = getResources().getStringArray(R.array.estado_lectura); arrayUserCosenza = getResources().getStringArray(R.array.user_cosenza); arrayWidgets = bundle.getStringArrayList("widgets"); arrayModulos = bundle.getStringArrayList("modulos"); if (arrayModulos != null && arrayModulos.size() > 0 && arrayModulos.contains(empresa + "@" + modIngreso)) { arrayTipoPoste = getResources().getStringArray(R.array.tipo_poste); arrayTension = getResources().getStringArray(R.array.tipo_tension); arrayTipoEdif = getResources().getStringArray(R.array.tipo_edificacion); arrayMedidor = getResources().getStringArray(R.array.tipo_medidor); arrayEmpalme = getResources().getStringArray(R.array.tipo_empalme); arrayTecMedidor = getResources().getStringArray(R.array.tec_medidor); arrayTipoCnr = getResources().getStringArray(R.array.tipo_cnr); arrayTipoFase = getResources().getStringArray(R.array.fase_conexion); dialogCrear = new Dialog(OtRouteActivity.this); fabShowDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bMapTap = false; bCallOut = false; myMapView.getCallout().hide(); //TODO Restringir datos dialog if (oUbicacion != null) { btnUbicacion.setColorFilter(Color.BLACK); setEnabledDialog(true); } dialogCrear.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); } }); fabVerCapas.setVisibility(View.VISIBLE); fabVerCapas.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleCapas(v); } }); fabVerCapas.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Capas de Ingreso", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a); final FloatingActionButton actionB = (FloatingActionButton) findViewById(R.id.action_b); final FloatingActionButton actionC = (FloatingActionButton) findViewById(R.id.action_c); final FloatingActionButton actionD = (FloatingActionButton) findViewById(R.id.action_d); setOpcion(actionA, null); setOpcion(actionB, null); setOpcion(actionC, modIngreso + "_TECNO"); setOpcion(actionD, modIngreso + "_CNR"); setLayersURL(this.getResources().getString(R.string.srv_Clientes), "SRV_CLIENTES"); setLayersURL(this.getResources().getString(R.string.srv_Union_012), "SRV_UNIONES"); setLayersURL(din_urlTramos, "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "SRV_CALLES"); setLayersURL(this.getResources().getString(R.string.srv_ClientesCnr), "SRV_CLIENTESCNR"); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTE", srv_urlClientes, null, true); addLayersToMap(credenciales, "FEATURE", "ADDUNION", srv_urlUnion012, null, true); addLayersToMap(credenciales, "FEATURE", "ASOCTRAMO", LyREDBT.getUrl(), null, false); addLayersToMap(credenciales, "FEATURE", "ASOCCALLE", srv_calles, null, false); addLayersToMap(credenciales, "FEATURE", "ADDCLIENTECNR", srv_urlClientesCnr, null, true); myMapView.addLayer(LyAddCliente, 29); myMapView.addLayer(LyAddUnion, 30); myMapView.addLayer(LyAsocTramo, 31); myMapView.addLayer(LyAsocCalle, 32); myMapView.addLayer(LyAddClienteCnr, 33); setLayerAddToggle(false); } else { bIngCliente = false; menuMultipleActions.setVisibility(View.GONE); //Informar al usuario que carece de permisos para ver y usar la capa de ingreso clientes comun } getUbicacionLectura(objId); }