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.ffmpeger.card.ui.BaseNaviActivity.java

protected void onActionBarAutoShowOrHide(boolean shown) {
    if (mStatusBarColorAnimator != null) {
        mStatusBarColorAnimator.cancel();
    }//from w w w .  j  av  a  2  s . c o m
    mStatusBarColorAnimator = ObjectAnimator
            .ofInt((mDrawerLayout != null) ? mDrawerLayout : getLPreviewUtils(),
                    (mDrawerLayout != null) ? "statusBarBackgroundColor" : "statusBarColor",
                    shown ? Color.BLACK : mNormalStatusBarColor, shown ? mNormalStatusBarColor : Color.BLACK)
            .setDuration(250);
    if (mDrawerLayout != null) {
        mStatusBarColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                ViewCompat.postInvalidateOnAnimation(mDrawerLayout);
            }
        });
    }
    mStatusBarColorAnimator.setEvaluator(ARGB_EVALUATOR);
    mStatusBarColorAnimator.start();

    for (View view : mHideableHeaderViews) {
        if (shown) {
            view.animate().translationY(0).alpha(1).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        } else {
            view.animate().translationY(-view.getBottom()).alpha(0).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        }
    }
}

From source file:com.p3authentication.preferences.Prefs.java

@SuppressWarnings("static-access")
@Override/*  www .  j a v  a  2s .c  o  m*/
public boolean onTouch(View v, MotionEvent event) {
    // TODO Auto-generated method stub
    int action = event.getAction();
    int N = event.getHistorySize();
    if (action == event.ACTION_DOWN) {
        calibrator.setColorFilter(Color.BLACK);
        for (int i = 0; i < N; i++) {
            calibrate(event.getHistoricalX(i), event.getHistoricalY(i), event.getHistoricalPressure(i),
                    event.getHistoricalSize(i));
        }
        calibrate(event.getX(), event.getY(), event.getPressure(), event.getSize());
    } else if (action == event.ACTION_UP) {
        Float temp = Collections.max(CalList);
        temp = (float) Math.ceil((Double.parseDouble(Float.valueOf(temp).toString())) / 10);
        LargeValue = temp * 10;
        calibrator.setColorFilter(Color.GREEN);
        // Largest.setText(String.valueOf(LargeValue));

    }

    return true;
}

