Example usage for android.app Dialog Dialog

List of usage examples for android.app Dialog Dialog

Introduction

In this page you can find the example usage for android.app Dialog Dialog.

Prototype

public Dialog(@NonNull Context context) 

Source Link

Document

Creates a dialog window that uses the default dialog theme.

Usage

From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java

private void selectImportProfileItem(final AdapterSyncTask tfl, final NotifyEvent p_ntfy) {
    final Dialog dialog = new Dialog(mContext);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.export_import_profile_dlg);
    dialog.setCanceledOnTouchOutside(false);

    LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.export_import_profile_view);
    ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);

    ArrayList<ExportImportProfileListItem> eipl = new ArrayList<ExportImportProfileListItem>();

    for (int i = 0; i < tfl.getCount(); i++) {
        SyncTaskItem pl = tfl.getItem(i);
        ExportImportProfileListItem eipli = new ExportImportProfileListItem();
        eipli.isChecked = true;/*from w  ww. j  a  v  a 2 s.  c o m*/
        eipli.item_name = pl.getSyncTaskName();
        eipl.add(eipli);
    }
    //      Collections.sort(eipl, new Comparator<ExportImportProfileListItem>(){
    //         @Override
    //         public int compare(ExportImportProfileListItem arg0,
    //               ExportImportProfileListItem arg1) {
    //            if (arg0.item_name.equals(arg1.item_name)) return arg0.item_type.compareToIgnoreCase(arg1.item_type);
    //            return arg0.item_name.compareToIgnoreCase(arg1.item_name);
    //         }
    //      });
    //      ExportImportProfileListItem eipli=new ExportImportProfileListItem();
    //      eipli.isChecked=true;
    //      eipli.item_type="*";
    //      eipli.item_name=mContext.getString(R.string.msgs_export_import_profile_setting_parms);
    //      eipl.add(eipli);
    final AdapterExportImportSyncTask imp_list_adapt = new AdapterExportImportSyncTask(mContext,
            R.layout.export_import_profile_list_item, eipl);

    ListView lv = (ListView) dialog.findViewById(R.id.export_import_profile_listview);
    lv.setAdapter(imp_list_adapt);

    CommonDialog.setDlgBoxSizeLimit(dialog, true);

    final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.export_import_profile_title_view);
    final TextView title = (TextView) dialog.findViewById(R.id.export_import_profile_title);
    title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color);
    title.setTextColor(mGp.themeColorList.text_color_dialog_title);
    title.setText(mContext.getString(R.string.msgs_export_import_profile_title));
    //      TextView tv_msgx=(TextView)dialog.findViewById(R.id.export_import_profile_msg);
    //      tv_msgx.setVisibility(LinearLayout.GONE);
    LinearLayout ll_filelist = (LinearLayout) dialog.findViewById(R.id.export_import_profile_file_list);
    ll_filelist.setVisibility(LinearLayout.GONE);
    final Button ok_btn = (Button) dialog.findViewById(R.id.export_import_profile_dlg_btn_ok);
    Button cancel_btn = (Button) dialog.findViewById(R.id.export_import_profile_dlg_btn_cancel);

    final Button rb_select_all = (Button) dialog.findViewById(R.id.export_import_profile_list_select_all);
    final Button rb_unselect_all = (Button) dialog.findViewById(R.id.export_import_profile_list_unselect_all);
    final CheckedTextView ctv_reset_profile = (CheckedTextView) dialog
            .findViewById(R.id.export_import_profile_list_ctv_reset_profile);
    final CheckedTextView ctv_import_settings = (CheckedTextView) dialog
            .findViewById(R.id.export_import_profile_list_ctv_import_settings);
    final CheckedTextView ctv_import_schedule = (CheckedTextView) dialog
            .findViewById(R.id.export_import_profile_list_ctv_import_schedule);

    ctv_reset_profile.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            ((CheckedTextView) v).toggle();
            setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt,
                    ok_btn);
        }
    });

    ctv_import_settings.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            ((CheckedTextView) v).toggle();
            setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt,
                    ok_btn);
        }
    });

    ctv_import_schedule.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            ((CheckedTextView) v).toggle();
            setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt,
                    ok_btn);
        }
    });

    ctv_import_settings.setChecked(true);
    ctv_import_schedule.setChecked(true);

    lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) {
            //              imp_list_adapt.getItem(pos).isChecked=!imp_list_adapt.getItem(pos).isChecked;
            //              imp_list_adapt.notifyDataSetChanged();
            //              if (imp_list_adapt.isItemSelected()) {
            //                 ok_btn.setEnabled(true);
            //              } else {
            //                 ok_btn.setEnabled(false);
            //              }
            setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt,
                    ok_btn);
        }
    });

    //      lv.setOnItemLongClickListener(new OnItemLongClickListener(){
    //         @Override
    //         public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
    //               int pos, long arg3) {
    //            ccMenu.addMenuItem(
    //                  mContext.getString(R.string.msgs_export_import_profile_select_all),R.drawable.blank)
    //              .setOnClickListener(new CustomContextMenuOnClickListener() {
    //              @Override
    //              final public void onClick(CharSequence menuTitle) {
    //                 for (int i=0;i<imp_list_adapt.getCount();i++)
    //                    imp_list_adapt.getItem(i).isChecked=true;
    //                 imp_list_adapt.notifyDataSetChanged();
    //                 ok_btn.setEnabled(true);
    //                 }
    //              });
    //            ccMenu.addMenuItem(
    //                  mContext.getString(R.string.msgs_export_import_profile_unselect_all),R.drawable.blank)
    //              .setOnClickListener(new CustomContextMenuOnClickListener() {
    //              @Override
    //              final public void onClick(CharSequence menuTitle) {
    //                 for (int i=0;i<imp_list_adapt.getCount();i++)
    //                    imp_list_adapt.getItem(i).isChecked=false;
    //                 imp_list_adapt.notifyDataSetChanged();
    //                 ok_btn.setEnabled(false);
    //                 }
    //              });
    //            ccMenu.createMenu();
    //            return false;
    //         }
    //      });

    rb_select_all.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            for (int i = 0; i < imp_list_adapt.getCount(); i++)
                imp_list_adapt.getItem(i).isChecked = true;
            ctv_import_settings.setChecked(true);
            ctv_import_schedule.setChecked(true);
            imp_list_adapt.notifyDataSetChanged();
            ok_btn.setEnabled(true);
        }
    });
    rb_unselect_all.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            for (int i = 0; i < imp_list_adapt.getCount(); i++)
                imp_list_adapt.getItem(i).isChecked = false;
            ctv_import_settings.setChecked(false);
            ctv_import_schedule.setChecked(false);
            imp_list_adapt.notifyDataSetChanged();
            ok_btn.setEnabled(false);
        }
    });

    NotifyEvent ntfy_ctv_listener = new NotifyEvent(mContext);
    ntfy_ctv_listener.setListener(new NotifyEventListener() {
        @Override
        public void positiveResponse(Context c, Object[] o) {
            //              if (imp_list_adapt.isItemSelected()) {
            //                 ok_btn.setEnabled(true);
            //              } else {
            //                 if (ctv_import_settings.isChecked()) ok_btn.setEnabled(true);
            //                 else ok_btn.setEnabled(false);
            //              }
            setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt,
                    ok_btn);
        }

        @Override
        public void negativeResponse(Context c, Object[] o) {
        }
    });
    imp_list_adapt.setCheckButtonListener(ntfy_ctv_listener);

    ok_btn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            if (ctv_reset_profile.isChecked())
                mGp.syncTaskAdapter.clear();
            importSelectedSyncTaskItem(imp_list_adapt, tfl, ctv_import_settings.isChecked(),
                    ctv_import_schedule.isChecked(), p_ntfy);
            dialog.dismiss();
        }
    });
    cancel_btn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            dialog.dismiss();
        }
    });

    dialog.show();

}

