List of usage examples for android.view LayoutInflater inflate
public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot)
From source file:com.sudhirkhanger.app.popularmoviesstageone.TitlesFragment.java
/** * This is the main class of the of the fragment * we set RecyclerView here./*from w ww . ja v a2 s .c o m*/ * Initialize settings to store URL for sorting. * * @param inflater * @param container * @param savedInstanceState * @return */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_titles, container, false); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), COLUMN)); mSettings = PreferenceManager.getDefaultSharedPreferences(getActivity()); mEditor = mSettings.edit(); mEditor.apply(); mRecyclerView.setAdapter(new MovieAdapter(getActivity(), new ArrayList<Movie>())); return rootView; }
From source file:com.mercandalli.android.apps.files.user.ProfileFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final FragmentActivity activity = getActivity(); final View rootView = inflater.inflate(R.layout.fragment_profile, container, false); mProgressBar = (ProgressBar) rootView.findViewById(R.id.circularProgressBar); mProgressBar.setVisibility(View.VISIBLE); mIconBack = (ImageView) rootView.findViewById(R.id.icon_back); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(activity); mRecyclerView.setLayoutManager(mLayoutManager); final Bitmap iconProfileOnline = Config.getUserProfilePicture(activity); if (iconProfileOnline != null) { mIconBack.setImageBitmap(ImageUtils.setBlur(ImageUtils.setBrightness(iconProfileOnline, -50), 15)); }//w ww . j a v a 2 s. c om this.mUsernameTextView = (TextView) rootView.findViewById(R.id.username); this.mUsernameTextView.setText(StringUtils.capitalize(Config.getUserUsername())); refreshView(); return rootView; }
From source file:com.google.zxing.client.android.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();//from w ww . j av a2 s .c o m if (intent == null || (!intent.getAction().equals(Intents.SearchBookContents.ACTION) && !intent.getAction().equals(Intents.SearchBookContents.DEPRECATED_ACTION))) { finish(); return; } mISBN = intent.getStringExtra(Intents.SearchBookContents.ISBN); setTitle(getString(R.string.sbc_name) + ": ISBN " + mISBN); setContentView(R.layout.search_book_contents); mQueryTextView = (EditText) findViewById(R.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 mQueryTextView.setText(initialQuery); } mQueryTextView.setOnKeyListener(mKeyListener); mQueryButton = (Button) findViewById(R.id.query_button); mQueryButton.setOnClickListener(mButtonListener); mResultListView = (ListView) findViewById(R.id.result_list_view); LayoutInflater factory = LayoutInflater.from(this); mHeaderView = (TextView) factory.inflate(R.layout.search_book_contents_header, mResultListView, false); mResultListView.addHeaderView(mHeaderView); mUserAgent = getString(R.string.zxing_user_agent); }
From source file:com.fastbootmobile.encore.app.adapters.PlaylistGridAdapter.java
/** * {@inheritDoc}//w ww . jav a 2 s . co m */ @Override public View getView(int position, View convertView, ViewGroup parent) { Context ctx = parent.getContext(); assert ctx != null; View root = convertView; if (convertView == null) { // Create a new view (nothing to recycle) LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); root = inflater.inflate(R.layout.medium_card_two_lines, parent, false); assert root != null; ViewHolder holder = new ViewHolder(); holder.vRoot = (ViewGroup) root; holder.ivCover = (AlbumArtImageView) root.findViewById(R.id.ivCover); holder.tvTitle = (TextView) root.findViewById(R.id.tvTitle); holder.tvSubTitle = (TextView) root.findViewById(R.id.tvSubTitle); holder.ivOfflineStatus = (ImageView) root.findViewById(R.id.ivOfflineStatus); root.setTag(holder); } // Fill in the fields final Playlist playlist = getItem(position); final ViewHolder tag = (ViewHolder) root.getTag(); tag.playlist = playlist; if (playlist.isLoaded() || playlist.getName() != null) { tag.tvTitle.setText(playlist.getName()); tag.tvSubTitle.setText(ctx.getResources().getQuantityString(R.plurals.songs_count, playlist.getSongsCount(), playlist.getSongsCount())); tag.ivCover.loadArtForPlaylist(playlist); tag.ivOfflineStatus.setVisibility(View.VISIBLE); switch (playlist.getOfflineStatus()) { case BoundEntity.OFFLINE_STATUS_NO: tag.ivOfflineStatus.setVisibility(View.GONE); break; case BoundEntity.OFFLINE_STATUS_DOWNLOADING: tag.ivOfflineStatus.setImageResource(R.drawable.ic_sync_in_progress); break; case BoundEntity.OFFLINE_STATUS_ERROR: tag.ivOfflineStatus.setImageResource(R.drawable.ic_sync_problem); break; case BoundEntity.OFFLINE_STATUS_PENDING: tag.ivOfflineStatus.setImageResource(R.drawable.ic_track_download_pending); break; case BoundEntity.OFFLINE_STATUS_READY: tag.ivOfflineStatus.setImageResource(R.drawable.ic_track_downloaded); break; } } else { tag.tvTitle.setText(R.string.loading); tag.tvSubTitle.setText(R.string.loading); tag.ivCover.setDefaultArt(); tag.ivOfflineStatus.setVisibility(View.GONE); } return root; }
From source file:de.hackerspacebremen.fragments.ChangeStatusFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.change_fragment, container, false); }
From source file:cn.newgxu.android.bbs.ui.ForumsTopicsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { refreshListView = (PullToRefreshListView) inflater.inflate(R.layout.pull_refresh_list, container, false); this.listView = refreshListView.getRefreshableView(); refreshListView.setOnRefreshListener(this); refreshListView.setOnLastItemVisibleListener(this); // refreshListView.setOnRefreshListener(this); return refreshListView; }
From source file:com.commonsware.cwac.colormixer.ColorMixer.java
private void initMixer(AttributeSet attrs) { if (isInEditMode()) { return;/* w ww . j a v a2 s .c om*/ } LayoutInflater inflater = null; if (getContext() instanceof Activity) { inflater = ((Activity) getContext()).getLayoutInflater(); } else { inflater = LayoutInflater.from(getContext()); } inflater.inflate(R.layout.cwac_colormixer_main, this, true); swatch = findViewById(R.id.swatch); red = (SeekBar) findViewById(R.id.red); red.setMax(0xFF); red.setOnSeekBarChangeListener(onMix); green = (SeekBar) findViewById(R.id.green); green.setMax(0xFF); green.setOnSeekBarChangeListener(onMix); blue = (SeekBar) findViewById(R.id.blue); blue.setMax(0xFF); blue.setOnSeekBarChangeListener(onMix); if (attrs != null) { int[] styleable = R.styleable.ColorMixer; TypedArray a = getContext().obtainStyledAttributes(attrs, styleable, 0, 0); setColor(a.getInt(R.styleable.ColorMixer_cwac_colormixer_color, 0xFFA4C639)); a.recycle(); } }
From source file:com.androidrocks.bex.zxing.client.android.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();/*from www . j av a 2s .c o m*/ if (intent == null || (!intent.getAction().equals(Intents.SearchBookContents.ACTION) && !intent.getAction().equals(Intents.SearchBookContents.DEPRECATED_ACTION))) { finish(); return; } mISBN = intent.getStringExtra(Intents.SearchBookContents.ISBN); setTitle(getString(R.string.sbc_name) + ": ISBN " + mISBN); setContentView(R.layout.search_book_contents); mQueryTextView = (EditText) findViewById(R.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 mQueryTextView.setText(initialQuery); } mQueryTextView.setOnKeyListener(mKeyListener); mQueryButton = (Button) findViewById(R.id.query_button); mQueryButton.setOnClickListener(mButtonListener); mResultListView = (ListView) findViewById(R.id.result_list_view); LayoutInflater factory = LayoutInflater.from(this); mHeaderView = (TextView) factory.inflate(R.layout.search_book_contents_header, mResultListView, false); mResultListView.addHeaderView(mHeaderView); }
From source file:com.sakisds.icymonitor.fragments.NotificationsFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_list, container, false); mSettings = getActivity().getSharedPreferences(MainViewActivity.SHAREDPREFS_FILE, Context.MODE_PRIVATE); mError = rootView.findViewById(R.id.emptyhidden); mError.setOnClickListener(this); mProgressBar = rootView.findViewById(R.id.progressBar_list); setHasOptionsMenu(true);// w ww . ja v a 2 s .c om return rootView; }
From source file:com.hybris.mobile.adapter.CartAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Object cartItem = items.get(position); View rowView = null;//from ww w . j a v a2 s .com if (cartItem instanceof CartEntry) { CartEntry cartEntry = (CartEntry) cartItem; rowView = inflater.inflate(R.layout.cart_row, parent, false); TextView lblProductTitle = (TextView) rowView.findViewById(R.id.lbl_product_title); TextView lblProductPrice = (TextView) rowView.findViewById(R.id.lbl_price_quantity); TextView lblManufacturer = (TextView) rowView.findViewById(R.id.lbl_productManufacturer); TextView lblTotal = (TextView) rowView.findViewById(R.id.lbl_total); ImageView productImage = (ImageView) rowView.findViewById(R.id.img_product); if (StringUtils.isEmpty(cartEntry.getProduct().getManufacturer())) { lblManufacturer.setHeight(0); } else { lblManufacturer.setText(cartEntry.getProduct().getManufacturer()); } lblProductTitle.setText(cartEntry.getProduct().getName()); lblProductPrice.setText(cartEntry.getBasePrice().getFormattedValue() + " - " + this.getContext().getString(R.string.cartentry_quantity_placeholder) + cartEntry.getQuantity().toString()); lblManufacturer.setText(cartEntry.getProduct().getManufacturer()); lblTotal.setText(cartEntry.getTotalPrice().getFormattedValue()); UrlImageViewHelper.setUrlDrawable(productImage, cartEntry.getProduct().getThumbnail(), R.drawable.loading_drawable); } // Promotions else if (cartItem instanceof CartPromotion) { CartPromotion cartPromotion = (CartPromotion) cartItem; rowView = inflater.inflate(R.layout.promotion_row, parent, false); // Update promotions section TextView promotionsTextView = (TextView) rowView.findViewById(R.id.textView); promotionsTextView.setMovementMethod(LinkMovementMethod.getInstance()); promotionsTextView.setText(Html.fromHtml(Cart.generatePromotionString(cartPromotion))); StringUtil.removeUnderlines((Spannable) promotionsTextView.getText()); } return rowView; }