From source file:cl.gisred.android.MapsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    LicenseResult licenseResult = ArcGISRuntime.setClientId(CLIENT_ID);
    LicenseLevel licenseLevel = ArcGISRuntime.License.getLicenseLevel();

    if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.BASIC) {
        //Toast.makeText(getApplicationContext(), "Licencia bsica vlida", Toast.LENGTH_SHORT).show();
    } else if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.STANDARD) {
        //Toast.makeText(getApplicationContext(), "Licencia standard vlida", Toast.LENGTH_SHORT).show();
    }/*  w  w w .  java  2s. com*/

    setContentView(R.layout.activity_maps);

    Toolbar toolbar = (Toolbar) findViewById(R.id.apptool);
    setSupportActionBar(toolbar);

    /*Get Credenciales String*/
    Bundle bundle = getIntent().getExtras();
    usuar = bundle.getString("usuario");
    passw = bundle.getString("password");
    modulo = bundle.getString("modulo");
    empresa = bundle.getString("empresa");

    //Set Credenciales
    setCredenciales(usuar, passw);

    //Set Mapa
    setMap(R.id.map, 0xffffff, 0xffffff, 10, 10, false, true);
    choices = 0;

    if (Build.VERSION.SDK_INT >= 23)
        verifPermisos();
    else
        initGeoposition();

    setLayersURL(this.getResources().getString(R.string.url_Mapabase), "MAPABASE");
    setLayersURL(this.getResources().getString(R.string.url_token), "TOKENSRV");
    setLayersURL(this.getResources().getString(R.string.url_EquiposLinea), "EQUIPOS_LINEA");
    setLayersURL(this.getResources().getString(R.string.url_TRAMOS), "TRAMOS");
    setLayersURL(this.getResources().getString(R.string.url_EquiposPTO), "EQUIPOS_PTO");
    setLayersURL(this.getResources().getString(R.string.url_Nodos), "NODOS");
    setLayersURL(this.getResources().getString(R.string.url_Luminarias), "LUMINARIAS");
    setLayersURL(this.getResources().getString(R.string.url_Clientes), "CLIENTES");
    setLayersURL(this.getResources().getString(R.string.url_Concesiones), "CONCESIONES");
    setLayersURL(this.getResources().getString(R.string.url_Direcciones), "DIRECCIONES");
    setLayersURL(this.getResources().getString(R.string.url_medidores), "MEDIDORES");
    setLayersURL(this.getResources().getString(R.string.url_Stx), "STX");
    setLayersURL(this.getResources().getString(R.string.url_ECSE_varios), "ECSE");
    setLayersURL(this.getResources().getString(R.string.url_Electrodependientes), "ELECTRODEP");

    //Agrega layers dinmicos.
    addLayersToMap(credenciales, "DYNAMIC", "MAPABASECHQ", din_urlMapaBase, null, true);
    addLayersToMap(credenciales, "DYNAMIC", "SED", din_urlEquiposPunto, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "SSEE", din_urlEquiposPunto, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "SALIDAALIM", din_urlEquiposPunto, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "REDMT", din_urlTramos, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "REDBT", din_urlTramos, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "REDAP", din_urlTramos, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "POSTES", din_urlNodos, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_LINEA", din_urlEquiposLinea, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_PTO", din_urlEquiposPunto, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "LUMINARIAS", din_urlLuminarias, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "CLIENTES", din_urlClientes, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "MEDIDORES", din_urlMedidores, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "CONCESIONES", din_urlConcesiones, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "DIRECCIONES", din_urlDirecciones, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "EMPALMES", din_urlClientes, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "REDSTX", din_urlStx, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "TORRESSTX", din_urlStx, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "ENCUESTADO", din_urlECSE, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "REEMPLAZO", din_urlECSE, null, false);
    addLayersToMap(credenciales, "DYNAMIC", "ELECTRODEP", din_urlElectroDep, null, false);

    //Aade Layer al Mapa
    myMapView.addLayer(mRoadBaseMaps, 0);
    myMapView.addLayer(LySED, 1);
    myMapView.addLayer(LySSEE, 2);
    myMapView.addLayer(LySALIDAALIM, 3);
    myMapView.addLayer(LyPOSTES, 4);
    myMapView.addLayer(LyREDMT, 5);
    myMapView.addLayer(LyREDBT, 6);
    myMapView.addLayer(LyREDAP, 7);
    myMapView.addLayer(LyEQUIPOSLINEA, 8);
    myMapView.addLayer(LyEQUIPOSPTO, 9);
    myMapView.addLayer(LyLUMINARIAS, 10);
    myMapView.addLayer(LyCLIENTES, 11);
    myMapView.addLayer(LyMEDIDORES, 12);
    myMapView.addLayer(LyCONCESIONES, 13);
    myMapView.addLayer(LyDIRECCIONES, 14);
    myMapView.addLayer(LyEMPALMES, 15);
    myMapView.addLayer(LyREDSTX, 16);
    myMapView.addLayer(LyTORRESSTX, 17);
    myMapView.addLayer(LyENCUESTA, 18);
    myMapView.addLayer(LyREEMPLAZO, 19);
    myMapView.addLayer(LyELECTRODEP, 20);

    final FloatingActionButton btnGps = (FloatingActionButton) findViewById(R.id.action_gps);
    btnGps.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
            if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                alertNoGps();
            }
            toogleGps(v);
        }
    });

    btnGps.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            Toast.makeText(getApplicationContext(), "Funcin Gps", Toast.LENGTH_SHORT).show();
            return true;
        }
    });

    final FloatingActionButton btnVerData = (FloatingActionButton) findViewById(R.id.action_ver_data);
    btnVerData.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            toogleData(v);
        }
    });

    btnVerData.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            Toast.makeText(getApplicationContext(), "Ver Datos", Toast.LENGTH_SHORT).show();
            return true;
        }
    });

    drawOk = new ShapeDrawable(new OvalShape());
    drawOk.getPaint().setColor(getResources().getColor(R.color.colorPrimary));

    drawNo = new ShapeDrawable(new OvalShape());
    drawNo.getPaint().setColor(getResources().getColor(R.color.black_overlay));

    menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions);
    fabShowDialog = (FloatingActionButton) findViewById(R.id.action_show_dialog);
    if (fabShowDialog != null)
        fabShowDialog.setVisibility(View.GONE);

    fabVerCapas = (FloatingActionButton) findViewById(R.id.action_ver_capa);
    if (fabVerCapas != null)
        fabVerCapas.setVisibility(View.GONE);

    fabNavRoute = (FloatingActionButton) findViewById(R.id.action_nav_route);
    if (fabNavRoute != null) {
        fabNavRoute.setVisibility(View.GONE);
        fabNavRoute.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (myMapView != null && myMapView.getCallout().isShowing()) {
                    Point p = (Point) GeometryEngine.project(myMapView.getCallout().getCoordinates(), wm, egs);
                    Util.QueryNavigation(MapsActivity.this, p);
                }
            }
        });

        fabNavRoute.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                Toast.makeText(getApplicationContext(), "Ir a Ruta", Toast.LENGTH_SHORT).show();
                return true;
            }
        });
    }

    if (modulo.replace(" ", "_").equals(modIngreso)) {

        arrayTipoPoste = getResources().getStringArray(R.array.tipo_poste);
        arrayTension = getResources().getStringArray(R.array.tipo_tension);
        arrayTipoEdif = getResources().getStringArray(R.array.tipo_edificacion);
        arrayMedidor = getResources().getStringArray(R.array.tipo_medidor);
        arrayEmpalme = getResources().getStringArray(R.array.tipo_empalme);
        arrayTecMedidor = getResources().getStringArray(R.array.tec_medidor);
        arrayTipoCnr = getResources().getStringArray(R.array.tipo_cnr);
        arrayTipoFase = getResources().getStringArray(R.array.fase_conexion);

        dialogCrear = new Dialog(MapsActivity.this);

        fabShowDialog.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                bMapTap = false;
                bCallOut = false;
                myMapView.getCallout().hide();
                //TODO Restringir datos dialog
                if (oUbicacion != null) {
                    btnUbicacion.setColorFilter(Color.BLACK);
                    setEnabledDialog(true);
                }
                dialogCrear.show();
                if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null)
                    myMapView.removeLayer(mSeleccionLayer);
            }
        });

        fabVerCapas.setVisibility(View.VISIBLE);
        fabVerCapas.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                toogleCapas(v);
            }
        });

        fabVerCapas.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                Toast.makeText(getApplicationContext(), "Ver Capas de Ingreso", Toast.LENGTH_SHORT).show();
                return true;
            }
        });

        arrayWidgets = bundle.getStringArrayList("widgets");

        final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a);
        final FloatingActionButton actionB = (FloatingActionButton) findViewById(R.id.action_b);
        final FloatingActionButton actionC = (FloatingActionButton) findViewById(R.id.action_c);
        final FloatingActionButton actionD = (FloatingActionButton) findViewById(R.id.action_d);

        setOpcion(actionA, null);
        setOpcion(actionB, null);
        setOpcion(actionC, modIngreso + "_TECNO");
        setOpcion(actionD, modIngreso + "_CNR");

        setLayersURL(this.getResources().getString(R.string.srv_Postes), "SRV_POSTES");
        setLayersURL(this.getResources().getString(R.string.srv_Direcciones), "SRV_DIRECCIONES");
        setLayersURL(this.getResources().getString(R.string.srv_Clientes), "SRV_CLIENTES");
        setLayersURL(this.getResources().getString(R.string.srv_Union_012), "SRV_UNIONES");
        setLayersURL(din_urlTramos, "TRAMOS");
        setLayersURL(this.getResources().getString(R.string.url_Mapabase), "SRV_CALLES");
        setLayersURL(this.getResources().getString(R.string.srv_ClientesCnr), "SRV_CLIENTESCNR");

        addLayersToMap(credenciales, "FEATURE", "ADDPOSTE", srv_urlPostes, null, true);
        addLayersToMap(credenciales, "FEATURE", "ADDADDRESS", srv_urlDireccion, null, true);
        addLayersToMap(credenciales, "FEATURE", "ADDCLIENTE", srv_urlClientes, null, true);
        addLayersToMap(credenciales, "FEATURE", "ADDUNION", srv_urlUnion012, null, true);
        addLayersToMap(credenciales, "FEATURE", "ASOCTRAMO", LyREDBT.getUrl(), null, false);
        addLayersToMap(credenciales, "FEATURE", "ASOCCALLE", srv_calles, null, false);
        addLayersToMap(credenciales, "FEATURE", "ADDCLIENTECNR", srv_urlClientesCnr, null, true);

        myMapView.addLayer(LyAddPoste, 21);
        myMapView.addLayer(LyAddDireccion, 22);
        myMapView.addLayer(LyAddCliente, 23);
        myMapView.addLayer(LyAddUnion, 24);
        myMapView.addLayer(LyAsocTramo, 25);
        myMapView.addLayer(LyAsocCalle, 26);
        myMapView.addLayer(LyAddClienteCnr, 27);

        setLayerAddToggle(false);

    } else {
        menuMultipleActions.setVisibility(View.GONE);
    }
}

