List of usage examples for android.view LayoutInflater inflate
public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot)
From source file:com.hybris.mobile.app.commerce.adapter.OrderProductListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView;/*from w w w .ja v a2s . c o m*/ if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.item_order_product, parent, false); rowView.setTag(new OrderViewHolder(rowView, position)); } else { rowView = convertView; } final OrderViewHolder orderViewHolder = (OrderViewHolder) rowView.getTag(); final OrderEntry orderProduct = mProducts.get(position); if (orderProduct != null) { // Name orderViewHolder.productNameTextView.setText(orderProduct.getProduct().getName()); // Price if (orderProduct.getBasePrice() != null) { orderViewHolder.productPrice.setText(orderProduct.getBasePrice().getFormattedValue()); } // Promotion if (orderProduct.getPromotionResult() != null) { if (StringUtils.isNotBlank(orderProduct.getPromotionResult().getDescription())) { orderViewHolder.productPromotion.setText(orderProduct.getPromotionResult().getDescription()); } orderViewHolder.productPromotion.setVisibility(View.VISIBLE); } else { orderViewHolder.productPromotion.setVisibility(View.GONE); } // Variants if (orderProduct.getProduct().getBaseOptions() != null && !orderProduct.getProduct().getBaseOptions().isEmpty()) { orderViewHolder.linearLayoutVariants.setVisibility(View.VISIBLE); orderViewHolder.linearLayoutVariants.removeAllViews(); } // Redirecting to the product detail page when clicking on the image orderViewHolder.orderItemClickableLyout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ProductHelper.redirectToProductDetail(getContext(), orderProduct.getProduct().getCode()); } }); // Loading the product image if (StringUtils.isNotBlank(orderProduct.getProduct().getImageThumbnailUrl())) { CommerceApplication.getContentServiceHelper().loadImage( orderProduct.getProduct().getImageThumbnailUrl(), null, orderViewHolder.productImageView, 0, 0, true, null, true); } // Quantity orderViewHolder.quantityTextView .setText(getContext().getString(R.string.order_confirmation_qty, orderProduct.getQuantity())); // Total price if (orderProduct.getTotalPrice() != null) { orderViewHolder.productTotalPrice.setText(orderProduct.getTotalPrice().getFormattedValue()); } } return rowView; }
From source file:com.pimp.calculator.fragments.CurrencyFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_currency, container, false); result_TV = (AutoResizeTextView) root.findViewById(R.id.curr_result_TV); resultant_TV = (AutoResizeTextView) root.findViewById(R.id.curr_resultant_TV); conversionRate = new ConversionRate(); return root;/*from w w w . j av a 2 s . co m*/ }
From source file:io.v.android.apps.syncslides.DeckChooserFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_deck_chooser, container, false); FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.new_deck_fab); fab.setOnClickListener(new View.OnClickListener() { @Override// w w w .ja v a2 s.c o m public void onClick(View v) { onImportDeck(); } }); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.deck_grid); mRecyclerView.setHasFixedSize(true); // Statically set the span count (i.e. number of columns) for now... See below. mLayoutManager = new GridLayoutManager(getContext(), 2); mRecyclerView.setLayoutManager(mLayoutManager); // Dynamically set the span based on the screen width. Cribbed from // http://stackoverflow.com/questions/26666143/recyclerview-gridlayoutmanager-how-to-auto-detect-span-count mRecyclerView.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { mRecyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this); int viewWidth = mRecyclerView.getMeasuredWidth(); float cardViewWidth = getActivity().getResources().getDimension(R.dimen.deck_card_width); int newSpanCount = (int) Math.floor(viewWidth / cardViewWidth); mLayoutManager.setSpanCount(newSpanCount); mLayoutManager.requestLayout(); } }); return rootView; }
From source file:com.hybris.mobile.app.commerce.adapter.StoreListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView;//from www. ja va 2 s . c o m if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.item_store_locator, parent, false); rowView.setTag(new ViewHolder(rowView)); } else { rowView = convertView; } ViewHolder viewHolder = (ViewHolder) rowView.getTag(); // Content description viewHolder.storePosition.setContentDescription("storePosition_" + position); viewHolder.name.setContentDescription("name_" + position); viewHolder.description.setContentDescription("description_" + position); viewHolder.tel.setContentDescription("tel_" + position); viewHolder.directions.setContentDescription("directions_" + position); viewHolder.distance.setContentDescription("distance_" + position); final PointOfService store = getItem(position); // Setting the values viewHolder.storePosition.setText(position + 1 + ". "); viewHolder.name.setText(store.getName()); viewHolder.description.setText(store.getAddress().getFormattedAddress()); viewHolder.tel.setText(store.getAddress().getPhone()); viewHolder.distance.setText(store.getFormattedDistance()); // Distance intent viewHolder.directions.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mDeviceLocation != null && mDeviceLocation.getDeviceLocation() != null) { LocationUtils.sendDirectionsIntent(getContext(), new LatLng(mDeviceLocation.getDeviceLocation().getLatitude(), mDeviceLocation.getDeviceLocation().getLongitude()), new LatLng(store.getGeoPoint().getLatitude(), store.getGeoPoint().getLongitude())); } else { LocationUtils.sendDirectionsIntent(getContext(), null, new LatLng(store.getGeoPoint().getLatitude(), store.getGeoPoint().getLongitude())); } } }); // Center map when clicking on the name and description viewHolder.name.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { centerMap(store); } }); viewHolder.description.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { centerMap(store); } }); return rowView; }
From source file:com.example.office.ui.mail.MailItemFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mInflater = inflater;//from ww w. j a v a2s . c om View rootView = inflater.inflate(getFragmentLayoutId(), container, false); setHasOptionsMenu(true); try { Activity activity = getActivity(); activity.getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); Intent intent = getActivity().getIntent(); mail = (MailItem) intent.getExtras().get(getActivity().getString(R.string.intent_mail_key)); displayMail(rootView); getActivity().setProgressBarIndeterminateVisibility(false); } catch (Exception e) { Logger.logApplicationException(e, getClass().getSimpleName() + ".onCreateView(): Error."); } return rootView; }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.SignBrowserFragment.java
@Nullable @Override/* w ww .ja va 2s . c om*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "onCreateView " + hashCode()); final View view = inflater.inflate(R.layout.browser_fragment, container, false); setHasOptionsMenu(true); final RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.signRecyclerView); recyclerView.setHasFixedSize(true); // performance fix recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(new SignBrowserAdapter(this, getActivity(), new ArrayList<Sign>())); return view; }
From source file:com.netpace.expressit.fragment.MainGridFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main_grid, container, false); mPullRefreshGridView = (PullToRefreshGridView) rootView.findViewById(R.id.home_grid_view); gridView = mPullRefreshGridView.getRefreshableView(); progressBar = (ProgressBar) rootView.findViewById(R.id.grid_progress_view); mPullRefreshGridView.setOnRefreshListener(new OnRefreshListener<GridView>() { @Override//from w ww.j a va 2s . c o m public void onRefresh(PullToRefreshBase<GridView> refreshView) { fetchMediaFromRemote(Boolean.TRUE); } }); mPullRefreshGridView.setMoreItemScrollState(MoreItemScrollState.MORE_ITEM_SCROLL_MID_POINT); mPullRefreshGridView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() { @Override public void onLastItemVisible() { if (mediaArray.size() < AppConstants.MEDIA_THRESHOLD) { fetchMediaFromRemote(Boolean.FALSE); } } }); adapter = new HomeGridAdapter(getActivity().getApplicationContext(), mediaArray); gridView.setAdapter(adapter); gridView.setOnItemClickListener(this); return rootView; }
From source file:heartware.com.heartware_master.ProfileFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_profile, container, false); mProfileDialog = new ProfileDialogFragment(); dbAdapter = new DBAdapter(getActivity()); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); String token = preferences.getString(UpPlatformSdkConstants.UP_PLATFORM_ACCESS_TOKEN, "NULL"); JawboneAPI_Caller api_caller = (JawboneAPI_Caller) new JawboneAPI_Caller().execute(new String(token)); createButtons(rootView);//from w ww . j av a 2 s. c o m createGraph(rootView); return rootView; }
From source file:de.awisus.refugeeaidleipzig.views.map.FragmentKarte.java
/** * Automatically called method inflating the xml-layout * Sets actovoty title to Map/*from w ww . j a va2 s . c o m*/ * @param inflater who cares * @param container who cares * @param savedInstanceState who cares * @return View inflated with the layout */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_karte, container, false); fabUpdate = (FloatingActionButton) view.findViewById(R.id.fabUpdate); fabUpdate.setOnClickListener(this); fabHide = AnimationUtils.loadAnimation(context, R.anim.bt_hide); fabShow = AnimationUtils.loadAnimation(context, R.anim.bt_show); getActivity().setTitle(R.string.app_name); return view; }
From source file:com.normalexception.app.rx8club.fragment.LoginFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.activity_login, container, false); return rootView; }