Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

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

Prototype

int BLACK

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

Click Source Link

Usage

From source file:com.aujur.ebookreader.Configuration.java

public int getTextColor() {
    return getProfileSetting(KEY_TEXT, Color.BLACK, Color.GRAY);
}

From source file:com.example.android.contactslist.ui.eventEntry.EventEntryFragment.java

private boolean completenessCheck() {

    boolean complete = true;
    String address = mAddressViewButton.getText().toString();

    mEventTypeTitle.setTextColor(Color.BLACK);
    mAddressTitle.setTextColor(Color.BLACK);
    mWordCountTitle.setTextColor(Color.BLACK);
    mEventDurationTitle.setTextColor(Color.BLACK);

    if (!mIncomingButton.isChecked() && !mOutgoingButton.isChecked()) {
        mEventTypeTitle.setTextColor(Color.RED);
        complete = false;// w w  w.j av  a  2s . c  o  m
    }

    // the simplest of checks for address completeness
    if (address.equals("") || address.equals(" ")) {
        mAddressTitle.setTextColor(Color.RED);
        complete = false;
    }

    if (eventClassIsText(mEventClass)) {
        if (mWordCount < 1) {
            mWordCountTitle.setTextColor(Color.RED);
            complete = false;

        }
    } else {

        //This test is innefectual.
        //TODO figure out a better duration test
        if (!mDurationViewIsDirty) {
            mEventDurationTitle.setTextColor(Color.RED);
            complete = false;

        }
    }

    return complete;
}

From source file:cl.gisred.android.MantCatastroActivity.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 a2  s  .co  m

    setContentView(R.layout.activity_mant_catastro);

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

    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(MantCatastroActivity.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(modMantenimiento)) {

        setLayersURL(this.getResources().getString(R.string.srv_MantCatastro), "SRV_MANT_CATASTRO");
        setLayersURL(this.getResources().getString(R.string.srv_Postes), "SRV_POSTES");
        setLayersURL(this.getResources().getString(R.string.srv_Direcciones), "SRV_DIRECCIONES");

        addLayersToMap(credenciales, "FEATURE", "ADDMANTCATASTRO", srv_mantCatastro, null, true);
        addLayersToMap(credenciales, "FEATURE", "ADDPOSTE", srv_urlPostes, null, true);
        addLayersToMap(credenciales, "FEATURE", "ADDADDRESS", srv_urlDireccion, null, true);

        myMapView.addLayer(LyAddMantCatastro, 21);
        myMapView.addLayer(LyAddPoste, 22);
        myMapView.addLayer(LyAddDireccion, 23);

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

        formMant = new Dialog(MantCatastroActivity.this);
        fabShowForm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                bMapTap = false;
                bCallOut = false;
                myMapView.getCallout().hide();
                formMant.show();
            }
        });

        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(MantCatastroActivity.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, 24);
            myMapView.addLayer(LyAddUnion, 25);
            myMapView.addLayer(LyAsocTramo, 26);
            myMapView.addLayer(LyAsocCalle, 27);
            myMapView.addLayer(LyAddClienteCnr, 28);

            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
        }
    }
}

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();
    }/*  ww  w.j ava 2  s  .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);
}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

public static void UIAlertLicense(String title, String html, final Activity activity) {

    AlertDialog alertDialog;/* w w  w  . j  a  va 2 s  . co  m*/
    alertDialog = new AlertDialog.Builder(activity).create();
    alertDialog.setTitle(title);
    WebView webview = new WebView(activity);
    webview.setBackgroundColor(Color.BLACK);
    webview.loadData("<font color=\"FFFFFF\">" + html + " </font>", "text/html", "UTF-8");
    alertDialog.setView(webview);

    alertDialog.setButton("I Acknowledge", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            if (isFirstLaunch()) {
                install();
                onHelp();
                onChangeLog();
            }
            setFirstLaunch();
            return;
        }
    });
    alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            if (isFirstLaunch()) {
                if (activity.getParent() != null) {
                    activity.getParent().finish();
                } else {
                    activity.finish();
                }
            }
        }
    });
    alertDialog.show();
}