From source file:com.makotojava.android.debate.PolicySpeechFragment.java

private SpeechCountDownTimerWithAlarm createAffPrepCountDownTimer(final long durationInMillis) {
    Log.i(TAG, "Creating Affirmative Prep Timer...");
    SpeechCountDownTimerWithAlarm ret = new SpeechCountDownTimerWithAlarm(durationInMillis,
            getCountdownInterval(), new SpeechCountDownTimerCallback() {
                //private static final long serialVersionUID = 1L;
                @Override/*from  ww  w.  ja  v  a  2 s . com*/
                public void update(long millisUntilFinished) {
                    updateTimerTextView(_affirmativePrepTimerTextView, millisUntilFinished);
                    getPolicySpeechSingleton().setAffirmativePrepRemainingTime(millisUntilFinished);
                    //Log.i(TAG, "Aff Prep Timer, millis to go => " + millisUntilFinished);
                    // Animate the timer when < 1 minute to go
                    if (getSystemOptions().animateWhenTimerBelowThreshold()) {
                        if (millisUntilFinished < NUMBER_OF_MILLIS_IN_ONE_MINUTE) {
                            if (((millisUntilFinished / 1000) % 60 % 2) == 0)
                                _affirmativePrepTimerTextView.setTextColor(Color.RED);
                            else
                                _affirmativePrepTimerTextView.setTextColor(Color.BLACK);
                        }
                    }
                }

                @Override
                public void done() {
                    Log.i(TAG, "Affirmative Prep Timer is done!");
                    getPolicySpeechSingleton().setAffirmativePrepRemainingTime(0);
                    getAffirmativePrepTimer().exhaust();
                    if (getSystemOptions().notifyAtTimerExpiration()) {
                        getAffirmativePrepTimer().playNotification(getActivity());
                    }
                    _affirmativePrepTimerTextView.setTextColor(Color.RED);
                    manageState();
                }
            });
    return ret;
}

From source file:au.com.wallaceit.reddinator.Rservice.java