From source file:com.near.chimerarevo.fragments.PostFragment.java

private void addGallery(final String[] imgUrls) {
    numGalleries++;/*from  w w  w.j  ava 2s.c  o m*/
    if (!PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("load_imgs_pref", true)
            || numGalleries > Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(getActivity())
                    .getString("gallery_num_pref", "20")))
        return;
    HorizontalScrollView hsv = new HorizontalScrollView(getActivity());
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER_HORIZONTAL;
    params.setMargins(10, 10, 10, 0);
    hsv.setLayoutParams(params);

    LinearLayout container = new LinearLayout(getActivity());
    container.setOrientation(LinearLayout.HORIZONTAL);
    for (int i = 0; i < imgUrls.length; i++) {
        final ImageView img = new ImageView(getActivity());
        LayoutParams imgPar = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        if (i == 0)
            imgPar.setMargins(5, 10, 0, 10);
        else
            imgPar.setMargins(10, 10, 0, 10);
        img.setLayoutParams(imgPar);
        img.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        container.addView(img);

        final DisplayImageOptions options = new DisplayImageOptions.Builder().cacheOnDisk(false)
                .cacheInMemory(true).showImageOnLoading(R.drawable.empty_cr).bitmapConfig(Bitmap.Config.RGB_565)
                .imageScaleType(ImageScaleType.EXACTLY).delayBeforeLoading(200).build();
        ImageLoader.getInstance().displayImage(imgUrls[i], img, options);

        final int k = i;
        img.setClickable(true);
        img.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                final Dialog dialog = new Dialog(getActivity());
                dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                dialog.setContentView(R.layout.img_dialog_layout);
                ImageLoader.getInstance().displayImage(imgUrls[k].split("\\?resize=")[0],
                        ((TouchImageView) dialog.findViewById(R.id.dialog_image)), options);
                dialog.setCancelable(true);
                dialog.show();
            }
        });
    }
    hsv.addView(container);
    lay.addView(hsv);
}

