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.max2idea.android.limbo.main.LimboActivity.java

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

    AlertDialog alertDialog;/*from  w  w w. j a va  2s. c om*/
    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("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            return;
        }
    });
    alertDialog.show();
}

From source file:com.example.drugsformarinemammals.Dose_Information.java

public TextView createInformationTextView() {
    TextView information_textview = new TextView(this);
    information_textview.setTextColor(Color.BLACK);
    information_textview.setTextSize(16);
    information_textview.setTypeface(Typeface.SANS_SERIF);
    return information_textview;
}

From source file:com.dngames.mobilewebcam.PhotoSettings.java

@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
    if (key == "cam_refresh") {
        int new_refresh = getEditInt(mContext, prefs, "cam_refresh", 60);
        String msg = "Camera refresh set to " + new_refresh + " seconds!";
        if (MobileWebCam.gIsRunning) {
            if (!mNoToasts && new_refresh != mRefreshDuration) {
                try {
                    Toast.makeText(mContext.getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
                } catch (RuntimeException e) {
                    e.printStackTrace();
                }//  w  ww  .j  a  v  a 2  s. co m
            }
        } else if (new_refresh != mRefreshDuration) {
            MobileWebCam.LogI(msg);
        }
    }

    // get all preferences
    for (Field f : getClass().getFields()) {
        {
            BooleanPref bp = f.getAnnotation(BooleanPref.class);
            if (bp != null) {
                try {
                    f.setBoolean(this, prefs.getBoolean(bp.key(), bp.val()));
                } catch (Exception e) {
                    Log.e("MobileWebCam", "Exception: " + bp.key() + " <- " + bp.val());
                    e.printStackTrace();
                }
            }
        }
        {
            EditIntPref ip = f.getAnnotation(EditIntPref.class);
            if (ip != null) {
                try {
                    int eval = getEditInt(mContext, prefs, ip.key(), ip.val()) * ip.factor();
                    if (ip.max() != Integer.MAX_VALUE)
                        eval = Math.min(eval, ip.max());
                    if (ip.min() != Integer.MIN_VALUE)
                        eval = Math.max(eval, ip.min());
                    f.setInt(this, eval);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        {
            IntPref ip = f.getAnnotation(IntPref.class);
            if (ip != null) {
                try {
                    int eval = prefs.getInt(ip.key(), ip.val()) * ip.factor();
                    if (ip.max() != Integer.MAX_VALUE)
                        eval = Math.min(eval, ip.max());
                    if (ip.min() != Integer.MIN_VALUE)
                        eval = Math.max(eval, ip.min());
                    f.setInt(this, eval);
                } catch (Exception e) {
                    // handle wrong set class
                    e.printStackTrace();
                    Editor edit = prefs.edit();
                    edit.remove(ip.key());
                    edit.putInt(ip.key(), ip.val());
                    edit.commit();
                    try {
                        f.setInt(this, ip.val());
                    } catch (IllegalArgumentException e1) {
                        e1.printStackTrace();
                    } catch (IllegalAccessException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        }
        {
            EditFloatPref fp = f.getAnnotation(EditFloatPref.class);
            if (fp != null) {
                try {
                    float eval = getEditFloat(mContext, prefs, fp.key(), fp.val());
                    if (fp.max() != Float.MAX_VALUE)
                        eval = Math.min(eval, fp.max());
                    if (fp.min() != Float.MIN_VALUE)
                        eval = Math.max(eval, fp.min());
                    f.setFloat(this, eval);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        {
            StringPref sp = f.getAnnotation(StringPref.class);
            if (sp != null) {
                try {
                    f.set(this, prefs.getString(sp.key(), getDefaultString(mContext, sp)));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }

    mCustomImageScale = Enum.valueOf(ImageScaleMode.class, prefs.getString("custompicscale", "CROP"));

    mAutoStart = prefs.getBoolean("autostart", false);
    mCameraStartupEnabled = prefs.getBoolean("cam_autostart", true);
    mShutterSound = prefs.getBoolean("shutter", true);
    mDateTimeColor = GetPrefColor(prefs, "datetime_color", "#FFFFFFFF", Color.WHITE);
    mDateTimeShadowColor = GetPrefColor(prefs, "datetime_shadowcolor", "#FF000000", Color.BLACK);
    mDateTimeBackgroundColor = GetPrefColor(prefs, "datetime_backcolor", "#80FF0000",
            Color.argb(0x80, 0xFF, 0x00, 0x00));
    mDateTimeBackgroundLine = prefs.getBoolean("datetime_fillline", true);
    mDateTimeX = prefs.getInt("datetime_x", 98);
    mDateTimeY = prefs.getInt("datetime_y", 98);
    mDateTimeAlign = Paint.Align.valueOf(prefs.getString("datetime_imprintalign", "RIGHT"));

    mDateTimeFontScale = (float) prefs.getInt("datetime_fontsize", 6);

    mTextColor = GetPrefColor(prefs, "text_color", "#FFFFFFFF", Color.WHITE);
    mTextShadowColor = GetPrefColor(prefs, "text_shadowcolor", "#FF000000", Color.BLACK);
    mTextBackgroundColor = GetPrefColor(prefs, "text_backcolor", "#80FF0000",
            Color.argb(0x80, 0xFF, 0x00, 0x00));
    mTextBackgroundLine = prefs.getBoolean("text_fillline", true);
    mTextX = prefs.getInt("text_x", 2);
    mTextY = prefs.getInt("text_y", 2);
    mTextAlign = Paint.Align.valueOf(prefs.getString("text_imprintalign", "LEFT"));
    mTextFontScale = (float) prefs.getInt("infotext_fontsize", 6);
    mTextFontname = prefs.getString("infotext_fonttypeface", "");

    mStatusInfoColor = GetPrefColor(prefs, "statusinfo_color", "#FFFFFFFF", Color.WHITE);
    mStatusInfoShadowColor = GetPrefColor(prefs, "statusinfo_shadowcolor", "#FF000000", Color.BLACK);
    mStatusInfoX = prefs.getInt("statusinfo_x", 2);
    mStatusInfoY = prefs.getInt("statusinfo_y", 98);
    mStatusInfoAlign = Paint.Align.valueOf(prefs.getString("statusinfo_imprintalign", "LEFT"));
    mStatusInfoBackgroundColor = GetPrefColor(prefs, "statusinfo_backcolor", "#00000000", Color.TRANSPARENT);
    mStatusInfoFontScale = (float) prefs.getInt("statusinfo_fontsize", 6);
    mStatusInfoBackgroundLine = prefs.getBoolean("statusinfo_fillline", false);

    mGPSColor = GetPrefColor(prefs, "gps_color", "#FFFFFFFF", Color.WHITE);
    mGPSShadowColor = GetPrefColor(prefs, "gps_shadowcolor", "#FF000000", Color.BLACK);
    mGPSX = prefs.getInt("gps_x", 98);
    mGPSY = prefs.getInt("gps_y", 2);
    mGPSAlign = Paint.Align.valueOf(prefs.getString("gps_imprintalign", "RIGHT"));
    mGPSBackgroundColor = GetPrefColor(prefs, "gps_backcolor", "#00000000", Color.TRANSPARENT);
    mGPSFontScale = (float) prefs.getInt("gps_fontsize", 6);
    mGPSBackgroundLine = prefs.getBoolean("gps_fillline", false);

    mImprintPictureX = prefs.getInt("imprint_picture_x", 0);
    mImprintPictureY = prefs.getInt("imprint_picture_y", 0);

    mNightAutoConfigEnabled = prefs.getBoolean("night_auto_enabled", false);

    mSetNightConfiguration = prefs.getBoolean("cam_nightconfiguration", false);
    // override night camera parameters (read again with postfix)
    getCurrentNightSettings();

    mFilterPicture = false; //***prefs.getBoolean("filter_picture", false);
    mFilterType = getEditInt(mContext, prefs, "filter_sel", 0);

    if (mImprintPicture) {
        if (mImprintPictureURL.length() == 0) {
            // sdcard image
            File path = new File(Environment.getExternalStorageDirectory() + "/MobileWebCam/");
            if (path.exists()) {
                synchronized (gImprintBitmapLock) {
                    if (gImprintBitmap != null)
                        gImprintBitmap.recycle();
                    gImprintBitmap = null;

                    File file = new File(path, "imprint.png");
                    try {
                        FileInputStream in = new FileInputStream(file);
                        gImprintBitmap = BitmapFactory.decodeStream(in);
                        in.close();
                    } catch (IOException e) {
                        Toast.makeText(mContext, "Error: unable to read imprint bitmap " + file.getName() + "!",
                                Toast.LENGTH_SHORT).show();
                        gImprintBitmap = null;
                    } catch (OutOfMemoryError e) {
                        Toast.makeText(mContext, "Error: imprint bitmap " + file.getName() + " too large!",
                                Toast.LENGTH_LONG).show();
                        gImprintBitmap = null;
                    }
                }
            }
        } else {
            DownloadImprintBitmap();
        }

        synchronized (gImprintBitmapLock) {
            if (gImprintBitmap == null) {
                // last resort: resource default
                try {
                    gImprintBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.imprint);
                } catch (OutOfMemoryError e) {
                    Toast.makeText(mContext, "Error: default imprint bitmap too large!", Toast.LENGTH_LONG)
                            .show();
                    gImprintBitmap = null;
                }
            }
        }
    }

    mNoToasts = prefs.getBoolean("no_messages", false);
    mFullWakeLock = prefs.getBoolean("full_wakelock", true);

    switch (getEditInt(mContext, prefs, "camera_mode", 1)) {
    case 0:
        mMode = Mode.MANUAL;
        break;
    case 2:
        mMode = Mode.HIDDEN;
        break;
    case 3:
        mMode = Mode.BACKGROUND;
        break;
    case 1:
    default:
        mMode = Mode.NORMAL;
        break;
    }
}

From source file:com.here.android.example.venue.Venue3dActivity.java

private void configureSpinner(Spinner spinner, String[] listItems) {
    int spinner_item = android.R.layout.simple_spinner_item;
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, spinner_item, listItems) {
        public View getView(int position, View convertView, ViewGroup parent) {
            View v = super.getView(position, convertView, parent);
            ((TextView) v).setTextColor(Color.BLACK);
            return v;
        }//w w w . j  a  v a2  s  . com

        public View getDropDownView(int pos, View convertView, ViewGroup parent) {
            View v = super.getDropDownView(pos, convertView, parent);
            ((TextView) v).setTextSize(22);
            return v;
        }
    };
    spinner.setAdapter(adapter);
}

From source file:com.jaredrummler.android.colorpicker.ColorPickerDialog.java

private void setupTransparency() {
    int progress = 255 - Color.alpha(color);
    transparencySeekBar.setMax(255);//from   w w w.  j av  a  2 s.com
    transparencySeekBar.setProgress(progress);
    int percentage = (int) ((double) progress * 100 / 255);
    transparencyPercText.setText(String.format(Locale.ENGLISH, "%d%%", percentage));
    transparencySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            int percentage = (int) ((double) progress * 100 / 255);
            transparencyPercText.setText(String.format(Locale.ENGLISH, "%d%%", percentage));
            int alpha = 255 - progress;
            // update items in GridView:
            for (int i = 0; i < adapter.colors.length; i++) {
                int color = adapter.colors[i];
                int red = Color.red(color);
                int green = Color.green(color);
                int blue = Color.blue(color);
                adapter.colors[i] = Color.argb(alpha, red, green, blue);
            }
            adapter.notifyDataSetChanged();
            // update shades:
            for (int i = 0; i < shadesLayout.getChildCount(); i++) {
                FrameLayout layout = (FrameLayout) shadesLayout.getChildAt(i);
                ColorPanelView cpv = (ColorPanelView) layout.findViewById(R.id.cpv_color_panel_view);
                ImageView iv = (ImageView) layout.findViewById(R.id.cpv_color_image_view);
                if (layout.getTag() == null) {
                    // save the original border color
                    layout.setTag(cpv.getBorderColor());
                }
                int color = cpv.getColor();
                color = Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
                if (alpha <= ALPHA_THRESHOLD) {
                    cpv.setBorderColor(color | 0xFF000000);
                } else {
                    cpv.setBorderColor((int) layout.getTag());
                }
                if (cpv.getTag() != null && (Boolean) cpv.getTag()) {
                    // The alpha changed on the selected shaded color. Update the checkmark color filter.
                    if (alpha <= ALPHA_THRESHOLD) {
                        iv.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN);
                    } else {
                        if (ColorUtils.calculateLuminance(color) >= 0.65) {
                            iv.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN);
                        } else {
                            iv.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
                        }
                    }
                }
                cpv.setColor(color);
            }
            // update color:
            int red = Color.red(color);
            int green = Color.green(color);
            int blue = Color.blue(color);
            color = Color.argb(alpha, red, green, blue);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });
}

From source file:com.jrummyapps.android.colorpicker.ColorPickerDialog.java

private void setupTransparency() {
    int progress = 255 - Color.alpha(color);
    transparencySeekBar.setMax(255);//from  w  ww  .  j  a  va  2s. com
    transparencySeekBar.setProgress(progress);
    int percentage = (int) ((double) progress * 100 / 255);
    transparencyPercText.setText(String.format(Locale.ENGLISH, "%d%%", percentage));
    transparencySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            int percentage = (int) ((double) progress * 100 / 255);
            transparencyPercText.setText(String.format(Locale.ENGLISH, "%d%%", percentage));
            int alpha = 255 - progress;
            // update items in GridView:
            for (int i = 0; i < adapter.colors.length; i++) {
                int color = adapter.colors[i];
                int red = Color.red(color);
                int green = Color.green(color);
                int blue = Color.blue(color);
                adapter.colors[i] = Color.argb(alpha, red, green, blue);
            }
            adapter.notifyDataSetChanged();
            // update shades:
            for (int i = 0; i < shadesLayout.getChildCount(); i++) {
                FrameLayout layout = (FrameLayout) shadesLayout.getChildAt(i);
                ColorPanelView cpv = layout.findViewById(R.id.cpv_color_panel_view);
                ImageView iv = layout.findViewById(R.id.cpv_color_image_view);
                if (layout.getTag() == null) {
                    // save the original border color
                    layout.setTag(cpv.getBorderColor());
                }
                int color = cpv.getColor();
                color = Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
                if (alpha <= ALPHA_THRESHOLD) {
                    cpv.setBorderColor(color | 0xFF000000);
                } else {
                    cpv.setBorderColor((int) layout.getTag());
                }
                if (cpv.getTag() != null && (Boolean) cpv.getTag()) {
                    // The alpha changed on the selected shaded color. Update the checkmark color filter.
                    if (alpha <= ALPHA_THRESHOLD) {
                        iv.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN);
                    } else {
                        if (ColorUtils.calculateLuminance(color) >= 0.65) {
                            iv.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN);
                        } else {
                            iv.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
                        }
                    }
                }
                cpv.setColor(color);
            }
            // update color:
            int red = Color.red(color);
            int green = Color.green(color);
            int blue = Color.blue(color);
            color = Color.argb(alpha, red, green, blue);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });
}

From source file:com.example.hciproject.Camera2VideoFragment.java

public void setColor(boolean b) {
    if (b) {/*from  ww w . java 2 s .  c  om*/
        relative.setBackgroundColor(Color.RED);
        pasKala.setVisibility(View.VISIBLE);
    } else {
        relative.setBackgroundColor(Color.BLACK);
        pasKala.setVisibility(View.GONE);
    }
}

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();
    }/*from  www  . j a v a 2  s. c  o 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:com.paic.zhifu.wallet.activity.modules.boundcard.OpenPaymentConfirmActivity.java

/**
 * ?/*w w w .  j  a  v  a  2  s .  c o m*/
 */
private void checkAndChangeNextBtnState() {
    // ?????????
    if (!checkPhoneNum() || !checkLicense() || !checkSMSCode()) {
        next_btn.setBackgroundResource(R.drawable.normal_btn2);
        next_btn.setTextColor(Color.BLACK);
        next_btn.setEnabled(false);
    } else {
        next_btn.setBackgroundResource(R.drawable.normal_btn);
        next_btn.setTextColor(Color.WHITE);
        next_btn.setEnabled(true);
    }
}

From source file:com.example.drugsformarinemammals.Dose_Information.java

public void show_dose(ArrayList<Dose_Data> dose, TableLayout dose_table, TableRow dose_data, String drug_name,
        String group_name, String animal_family, String animal_name, String animal_category,
        ArrayList<String> notes, ArrayList<String> references, ArrayList<Article_Reference> references_index) {

    String doseAmount;/*from  w  w  w  . j  av a 2  s.  c  o m*/
    String dosePosology;
    String doseRoute;
    String doseBookReference;
    String doseArticleReference;
    for (int k = 0; k < dose.size(); k++) {
        if (k > 0) {
            dose_data = new TableRow(this);
        }

        doseAmount = dose.get(k).getAmount();
        dosePosology = dose.get(k).getPosology();
        doseRoute = dose.get(k).getRoute();
        doseBookReference = dose.get(k).getBookReference();
        doseArticleReference = dose.get(k).getArticleReference();

        //Dose amount data

        TextView textView_animal_dose_amount = new TextView(this);
        textView_animal_dose_amount.setText(doseAmount);
        textView_animal_dose_amount.setSingleLine(false);
        textView_animal_dose_amount.setTextColor(Color.BLACK);
        textView_animal_dose_amount.setTextSize(15);
        textView_animal_dose_amount.setTypeface(Typeface.SANS_SERIF);
        TableRow.LayoutParams paramsDoseAmount = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
                TableRow.LayoutParams.WRAP_CONTENT);
        paramsDoseAmount.gravity = Gravity.CENTER;
        dose_data.addView(textView_animal_dose_amount, paramsDoseAmount);

        //Dose posology data

        TextView textView_animal_dose_posology = new TextView(this);
        textView_animal_dose_posology.setText(dosePosology);
        textView_animal_dose_posology.setSingleLine(false);
        textView_animal_dose_posology.setTextColor(Color.BLACK);
        textView_animal_dose_posology.setTextSize(15);
        textView_animal_dose_posology.setTypeface(Typeface.SANS_SERIF);
        TableRow.LayoutParams paramsDosePosology = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
                TableRow.LayoutParams.WRAP_CONTENT);
        paramsDosePosology.gravity = Gravity.CENTER;
        if ((screenWidth < 600 && !isCollapsed(drug_name, group_name, animal_family, "Posology"))
                || screenWidth >= 600)
            dose_data.addView(textView_animal_dose_posology, paramsDosePosology);

        //Dose route data

        TextView textView_animal_dose_route = new TextView(this);
        textView_animal_dose_route.setText(doseRoute);
        textView_animal_dose_route.setSingleLine(false);
        textView_animal_dose_route.setTextColor(Color.BLACK);
        textView_animal_dose_route.setTextSize(15);
        textView_animal_dose_route.setTypeface(Typeface.SANS_SERIF);
        if (screenWidth >= 600) {
            TableRow.LayoutParams paramsDoseRoute = new TableRow.LayoutParams(
                    TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
            paramsDoseRoute.gravity = Gravity.CENTER;
            dose_data.addView(textView_animal_dose_route, paramsDoseRoute);
        } else {
            TableRow.LayoutParams paramsDoseRoute = new TableRow.LayoutParams(30,
                    TableRow.LayoutParams.WRAP_CONTENT);
            paramsDoseRoute.gravity = Gravity.CENTER;
            dose_data.addView(textView_animal_dose_route, paramsDoseRoute);
        }

        //Dose reference data

        TextView textView_animal_dose_reference = new TextView(this);
        if (!doseBookReference.equals(""))
            textView_animal_dose_reference.setText(doseBookReference);
        else if (!doseArticleReference.equals("")) {
            if (!references.contains(doseArticleReference)) {
                references.add(references.size(), doseArticleReference);
                Article_Reference article_reference = new Article_Reference(reference_index,
                        doseArticleReference);
                references_index.add(references_index.size(), article_reference);
                reference_index++;
            }
            int article_index = references.indexOf(doseArticleReference);
            textView_animal_dose_reference.setText("(" + references_index.get(article_index).getIndex() + ")");
        }
        textView_animal_dose_reference.setSingleLine(false);
        textView_animal_dose_reference.setTextColor(Color.BLACK);
        textView_animal_dose_reference.setTextSize(15);
        textView_animal_dose_reference.setTypeface(Typeface.SANS_SERIF);
        if (screenWidth >= 600) {
            TableRow.LayoutParams paramsDoseReference = new TableRow.LayoutParams(
                    TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
            paramsDoseReference.gravity = Gravity.CENTER;
            dose_data.addView(textView_animal_dose_reference, paramsDoseReference);
        } else {
            TableRow.LayoutParams paramsDoseReference = new TableRow.LayoutParams(150,
                    TableRow.LayoutParams.WRAP_CONTENT);
            paramsDoseReference.gravity = Gravity.CENTER;
            dose_data.addView(textView_animal_dose_reference, paramsDoseReference);
        }

        //Specific note index

        ArrayList<String> specific_notes = new ArrayList<String>();
        specific_notes = helper.read_specific_notes(drug_name, group_name, animal_name, animal_family,
                animal_category, doseAmount, dosePosology, doseRoute, doseBookReference, doseArticleReference);

        String index = "";
        for (int m = 0; m < specific_notes.size(); m++) {
            String note = specific_notes.get(m);
            if (!notes.contains(note)) {
                notes.add(notes.size(), note);
            }
            index += "(" + (notes.indexOf(note) + 1) + ")  ";
        }

        TextView textView_specific_note_index = new TextView(this);
        textView_specific_note_index.setText(index);
        textView_specific_note_index.setSingleLine(false);
        textView_specific_note_index.setTextColor(Color.BLACK);
        textView_specific_note_index.setTextSize(15);
        textView_specific_note_index.setTypeface(Typeface.SANS_SERIF);
        if (screenWidth >= 600 && screenWidth < 720) {
            TableRow.LayoutParams paramsSpecificNoteIndex = new TableRow.LayoutParams(150,
                    TableRow.LayoutParams.WRAP_CONTENT);
            paramsSpecificNoteIndex.gravity = Gravity.CENTER;
            dose_data.addView(textView_specific_note_index, paramsSpecificNoteIndex);
        } else if (screenWidth >= 720) {
            TableRow.LayoutParams paramsSpecificNoteIndex = new TableRow.LayoutParams(
                    TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
            paramsSpecificNoteIndex.gravity = Gravity.CENTER;
            dose_data.addView(textView_specific_note_index, paramsSpecificNoteIndex);
        } else {
            TableRow.LayoutParams paramsSpecificNoteIndex = new TableRow.LayoutParams(100,
                    TableRow.LayoutParams.WRAP_CONTENT);
            paramsSpecificNoteIndex.gravity = Gravity.CENTER;
            if ((screenWidth < 600 && !isCollapsed(drug_name, group_name, animal_family, "Note"))
                    || screenWidth >= 600)
                dose_data.addView(textView_specific_note_index, paramsSpecificNoteIndex);
        }

        dose_table.addView(dose_data);

    }
}