From source file:com.esri.arcgisruntime.sample.findplace.MainActivity.java

/**
 * Identifies the Graphic at the tapped point. Gets attribute of that Graphic and assigns it to a Callout, which is
 * then displayed./*from w w  w.  j  a  v  a 2 s .c  o  m*/
 *
 * @param motionEvent from onSingleTapConfirmed
 */
private void showCallout(MotionEvent motionEvent) {
    // get the screen point
    android.graphics.Point screenPoint = new android.graphics.Point(Math.round(motionEvent.getX()),
            Math.round(motionEvent.getY()));
    // convert to map point
    final Point mapPoint = mMapView.screenToLocation(screenPoint);
    // from the graphics overlay, get graphics near the tapped location
    final ListenableFuture<IdentifyGraphicsOverlayResult> identifyResultsFuture = mMapView
            .identifyGraphicsOverlayAsync(mGraphicsOverlay, screenPoint, 10, false);
    identifyResultsFuture.addDoneListener(new Runnable() {
        @Override
        public void run() {
            try {
                IdentifyGraphicsOverlayResult identifyGraphicsOverlayResult = identifyResultsFuture.get();
                List<Graphic> graphics = identifyGraphicsOverlayResult.getGraphics();
                // if a graphic has been identified
                if (graphics.size() > 0) {
                    //get the first graphic identified
                    Graphic identifiedGraphic = graphics.get(0);
                    // create a TextView for the Callout
                    TextView calloutContent = new TextView(getApplicationContext());
                    calloutContent.setTextColor(Color.BLACK);
                    // set the text of the Callout to graphic's attributes
                    calloutContent.setText(identifiedGraphic.getAttributes().get("PlaceName").toString() + "\n"
                            + identifiedGraphic.getAttributes().get("StAddr").toString());
                    // get Callout and set its options: animateCallout: true, recenterMap: false, animateRecenter: false
                    mCallout = mMapView.getCallout();
                    mCallout.setShowOptions(new Callout.ShowOptions(true, false, false));
                    // set the leader position and show the callout
                    mCallout.setLocation(identifiedGraphic.computeCalloutLocation(mapPoint, mMapView));
                    mCallout.setContent(calloutContent);
                    mCallout.show();
                } else {
                    mCallout.dismiss();
                }
            } catch (Exception e) {
                Log.e(TAG, "Identify error: " + e.getMessage());
            }
        }
    });
}

From source file:com.connectsdk.service.CastService.java