From source file:app.clirnet.com.clirnetapp.activity.LoginActivity.java

private void showChangePassDialog() {

    dialog = new Dialog(LoginActivity.this);
    dialog.setContentView(R.layout.change_password_dialog);
    dialog.setTitle("Change Password");
    dialog.setCancelable(false);/*from   w  w w . j a  v  a  2 s.  co  m*/
    dialog.setCanceledOnTouchOutside(false);

    // set the custom dialog components - text, image and button
    Button btnSubmitPass = (Button) dialog.findViewById(R.id.submit);

    oldPassword = (EditText) dialog.findViewById(R.id.oldPassword);
    newPassword = (EditText) dialog.findViewById(R.id.password);
    confirmPassword = (EditText) dialog.findViewById(R.id.confirmPassword);

    name = inputEmail.getText().toString().trim();

    btnSubmitPass.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            String oldPass = oldPassword.getText().toString().trim();
            String newPass = newPassword.getText().toString().trim();
            String confirmPass = confirmPassword.getText().toString().trim();
            try {
                if (name != null || !name.equals(""))
                    doctor_membership_number = sqlController.getDoctorMembershipIdNew(name);
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (TextUtils.isEmpty(oldPass)) {
                oldPassword.setError("Please enter current password!");
                return;
            }
            if (TextUtils.isEmpty(newPass)) {
                newPassword.setError("Please enter new password!");
                return;
            }
            if (TextUtils.isEmpty(confirmPass)) {
                confirmPassword.setError("Please confirm new password!");
                return;
            }
            if (!newPass.equals(confirmPass)) {

                confirmPassword.setError("New and confirmation password do not match. Please re-enter.");
                return;
            }

            String md5oldPassword = MD5.getMD5(oldPass);
            String md5newPassword = MD5.getMD5(newPass);
            String start_time = appController.getDateTimenew();
            new UpdatePassworsAsynTask(LoginActivity.this, username, doctor_membership_number, docId,
                    md5oldPassword, md5newPassword, start_time);
            dialog.dismiss();
        }
    });

    Button cancel = (Button) dialog.findViewById(R.id.cancel);
    cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
}

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

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

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

    if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.BASIC) {
        //Toast.makeText(getApplicationContext(), "Licencia bsica vlida", Toast.LENGTH_SHORT).show();
    } else if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.STANDARD) {
        //Toast.makeText(getApplicationContext(), "Licencia standard vlida", Toast.LENGTH_SHORT).show();
    }//from  w  ww. ja  va  2  s  .c  om

    setContentView(R.layout.activity_lector);

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

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

    //Set Credenciales
    setCredenciales(usuar, passw);

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

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

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

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

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

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

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

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

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

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

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

    menuLectorActions = (FloatingActionsMenu) findViewById(R.id.lector_actions);
    menuLectorActions.setVisibility(View.GONE);

    menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions);

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

    fabShowForm = (FloatingActionButton) findViewById(R.id.action_show_form);
    if (fabShowForm != null)
        fabShowForm.setVisibility(View.GONE);

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

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

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

    setLayersURL(this.getResources().getString(R.string.srv_micromed_OT), "SRV_OTMICRO");
    setLayersURL(this.getResources().getString(R.string.srv_viaopen_OT), "SRV_OTOPEN");
    setLayersURL(this.getResources().getString(R.string.srv_denuncio_OT), "SRV_OTDENUNCIO");
    setLayersURL(this.getResources().getString(R.string.srv_denuncio_web_OT), "SRV_OTWEBDENUNCIO");
    setLayersURL(this.getResources().getString(R.string.srv_Postes), "SRV_POSTES");
    setLayersURL(this.getResources().getString(R.string.srv_Direcciones), "SRV_DIRECCIONES");

    addLayersToMap(credenciales, "FEATURE", "ADDOTMICRO", srv_otMicro, null, false);
    addLayersToMap(credenciales, "FEATURE", "ADDOTOPEN", srv_otOpen, null, false);
    addLayersToMap(credenciales, "FEATURE", "ADDOTDENUNCIO", srv_otDenuncio, null, false);
    addLayersToMap(credenciales, "FEATURE", "ADDOTWEBDENUNCIO", srv_otWebDenuncio, null, false);
    addLayersToMap(credenciales, "FEATURE", "ADDPOSTE", srv_urlPostes, null, true);
    addLayersToMap(credenciales, "FEATURE", "ADDADDRESS", srv_urlDireccion, null, true);

    myMapView.addLayer(LyAddMicroOt, 23);
    myMapView.addLayer(LyAddOpenOt, 24);
    myMapView.addLayer(LyAddDenuncioOt, 25);
    myMapView.addLayer(LyAddWebDenuncioOt, 26);
    myMapView.addLayer(LyAddPoste, 27);
    myMapView.addLayer(LyAddDireccion, 28);

    arrayTipoEdif = getResources().getStringArray(R.array.tipo_edificacion);
    arrayEstado = getResources().getStringArray(R.array.estado_lectura);
    arrayUserCosenza = getResources().getStringArray(R.array.user_cosenza);

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

    if (arrayModulos != null && arrayModulos.size() > 0 && arrayModulos.contains(empresa + "@" + modIngreso)) {

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

        dialogCrear = new Dialog(OtRouteActivity.this);

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

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

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

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

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

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

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

        myMapView.addLayer(LyAddCliente, 29);
        myMapView.addLayer(LyAddUnion, 30);
        myMapView.addLayer(LyAsocTramo, 31);
        myMapView.addLayer(LyAsocCalle, 32);
        myMapView.addLayer(LyAddClienteCnr, 33);

        setLayerAddToggle(false);
    } else {
        bIngCliente = false;
        menuMultipleActions.setVisibility(View.GONE);
        //Informar al usuario que carece de permisos para ver y usar la capa de ingreso clientes comun
    }

    getUbicacionLectura(objId);
}