private void getThemeColors() {
    switch (Integer.valueOf(mSharedPreferences.getString("widgetthemepref", "1"))) {
    // set colors array: healine text, load more text, divider, domain text, vote & comments
    case 1:// w w w.  j  a  v  a  2 s  . c om
        themeColors = new int[] { Color.BLACK, Color.BLACK, Color.parseColor("#D7D7D7"),
                Color.parseColor("#336699"), Color.parseColor("#FF4500") };
        break;
    case 2:
        themeColors = new int[] { Color.WHITE, Color.WHITE, Color.parseColor("#646464"),
                Color.parseColor("#5F99CF"), Color.parseColor("#FF8B60") };
        break;
    case 3:
    case 4:
    case 5:
        themeColors = new int[] { Color.WHITE, Color.WHITE, Color.parseColor("#646464"),
                Color.parseColor("#CEE3F8"), Color.parseColor("#FF8B60") };
        break;
    }
    // user title color override
    if (!mSharedPreferences.getString("titlecolorpref", "0").equals("0")) {
        themeColors[0] = Color.parseColor(mSharedPreferences.getString("titlecolorpref", "#000"));
    }
}

From source file:com.cypress.cysmart.BLEServiceFragments.CSCService.java

/**
 * Setting up the aChart Third party library
 *
 * @param parent/* w  w w. ja  v  a2s  . co  m*/
 */
private void setupChart(View parent) {
    /**
     * Setting graph titles
     */
    String graphTitle = getResources().getString(R.string.csc_fragment);
    String graphXAxis = getResources().getString(R.string.health_temperature_time);
    String graphYAxis = getResources().getString(R.string.csc_cadence_graph);

    // Creating an  XYSeries for running speed
    mDataSeries = new XYSeries(graphTitle);

    // Creating a dataset to hold each series
    XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset();

    // Adding temperature Series to the dataset
    mDataset.addSeries(mDataSeries);

    // Creating XYSeriesRenderer to customize
    XYSeriesRenderer mRenderer = new XYSeriesRenderer();
    mRenderer.setColor(getResources().getColor(R.color.main_bg_color));
    mRenderer.setPointStyle(PointStyle.CIRCLE);
    mRenderer.setFillPoints(true);
    mRenderer.setLineWidth(5);

    // Creating a XYMultipleSeriesRenderer to customize the whole chart
    XYMultipleSeriesRenderer mMultiRenderer = new XYMultipleSeriesRenderer();
    int deviceDPi = getResources().getDisplayMetrics().densityDpi;
    switch (getResources().getDisplayMetrics().densityDpi) {
    case DisplayMetrics.DENSITY_XHIGH:
        mMultiRenderer.setMargins(new int[] { 40, 90, 25, 10 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI);
        break;
    case DisplayMetrics.DENSITY_HIGH:
        mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI);
        break;
    case DisplayMetrics.DENSITY_XXHIGH:
        mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI);
        break;

    default:
        if (deviceDPi > DisplayMetrics.DENSITY_XXHIGH && deviceDPi < DisplayMetrics.DENSITY_XXXHIGH) {
            mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 });
            mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI);
        } else {
            mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 });
            mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI);
        }
        break;
    }
    mMultiRenderer.setXTitle(graphXAxis);
    mMultiRenderer.setLabelsColor(Color.BLACK);
    mMultiRenderer.setYTitle(graphYAxis);
    mMultiRenderer.setYAxisMin(0);
    mMultiRenderer.setXAxisMin(0);
    mMultiRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));
    mMultiRenderer.setPanEnabled(true, true);
    mMultiRenderer.setZoomEnabled(false, false);
    mMultiRenderer.setYLabelsColor(0, Color.BLACK);
    mMultiRenderer.setXLabelsColor(Color.BLACK);
    mMultiRenderer.setApplyBackgroundColor(true);
    mMultiRenderer.setBackgroundColor(Color.WHITE);
    mMultiRenderer.setGridColor(Color.BLACK);
    mMultiRenderer.setShowGrid(true);
    mMultiRenderer.setShowLegend(false);

    // Adding mRenderer to multipleRenderer
    mMultiRenderer.addSeriesRenderer(mRenderer);

    // Getting a reference to LinearLayout of the MainActivity Layout
    mGraphLayoutParent = (LinearLayout) parent.findViewById(R.id.chart_container);

    mChart = ChartFactory.getLineChartView(getActivity(), mDataset, mMultiRenderer);

    // Adding the Line Chart to the LinearLayout
    mGraphLayoutParent.addView(mChart);

}