private void playMedia(final com.google.android.gms.cast.MediaInfo mediaInformation, final String mediaAppId,
        final LaunchListener listener) {
    final ApplicationConnectionResultCallback webAppLaunchCallback = new ApplicationConnectionResultCallback(
            new LaunchWebAppListener() {

                @Override/*from w  w w.  j a va 2s.  c o  m*/
                public void onSuccess(final WebAppSession webAppSession) {
                    ConnectionListener connectionListener = new ConnectionListener() {

                        @Override
                        public void onConnected() {
                            try {
                                mMediaPlayer.load(mApiClient, mediaInformation, true).setResultCallback(
                                        new ResultCallback<RemoteMediaPlayer.MediaChannelResult>() {

                                            @Override
                                            public void onResult(MediaChannelResult result) {
                                                Status status = result.getStatus();

                                                if (status.isSuccess()) {
                                                    webAppSession.launchSession
                                                            .setSessionType(LaunchSessionType.Media);

                                                    // White text, black outline, no background
                                                    TextTrackStyle textTrackStyle = new TextTrackStyle();
                                                    textTrackStyle
                                                            .setForegroundColor(Color.parseColor("#FFFFFFFF"));
                                                    textTrackStyle
                                                            .setBackgroundColor(Color.parseColor("#01000000"));
                                                    textTrackStyle
                                                            .setWindowType(TextTrackStyle.WINDOW_TYPE_NONE);
                                                    textTrackStyle
                                                            .setEdgeType(TextTrackStyle.EDGE_TYPE_OUTLINE);
                                                    textTrackStyle.setEdgeColor(Color.BLACK);
                                                    textTrackStyle.setFontGenericFamily(
                                                            TextTrackStyle.FONT_FAMILY_SANS_SERIF);

                                                    mMediaPlayer.setTextTrackStyle(mApiClient, textTrackStyle);
                                                    mMediaPlayer.setActiveMediaTracks(mApiClient,
                                                            new long[] { 1 });

                                                    Util.postSuccess(listener, new MediaLaunchObject(
                                                            webAppSession.launchSession, CastService.this));
                                                } else {
                                                    Util.postError(listener,
                                                            new ServiceCommandError(status.getStatusCode(),
                                                                    status.getStatusMessage(), status));
                                                }
                                            }
                                        });
                            } catch (Exception e) {
                                Util.postError(listener, new ServiceCommandError(0, "Unable to load", null));
                            }
                        }
                    };

                    runCommand(connectionListener);
                }

                @Override
                public void onFailure(ServiceCommandError error) {
                    Util.postError(listener, error);
                }
            });

    launchingAppId = mediaAppId;

    ConnectionListener connectionListener = new ConnectionListener() {

        @Override
        public void onConnected() {
            boolean relaunchIfRunning = false;

            try {
                if (Cast.CastApi.getApplicationStatus(mApiClient) == null
                        || (!mediaAppId.equals(currentAppId))) {
                    relaunchIfRunning = true;
                }

                LaunchOptions options = new LaunchOptions();
                options.setRelaunchIfRunning(relaunchIfRunning);
                Cast.CastApi.launchApplication(mApiClient, mediaAppId, options)
                        .setResultCallback(webAppLaunchCallback);
            } catch (Exception e) {
                Util.postError(listener, new ServiceCommandError(0, "Unable to launch", null));
            }
        }
    };

    runCommand(connectionListener);
}

From source file:com.googlemapapp.MainActivity.java

/**
 * This sample hard codes geofence data. A real app might dynamically create geofences based on
 * the user's location./*  ww  w  .j  a v a 2s .co  m*/
 */
public void populateGeofenceList() {
    for (Map.Entry<String, LatLng> entry : Constants.BAY_AREA_LANDMARKS.entrySet()) {

        mGeofenceList.add(new Geofence.Builder()
                // Set the request ID of the geofence. This is a string to identify this
                // geofence.
                .setRequestId(entry.getKey())

                // Set the circular region of this geofence.
                .setCircularRegion(entry.getValue().latitude, entry.getValue().longitude,
                        Constants.GEOFENCE_RADIUS_IN_METERS)

                // Set the expiration duration of the geofence. This geofence gets automatically
                // removed after this period of time.
                .setExpirationDuration(Constants.GEOFENCE_EXPIRATION_IN_MILLISECONDS)

                // Set the transition types of interest. Alerts are only generated for these
                // transition. We track entry and exit transitions in this sample.
                .setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT)

                // Create the geofence.
                .build());

        LatLng sydney = new LatLng(entry.getValue().latitude, entry.getValue().longitude);
        mMap.addMarker(new MarkerOptions().position(sydney).title(entry.getKey()));
        mMap.addCircle(new CircleOptions().center(sydney).radius(Constants.GEOFENCE_RADIUS_IN_METERS)
                .strokeColor(Color.BLACK).fillColor(getResources().getColor(R.color.trnsprnt_black)));
    }
}

From source file:com.dl2974.andgeofencedetection.MainActivity.java

/**
 * Check all the input values and flag those that are incorrect
 * @return true if all the widget values are correct; otherwise false
 *///  www .jav  a  2s  .com