From source file: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();
    }//  w w w  .  j  a va2s  . c  om

    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.xmobileapp.rockplayer.RockPlayer.java

/**********************************************
 * /*from w w  w.  j a  va  2s.  c o  m*/
 *  Called when the activity is first created
 *  
 **********************************************/
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    System.gc();

    //Log.i("PRFMC", "1");
    /*
    * Window Properties
    */
    //requestWindowFeature(Window.FEATURE_PROGRESS);
    //requestWindowFeature(Window.PROGRESS_VISIBILITY_ON);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    /*
     * Blur&Dim the BG
     */
    // Have the system blur any windows behind this one.
    //        getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
    //                WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    ////        getWindow().setFlags(WindowManager.LayoutParams.FLAG_DITHER, 
    ////              WindowManager.LayoutParams.FLAG_DITHER);
    //        getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, 
    //              WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    //        WindowManager.LayoutParams params = getWindow().getAttributes();
    //        params.dimAmount = 0.625f;
    //        getWindow().setAttributes(params);

    //        Resources.Theme theme = getTheme();
    //        theme.dump(arg0, arg1, arg2)

    //setContentView(R.layout.songfest_main);
    //Log.i("PRFMC", "2");

    /*
     * Initialize Display
     */
    WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    this.display = windowManager.getDefaultDisplay();
    //Log.i("PRFMC", "3");

    /*
     * Set Bug Report Handler
     */
    fdHandler = new FilexDefaultExceptionHandler(this);

    /*
     * Check if Album Art Directory exists
     */
    checkAlbumArtDirectory();
    checkConcertDirectory();
    checkPreferencesDirectory();
    checkBackgroundDirectory();
    //Log.i("PRFMC", "7");

    /*
     * Get Preferences
     */
    readPreferences();

    /*
     * Force landscape or auto-rotate orientation if user requested
     */
    if (alwaysLandscape)
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    else if (autoRotate)
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);

    /*
      * Create UI and initialize UI vars
      */
    setContentView(R.layout.songfest_main);

    //getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    //if (true) return;

    //if(true)
    //   return;
    //Log.i("PRFMC", "4");
    initializeAnimations();
    //Log.i("PRFMC", "5");
    initializeUiVariables();
    //Log.i("PRFMC", "6");

    /*
     * Set Background
     */
    setBackground();

    /*
     * Set Current View
     */
    switch (VIEW_STATE) {
    case LIST_EXPANDED_VIEW:
        setListExpandedView();
        break;
    case FULLSCREEN_VIEW:
        setFullScreenView();
        break;
    default:
        setNormalView();
        break;
    }

    //        AlphaAnimation aAnim = new AlphaAnimation(0.0f, 0.92f);
    //        aAnim.setFillAfter(true);
    //        aAnim.setDuration(200);
    //        mainUIContainer.startAnimation(aAnim);

    /*
     * Check for SD Card
     */
    if (!android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
        Dialog noSDDialog = new Dialog(this);
        noSDDialog.setTitle("SD Card Error!");
        noSDDialog.setContentView(R.layout.no_sd_alert_layout);
        noSDDialog.show();
        return;
    }

    /*
     * Get a Content Resolver to browse
     * the phone audio database
     */
    contentResolver = getContentResolver();

    /*
     * Get Preferences
     */
    //SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    RockOnPreferenceManager settings = new RockOnPreferenceManager(FILEX_PREFERENCES_PATH);
    settings = new RockOnPreferenceManager(this.FILEX_PREFERENCES_PATH);
    // Shuffle
    boolean shuffle = settings.getBoolean("Shuffle", false);
    this.SHUFFLE = shuffle;
    //Playlist
    if (playlist == constants.PLAYLIST_NONE)
        playlist = settings.getLong(constants.PREF_KEY_PLAYLIST, constants.PLAYLIST_ALL);
    Log.i("PLAYLIST PREF", constants.PREF_KEY_PLAYLIST + " " + constants.PLAYLIST_ALL + " " + playlist);

    /*
     * Check if the MediaScanner is scanning
     */
    //        ProgressDialog pD = null;
    //        while(isMediaScannerScanning(this, contentResolver) == true){
    //           if(pD == null){
    //              pD = new ProgressDialog(this);
    //              pD.setTitle("Scanning Media");
    //              pD.setMessage("Wait please...");
    //              pD.show();
    //           }
    //           try {
    //            wait(2000);
    //         } catch (InterruptedException e) {
    //            e.printStackTrace();
    //         }
    //        }
    //        if(pD != null)
    //           pD.dismiss();

    /*
     * Initialize mediaPlayer
     */
    //this.mediaPlayer = new MediaPlayer();
    //this.mediaPlayer.setOnCompletionListener(songCompletedListener);

    /*
     * Initialize (or connect to) BG Service
     *  - when connected it will call the method getCurrentPlaying()
     *     and will cause the Service to reset its albumCursor
     */
    initializeService();
    //Log.i("PRFMC", "8");
    musicChangedIntentReceiver = new MusicChangedIntentReceiver();
    albumChangedIntentReceiver = new AlbumChangedIntentReceiver();
    mediaButtonPauseIntentReceiver = new MediaButtonPauseIntentReceiver();
    mediaButtonPlayIntentReceiver = new MediaButtonPlayIntentReceiver();
    registerReceiver(musicChangedIntentReceiver, musicChangedIntentFilter);
    //Log.i("PRFMC", "9");
    registerReceiver(albumChangedIntentReceiver, albumChangedIntentFilter);
    //Log.i("PRFMC", "10");
    registerReceiver(mediaButtonPauseIntentReceiver, mediaButtonPauseIntentFilter);
    registerReceiver(mediaButtonPlayIntentReceiver, mediaButtonPlayIntentFilter);
    // calls also getCurrentPlaying() upon connection

    /*
     * Register Media Button Receiver
     */
    //        mediaButtonIntentReceiver = new MediaButtonIntentReceiver();
    //        registerReceiver(mediaButtonIntentReceiver, new IntentFilter("android.intent.action.MEDIA_BUTTON"));

    /*
      * Get album information on a new
      * thread
      */
    //new Thread(){
    //   public void run(){
    getAlbums(false);
    //Log.i("PRFMC", "11");
    //   }
    //}.start();

    /*
     * Check for first time run ----------
     * 
     * Save Software Version
     *    &
     * Show Help Screen
     */
    //            if(!settings.contains("Version")){
    //               Editor settingsEditor = settings.edit();
    //               settingsEditor.putLong("Version", VERSION);
    //               settingsEditor.commit();
    //               this.hideMainUI();
    //               this.showHelpUI();
    //            }
    Log.i("DBG", "Version - " + (new RockOnPreferenceManager(this.FILEX_PREFERENCES_PATH)).getLong("Version", 0)
            + " - " + VERSION);
    if (!(new RockOnPreferenceManager(this.FILEX_PREFERENCES_PATH)).contains("Version")
            || (new RockOnPreferenceManager(this.FILEX_PREFERENCES_PATH)).getLong("Version", 0) < VERSION) {

        (new RockOnPreferenceManager(this.FILEX_PREFERENCES_PATH)).putLong("Version", VERSION);

        /*
        * Clear previous Album Art
        */
        Builder aD = new AlertDialog.Builder(context);
        aD.setTitle("New Version");
        aD.setMessage(
                "The new version of RockOn supports album art download from higher quality sources. Do you want to download art now? "
                        + "Every 10 albums will take aproximately 1 minute to download. "
                        + "(You can always do this later by choosing the 'Get Art' menu option)");
        aD.setPositiveButton("Yes", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                //(new RockOnPreferenceManager(FILEX_PREFERENCES_PATH)).putLong("artImportDate", 0);
                try {
                    File albumArtDir = new File(FILEX_ALBUM_ART_PATH);
                    String[] fileList = albumArtDir.list();
                    File albumArtFile;
                    for (int i = 0; i < fileList.length; i++) {
                        albumArtFile = new File(albumArtDir.getAbsolutePath() + "/" + fileList[i]);
                        albumArtFile.delete();
                    }
                    checkAlbumArtDirectory();
                    triggerAlbumArtFetching();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

        });
        aD.setNegativeButton("No", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {

            }

        });
        aD.show();

        /*
        * Version 2 specific default preference changes
        */
        // version 2 specific
        if (albumCursor.getCount() > 100)
            (new RockOnPreferenceManager(this.FILEX_PREFERENCES_PATH))
                    .putBoolean(PREFS_SHOW_ART_WHILE_SCROLLING, false);
        else
            (new RockOnPreferenceManager(this.FILEX_PREFERENCES_PATH))
                    .putBoolean(PREFS_SHOW_ART_WHILE_SCROLLING, true);

        readPreferences();
        albumAdapter.showArtWhileScrolling = showArtWhileScrolling;
        albumAdapter.showFrame = showFrame;
        //

        /*
        * Show help screen
        */
        this.hideMainUI();
        this.showHelpUI();
    } else {
        /*
         * Run albumArt getter in background
         */
        long lastAlbumArtImportDate = settings.getLong("artImportDate", 0);
        Log.i("SYNCTIME",
                lastAlbumArtImportDate + " + " + this.ART_IMPORT_INTVL + " < " + System.currentTimeMillis());
        if (lastAlbumArtImportDate + this.ART_IMPORT_INTVL < System.currentTimeMillis()) {
            triggerAlbumArtFetching();
        }
        //Log.i("PRFMC", "13");
    }
}