From source file:cl.gisred.android.CatastroActivity.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  w w w.  j  a  va 2s .  c  o m

    setContentView(R.layout.activity_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");

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

    //Aade Layer al Mapa
    myMapView.addLayer(mRoadBaseMaps, 0);
    myMapView.addLayer(LySED, 1);
    myMapView.addLayer(LySSEE, 2);
    myMapView.addLayer(LySALIDAALIM, 3);
    myMapView.addLayer(LyREDMT, 4);
    myMapView.addLayer(LyREDBT, 5);
    myMapView.addLayer(LyREDAP, 6);
    myMapView.addLayer(LyPOSTES, 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);

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

    menuCatastroActions = (FloatingActionsMenu) findViewById(R.id.catastro_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(CatastroActivity.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(modCatastro)) {

        setLayersURL(this.getResources().getString(R.string.srv_Lectores), "SRV_CATASTRO");
        addLayersToMap(credenciales, "FEATURE", "ADDCATASTRO", srv_catastro, null, true);
        myMapView.addLayer(LyAddCatastro, 20);

        arrayTipoEquipo = getResources().getStringArray(R.array.tipo_equipo);
        arrayTipoCaja = getResources().getStringArray(R.array.tipo_caja);
        arrayTipoConex = getResources().getStringArray(R.array.tipo_conexion);
        arrayEstadoMedidor = getResources().getStringArray(R.array.estado_medidor);
        arrayPropiedad = getResources().getStringArray(R.array.propiedad);
        arrayAccesoLectura = getResources().getStringArray(R.array.acceso_lectura);
        arrayTipoIrregularidad = getResources().getStringArray(R.array.tipo_irregularidad);
        arrayResultadoCatastro = getResources().getStringArray(R.array.resultado_catastro);

        arrayWidgets = bundle.getStringArrayList("widgets");
        arrayModulos = bundle.getStringArrayList("modulos");

        formCrear = new Dialog(CatastroActivity.this);
        fabShowForm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                bMapTap = false;
                bCallOut = false;
                myMapView.getCallout().hide();
                //TODO Restringir datos dialog
                if (oUbicacion != null) {
                    btnUbicacion.setColorFilter(Color.BLACK);
                    setEnabledDialog(true);
                }
                formCrear.show();
            }
        });

        FloatingActionButton oFabForm = (FloatingActionButton) findViewById(R.id.action_form);
        oFabForm.setIconDrawable(drawOk);
        oFabForm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                abrirFormIngreso(v);
            }
        });

        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(CatastroActivity.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_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 {
        menuCatastroActions.setVisibility(View.GONE);
    }
}

From source file:com.paic.zhifu.wallet.activity.modules.register.PhoneValidationActivity.java

/**
 * ?/*from  w ww .  j  av  a2s  .c om*/
 */
private void checkAndChangeNextBtnState() {
    // ?????????
    if (!checkPhoneNum() || !checkLicense() || !checkSMSCode()) {
        next.setBackgroundResource(R.drawable.normal_btn2);
        next.setTextColor(Color.BLACK);
        next.setEnabled(false);
    } else {
        next.setBackgroundResource(R.drawable.normal_btn);
        next.setTextColor(Color.WHITE);
        next.setEnabled(true);
    }
}

From source file:com.facebook.react.views.webview.ReactWebViewManager.java