private boolean checkInputFields() {
    // Start with the input validity flag set to true
    boolean inputOK = true;

    /*
     * Latitude, longitude, and radius values can't be empty. If they are, highlight the input
     * field in red and put a Toast message in the UI. Otherwise set the input field highlight
     * to black, ensuring that a field that was formerly wrong is reset.
     */
    if (TextUtils.isEmpty(mLatitude1.getText())) {
        mLatitude1.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        mLatitude1.setBackgroundColor(Color.BLACK);
    }

    if (TextUtils.isEmpty(mLongitude1.getText())) {
        mLongitude1.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        mLongitude1.setBackgroundColor(Color.BLACK);
    }
    if (TextUtils.isEmpty(mRadius1.getText())) {
        mRadius1.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        mRadius1.setBackgroundColor(Color.BLACK);
    }

    if (TextUtils.isEmpty(mLatitude2.getText())) {
        mLatitude2.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        mLatitude2.setBackgroundColor(Color.BLACK);
    }
    if (TextUtils.isEmpty(mLongitude2.getText())) {
        mLongitude2.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        mLongitude2.setBackgroundColor(Color.BLACK);
    }
    if (TextUtils.isEmpty(mRadius2.getText())) {
        mRadius2.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        mRadius2.setBackgroundColor(Color.BLACK);
    }

    /*
     * If all the input fields have been entered, test to ensure that their values are within
     * the acceptable range. The tests can't be performed until it's confirmed that there are
     * actual values in the fields.
     */
    if (inputOK) {

        /*
         * Get values from the latitude, longitude, and radius fields.
         */
        double lat1 = Double.valueOf(mLatitude1.getText().toString());
        double lng1 = Double.valueOf(mLongitude1.getText().toString());
        double lat2 = Double.valueOf(mLatitude1.getText().toString());
        double lng2 = Double.valueOf(mLongitude1.getText().toString());
        float rd1 = Float.valueOf(mRadius1.getText().toString());
        float rd2 = Float.valueOf(mRadius2.getText().toString());

        /*
         * Test latitude and longitude for minimum and maximum values. Highlight incorrect
         * values and set a Toast in the UI.
         */

        if (lat1 > GeofenceUtils.MAX_LATITUDE || lat1 < GeofenceUtils.MIN_LATITUDE) {
            mLatitude1.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_latitude_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            mLatitude1.setBackgroundColor(Color.BLACK);
        }

        if ((lng1 > GeofenceUtils.MAX_LONGITUDE) || (lng1 < GeofenceUtils.MIN_LONGITUDE)) {
            mLongitude1.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_longitude_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            mLongitude1.setBackgroundColor(Color.BLACK);
        }

        if (lat2 > GeofenceUtils.MAX_LATITUDE || lat2 < GeofenceUtils.MIN_LATITUDE) {
            mLatitude2.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_latitude_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            mLatitude2.setBackgroundColor(Color.BLACK);
        }

        if ((lng2 > GeofenceUtils.MAX_LONGITUDE) || (lng2 < GeofenceUtils.MIN_LONGITUDE)) {
            mLongitude2.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_longitude_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            mLongitude2.setBackgroundColor(Color.BLACK);
        }
        if (rd1 < GeofenceUtils.MIN_RADIUS) {
            mRadius1.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_radius_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            mRadius1.setBackgroundColor(Color.BLACK);
        }
        if (rd2 < GeofenceUtils.MIN_RADIUS) {
            mRadius2.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_radius_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            mRadius2.setBackgroundColor(Color.BLACK);
        }
    }

    // If everything passes, the validity flag will still be true, otherwise it will be false.
    return inputOK;
}

From source file:ch.bfh.fbi.mobicomp.geofence.MainActivity.java

/**
 * Check all the input values and flag those that are incorrect
 * @return true if all the widget values are correct; otherwise false
 *//*from  w  w  w.  j a  va2 s . c o  m*/