From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java

void init() {

    //        img=(ImageView)findViewById(R.id.logo);

    TextView build = (TextView) findViewById(R.id.checkfornew);
    build.setOnClickListener(new View.OnClickListener() {
        @Override//from  w  w w  .j  av a 2 s  . c  om
        public void onClick(View v) {
            if (android.os.Build.VERSION.SDK_INT > 9) {
                StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
                StrictMode.setThreadPolicy(policy);
            }

            CommonUtilities.logMe("about to check for version ");
            try {
                WebServiceHandler wsb = new WebServiceHandler();
                ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
                String result = wsb.getWebServiceData("http://doe.emergencyskills.com/api/version.php",
                        postParameters);
                JSONObject jsonObject = new JSONObject(result);
                String version = jsonObject.getString("version");
                String features = jsonObject.getString("features");
                System.err.println("version is : " + version);
                if (!LoginActivity.myversion.equals(version)) {
                    MyToast.popmessagelong(
                            "There is a new build available. Please download for these features: " + features,
                            TabsActivity.this);
                    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://vireo.org/esiapp"));
                    browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(browserIntent);
                } else {
                    MyToast.popmessagelong("You have the most current version!", TabsActivity.this);
                }
            } catch (Exception exc) {
                exc.printStackTrace();
            }

        }
    });

    TextView maillog = (TextView) findViewById(R.id.maillog);
    maillog.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            final Dialog dialog = new Dialog(TabsActivity.this);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.dialog_logout);

            TextView question = (TextView) dialog.findViewById(R.id.question);
            question.setText("Are you sure you want to email the log?");
            TextView extra = (TextView) dialog.findViewById(R.id.extratext);
            extra.setText("");

            dialog.getWindow().setBackgroundDrawable(
                    new ColorDrawable(getResources().getColor(android.R.color.transparent)));
            Button yes = (Button) dialog.findViewById(R.id.yesbtn);
            yes.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    Intent i = new Intent(Intent.ACTION_SEND);
                    i.setType("message/rfc822");
                    i.putExtra(Intent.EXTRA_EMAIL, new String[] { "rachelc@gmail.com" });
                    i.putExtra(Intent.EXTRA_SUBJECT, "Sending Log");
                    i.putExtra(Intent.EXTRA_TEXT, "body of email");
                    try {
                        startActivity(Intent.createChooser(i, "Send mail..."));
                    } catch (android.content.ActivityNotFoundException ex) {
                        Toast.makeText(TabsActivity.this, "There are no email clients installed.",
                                Toast.LENGTH_SHORT).show();
                    }

                    finish();
                }
            });
            Button no = (Button) dialog.findViewById(R.id.nobtn);
            no.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });
            ImageView close = (ImageView) dialog.findViewById(R.id.ivClose);
            close.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });

            dialog.show();

        }
    });

    listops listops = new listops(TabsActivity.this);
    CommonUtilities.logMe("logging in as: " + listops.getString("firstname"));
    TextView name = (TextView) findViewById(R.id.welcome);
    name.setText("Welcome, " + listops.getString("firstname"));

    TextView logoutname = (TextView) findViewById(R.id.logoutname);
    logoutname.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final Dialog dialog = new Dialog(TabsActivity.this);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.dialog_logout);
            dialog.getWindow().setBackgroundDrawable(
                    new ColorDrawable(getResources().getColor(android.R.color.transparent)));
            dialog.setContentView(R.layout.dialog_logout);
            Button yes = (Button) dialog.findViewById(R.id.yesbtn);
            yes.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    MyToast.popmessagelong("Logging out... ", TabsActivity.this);
                    SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
                    SharedPreferences.Editor editor = prefs.edit();
                    editor.putString(Constants.loginkey, "");
                    editor.commit();
                    listops listops = new listops(TabsActivity.this);
                    //make sure to remove the downloaded schools

                    Intent intent = new Intent(TabsActivity.this, LoginActivity.class);
                    startActivity(intent);
                    ArrayList<Schoolinfomodel> ls = new ArrayList<Schoolinfomodel>();
                    listops.putdrilllist(ls);
                    listops.putservicelist(ls);
                    listops.putinstallllist(ls);
                    ArrayList<PendingUploadModel> l = new ArrayList<PendingUploadModel>();
                    listops.putpendinglist(l);

                    finish();
                }
            });
            Button no = (Button) dialog.findViewById(R.id.nobtn);
            no.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });
            ImageView close = (ImageView) dialog.findViewById(R.id.ivClose);
            close.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });

            dialog.show();
        }

    });

    ll1 = (LinearLayout) findViewById(R.id.ll1);
    ll2 = (LinearLayout) findViewById(R.id.ll2);
    ll3 = (LinearLayout) findViewById(R.id.ll3);
    ll4 = (LinearLayout) findViewById(R.id.ll4);
    ll5 = (LinearLayout) findViewById(R.id.ll5);
    ll6 = (LinearLayout) findViewById(R.id.ll6);
    ll1.setBackgroundColor(getResources().getColor(R.color.White));

    llPickSchools = (LinearLayout) findViewById(R.id.llPickSchool);
    llDrills = (LinearLayout) findViewById(R.id.llDrills);
    llServiceCalls = (LinearLayout) findViewById(R.id.llServiceCalls);
    llNewInstalls = (LinearLayout) findViewById(R.id.llNewInstalls);
    llPendingUploads = (LinearLayout) findViewById(R.id.llPendingUploads);

    frameLayout = (FrameLayout) findViewById(R.id.frame);

}

