List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE
String LAYOUT_INFLATER_SERVICE
To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.
Click Source Link
From source file:com.dragon4.owo.ar_trace.ARCore.MixView.java
public TopLayoutOnMixView(final Context context) { this.context = context; inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mainArView = inflater.inflate(R.layout.activity_ar_mixview, null); initButtonViews();/*from w w w . j a v a 2 s.c o m*/ initNaverMap(); initSearchbar(); }
From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragment.java
/** * Populate overzicht fragment from local member vars *//* ww w .j a va 2s .c om*/ private void populateOverzichtFragment() { if (mOverzichtFragmentReady) { // TODO: show the changes in case we are editing an existing dagvergunning // koopman if (mKoopmanId > 0) { mOverzichtFragment.mKoopmanLinearLayout.setVisibility(View.VISIBLE); mOverzichtFragment.mKoopmanEmptyTextView.setVisibility(View.GONE); // koopman details mOverzichtFragment.setKoopman(mKoopmanId); // dagvergunning registratie tijd if (mRegistratieDatumtijd != null) { try { Date registratieDate = new SimpleDateFormat(getString(R.string.date_format_datumtijd), Locale.getDefault()).parse(mRegistratieDatumtijd); SimpleDateFormat sdf = new SimpleDateFormat(getString(R.string.date_format_tijd)); String registratieTijd = sdf.format(registratieDate); mOverzichtFragment.mRegistratieDatumtijdText.setText(registratieTijd); } catch (java.text.ParseException e) { Utility.log(getContext(), LOG_TAG, "Format registratie tijd failed: " + e.getMessage()); } } else { mOverzichtFragment.mRegistratieDatumtijdText.setText(""); } // dagvergunning notitie if (mNotitie != null && !mNotitie.equals("")) { mOverzichtFragment.mNotitieText.setText(getString(R.string.label_notitie) + ": " + mNotitie); Utility.collapseView(mOverzichtFragment.mNotitieText, false); } else { Utility.collapseView(mOverzichtFragment.mNotitieText, true); } // dagvergunning totale lengte if (mTotaleLengte != -1) { mOverzichtFragment.mTotaleLengte .setText(mTotaleLengte + " " + getString(R.string.length_meter)); } // registratie account naam if (mRegistratieAccountNaam != null) { mOverzichtFragment.mAccountNaam.setText(mRegistratieAccountNaam); } else { mOverzichtFragment.mAccountNaam.setText(""); } // koopman aanwezig status if (mKoopmanAanwezig != null) { // get the corresponding aanwezig title from the resource array based on the aanwezig key String[] aanwezigKeys = getResources().getStringArray(R.array.array_aanwezig_key); String[] aanwezigTitles = getResources().getStringArray(R.array.array_aanwezig_title); String aanwezigTitle = ""; for (int i = 0; i < aanwezigKeys.length; i++) { if (aanwezigKeys[i].equals(mKoopmanAanwezig)) { aanwezigTitle = aanwezigTitles[i]; } } mOverzichtFragment.mAanwezigText.setText(aanwezigTitle); } // vervanger if (mVervangerId > 0) { // hide the aanwezig status and populate and show the vervanger details mOverzichtFragment.mAanwezigText.setVisibility(View.GONE); mOverzichtFragment.mVervangerDetail.setVisibility(View.VISIBLE); mOverzichtFragment.setVervanger(mVervangerId); } else { // show the aanwezig status and hide the vervanger details mOverzichtFragment.mAanwezigText.setVisibility(View.VISIBLE); mOverzichtFragment.mVervangerDetail.setVisibility(View.GONE); } } else { mOverzichtFragment.mKoopmanEmptyTextView.setVisibility(View.VISIBLE); mOverzichtFragment.mKoopmanLinearLayout.setVisibility(View.GONE); } // product if (mErkenningsnummer != null && isProductSelected()) { // show progress bar mProgressbar.setVisibility(View.VISIBLE); // disable save function until we have a response from the api for a concept factuur mConceptFactuurDownloaded = false; // post the dagvergunning details to the api and retrieve a concept 'factuur' ApiPostDagvergunningConcept postDagvergunningConcept = new ApiPostDagvergunningConcept( getContext()); postDagvergunningConcept.setPayload(dagvergunningToJson()); postDagvergunningConcept.enqueue(new Callback<JsonObject>() { @Override public void onResponse(Response<JsonObject> response) { // hide progress bar mProgressbar.setVisibility(View.GONE); if (response.isSuccess() && response.body() != null) { mOverzichtFragment.mProductenLinearLayout.setVisibility(View.VISIBLE); mOverzichtFragment.mProductenEmptyTextView.setVisibility(View.GONE); // enable save function and give wizard next button background enabled color mConceptFactuurDownloaded = true; mWizardNextButton .setBackgroundColor(ContextCompat.getColor(getContext(), R.color.accent)); // from the response, populate the product section of the overzicht fragment View overzichtView = mOverzichtFragment.getView(); if (overzichtView != null) { // find placeholder table layout view TableLayout placeholderLayout = (TableLayout) overzichtView .findViewById(R.id.producten_placeholder); if (placeholderLayout != null) { placeholderLayout.removeAllViews(); LayoutInflater layoutInflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // get the producten array JsonArray producten = response.body().getAsJsonArray(getString( R.string.makkelijkemarkt_api_dagvergunning_concept_producten)); if (producten != null) { int rowCount = 0; // table header View headerLayout = layoutInflater .inflate(R.layout.dagvergunning_overzicht_product_item, null); TextView btwHeaderText = (TextView) headerLayout .findViewById(R.id.btw_totaal); btwHeaderText.setText("BTW"); TextView exclusiefHeaderText = (TextView) headerLayout .findViewById(R.id.bedrag_totaal); exclusiefHeaderText.setText("Ex. BTW"); placeholderLayout.addView(headerLayout, rowCount++); for (int i = 0; i < producten.size(); i++) { JsonObject product = producten.get(i).getAsJsonObject(); // get the product item layout View childLayout = layoutInflater .inflate(R.layout.dagvergunning_overzicht_product_item, null); // aantal if (product.get("aantal") != null && !product.get("aantal").isJsonNull()) { TextView aantalText = (TextView) childLayout .findViewById(R.id.product_aantal); aantalText.setText(product.get("aantal").getAsInt() + " x "); } // naam if (product.get("naam") != null && !product.get("naam").isJsonNull()) { TextView naamText = (TextView) childLayout .findViewById(R.id.product_naam); naamText.setText( Utility.capitalize(product.get("naam").getAsString())); } // btw % if (product.get("btw_percentage") != null && !product.get("btw_percentage").isJsonNull()) { long btwPercentage = Math.round(Double .parseDouble(product.get("btw_percentage").getAsString())); if (btwPercentage != 0) { TextView btwPercentageText = (TextView) childLayout .findViewById(R.id.btw_percentage); btwPercentageText.setText(btwPercentage + "%"); } } // btw totaal if (product.get("btw_totaal") != null && !product.get("btw_totaal").isJsonNull()) { double btwTotaalProduct = Double .parseDouble(product.get("btw_totaal").getAsString()); TextView btwTotaalText = (TextView) childLayout .findViewById(R.id.btw_totaal); if (Math.round(btwTotaalProduct) != 0) { btwTotaalText .setText(String.format(" %.2f", btwTotaalProduct)); } else { btwTotaalText.setText("-"); } } // bedrag totaal if (product.get("totaal") != null && !product.get("totaal").isJsonNull()) { double bedragTotaal = Double .parseDouble(product.get("totaal").getAsString()); TextView bedragTotaalText = (TextView) childLayout .findViewById(R.id.bedrag_totaal); bedragTotaalText.setText(String.format(" %.2f", bedragTotaal)); } // add child view placeholderLayout.addView(childLayout, rowCount++); } // exclusief double exclusief = 0; if (response.body().get("exclusief") != null && !response.body().get("exclusief").isJsonNull()) { exclusief = Double .parseDouble(response.body().get("exclusief").getAsString()); } // totaal double totaal = 0; if (response.body().get("totaal") != null && !response.body().get("totaal").isJsonNull()) { totaal = response.body().get("totaal").getAsDouble(); } // totaal btw en ex. btw View totaalLayout = layoutInflater .inflate(R.layout.dagvergunning_overzicht_product_item, null); TextView naamText = (TextView) totaalLayout.findViewById(R.id.product_naam); naamText.setText("Totaal"); TextView btwTotaalText = (TextView) totaalLayout .findViewById(R.id.btw_totaal); if (Math.round(totaal - exclusief) != 0) { btwTotaalText.setText(String.format(" %.2f", (totaal - exclusief))); } TextView exclusiefText = (TextView) totaalLayout .findViewById(R.id.bedrag_totaal); exclusiefText.setText(String.format(" %.2f", exclusief)); placeholderLayout.addView(totaalLayout, rowCount++); // separator View emptyLayout = layoutInflater .inflate(R.layout.dagvergunning_overzicht_product_item, null); placeholderLayout.addView(emptyLayout, rowCount++); // totaal inc. btw View totaalIncLayout = layoutInflater .inflate(R.layout.dagvergunning_overzicht_product_item, null); TextView totaalNaamText = (TextView) totaalIncLayout .findViewById(R.id.product_naam); totaalNaamText.setText("Totaal inc. BTW"); TextView totaalIncText = (TextView) totaalIncLayout .findViewById(R.id.bedrag_totaal); totaalIncText.setText(String.format(" %.2f", totaal)); placeholderLayout.addView(totaalIncLayout, rowCount); } } } } } @Override public void onFailure(Throwable t) { mProgressbar.setVisibility(View.GONE); } }); } else { mOverzichtFragment.mProductenLinearLayout.setVisibility(View.GONE); if (mKoopmanId > 0) { mOverzichtFragment.mProductenEmptyTextView.setVisibility(View.VISIBLE); } } } }
From source file:cl.gisred.android.CatastroActivity.java
public void dialogBusqueda() { AlertDialog.Builder dialogBusqueda = new AlertDialog.Builder(this); dialogBusqueda.setTitle("Busqueda"); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.dialog_busqueda, null); dialogBusqueda.setView(v);//from www. j a v a 2 s. c o m Spinner spinner = (Spinner) v.findViewById(R.id.spinnerBusqueda); final LinearLayout llBuscar = (LinearLayout) v.findViewById(R.id.llBuscar); final LinearLayout llDireccion = (LinearLayout) v.findViewById(R.id.llBuscarDir); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, searchArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { SpiBusqueda = position; if (position != 3) { if (llDireccion != null) llDireccion.setVisibility(View.GONE); if (llBuscar != null) llBuscar.setVisibility(View.VISIBLE); } else { if (llDireccion != null) llDireccion.setVisibility(View.VISIBLE); if (llBuscar != null) llBuscar.setVisibility(View.GONE); } } @Override public void onNothingSelected(AdapterView<?> parent) { Toast.makeText(getApplicationContext(), "Nada seleccionado", Toast.LENGTH_SHORT).show(); } }); final EditText eSearch = (EditText) v.findViewById(R.id.txtBuscar); final EditText eStreet = (EditText) v.findViewById(R.id.txtCalle); final EditText eNumber = (EditText) v.findViewById(R.id.txtNum); dialogBusqueda.setPositiveButton("Buscar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (SpiBusqueda == 3) { txtBusqueda = new String(); if (!eStreet.getText().toString().isEmpty()) txtBusqueda = (eNumber.getText().toString().trim().isEmpty()) ? "0 " : eNumber.getText().toString().trim() + " "; txtBusqueda = txtBusqueda + eStreet.getText().toString(); } else { txtBusqueda = eSearch.getText().toString(); } if (txtBusqueda.trim().isEmpty()) { Toast.makeText(myMapView.getContext(), "Debe ingresar un valor", Toast.LENGTH_SHORT).show(); } else { // Escala de calle para busquedas por default // TODO Asignar a res values o strings iBusqScale = 4000; switch (SpiBusqueda) { case 0: callQuery(txtBusqueda, getValueByEmp("CLIENTES_XY_006.nis"), LyCLIENTES.getUrl().concat("/0")); if (LyCLIENTES.getLayers() != null && LyCLIENTES.getLayers().length > 0) iBusqScale = LyCLIENTES.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 1: callQuery(txtBusqueda, "codigo", LySED.getUrl().concat("/1")); if (LySED.getLayers() != null && LySED.getLayers().length > 1) iBusqScale = LySED.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 2: callQuery(txtBusqueda, "rotulo", LyPOSTES.getUrl().concat("/0")); if (LyPOSTES.getLayers() != null && LyPOSTES.getLayers().length > 0) iBusqScale = LyPOSTES.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 3: iBusqScale = 5000; String[] sBuscar = { eStreet.getText().toString(), eNumber.getText().toString() }; String[] sFields = { "nombre_calle", "numero" }; callQuery(sBuscar, sFields, LyDIRECCIONES.getUrl().concat("/0")); break; } } } }); dialogBusqueda.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); dialogBusqueda.show(); }
From source file:cl.gisred.android.MapsActivity.java
public void setActionsDialog(final int idRes, String sNombre) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(idRes, null); v.setMinimumWidth(400);/* ww w.j av a2 s .com*/ dialogCrear.setTitle(sNombre); dialogCrear.setContentView(v); idResLayoutSelect = idRes; setSpinnerDialog(idRes, v); if (idRes != R.layout.dialog_poste) { setButtonAsociacion(v); } btnUbicacion = (ImageButton) v.findViewById(R.id.btnUbicacion); btnUbicacion.setColorFilter(Color.RED); btnUbicacion.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bMapTap = true; dialogCrear.hide(); } }); ImageButton btnClose = (ImageButton) v.findViewById(R.id.btnCancelar); btnClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { cerrarDialogCrear(false, null); } }); ImageButton btnOk = (ImageButton) v.findViewById(R.id.btnConfirmar); btnOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { cerrarDialogCrear(true, v); } }); arrayTouchs = new ArrayList<>(); setEnabledDialog(false); dialogCrear.show(); }
From source file:org.cryptsecure.Utility.java
/** * Sets the content view with custom title. This is necessary for a holo * layout where a custom title bar is normally not permitted. * //from w ww . ja v a 2 s . c o m * @param activity * the activity * @param resIdMainLayout * the res id main layout * @param resIdTitle * the res id title * @return the linear layout */ public static LinearLayout setContentViewWithCustomTitle(Activity activity, int resIdMainLayout, int resIdTitle) { Context context = activity.getApplicationContext(); // Inflate the given layouts LayoutInflater inflaterInfo = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View titleView = (View) inflaterInfo.inflate(resIdTitle, null); View mainView = (View) inflaterInfo.inflate(resIdMainLayout, null); // Own custom title bar // // ATTENTION: // ADD THIS TO THEME <item name="android:windowNoTitle">true</item> activity.requestWindowFeature(Window.FEATURE_NO_TITLE); // We can ONLY disable the original title bar because you cannot combine // HOLO theme with a CUSTOM title bar :( // So we make our own title bar instead! // ALSO REMOVE TITLEBAR FROM APPLICATION AT STARTUP: // ADD TO MANIFEST // android:theme="@android:style/Theme.NoTitleBar" // THE FOLLOWING IS NOT WORKING WITH HOLO // requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); // setContentView(R.layout.activity_main); // getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, // R.layout.title_main); // Create title layout LinearLayout.LayoutParams lpTitle = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout titleLayout = new LinearLayout(context); titleLayout.setOrientation(LinearLayout.VERTICAL); titleLayout.addView(titleView); titleLayout.setLayoutParams(lpTitle); // Create main layout LinearLayout.LayoutParams lpMain = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout mainLayout = new LinearLayout(context); mainLayout.setOrientation(LinearLayout.VERTICAL); mainLayout.addView(mainView); mainLayout.setLayoutParams(lpMain); // Create root outer layout LinearLayout outerLayout = new LinearLayout(context); outerLayout.setOrientation(LinearLayout.VERTICAL); outerLayout.addView(titleLayout); outerLayout.addView(mainLayout); // outerLayout.setBackgroundColor(Color.rgb(255, 0, 0)); // mainLayout.setBackgroundColor(Color.rgb(0, 255, 0)); // titleLayout.setBackgroundColor(Color.rgb(0, 0, 255)); // lpSectionInnerLeft.setMargins(20, 5, 0, 15); // LinearLayout.LayoutParams lpSectionInnerRight = new // LinearLayout.LayoutParams( // 90, LinearLayout.LayoutParams.WRAP_CONTENT, 0f); // lpSectionInnerRight.setMargins(0, 5, 15, 15); // After setting NO TITLE .. apply the layout activity.setContentView(outerLayout); return mainLayout; }
From source file:com.cybrosys.scientific.EventListener.java
@SuppressWarnings("deprecation") public void mode(String strDisplay, int inMode) { LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); vwLayout = inflater.inflate(R.layout.fse, (ViewGroup) ((Activity) ctx).findViewById(R.id.popup_element)); popmW1 = new PopupWindow(vwLayout, PalmCalcActivity.inDispwidth, PalmCalcActivity.inDispheight, true); popmW1.setBackgroundDrawable(new BitmapDrawable()); popmW1.setOutsideTouchable(true);//from w ww.j a v a 2 s. co m TextView txtvHeaderPop = (TextView) vwLayout.findViewById(R.id.txtvHeaderFse); popmW1.showAtLocation(vwLayout, Gravity.CENTER, 0, 30); ImageButton btnCancel = (ImageButton) vwLayout.findViewById(R.id.butcancelmain); btnCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { popmW1.dismiss(); } }); btnsM[0] = (Button) vwLayout.findViewById(R.id.btn1); btnsM[1] = (Button) vwLayout.findViewById(R.id.btn2); btnsM[2] = (Button) vwLayout.findViewById(R.id.btn3); btnsM[3] = (Button) vwLayout.findViewById(R.id.btn4); btnsM[4] = (Button) vwLayout.findViewById(R.id.btn5); btnsM[5] = (Button) vwLayout.findViewById(R.id.btn6); btnsM[6] = (Button) vwLayout.findViewById(R.id.btn7); btnsM[7] = (Button) vwLayout.findViewById(R.id.btn8); btnsM[8] = (Button) vwLayout.findViewById(R.id.btn9); btnsM[9] = (Button) vwLayout.findViewById(R.id.btn10); switch (inMode) { case 1: for (int inI = 1; inI <= 10; inI++) { btnsM[inI - 1].setText(fixDisp(Double.parseDouble(strDisplay), inI)); final int inK = inI; btnsM[inI - 1].setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { PreferenceClass.setMyIntPref(ctx, inK); ScientificActivity.txtvFSE.setText("FIX:" + (inK - 1)); popmW1.dismiss(); } }); } break; case 2: txtvHeaderPop.setText("Significant Digits"); for (int inI = 1; inI <= 10; inI++) { btnsM[inI - 1].setText(sciDisp(Double.parseDouble(strDisplay), inI)); final int inK = inI; btnsM[inI - 1].setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { inP = inK; ScientificActivity.txtvFSE.setText("SCI:" + inK); PreferenceClass.setMyIntPref(ctx, inP); popmW1.dismiss(); } }); } break; case 3: break; } }
From source file:androidx.media.widget.VideoView2.java
private void inflateMusicView(int layoutId) { removeView(mMusicView);/*w w w .j av a 2 s .co m*/ LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(layoutId, null); v.setBackgroundColor(mDominantColor); ImageView albumView = v.findViewById(R.id.album); if (albumView != null) { albumView.setImageDrawable(mMusicAlbumDrawable); } TextView titleView = v.findViewById(R.id.title); if (titleView != null) { titleView.setText(mMusicTitleText); } TextView artistView = v.findViewById(R.id.artist); if (artistView != null) { artistView.setText(mMusicArtistText); } mMusicView = v; addView(mMusicView, 0); }
From source file:com.dsdar.thosearoundme.TeamViewActivity.java
@Override public void onMapLongClick(LatLng point) { if (TeamMapFragment.isStickyTeam.equals("true")) { // if (MyAppConstants.ISOWNER) { View marker1 = ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)) .inflate(R.layout.sticky_marker, null); ImageView sticky_marker_img = (ImageView) marker1.findViewById(R.id.stikcy_marker_img); // marker_img.getBackground().setColorFilter(-9175296, // Mode.SRC_IN); sticky_marker_img.setBackgroundResource(R.drawable.pin_red); if (MyAppConstants.myStickyMarker != null) { MyAppConstants.myStickyMarker.remove(); }//w w w.jav a 2s . c om MyAppConstants.myStickyMarker = itsGoogleMap.addMarker(new MarkerOptions() .position(new LatLng(point.latitude, point.longitude)) .icon(BitmapDescriptorFactory.fromBitmap(TeamMapFragment.createDrawableFromView(this, marker1))) .draggable(true)); insertStickyTeamMarkerInfo(point.latitude, point.longitude, null, null, null, null); } // } }
From source file:cl.gisred.android.CatastroActivity.java
public void setActionsForm(final int idRes, String sNombre) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(idRes, null); final int topeWidth = 650; ArrayAdapter<CharSequence> adapter; DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int widthSize = displayMetrics.widthPixels; int widthScale = (widthSize * 3) / 4; if (topeWidth < widthScale) widthScale = topeWidth;// w ww . j a v a2 s . c om v.setMinimumWidth(widthScale); formCrear.setTitle(sNombre); formCrear.setContentView(v); idResLayoutSelect = idRes; Spinner spTipoEquipo = (Spinner) v.findViewById(R.id.spinnerTipoEquipo); adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, arrayTipoEquipo); spTipoEquipo.setAdapter(adapter); Spinner spTipoCaja = (Spinner) v.findViewById(R.id.spinnerTipoCaja); adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, arrayTipoCaja); spTipoCaja.setAdapter(adapter); Spinner spTipoConex = (Spinner) v.findViewById(R.id.spinnerTipoConex); adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, arrayTipoConex); spTipoConex.setAdapter(adapter); Spinner spEstadoMedidor = (Spinner) v.findViewById(R.id.spinnerEstadoMedidor); adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, arrayEstadoMedidor); spEstadoMedidor.setAdapter(adapter); Spinner spPropiedad = (Spinner) v.findViewById(R.id.spinnerPropiedad); adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, arrayPropiedad); spPropiedad.setAdapter(adapter); Spinner spAccesoLectura = (Spinner) v.findViewById(R.id.spinnerAccesoLectura); adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, arrayAccesoLectura); spAccesoLectura.setAdapter(adapter); Spinner spTipoIrregular = (Spinner) v.findViewById(R.id.spinnerTipoIrregular); adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, arrayTipoIrregularidad); spTipoIrregular.setAdapter(adapter); Spinner spResultado = (Spinner) v.findViewById(R.id.spinnerResultado); adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, arrayResultadoCatastro); spResultado.setAdapter(adapter); ImageButton btnIdentPoste = (ImageButton) v.findViewById(R.id.btnPoste); btnIdentPoste.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { formCrear.hide(); bMapTap = true; bCallOut = true; oLySelectAsoc = LyAddPoste; oLyExistAsoc = LyPOSTES; oLyExistAsoc.setVisible(true); myMapView.zoomToScale(ldm.getPoint(), oLyExistAsoc.getMinScale() * 0.9); Log.w("[CatastroActivity]", "HIDE FORM POSTE and Zoom"); setValueToAsoc(getLayoutContenedor(view)); } }); btnUbicacion = (ImageButton) v.findViewById(R.id.btnUbicacion); btnUbicacion.setColorFilter(Color.RED); btnUbicacion.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bMapTap = true; formCrear.hide(); } }); ImageButton btnClose = (ImageButton) v.findViewById(R.id.btnCancelar); btnClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { cerrarFormCrear(false, v); } }); ImageButton btnOk = (ImageButton) v.findViewById(R.id.btnConfirmar); btnOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { cerrarFormCrear(true, v); } }); arrayTouchs = new ArrayList<>(); setEnabledDialog(false); formCrear.show(); dialogCur = formCrear; }
From source file:cl.gisred.android.LectorActivity.java
public void dialogBusqueda() { AlertDialog.Builder dialogBusqueda = new AlertDialog.Builder(this); dialogBusqueda.setTitle("Busqueda"); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.dialog_busqueda, null); dialogBusqueda.setView(v);/* ww w .j a v a 2 s .c om*/ Spinner spinner = (Spinner) v.findViewById(R.id.spinnerBusqueda); final LinearLayout llBuscar = (LinearLayout) v.findViewById(R.id.llBuscar); final LinearLayout llDireccion = (LinearLayout) v.findViewById(R.id.llBuscarDir); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, searchArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { SpiBusqueda = position; if (position != 4) { if (llDireccion != null) llDireccion.setVisibility(View.GONE); if (llBuscar != null) llBuscar.setVisibility(View.VISIBLE); } else { if (llDireccion != null) llDireccion.setVisibility(View.VISIBLE); if (llBuscar != null) llBuscar.setVisibility(View.GONE); } } @Override public void onNothingSelected(AdapterView<?> parent) { Toast.makeText(getApplicationContext(), "Nada seleccionado", Toast.LENGTH_SHORT).show(); } }); final EditText eSearch = (EditText) v.findViewById(R.id.txtBuscar); final EditText eStreet = (EditText) v.findViewById(R.id.txtCalle); final EditText eNumber = (EditText) v.findViewById(R.id.txtNum); dialogBusqueda.setPositiveButton("Buscar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (SpiBusqueda == 4) { txtBusqueda = new String(); if (!eStreet.getText().toString().isEmpty()) txtBusqueda = (eNumber.getText().toString().trim().isEmpty()) ? "0 " : eNumber.getText().toString().trim() + " "; txtBusqueda = txtBusqueda + eStreet.getText().toString(); } else { if (SpiBusqueda > 1) txtBusqueda = eSearch.getText().toString(); else txtBusqueda = Util.extraerNum(eSearch.getText().toString()); } if (txtBusqueda.trim().isEmpty()) { Toast.makeText(myMapView.getContext(), "Debe ingresar un valor", Toast.LENGTH_SHORT).show(); } else { // Escala de calle para busquedas por default iBusqScale = 4000; switch (SpiBusqueda) { case 0: callQuery(txtBusqueda, getValueByEmp("CLIENTES_XY_006.nis"), LyCLIENTES.getUrl().concat("/0")); if (LyCLIENTES.getLayers() != null && LyCLIENTES.getLayers().length > 0) iBusqScale = LyCLIENTES.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 1: callQuery(txtBusqueda, "codigo", LySED.getUrl().concat("/1")); if (LySED.getLayers() != null && LySED.getLayers().length > 1) iBusqScale = LySED.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 2: callQuery(txtBusqueda, "rotulo", LyPOSTES.getUrl().concat("/0")); if (LyPOSTES.getLayers() != null && LyPOSTES.getLayers().length > 0) iBusqScale = LyPOSTES.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 3: callQuery(txtBusqueda, "serie_medidor", LyMEDIDORES.getUrl().concat("/1")); if (LyMEDIDORES.getLayers() != null && LyMEDIDORES.getLayers().length > 1) iBusqScale = LyMEDIDORES.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 4: iBusqScale = 5000; String[] sBuscar = { eStreet.getText().toString(), eNumber.getText().toString() }; String[] sFields = { "nombre_calle", "numero" }; callQuery(sBuscar, sFields, LyDIRECCIONES.getUrl().concat("/0")); break; case 5: callQuery(txtBusqueda, new String[] { "id_equipo", "nombre" }, LyEQUIPOSLINEA.getUrl().concat("/0")); if (LyEQUIPOSLINEA.getLayers() != null && LyEQUIPOSLINEA.getLayers().length > 0) iBusqScale = LyEQUIPOSLINEA.getLayers()[0].getLayerServiceInfo().getMinScale(); break; } } } }); dialogBusqueda.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); dialogBusqueda.show(); }