private boolean checkInputFields() {
    // Start with the input validity flag set to true
    boolean inputOK = true;

    /*
     * Latitude, longitude, and radius values can't be empty. If they are, highlight the input
     * field in red and put a Toast message in the UI. Otherwise set the input field highlight
     * to black, ensuring that a field that was formerly wrong is reset.
     */
    if (TextUtils.isEmpty(latitude1.getText())) {
        latitude1.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        latitude1.setBackgroundColor(Color.BLACK);
    }

    if (TextUtils.isEmpty(longitude1.getText())) {
        longitude1.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        longitude1.setBackgroundColor(Color.BLACK);
    }
    if (TextUtils.isEmpty(radius1.getText())) {
        radius1.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        radius1.setBackgroundColor(Color.BLACK);
    }

    if (TextUtils.isEmpty(latitude2.getText())) {
        latitude2.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        latitude2.setBackgroundColor(Color.BLACK);
    }
    if (TextUtils.isEmpty(longitude2.getText())) {
        longitude2.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        longitude2.setBackgroundColor(Color.BLACK);
    }
    if (TextUtils.isEmpty(radius2.getText())) {
        radius2.setBackgroundColor(Color.RED);
        Toast.makeText(this, R.string.geofence_input_error_missing, Toast.LENGTH_LONG).show();

        // Set the validity to "invalid" (false)
        inputOK = false;
    } else {

        radius2.setBackgroundColor(Color.BLACK);
    }

    /*
     * If all the input fields have been entered, test to ensure that their values are within
     * the acceptable range. The tests can't be performed until it's confirmed that there are
     * actual values in the fields.
     */
    if (inputOK) {

        /*
         * Get values from the latitude, longitude, and radius fields.
         */
        double lat1 = Double.valueOf(latitude1.getText().toString());
        double lng1 = Double.valueOf(longitude1.getText().toString());
        double lat2 = Double.valueOf(latitude1.getText().toString());
        double lng2 = Double.valueOf(longitude1.getText().toString());
        float rd1 = Float.valueOf(radius1.getText().toString());
        float rd2 = Float.valueOf(radius2.getText().toString());

        /*
         * Test latitude and longitude for minimum and maximum values. Highlight incorrect
         * values and set a Toast in the UI.
         */

        if (lat1 > GeofenceUtils.MAX_LATITUDE || lat1 < GeofenceUtils.MIN_LATITUDE) {
            latitude1.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_latitude_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            latitude1.setBackgroundColor(Color.BLACK);
        }

        if ((lng1 > GeofenceUtils.MAX_LONGITUDE) || (lng1 < GeofenceUtils.MIN_LONGITUDE)) {
            longitude1.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_longitude_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            longitude1.setBackgroundColor(Color.BLACK);
        }

        if (lat2 > GeofenceUtils.MAX_LATITUDE || lat2 < GeofenceUtils.MIN_LATITUDE) {
            latitude2.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_latitude_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            latitude2.setBackgroundColor(Color.BLACK);
        }

        if ((lng2 > GeofenceUtils.MAX_LONGITUDE) || (lng2 < GeofenceUtils.MIN_LONGITUDE)) {
            longitude2.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_longitude_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            longitude2.setBackgroundColor(Color.BLACK);
        }
        if (rd1 < GeofenceUtils.MIN_RADIUS) {
            radius1.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_radius_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            radius1.setBackgroundColor(Color.BLACK);
        }
        if (rd2 < GeofenceUtils.MIN_RADIUS) {
            radius2.setBackgroundColor(Color.RED);
            Toast.makeText(this, R.string.geofence_input_error_radius_invalid, Toast.LENGTH_LONG).show();

            // Set the validity to "invalid" (false)
            inputOK = false;
        } else {

            radius2.setBackgroundColor(Color.BLACK);
        }
    }

    // If everything passes, the validity flag will still be true, otherwise it will be false.
    return inputOK;
}