From source file:biz.bokhorst.xprivacy.ActivityApp.java

private void optionHelp() {
    // Show help/*from w  w  w.ja  v a  2  s.c o  m*/
    Dialog dialog = new Dialog(ActivityApp.this);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setTitle(R.string.menu_help);
    dialog.setContentView(R.layout.help);
    dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
    ((ImageView) dialog.findViewById(R.id.imgHelpHalf)).setImageBitmap(getHalfCheckBox());
    ((ImageView) dialog.findViewById(R.id.imgHelpOnDemand)).setImageBitmap(getOnDemandCheckBox());
    dialog.setCancelable(true);
    dialog.show();
}

From source file:com.birdeye.MainActivity.java

private void removeAdsDialog() {

    final Dialog dialog = new Dialog(MainActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    dialog.setContentView(R.layout.progress_pre);

    TextView tv_pay15 = (TextView) dialog.findViewById(R.id.tv_pay15);

    tv_pay15.setOnClickListener(new View.OnClickListener() {
        @Override//from   ww  w .  ja  v a 2 s  .  c o  m
        public void onClick(View v) {

            if (!BillingProcessor.isIabServiceAvailable(MainActivity.this)) {
                showToast(
                        "In-app billing service is unavailable, please upgrade Android Market/Play to version >= 3.9.16");
            }

            else {

                //    asdasd

                //  onFuturePaymentPressed(v);
                bp.subscribe(MainActivity.this, SUBSCRIPTION_ID);

            }

            dialog.dismiss();

        }
    });

    dialog.setCancelable(true);

    dialog.show();

}

From source file:com.popdeem.sdk.uikit.activity.PDUIClaimActivity.java

private void addRewardDetailsToUI() {
    // Logo/*from ww  w  .j a  va  2s . com*/
    final ImageView logoImageView = (ImageView) findViewById(R.id.pd_reward_star_image_view);
    final String imageUrl = mReward.getCoverImage();
    if (imageUrl == null || imageUrl.isEmpty() || imageUrl.contains("default")) {
        Glide.with(this).load(R.drawable.pd_ui_star_icon).error(R.drawable.pd_ui_star_icon).dontAnimate()
                .placeholder(R.drawable.pd_ui_star_icon).into(logoImageView);
    } else {
        Glide.with(this).load(imageUrl).error(R.drawable.pd_ui_star_icon).dontAnimate()
                .placeholder(R.drawable.pd_ui_star_icon).into(logoImageView);
    }

    // Reward Description
    TextView textView = (TextView) findViewById(R.id.pd_reward_offer_text_view);
    textView.setText(mReward.getDescription());

    // Rules
    textView = (TextView) findViewById(R.id.pd_reward_item_rules_text_view);
    textView.setText(mReward.getRules());
    if (mReward.getRules() == null || mReward.getRules().isEmpty()) {
        textView.setVisibility(View.GONE);
    }

    StringBuilder actionStringBuilder = new StringBuilder("");

    // Action
    final boolean TWITTER_ACTION_REQUIRED = twitterShareForced();
    if (mReward.getAction().equalsIgnoreCase(PDReward.PD_REWARD_ACTION_PHOTO)) {
        actionStringBuilder.append(getString(TWITTER_ACTION_REQUIRED ? R.string.pd_claim_action_tweet_photo
                : R.string.pd_claim_action_photo_camera));
    } else if (mReward.getAction().equalsIgnoreCase(PDReward.PD_REWARD_ACTION_CHECKIN)) {
        actionStringBuilder.append(getString(TWITTER_ACTION_REQUIRED ? R.string.pd_claim_action_tweet_checkin
                : R.string.pd_claim_action_checkin));
    } else {
        actionStringBuilder.append(getString(R.string.pd_claim_action_none));
    }

    // End date
    long timeInSecs = PDNumberUtils.toLong(mReward.getAvailableUntilInSeconds(), -1);
    String convertedTimeString = PDUIUtils.convertTimeToDayAndMonth(timeInSecs);
    if (!convertedTimeString.isEmpty()) {
        actionStringBuilder.append(String.format(Locale.getDefault(), " | Exp %1s", convertedTimeString));
    }

    textView = (TextView) findViewById(R.id.pd_reward_request_text_view);
    textView.setText(actionStringBuilder.toString());
    textView.setVisibility(View.GONE);

    //add photo
    addPhotoView = findViewById(R.id.pd_share_view_icon_holder);
    addedPhotoView = findViewById(R.id.pd_share_view_taken_holder);
    TextView infoView = findViewById(R.id.pd_claim_info_text);

    //already shared button
    LinearLayout alreadySharedButton = findViewById(R.id.pd_claim_already_shared_view);
    TextView alreadySharedText = findViewById(R.id.pd_claim_already_shared_button);

    if (mReward.getAction().equalsIgnoreCase(PDReward.PD_REWARD_ACTION_PHOTO)) {
        alreadySharedText.setText(getResources().getString(R.string.pd_claim_scan_for_already_shared_text));
        infoView.setText(String.format(getResources().getString(R.string.pd_claim_info_photo),
                mReward.getGlobalHashtag()));
    } else {
        alreadySharedText
                .setText(getResources().getString(R.string.pd_claim_scan_for_already_shared_activity_text));
        infoView.setText(String.format(getResources().getString(R.string.pd_claim_info_check_in),
                mReward.getGlobalHashtag()));
    }

    alreadySharedButton.setOnClickListener(this);
    if (mReward.getGlobalHashtag() != null && !mReward.getGlobalHashtag().equalsIgnoreCase("")) {
        //            alreadySharedButton.setText(String.format(getString(R.string.pd_claim_get_already_shared_text), mReward.getGlobalHashtag()));
    } else {
        //            alreadySharedButton.setText(R.string.pd_claim_already_shared_default);
    }

    infoIcon.setVisibility(View.VISIBLE);
    infoIcon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            final Dialog dialog = new Dialog(PDUIClaimActivity.this);
            PDUIDialogUtils.setMargins(dialog, 25, 100, 25, 100);
            dialog.setContentView(R.layout.claim_alert_dialog);
            Button claim = (Button) dialog.findViewById(R.id.button_claim);
            Button cancel = (Button) dialog.findViewById(R.id.button_cancel);
            ImageView icon = (ImageView) dialog.findViewById(R.id.icon);

            String imageUrl = mReward.getCoverImage();
            if (imageUrl == null || imageUrl.isEmpty() || imageUrl.contains("default")) {
                Glide.with(PDUIClaimActivity.this).load(R.drawable.pd_ui_star_icon).dontAnimate()
                        .error(R.drawable.pd_ui_star_icon).dontAnimate().placeholder(R.drawable.pd_ui_star_icon)
                        .into(icon);
            } else {

                Glide.with(PDUIClaimActivity.this).load(imageUrl).dontAnimate()
                        .error(R.drawable.pd_ui_star_icon).dontAnimate().placeholder(R.drawable.pd_ui_star_icon)
                        .into(icon);
            }

            claim.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    dialog.dismiss();
                }
            });
            claim.setText("Close");

            cancel.setVisibility(View.GONE);

            TextView tvTitle = dialog.findViewById(R.id.alertTitle);
            tvTitle.setText(mReward.getDescription());

            TextView message = dialog.findViewById(R.id.message);
            message.setText(mReward.getRules());

            TextView detailsActionText = (TextView) dialog.findViewById(R.id.pd_action_text);
            setActionString(detailsActionText);

            dialog.show();
        }
    });

}