List of usage examples for android.view LayoutInflater inflate
public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot)
From source file:com.flavik.barcode.recognizer.client.android.book.SearchBookContentsActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); // Make sure that expired cookies are removed on launch. CookieSyncManager.createInstance(this); CookieManager.getInstance().removeExpiredCookie(); Intent intent = getIntent();// ww w . j a v a2 s .co m if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) { finish(); return; } isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN); if (LocaleManager.isBookSearchUrl(isbn)) { setTitle(getString(R.string.sbc_name)); } else { setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn); } setContentView(R.layout.search_book_contents); queryTextView = (EditText) findViewById(R.id.query_text_view); String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY); if (initialQuery != null && !initialQuery.isEmpty()) { // Populate the search box but don't trigger the search queryTextView.setText(initialQuery); } queryTextView.setOnKeyListener(keyListener); queryButton = (Button) findViewById(R.id.query_button); queryButton.setOnClickListener(buttonListener); resultListView = (ListView) findViewById(R.id.result_list_view); LayoutInflater factory = LayoutInflater.from(this); headerView = (TextView) factory.inflate(R.layout.search_book_contents_header, resultListView, false); resultListView.addHeaderView(headerView); }
From source file:fr.bde_eseo.eseomega.lacommande.tabs.TabListFood.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.tab_listfood, container, false); // User GUI/* ww w . java 2 s. c o m*/ tvNetStatus = (TextView) rootView.findViewById(R.id.tvNetStatusFoodList); // Flags activityStarted = false; // Search for the listView, then set its adapter mAdapter = new MyFoodListAdapter(getActivity()); recList = (RecyclerView) rootView.findViewById(R.id.cardListFood); recList.setHasFixedSize(true); LinearLayoutManager llm = new LinearLayoutManager(getActivity()); llm.setOrientation(LinearLayoutManager.VERTICAL); recList.setLayoutManager(llm); recList.setAdapter(mAdapter); // Try to download categories's data AsyncGetData asyncGetData = new AsyncGetData(); asyncGetData.execute(Constants.URL_API_ORDER_ITEMS); recList.addOnItemTouchListener( new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() { @Override public void onItemClick(View view, int position) { //Toast.makeText(getActivity(), "Link to JSON category : " + DataManager.getInstance().getCategories().get(position).toString(), Toast.LENGTH_LONG).show(); final ArrayList<LacmdRoot> roots = DataManager.getInstance().arrayToCatArray( DataManager.getInstance().getCategories().get(position).getCatname()); CharSequence items[] = new CharSequence[roots.size()]; for (int i = 0; i < roots.size(); i++) items[i] = roots.get(i).getName() + " (" + roots.get(i).getFormattedPrice() + ")"; // Material dialog to show list of items MaterialDialog md = new MaterialDialog.Builder(getActivity()).items(items) .title("Nos " + DataManager.getInstance().getCategories().get(position).getName()) .cancelable(true) // faster for user .positiveText("Choisir").negativeText("Annuler") .itemsCallbackSingleChoice(0, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { /** * If you use alwaysCallSingleChoiceCallback(), which is discussed below, * returning false here won't allow the newly selected radio button to actually be selected. **/ /* ON ITEM SELECTION - If item has ingredients : launch the IngredientChooserActivity - If item has elements : launch the ElementChooserActivity - If item is just a simple item : add it to cart directly */ LacmdRoot root = roots.get(which); if (root.hasElements() > 0) { // ElementChooserActivity Intent myIntent = new Intent(getActivity(), ElementChooserActivity.class); myIntent.putExtra(Constants.KEY_MENU_ID, root.getIdstr()); getActivity().startActivity(myIntent); activityStarted = true; } else if (root.hasIngredients() > 0) { // IngredientChooserActivity Intent myIntent = new Intent(getActivity(), IngredientsChooserActivity.class); myIntent.putExtra(Constants.KEY_ELEMENT_ID, root.getIdstr()); myIntent.putExtra(Constants.KEY_ELEMENT_POSITION, -1); // not in a menu getActivity().startActivity(myIntent); activityStarted = true; } else { // Add it to cart ! DataManager.getInstance().addCartItem(root); Toast.makeText(getActivity(), "\"" + text + "\" a t ajout au panier", Toast.LENGTH_SHORT).show(); mOnItemAddToCart.OnItemAddToCart(); } return true; } }).show(); } })); return rootView; }
From source file:fr.music.overallbrothers.activity.ArtistActivity.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.artist, container, false); mAlbumGridView = (GridView) view.findViewById(R.id.AlbumGridView); mArtist = (Artist) this.getArguments().getSerializable("artiste"); mAlbumGridAdapter = new AlbumGridAdapter(this.getActivity()); loadAlbums();/*w w w .j a v a 2s .com*/ mAlbumGridView.setOnItemClickListener(mOnItemClickListener); mAlbumGridView.setOnItemLongClickListener(mOnItemLongClickListener); mDonateButton = (Button) view.findViewById(R.id.DonateButton); mDonateButton.setOnClickListener(mDonateClick); mWebpageButton = (Button) view.findViewById(R.id.WebpageButton); mWebpageButton.setOnClickListener(mWebpageClick); Toast.makeText(ArtistActivity.this.getActivity(), R.string.long_press_playlist, Toast.LENGTH_SHORT).show(); mGestureOverlayView = (GestureOverlayView) view.findViewById(R.id.gestures); mGestureOverlayView .addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler()); return view; }
From source file:in.codehex.facilis.PlaceBidFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_place_bid, container, false); initObjects(view);//from w w w . j a v a 2s. c om prepareObjects(); return view; }
From source file:com.deemsys.lmsmooc.BillingFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.billingfragment, container, false); cd = new ConnectionDetector(getActivity()); isInternetPresent = cd.isConnectingToInternet(); list2 = (ListView) rootView.findViewById(R.id.list); return rootView; }
From source file:com.kanchi.periyava.Fragments.Radio.java
@Nullable @Override/*from w w w . ja va 2 s . c om*/ public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { final Bundle bundle = getArguments(); rootView = inflater.inflate(R.layout.radio, container, false); btnRadio = ((ImageButton) rootView.findViewById(R.id.btnRadio)); strPlaylist = ""; tvPlayList = ((TextView) rootView.findViewById(R.id.playlist)); tvScheduleList = ((TextView) rootView.findViewById(R.id.schedulelist)); ServerCallback serverCallback = new ServerCallback() { @Override public void onSuccess(JSONObject response) { GeneralReceiveRequest generalReceive = new Gson().fromJson(response.toString(), GeneralReceiveRequest.class); if (generalReceive.isSuccess()) { ReceiveScheduleList receiveScheduleList = new Gson().fromJson(response.toString(), ReceiveScheduleList.class); tvScheduleList.setText(receiveScheduleList.data); } else { android.os.Message msg = android.os.Message.obtain(); msg.what = ConstValues.ERROR_DEFAULT; msg.obj = (Object) response; getBaseActivity().getFlowHandler().sendMessage(msg); tvScheduleList.setText(""); } } @Override public void onError(VolleyError error) { error.printStackTrace(); android.os.Message msg = android.os.Message.obtain(); msg.what = ConstValues.ERROR_DEFAULT; getBaseActivity().radiostate = false; getBaseActivity().getFlowHandler().sendMessage(msg); } }; //Sending the Message android.os.Message msg = android.os.Message.obtain(); msg.what = ConstValues.RADIO_SCHEDULE_LIST; msg.obj = (Object) serverCallback; getBaseActivity().getFlowHandler().sendMessage(msg); setRadioButtonState(MainActivity.radiostate); // getBaseActivity().getMenuOption(MainActivity.MenuOptions.RADIO).setVisible(false); btnRadio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { android.os.Message msg = android.os.Message.obtain(); msg.what = ConstValues.RADIO_RUN_STOP; msg.obj = bundle.getString("SERVER_SELECTION"); Log.d((String) msg.obj, "inside radio"); MainActivity.getFlowHandler().sendMessage(msg); } }); if (getBaseActivity().radiostate) { android.os.Message msg1 = android.os.Message.obtain(); msg1.what = ConstValues.RADIO_GET_PLAYLIST; MainActivity.getFlowHandler().sendMessage(msg1); getBaseActivity().startAlaram(); } return rootView; }
From source file:fragments.NewTicket.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); View view = inflater.inflate(R.layout.ticket_new, container, false); scrolly = (ScrollView) view.findViewById(R.id.scrollbar); ticketSerial = (EditText) view.findViewById(R.id.ticketserial); ticketName = (EditText) view.findViewById(R.id.ticketname); ticketdate = (TextView) view.findViewById(R.id.ticketdate); sedanRadio = (RadioButton) view.findViewById(R.id.sedanradio); sportRadio = (RadioButton) view.findViewById(R.id.sportradio); vanRadio = (RadioButton) view.findViewById(R.id.vanradio); truckRadio = (RadioButton) view.findViewById(R.id.truckradio); bikeRadio = (RadioButton) view.findViewById(R.id.bikeradio); ticketModel = (EditText) view.findViewById(R.id.ticketmodel); ticketColor = (EditText) view.findViewById(R.id.ticketcolor); ticketLicense = (EditText) view.findViewById(R.id.ticketlicense); ticketPark = (EditText) view.findViewById(R.id.ticketparklocation); ticketKey = (EditText) view.findViewById(R.id.ticketkeylocation); ticketSubmit = (Button) view.findViewById(R.id.ticketsubmit); colorWheel = (ImageView) view.findViewById(R.id.colorwheel); colorWheel.setOnClickListener(this); ticketColor.setOnClickListener(this); scrolly.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); String currentDate = new SimpleDateFormat("EEEE / MMMM-dd-yyyy / h:mm a", Locale.getDefault()) .format(new Date()); final String dateforSQL = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()) .format(new Date()); ticketdate.setText(currentDate);/*from w ww .j a va 2 s . co m*/ ticketSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String ticket, name, date, cartype, model, color, license, park, key; ticket = ticketSerial.getText().toString().trim(); name = ticketName.getText().toString().trim(); date = dateforSQL; cartype = CarType(); model = ticketModel.getText().toString().trim(); color = ticketColor.getText().toString().trim(); license = ticketLicense.getText().toString().trim(); park = ticketPark.getText().toString().trim(); key = ticketKey.getText().toString().trim(); ticketTask = new AddTicketDataAsync(getActivity(), getFragmentManager()); ticketTask.execute(ticket, name, date, cartype, model, color, license, park, key); } }); return view; }
From source file:com.google.zxing.client.android.book.SearchBookContentsActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); fakeR = new FakeR(this); // Make sure that expired cookies are removed on launch. CookieSyncManager.createInstance(this); CookieManager.getInstance().removeExpiredCookie(); Intent intent = getIntent();//from www . jav a 2 s.c o m if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) { finish(); return; } isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN); if (LocaleManager.isBookSearchUrl(isbn)) { setTitle(getString(fakeR.getId("string", "sbc_name"))); } else { setTitle(getString(fakeR.getId("string", "sbc_name")) + ": ISBN " + isbn); } setContentView(fakeR.getId("layout", "search_book_contents")); queryTextView = (EditText) findViewById(fakeR.getId("id", "query_text_view")); String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY); if (initialQuery != null && initialQuery.length() > 0) { // Populate the search box but don't trigger the search queryTextView.setText(initialQuery); } queryTextView.setOnKeyListener(keyListener); queryButton = (Button) findViewById(fakeR.getId("id", "query_button")); queryButton.setOnClickListener(buttonListener); resultListView = (ListView) findViewById(fakeR.getId("id", "result_list_view")); LayoutInflater factory = LayoutInflater.from(this); headerView = (TextView) factory.inflate(fakeR.getId("layout", "search_book_contents_header"), resultListView, false); resultListView.addHeaderView(headerView); }
From source file:at.alladin.rmbt.android.fragments.result.QoSCategoryPagerFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.result_tabhost_pager, container, false); tabHost = (TabHost) v.findViewById(android.R.id.tabhost); tabHost.setup();/* w w w .j ava2 s . c o m*/ tabHost.setOnTabChangedListener(this); for (int i = 0; i < pagerAdapter.getCount(); i++) { TabSpec tab = tabHost.newTabSpec(String.valueOf(i)); //tab.setIndicator(getActivity().getResources().getStringArray(R.array.result_page_title)[i]); tab.setContent(android.R.id.tabcontent); View indicator = inflater.inflate(R.layout.tabhost_indicator, null); TextView title = (TextView) indicator.findViewById(android.R.id.title); title.setText(pagerAdapter.getPageTitle(i)); tab.setIndicator(indicator); tabHost.addTab(tab); } viewPager = (ExtendedViewPager) v.findViewById(R.id.pager); viewPager.setAdapter(pagerAdapter); viewPager.setOnPageChangeListener(this); setCurrentPosition(0); scroller = (HorizontalScrollView) v.findViewById(R.id.tabwidget_scrollview); if (initPosition != null) { viewPager.setCurrentItem(initPosition); } return v; }
From source file:com.example.drugsformarinemammals.Fragment_Formulary.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_formulary, container, false); initializeArrayListSearchs();//from w ww . ja v a 2 s . com helper = new Handler_Sqlite(rootView.getContext()); list = (ListView) rootView.findViewById(R.id.listViewTypeSearch); ItemAdapterWithImageFormulary adapter; // Inicializamos el adapter. adapter = new ItemAdapterWithImageFormulary(getActivity(), options); // Asignamos el Adapter al ListView, en este punto hacemos que el // ListView muestre los datos que queremos. list.setAdapter(adapter); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) { switch (position) { // Single Search case 0: open_dialog(); break; // Combined Search case 1: Intent intent = new Intent(getActivity(), Combined_Search.class); startActivity(intent); break; // Five Last Searched case 2: Intent intentResults = new Intent(getActivity(), Listview_DrugResults.class); intentResults.putExtra("fiveLastScreen", true); startActivity(intentResults); break; default: break; } } }); return rootView; }