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:it.crs4.most.ehrlib.widgets.DvCodedTextWidget.java
/** * Instantiates a new {@link DvCodedTextWidget} * * @param provider the widget provider/*from www . j a va 2s. c o m*/ * @param name the name of this widget * @param path the path of the {@link DvCodedText} mapped on this widget * @param attributes the attributes of the {@link DvCodedText} mapped on this widget * @param parentIndex the parent index */ public DvCodedTextWidget(WidgetProvider provider, String name, String path, JSONObject attributes, int parentIndex) { super(provider, name, new DvCodedText(path, attributes), parentIndex); LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.dv_coded_text, null); _root_view = view; txtTitle = (TextView) _root_view.findViewById(R.id.txt_title); this.setupSpinner(); this.updateLabelsContent(); _help = (ImageView) _root_view.findViewById(R.id.image_help); toolTipRelativeLayout = (ToolTipRelativeLayout) _root_view .findViewById(R.id.activity_main_tooltipRelativeLayout); _help.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (myToolTipView == null) { myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, _help); //myToolTipView.setOnToolTipViewClickedListener(DvTextWidget.this); } else { myToolTipView.remove(); myToolTipView = null; } } }); }
From source file:com.amaze.filemanager.adapters.TabSpinnerAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.spinner_layout, parent, false); TextView textView = (TextView) row.findViewById(R.id.spinnerText); if (items.get(position).equals("/")) textView.setText(R.string.rootdirectory); else//from w w w . ja v a 2 s. c o m textView.setText(new File(items.get(position)).getName()); return row; }
From source file:com.degreat.apps.kwamelearn.CorrectWrongDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); int whatTo = getArguments().getInt(WHAT_TO); View solImage = null;/* www . jav a 2 s. c o m*/ switch (whatTo) { case GameFragment.CORRECT: solImage = inflater.inflate(R.layout.correct_view, null); break; case GameFragment.WRONG: solImage = inflater.inflate(R.layout.wrong_view, null); break; case GameFragment.INDICATE_LEVEL: int level = getArguments().getInt(LEVEL); solImage = inflater.inflate(R.layout.level_show, null); TextView levelNumber = (TextView) solImage.findViewById(R.id.level_number); levelNumber.setText("" + level); break; /*case GameFragment.RETARD: solImage = inflater.inflate(R.layout.retard_view, null); break;*/ } builder.setView(solImage); return builder.create(); }
From source file:com.fexcon.demolayout.RecipeAdapter.java
public RecipeAdapter(Context context, ArrayList<Recipe> items) { mContext = context; mDataSource = items; mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
From source file:com.mobeta.android.dslv.ResourceDragSortCursorAdapter.java
/** * Constructor the enables auto-requery. * * @deprecated This option is discouraged, as it results in Cursor queries * being performed on the application's UI thread and thus can * cause poor responsiveness or even Application Not Responding * errors. As an alternative, use * {@link android.app.LoaderManager} with a * {@link android.content.CursorLoader}. * * @param context/*from www.j a v a 2 s . c o m*/ * The context where the ListView associated with this adapter is * running * @param layout * resource identifier of a layout file that defines the views * for this list item. Unless you override them later, this will * define both the item views and the drop down views. */ @Deprecated public ResourceDragSortCursorAdapter(final Context context, final int layout, final Cursor c) { super(context, c); this.mLayout = this.mDropDownLayout = layout; this.mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
From source file:com.RSMSA.policeApp.Adapters.ViewPagerAccidentsDetailsAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); android.widget.ScrollView itemView = (ScrollView) inflater.inflate(R.layout.accident_details, container, false);// w w w .j a va2 s . c o m final AccidentVehicle accidentVehicle = new AccidentVehicle(); Button addPasenger = (Button) itemView.findViewById(R.id.add_witness); Button next = (Button) itemView.findViewById(R.id.next); final LinearLayout linearLayout = (LinearLayout) itemView.findViewById(R.id.passengers_layout); if (position == tabnames.size() - 1) { next.setVisibility(View.VISIBLE); } else { next.setVisibility(View.GONE); } next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AccidentReportFormActivity.showWitneses(); } }); final EditText fatalEdit = (EditText) itemView.findViewById(R.id.fatal_edit); fatalEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setFatal")); final EditText simpleEdit = (EditText) itemView.findViewById(R.id.simple_edit); simpleEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setSimple")); EditText injuryEdit = (EditText) itemView.findViewById(R.id.injury_edit); injuryEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setSevere_injured")); EditText notInjuredEdit = (EditText) itemView.findViewById(R.id.not_injured_edit); notInjuredEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setOnly_damage")); EditText driverLicenceEdit = (EditText) itemView.findViewById(R.id.license_one); driverLicenceEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setLicence_no") { public void afterFocus(final String text, final EditText editText) { new AsyncTask<Void, Void, Boolean>() { @Override protected Boolean doInBackground(Void... params) { DHIS2Modal dhis2Modal = new DHIS2Modal("Driver", null, MainOffence.username, MainOffence.password); JSONObject where = new JSONObject(); try { where.put("value", text); } catch (JSONException e) { e.printStackTrace(); } JSONObject driverObject = null; try { JSONArray driver = dhis2Modal.getEvent(where); Log.d(TAG, "returned driver json = " + driver.toString()); driverObject = driver.getJSONObject(0); } catch (JSONException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } try { if (driverObject.getString("Driver License Number").equals(text)) { accidentVehicle.setProgram_driver(driverObject.getString("id")); return true; } } catch (JSONException e) { e.printStackTrace(); } catch (NullPointerException e) { Log.e(TAG, "returned json object is null"); } return false; } @Override protected void onPostExecute(Boolean aVoid) { super.onPostExecute(aVoid); if (!aVoid) { editText.setTextColor(context.getResources().getColor(R.color.red)); } else { editText.setTextColor(context.getResources().getColor(R.color.green_500)); } } }.execute(); } }); final EditText alcoholEdit = (EditText) itemView.findViewById(R.id.alcohol_edit); alcoholEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setAlcohol_percentage")); CheckBox drug = (CheckBox) itemView.findViewById(R.id.drug_edit); drug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { accidentVehicle.setDrug(isChecked); } }); CheckBox phone = (CheckBox) itemView.findViewById(R.id.phone_edit); phone.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { accidentVehicle.setPhone_use(isChecked); } }); EditText plateNumber = (EditText) itemView.findViewById(R.id.registration_number_one); plateNumber.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setPlate_number") { public void afterFocus(final String text, final EditText editText) { new AsyncTask<Void, Void, Boolean>() { @Override protected Boolean doInBackground(Void... params) { DHIS2Modal dhis2Modal = new DHIS2Modal("Vehicle", null, MainOffence.username, MainOffence.password); JSONObject where = new JSONObject(); try { where.put("value", text); } catch (JSONException e) { e.printStackTrace(); } JSONObject vehicleObject = null; try { JSONArray vehiclesArray = dhis2Modal.getEvent(where); Log.d(TAG, "returned vehicle json = " + vehiclesArray.toString()); vehicleObject = vehiclesArray.getJSONObject(0); } catch (JSONException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } try { if (vehicleObject.getString("Vehicle Plate Number").equals(text)) { accidentVehicle.setProgram_vehicle(vehicleObject.getString("id")); return true; } } catch (JSONException e) { e.printStackTrace(); } catch (NullPointerException e) { Log.e(TAG, "returned json object is null"); } return false; } @Override protected void onPostExecute(Boolean aVoid) { super.onPostExecute(aVoid); if (!aVoid) { editText.setTextColor(context.getResources().getColor(R.color.red)); } else { editText.setTextColor(context.getResources().getColor(R.color.light_gray)); } } }.execute(); } }); EditText repairCost = (EditText) itemView.findViewById(R.id.repair_amount_one); repairCost.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setEstimated_repair")); EditText vehicleEdit = (EditText) itemView.findViewById(R.id.vehicle_title_edit); vehicleEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setVehicle")); EditText vehicleTotalEdit = (EditText) itemView.findViewById(R.id.vehicle_total_edit); vehicleTotalEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setVehicle_total")); EditText infastructureEdit = (EditText) itemView.findViewById(R.id.infrastructure_edit); infastructureEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setInfastructure")); EditText costEdit = (EditText) itemView.findViewById(R.id.rescue_cost_edit); costEdit.setOnFocusChangeListener(new CustomeTimeWatcher(accidentVehicle, "setCost")); final List<PassengerVehicle> passengers = new ArrayList<PassengerVehicle>(); addPasenger.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final PassengerVehicle passengerVehicle = new PassengerVehicle(); LinearLayout passenger = (LinearLayout) inflater.inflate(R.layout.passenger, null); linearLayout.addView(passenger); EditText nameEdit = (EditText) passenger.findViewById(R.id.name_edit); nameEdit.setOnFocusChangeListener(new CustomeTimeWatcher(passengerVehicle, "setName")); final EditText dateOfBirth = (EditText) passenger.findViewById(R.id.dob_one); dateOfBirth.setOnFocusChangeListener(new CustomeTimeWatcher(passengerVehicle, "setDate_of_birth")); EditText physicalAddressEdit = (EditText) passenger.findViewById(R.id.physical_address_one); physicalAddressEdit .setOnFocusChangeListener(new CustomeTimeWatcher(passengerVehicle, "setPhysical_address")); EditText addressBoxEdit = (EditText) passenger.findViewById(R.id.address_box_one); addressBoxEdit.setOnFocusChangeListener(new CustomeTimeWatcher(passengerVehicle, "setAddress")); EditText nationalIDEdit = (EditText) passenger.findViewById(R.id.national_id_one); nationalIDEdit.setOnFocusChangeListener(new CustomeTimeWatcher(passengerVehicle, "setNational_id")); EditText phoneNoEdit = (EditText) passenger.findViewById(R.id.phone_no_one); phoneNoEdit.setOnFocusChangeListener(new CustomeTimeWatcher(passengerVehicle, "setPhone_no")); EditText alcoholPercentageEdit = (EditText) passenger.findViewById(R.id.alcohol_percentage); alcoholPercentageEdit .setOnFocusChangeListener(new CustomeTimeWatcher(passengerVehicle, "setAlcohol_percent")); CheckBox seatbeltCheckbox = (CheckBox) passenger.findViewById(R.id.seat_belt_check); seatbeltCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { passengerVehicle.setHelmet(isChecked); } }); Button date_picker = (Button) passenger.findViewById(R.id.date_picker); date_picker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DatePickerDialog newDatePickerDialogueFragment; newDatePickerDialogueFragment = new DatePickerDialog(); newDatePickerDialogueFragment.show(AccidentReportFormActivity.fragmentManager, "DatePickerDialogue"); newDatePickerDialogueFragment .setOnDateSetListener(new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePickerDialog dialog, int year, int monthOfYear, int dayOfMonth) { dateOfBirth.setText(dayOfMonth + " / " + (monthOfYear + 1) + " / " + year); } }); } }); final RadioButton male = (RadioButton) passenger.findViewById(R.id.male); male.setTypeface(MainOffence.Roboto_Regular); final RadioButton female = (RadioButton) passenger.findViewById(R.id.female); female.setTypeface(MainOffence.Roboto_Regular); passengerVehicle.setGender("Male"); male.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) passengerVehicle.setGender("Male"); } }); female.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) passengerVehicle.setGender("Female"); } }); passengers.add(linearLayout.getChildCount() - 1, passengerVehicle); } }); accident[position] = accidentVehicle; passanger.add(position, passengers); ((ViewPager) container).addView(itemView); return itemView; }
From source file:com.irccloud.android.fragment.NickservFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (server == null) return null; Context ctx = getActivity();/*from ww w.j av a 2 s . co m*/ if (ctx == null) return null; LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.dialog_nickserv, null); nick = v.findViewById(R.id.nickname); pass = v.findViewById(R.id.password); nick.setText("Password for " + server.getNick()); if (server.getNickserv_pass() != null) pass.setText(server.getNickserv_pass()); String title = "Identify your nickname on "; if (server.getName() != null && server.getName().length() > 0) title += server.getName(); else title += server.getHostname(); AlertDialog d = new AlertDialog.Builder(ctx).setTitle(title).setView(v) .setPositiveButton("Save", new SaveClickListener()) .setNeutralButton("Instructions", new InstructionsClickListener()) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); d.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); return d; }
From source file:com.granita.tasks.utils.ExpandableGroupDescriptorAdapter.java
public ExpandableGroupDescriptorAdapter(Cursor cursor, Context context, LoaderManager loaderManager, ExpandableGroupDescriptor descriptor) { super(cursor, context, false); mContext = context;// w ww .ja v a 2 s .c o m mDescriptor = descriptor; mLoaderManager = loaderManager; mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
From source file:com.dnielfe.manager.adapters.BrowserListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder mViewHolder; int num_items = 0; final File file = new File(getItem(position)); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault()); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.item_browserlist, parent, false); mViewHolder = new ViewHolder(convertView); convertView.setTag(mViewHolder); } else {/* ww w .ja va 2 s .co m*/ mViewHolder = (ViewHolder) convertView.getTag(); } if (Settings.mListAppearance > 0) { mViewHolder.dateview.setVisibility(TextView.VISIBLE); } else { mViewHolder.dateview.setVisibility(TextView.GONE); } if (Settings.showthumbnail) setIcon(file, mViewHolder.icon); else loadFromRes(file, mViewHolder.icon); if (file.isFile()) { // Shows the size of File mViewHolder.bottomView.setText(FileUtils.byteCountToDisplaySize(file.length())); } else { String[] list = file.list(); if (list != null) num_items = list.length; // show the number of files in Folder mViewHolder.bottomView.setText(num_items + mResources.getString(R.string.files)); } mViewHolder.topView.setText(file.getName()); mViewHolder.dateview.setText(df.format(file.lastModified())); return convertView; }
From source file:com.hagreve.android.fragments.HaGreveListFragment.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void refreshItems(MenuItem item) { ConnectivityManager conman = (ConnectivityManager) getActivity() .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netinfo = conman.getActiveNetworkInfo(); if (netinfo != null && netinfo.isConnected()) { try {//from w w w . ja v a2 s . co m //setListShown(false); if (item != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { LayoutInflater inflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); refreshView = inflater.inflate(R.layout.action_refresh, null); refreshItem = item; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { item.setActionView(refreshView); } } if (adapter == null) { adapter = new StrikeAdapter<Strike>(getActivity(), R.layout.strike_row); adapter.setNotifyOnChange(true); setListAdapter(adapter); } getLoaderManager().restartLoader(0, null, this); } catch (Exception e) { Log.e(LOG_TAG, e.toString()); } } else { Log.d(LOG_TAG, "No network connection available"); View progressbar = getView().findViewById(R.id.loading_progress); progressbar.setVisibility(View.INVISIBLE); TextView loading_text = (TextView) getView().findViewById(R.id.status_text); loading_text.setText(R.string.no_connection); } }