List of usage examples for android.view LayoutInflater inflate
public View inflate(XmlPullParser parser, @Nullable ViewGroup root)
From source file:com.example.pyrkesa.frag.ScenarioAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) context1.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.scenario_list_item, null); }//from w ww. j ava 2 s. c o m pos = position; ImageView imgIcon = (ImageView) convertView.findViewById(R.id.scenario); final TextView txtTitle = (TextView) convertView.findViewById(R.id.scenario_name); ImageButton imgDelete = (ImageButton) convertView.findViewById(R.id.delete_scenario); imgIcon.setImageResource(scenarioItems.get(position).getIcon_Scenario()); txtTitle.setText(scenarioItems.get(position).getName()); imgDelete.setImageResource(scenarioItems.get(position).getIcon_Delete()); imgDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(context1,"ggffgfg",Toast.LENGTH_LONG).show(); ModelFactory model = (ModelFactory) ModelFactory.getContext(); new AlertDialog.Builder(v.getContext()).setTitle("Supprimer " + txtTitle.getText()) .setMessage("Voulez-vous supprimer ce scnario?") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete new DeleteScenario().execute(txtTitle.getText().toString()); } }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }).setIcon(android.R.drawable.ic_dialog_alert).show(); } }); return convertView; }
From source file:org.deviceconnect.android.client.fragment.TextDialogFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { mLogger.entering(getClass().getName(), "onCreateView", new Object[] { inflater, container, savedInstanceState }); View view = inflater.inflate(R.layout.fragment_privacypolicy, null); TextView text = (TextView) view.findViewById(android.R.id.text1); InputStream is = null;/*from w ww. j av a 2 s. co m*/ try { ByteArrayOutputStream os = new ByteArrayOutputStream(); is = getActivity().getResources().openRawResource(getArguments().getInt(Intent.EXTRA_TEXT)); byte[] buf = new byte[BUFFER_SIZE]; while (true) { int len = is.read(buf); if (len < 0) { break; } os.write(buf, 0, len); } text.setText(new String(os.toByteArray(), HTTP.UTF_8)); } catch (IOException e) { mLogger.warning(e.toString()); } finally { if (is != null) { try { is.close(); } catch (IOException e) { mLogger.fine(e.toString()); } } } getDialog().setTitle(getArguments().getInt(Intent.EXTRA_TITLE)); mLogger.exiting(getClass().getName(), "onCreateView", view); return view; }
From source file:com.blueverdi.rosietheriveter.PhotoViewActivity.java
private void hintScreen() { mPrefs = PreferenceManager.getDefaultSharedPreferences(this); showHint = mPrefs.getBoolean(GalleryFragment.showHintPref, true); if (showHint) { LayoutInflater li = LayoutInflater.from(this); View view = li.inflate(R.layout.photo_hint_screen, null); AlertDialog.Builder builder = new AlertDialog.Builder(this); CheckBox cb = (CheckBox) view.findViewById(R.id.chkWelcome); cb.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (((CheckBox) buttonView).isChecked()) { showHint = false;// w ww .j a v a 2s . co m } else { showHint = true; } } }); Button b = (Button) view.findViewById(R.id.exitPhotoHintButton); b.setOnClickListener(this); builder.setTitle(null); builder.setView(view); hintDialog = builder.show(); } }
From source file:gov.wa.wsdot.android.wsdot.ui.MountainPassItemCameraFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null); // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity. root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mLoadingSpinner = root.findViewById(R.id.loading_spinner); mEmptyView = root.findViewById(R.id.empty_list_view); return root;/* w w w . j a v a 2 s . c o m*/ }
From source file:com.irccloud.android.fragment.ChannelOptionsFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (savedInstanceState != null && savedInstanceState.containsKey("cid") && cid == -1) { cid = savedInstanceState.getInt("cid"); bid = savedInstanceState.getInt("bid"); }/* w w w . ja va2 s. co m*/ Context ctx = getActivity(); if (ctx == null) return null; LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.dialog_channel_options, null); members = (SwitchCompat) v.findViewById(R.id.members); unread = (SwitchCompat) v.findViewById(R.id.unread); notifyAll = (SwitchCompat) v.findViewById(R.id.notifyAll); joinpart = (SwitchCompat) v.findViewById(R.id.joinpart); collapse = (SwitchCompat) v.findViewById(R.id.collapse); autosuggest = (SwitchCompat) v.findViewById(R.id.autosuggest); return new AlertDialog.Builder(ctx) .setInverseBackgroundForced(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) .setTitle("Display Options").setView(v).setPositiveButton("Save", new SaveClickListener()) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:it.crs4.most.ehrlib.widgets.DvCodedTextAsListWidget.java
/** * Instantiates a new {@link DvCodedTextAsListWidget} * * @param provider the widget provider/*from www . j a v a 2 s . 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 DvCodedTextAsListWidget(WidgetProvider provider, String name, String path, JSONObject attributes, int parentIndex) { super(provider, name, new DvCodedText(path, attributes), parentIndex); Log.d(TAG, "istanziato DvCodedTextAsListWidget"); LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.dv_coded_text_listview, null); Log.d(TAG, "Root view recuperata"); _root_view = view; list = (ListView) _root_view.findViewById(R.id.list_coded_text); Log.d(TAG, "LIST istanziata"); txtTitle = (TextView) _root_view.findViewById(R.id.txt_title); 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; } } }); // ViewGroup header = (ViewGroup)inflater.inflate(R.layout.dv_coded_text_listview_header, list, false); // TextView txtView = (TextView) header.findViewById(R.id.txt_header); // txtView.setText(name); // Log.d(TAG, "Header creato"); // list.addHeaderView(header, null, false); // Log.d(TAG, "Header aggiunto"); this.setupListViewAdapter(); }
From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteAlertsBulletinsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null); // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity. root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mLoadingSpinner = root.findViewById(R.id.loading_spinner); return root;/*from w w w.j av a 2 s . c om*/ }
From source file:zjut.soft.finalwork.fragment.LeftFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.left, null); iv1 = (ImageView) view.findViewById(R.id.left_iv1); iv2 = (ImageView) view.findViewById(R.id.left_iv2); iv3 = (ImageView) view.findViewById(R.id.left_iv3); iv4 = (ImageView) view.findViewById(R.id.left_iv4); iv5 = (ImageView) view.findViewById(R.id.left_iv5); headTV = (ImageView) view.findViewById(R.id.sliding_activity_head_view); headTV.setOnClickListener(new View.OnClickListener() { @Override//from w w w. j a v a 2 s. co m public void onClick(View v) { Intent i = new Intent(getActivity(), BasicInfoUI.class); i.putExtra("myportrait", portraitBitmap); getActivity().startActivity(i); getActivity().overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }); TextView tv = (TextView) view.findViewById(R.id.sliding_activity_name_tv); YCApplication app = (YCApplication) this.getActivity().getApplication(); tv.setText(app.get("name").toString()); // // portrait = (ImageView) view.findViewById(R.id.sliding_activity_head_view); final String url = ((YCApplication) getActivity().getApplication()).get("selectedIp") + Constant.portraitContext; new Thread(new Runnable() { @Override public void run() { HttpGet get = new HttpGet(url); try { DefaultHttpClient client = ((YCApplication) getActivity().getApplicationContext()).getClient(); synchronized (client) { HttpResponse response = client.execute(get); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); portraitBitmap = BitmapFactory.decodeStream(is); // is.close(); Message msg = mHandler.obtainMessage(); msg.obj = portraitBitmap; mHandler.sendMessage(msg); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }).start(); TextView username = (TextView) view.findViewById(R.id.sliding_activity_username_textview); username.setText(app.get("username").toString()); // userConfTV = (TextView) view.findViewById(R.id.sliding_activity_user_manage); // payQueryTV = (TextView) view.findViewById(R.id.sliding_activity_pay_query); // querySystemTV = (TextView) view.findViewById(R.id.sliding_activity_query_system); // aboutUsTV = (TextView) view.findViewById(R.id.sliding_activity_about_us); // unRegisterTV = (TextView) view.findViewById(R.id.sliding_activity_unregister_user); // classNameTV = (TextView) view.findViewById(R.id.sliding_activity_class_tv); // registTV = (TextView) view.findViewById(R.id.sliding_activity_regist_system); // pickCourseTV = (TextView) view.findViewById(R.id.sliding_activity_pick_course_system); // RatingTV = (TextView) view.findViewById(R.id.sliding_activity_student_rating); // return view; }
From source file:asu.edu.msse.gpeddabu.moviedescriptions.MovieListAdapter.java
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { String headerTitle = (String) getGroup(groupPosition); if (convertView == null) { android.util.Log.d(this.getClass().getSimpleName(), "in getGroupView null so creating new view"); LayoutInflater inflater = (LayoutInflater) this.parent .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.movie_group, null); }//from w w w . j av a 2 s . c om TextView genreName = (TextView) convertView.findViewById(R.id.genreName); //android.util.Log.d(this.getClass().getSimpleName(),"in getGroupView text is: "+lblListHeader.getText()); genreName.setTypeface(null, Typeface.BOLD); genreName.setText(headerTitle); return convertView; }
From source file:asu.edu.msse.gpeddabu.moviedescriptions.MovieListAdapter.java
@Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {// w ww .j a v a 2 s. c o m final String childText = (String) getChild(groupPosition, childPosition); if (convertView == null) { android.util.Log.d(this.getClass().getSimpleName(), "in getChildView null so creating new view"); LayoutInflater inflater = (LayoutInflater) this.parent .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.movie_list, null); } TextView txtListChild = (TextView) convertView.findViewById(R.id.movieTitle); convertView.setOnTouchListener(this); convertView.setBackgroundResource(R.color.light_blue); txtListChild.setText(childText); return convertView; }