@Override
protected WebView createViewInstance(final ThemedReactContext reactContext) {
    final ReactWebView webView = new ReactWebView(reactContext);

    /**/*www  .  j  av  a2 s  .c  o m*/
     * cookie?
     * 5.0???cookie,5.0?false
     * 
     */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
    }

    webView.setDownloadListener(new DownloadListener() {
        @Override
        public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype,
                long contentLength) {
            Uri uri = Uri.parse(url);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            reactContext.getCurrentActivity().startActivity(intent);

            //                DownloadManager.Request request = new DownloadManager.Request(
            //                        Uri.parse(url));
            //
            //                request.setMimeType(mimetype);
            //                String cookies = CookieManager.getInstance().getCookie(url);
            //                request.addRequestHeader("cookie", cookies);
            //                request.addRequestHeader("User-Agent", userAgent);
            //                request.allowScanningByMediaScanner();
            ////                request.setTitle()
            //                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
            //                request.setDestinationInExternalPublicDir(
            //                        Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName(
            //                                url, contentDisposition, mimetype));
            //                DownloadManager dm = (DownloadManager) reactContext.getCurrentActivity().getSystemService(DOWNLOAD_SERVICE);
            //                dm.enqueue(request);
            //                Toast.makeText(reactContext, "...", //To notify the Client that the file is being downloaded
            //                        Toast.LENGTH_LONG).show();

        }
    });
    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public boolean onConsoleMessage(ConsoleMessage message) {
            if (ReactBuildConfig.DEBUG) {
                return super.onConsoleMessage(message);
            }
            // Ignore console logs in non debug builds.
            return true;
        }

        @Override
        public void onGeolocationPermissionsShowPrompt(String origin,
                GeolocationPermissions.Callback callback) {
            callback.invoke(origin, true, false);
        }

        private File createImageFile() throws IOException {
            // Create an image file name
            String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
            String imageFileName = "JPEG_" + timeStamp + "_";
            File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
            File imageFile = new File(storageDir, /* directory */
                    imageFileName + ".jpg" /* filename */
            );
            return imageFile;
        }

        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                WebChromeClient.FileChooserParams fileChooserParams) {
            if (mFilePathCallback != null) {
                mFilePathCallback.onReceiveValue(null);
            }
            mFilePathCallback = filePathCallback;

            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            if (takePictureIntent
                    .resolveActivity(reactContext.getCurrentActivity().getPackageManager()) != null) {
                // Create the File where the photo should go
                File photoFile = null;
                try {
                    photoFile = createImageFile();
                    takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
                } catch (IOException ex) {
                    // Error occurred while creating the File
                    FLog.e(ReactConstants.TAG, "Unable to create Image File", ex);
                }

                // Continue only if the File was successfully created
                if (photoFile != null) {
                    mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
                    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
                } else {
                    takePictureIntent = null;
                }
            }

            Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
            contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
            contentSelectionIntent.setType("*/*");

            Intent[] intentArray;
            if (takePictureIntent != null) {
                intentArray = new Intent[] { takePictureIntent };
            } else {
                intentArray = new Intent[0];
            }

            Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
            chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
            chooserIntent.putExtra(Intent.EXTRA_TITLE, "?");
            chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
            reactContext.getCurrentActivity().startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);

            // final Intent galleryIntent = new Intent(Intent.ACTION_PICK);
            // galleryIntent.setType("image/*");
            // final Intent chooserIntent = Intent.createChooser(galleryIntent, "Choose File");
            // reactContext.getCurrentActivity().startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);

            return true;
        }

        @Override
        public void onShowCustomView(View view, CustomViewCallback callback) {

            if (mVideoView != null) {
                callback.onCustomViewHidden();
                return;
            }

            // Store the view and it's callback for later, so we can dispose of them correctly
            mVideoView = view;
            mCustomViewCallback = callback;

            view.setBackgroundColor(Color.BLACK);
            getRootView().addView(view, FULLSCREEN_LAYOUT_PARAMS);
            webView.setVisibility(View.GONE);

            UiThreadUtil.runOnUiThread(new Runnable() {
                @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                @Override
                public void run() {
                    // If the status bar is translucent hook into the window insets calculations
                    // and consume all the top insets so no padding will be added under the status bar.
                    View decorView = reactContext.getCurrentActivity().getWindow().getDecorView();
                    decorView.setOnApplyWindowInsetsListener(null);
                    ViewCompat.requestApplyInsets(decorView);
                }
            });

            reactContext.getCurrentActivity()
                    .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        }

        @Override
        public void onHideCustomView() {
            if (mVideoView == null) {
                return;
            }

            mVideoView.setVisibility(View.GONE);
            getRootView().removeView(mVideoView);
            mVideoView = null;
            mCustomViewCallback.onCustomViewHidden();
            webView.setVisibility(View.VISIBLE);
            //                View decorView = reactContext.getCurrentActivity().getWindow().getDecorView();
            //                // Show Status Bar.
            //                int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
            //                decorView.setSystemUiVisibility(uiOptions);

            UiThreadUtil.runOnUiThread(new Runnable() {
                @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                @Override
                public void run() {
                    // If the status bar is translucent hook into the window insets calculations
                    // and consume all the top insets so no padding will be added under the status bar.
                    View decorView = reactContext.getCurrentActivity().getWindow().getDecorView();
                    //                                decorView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
                    //                                    @Override
                    //                                    public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
                    //                                        WindowInsets defaultInsets = v.onApplyWindowInsets(insets);
                    //                                        return defaultInsets.replaceSystemWindowInsets(
                    //                                                defaultInsets.getSystemWindowInsetLeft(),
                    //                                                0,
                    //                                                defaultInsets.getSystemWindowInsetRight(),
                    //                                                defaultInsets.getSystemWindowInsetBottom());
                    //                                    }
                    //                                });
                    decorView.setOnApplyWindowInsetsListener(null);
                    ViewCompat.requestApplyInsets(decorView);
                }
            });

            reactContext.getCurrentActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        }

        private ViewGroup getRootView() {
            return ((ViewGroup) reactContext.getCurrentActivity().findViewById(android.R.id.content));
        }

    });

    reactContext.addLifecycleEventListener(webView);
    reactContext.addActivityEventListener(new ActivityEventListener() {
        @Override
        public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
            if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) {
                return;
            }
            Uri[] results = null;

            // Check that the response is a good one
            if (resultCode == Activity.RESULT_OK) {
                if (data == null) {
                    // If there is not data, then we may have taken a photo
                    if (mCameraPhotoPath != null) {
                        results = new Uri[] { Uri.parse(mCameraPhotoPath) };
                    }
                } else {
                    String dataString = data.getDataString();
                    if (dataString != null) {
                        results = new Uri[] { Uri.parse(dataString) };
                    }
                }
            }

            if (results == null) {
                mFilePathCallback.onReceiveValue(new Uri[] {});
            } else {
                mFilePathCallback.onReceiveValue(results);
            }
            mFilePathCallback = null;
            return;
        }

        @Override
        public void onNewIntent(Intent intent) {
        }
    });
    mWebViewConfig.configWebView(webView);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setDisplayZoomControls(false);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setDefaultFontSize(16);
    webView.getSettings().setTextZoom(100);
    // Fixes broken full-screen modals/galleries due to body height being 0.
    webView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WebView.setWebContentsDebuggingEnabled(true);
    }

    return webView;
}

From source file:com.filemanager.free.adapters.Recycleradapter.java

@Override
public void onBindViewHolder(RecyclerView.ViewHolder vholder, @SuppressLint("RecyclerView") final int p) {
    final Recycleradapter.ViewHolder holder = ((Recycleradapter.ViewHolder) vholder);
    if (main.IS_LIST) {
        if (p == getItemCount() - 1) {
            holder.rl.setMinimumHeight(rowHeight);
            if (items.size() == (main.GO_BACK_ITEM ? 1 : 0))
                holder.txtTitle.setText(R.string.nofiles);
            else {
                holder.txtTitle.setText(R.string.footer);
            }/*from  w  w w.  j  av a2  s  . c o  m*/
            return;
        }
    }
    if (holder.imageView == null)
        return;
    if (!this.stoppedAnimation && !myanim.get(p)) {
        animate(holder);
        myanim.put(p, true);
    }
    final Layoutelements rowItem = items.get(p);
    if (main.IS_LIST) {
        holder.rl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                main.onListItemClicked(p, v);
            }
        });

        holder.rl.setOnLongClickListener(new View.OnLongClickListener() {

            public boolean onLongClick(View p1) {

                if (!rowItem.getSize().equals(main.goback)) {
                    Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim);
                    holder.imageView.setAnimation(iconAnimation);
                    toggleChecked(p);
                }

                return true;
            }
        });

        filetype = -1;
        if (Icons.isPicture((rowItem.getDesc().toLowerCase())))
            filetype = 0;
        else if (Icons.isApk((rowItem.getDesc())))
            filetype = 1;
        else if (Icons.isVideo(rowItem.getDesc()))
            filetype = 2;
        holder.txtTitle.setText(rowItem.getTitle());
        holder.imageView.setImageDrawable(rowItem.getImageId());
        holder.ext.setText("");

        if (holder.about != null) {
            if (main.theme1 == 0)
                holder.about.setColorFilter(grey_color);
            showPopup(holder.about, rowItem);
        }
        holder.imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (!rowItem.getSize().equals(main.goback)) {

                    Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim);
                    holder.imageView.setAnimation(iconAnimation);
                    toggleChecked(p);
                } else
                    main.goBack();

            }
        });
        holder.viewmageV.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (!rowItem.getSize().equals(main.goback)) {

                    Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim);
                    holder.imageView.setAnimation(iconAnimation);
                    toggleChecked(p);
                } else
                    main.goBack();
            }
        });
        holder.apk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (!rowItem.getSize().equals(main.goback)) {

                    Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim);
                    holder.imageView.setAnimation(iconAnimation);
                    toggleChecked(p);
                } else
                    main.goBack();
            }
        });
        holder.imageView.setVisibility(View.VISIBLE);
        holder.viewmageV.setVisibility(View.INVISIBLE);
        if (filetype == 0) {
            if (main.SHOW_THUMBS) {
                if (main.CIRCULAR_IMAGES) {
                    holder.imageView.setVisibility(View.GONE);
                    holder.apk.setVisibility(View.GONE);
                    holder.viewmageV.setVisibility(View.VISIBLE);
                    holder.viewmageV.setImageDrawable(main.DARK_IMAGE);
                    main.ic.cancelLoad(holder.viewmageV);
                    main.ic.loadDrawable(holder.viewmageV, (rowItem.getDesc()), null);
                } else {
                    holder.imageView.setVisibility(View.GONE);
                    holder.apk.setVisibility(View.VISIBLE);
                    holder.apk.setImageDrawable(main.DARK_IMAGE);
                    main.ic.cancelLoad(holder.apk);
                    main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null);
                }
            }
        } else if (filetype == 1) {
            if (main.SHOW_THUMBS) {
                holder.viewmageV.setVisibility(View.GONE);
                holder.imageView.setVisibility(View.GONE);
                holder.apk.setVisibility(View.VISIBLE);
                holder.apk.setImageDrawable(main.apk);
                main.ic.cancelLoad(holder.apk);
                main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null);
            }

        } else if (filetype == 2) {
            if (main.SHOW_THUMBS) {
                if (main.CIRCULAR_IMAGES) {
                    holder.imageView.setVisibility(View.GONE);
                    holder.viewmageV.setVisibility(View.VISIBLE);
                    holder.viewmageV.setImageDrawable(main.DARK_VIDEO);
                    main.ic.cancelLoad(holder.viewmageV);
                    main.ic.loadDrawable(holder.viewmageV, (rowItem.getDesc()), null);
                } else {
                    holder.imageView.setVisibility(View.GONE);
                    holder.apk.setVisibility(View.VISIBLE);
                    holder.apk.setImageDrawable(main.DARK_VIDEO);
                    main.ic.cancelLoad(holder.apk);
                    main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null);
                }
            }
        } else {
            holder.viewmageV.setVisibility(View.GONE);
            holder.apk.setVisibility(View.GONE);
            holder.imageView.setVisibility(View.VISIBLE);
        }
        Boolean checked = myChecked.get(p);
        if (checked != null) {

            if (main.theme1 == 0) {

                holder.rl.setBackgroundResource(R.drawable.safr_ripple_white);
            } else {

                holder.rl.setBackgroundResource(R.drawable.safr_ripple_black);
            }
            holder.rl.setSelected(false);
            if (checked) {
                holder.apk.setVisibility(View.GONE);
                holder.viewmageV.setVisibility(View.GONE);
                holder.imageView.setVisibility(View.VISIBLE);
                holder.imageView.setImageDrawable(
                        ContextCompat.getDrawable(context, R.drawable.abc_ic_cab_done_holo_dark));
                GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground();
                gradientDrawable.setColor(c1);
                holder.rl.setSelected(true);
                holder.ext.setText("");
            } else {
                GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground();
                if (main.COLORISE_ICONS) {
                    if (rowItem.isDirectory())
                        gradientDrawable.setColor(main.icon_skin_color);
                    else if (Icons.isVideo(rowItem.getDesc()) || Icons.isPicture(rowItem.getDesc()))
                        gradientDrawable.setColor(c2);
                    else if (Icons.isAudio(rowItem.getDesc()))
                        gradientDrawable.setColor(c3);
                    else if (Icons.isPdf(rowItem.getDesc()))
                        gradientDrawable.setColor(c4);
                    else if (Icons.isCode(rowItem.getDesc()))
                        gradientDrawable.setColor(c5);
                    else if (Icons.isText(rowItem.getDesc()))
                        gradientDrawable.setColor(c6);
                    else if (Icons.isArchive(rowItem.getDesc()))
                        gradientDrawable.setColor(c7);
                    else if (Icons.isApk(rowItem.getDesc()))
                        gradientDrawable.setColor(c8);
                    else if (Icons.isgeneric(rowItem.getDesc())) {
                        gradientDrawable.setColor(c9);
                        String ext = MimeTypes.getExtension(new File(rowItem.getDesc()).getName());
                        if (ext != null && ext.trim().length() != 0) {
                            holder.ext.setText(ext);
                            holder.imageView.setImageDrawable(null);
                        }
                    } else {
                        gradientDrawable.setColor(main.icon_skin_color);
                    }
                } else
                    gradientDrawable.setColor((main.icon_skin_color));
                if (rowItem.getSize().equals(main.goback))
                    gradientDrawable.setColor(c1);

            }
        }
        if (main.SHOW_PERMISSIONS)
            holder.perm.setText(rowItem.getPermissions());
        if (main.SHOW_LAST_MODIFIED)
            holder.date.setText(rowItem.getDate());
        String size = rowItem.getSize();

        if (size.equals(main.goback)) {

            holder.date.setText(size);

            holder.txtDesc.setText("");
        } else if (main.SHOW_SIZE)

            holder.txtDesc.setText(rowItem.getSize());
    } else {
        Boolean checked = myChecked.get(p);
        holder.rl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                main.onListItemClicked(p, v);
            }
        });

        holder.rl.setOnLongClickListener(new View.OnLongClickListener() {

            public boolean onLongClick(View p1) {

                if (!rowItem.getSize().equals(main.goback)) {
                    Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim);
                    holder.imageView.setAnimation(iconAnimation);
                    toggleChecked(p);
                }
                return true;
            }
        });
        holder.txtTitle.setText(rowItem.getTitle());
        holder.imageView1.setVisibility(View.INVISIBLE);
        holder.imageView.setVisibility(View.VISIBLE);
        holder.imageView.setImageDrawable(rowItem.getImageId());
        if (Icons.isPicture((rowItem.getDesc().toLowerCase()))
                || Icons.isVideo(rowItem.getDesc().toLowerCase())) {
            holder.imageView.setColorFilter(null);
            holder.imageView1.setVisibility(View.VISIBLE);
            holder.imageView1.setImageDrawable(null);
            if (main.theme == 1)
                holder.imageView1.setBackgroundColor(Color.BLACK);
            main.ic.cancelLoad(holder.imageView1);
            main.ic.loadDrawable(holder.imageView1, (rowItem.getDesc()), null);
        } else if (Icons.isApk((rowItem.getDesc()))) {
            holder.imageView.setColorFilter(null);
            main.ic.cancelLoad(holder.imageView);
            main.ic.loadDrawable(holder.imageView, (rowItem.getDesc()), null);
        }
        if (rowItem.isDirectory())
            holder.imageView.setColorFilter(main.icon_skin_color);

        else if (Icons.isVideo(rowItem.getDesc()))
            holder.imageView.setColorFilter(c2);

        else if (Icons.isAudio(rowItem.getDesc()))
            holder.imageView.setColorFilter(c3);

        else if (Icons.isPdf(rowItem.getDesc()))
            holder.imageView.setColorFilter(c4);

        else if (Icons.isCode(rowItem.getDesc()))
            holder.imageView.setColorFilter(c5);

        else if (Icons.isText(rowItem.getDesc()))
            holder.imageView.setColorFilter(c6);

        else if (Icons.isArchive(rowItem.getDesc()))
            holder.imageView.setColorFilter(c7);

        else if (Icons.isgeneric(rowItem.getDesc()))
            holder.imageView.setColorFilter(c9);

        else if (Icons.isApk(rowItem.getDesc()) || Icons.isPicture(rowItem.getDesc()))
            holder.imageView.setColorFilter(null);

        else
            holder.imageView.setColorFilter(main.icon_skin_color);
        if (rowItem.getSize().equals(main.goback))
            holder.imageView.setColorFilter(c1);
        if (checked != null) {

            if (checked) {
                holder.imageView.setColorFilter(main.icon_skin_color);
                holder.imageView.setImageDrawable(
                        ContextCompat.getDrawable(context, R.drawable.abc_ic_cab_done_holo_dark));
                holder.rl.setBackgroundColor(Color.parseColor("#9f757575"));
            } else {
                if (main.theme1 == 0)
                    holder.rl.setBackgroundResource(R.drawable.item_doc_grid);
                else {
                    holder.rl.setBackgroundResource(R.drawable.ic_grid_card_background_dark);
                    holder.rl.findViewById(R.id.icon_frame).setBackgroundColor(Color.parseColor("#303030"));
                }
            }
        }

        if (holder.about != null) {
            if (main.theme1 == 0)
                holder.about.setColorFilter(grey_color);
            showPopup(holder.about, rowItem);
        }
        if (main.SHOW_LAST_MODIFIED)
            holder.date.setText(rowItem.getDate());
        if (rowItem.getSize().equals(main.goback)) {
            holder.date.setText(rowItem.getSize());
            holder.txtDesc.setText("");
        } /*else if(main.SHOW_SIZE)
          holder.txtDesc.setText(rowItem.getSize());
          */
        if (main.SHOW_PERMISSIONS)
            holder.perm.setText(rowItem.getPermissions());
    }
}