Example usage for android.view LayoutInflater from

List of usage examples for android.view LayoutInflater from

Introduction

In this page you can find the example usage for android.view LayoutInflater from.

Prototype

public static LayoutInflater from(Context context) 

Source Link

Document

Obtains the LayoutInflater from the given context.

Usage

From source file:com.amanmehara.programming.android.adapters.ProgramAdapter.java

@Override
public ProgramAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.programs_list, viewGroup, false);
    return new ViewHolder(view);
}

From source file:com.beesham.popularmovies.ReviewAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final DetailsFragment.Reviews reviews = getItem(position);

    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_review, parent, false);
    }//from  ww  w . j  ava  2s  .com
    ButterKnife.bind(this, convertView);

    reviewAuthorTextView.setText(reviews.getAuthor());

    readReviewButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(reviews.getUrl()));
            if (intent.resolveActivity(getContext().getPackageManager()) != null) {
                getContext().startActivity(intent);
            }
        }
    });

    return convertView;
}

From source file:it.gulch.linuxday.android.adapters.EventsAdapter.java

public EventsAdapter(Context context, List<Event> events, boolean showDay) {
    super();// ww w  .  j  a v a  2 s . c  om
    inflater = LayoutInflater.from(context);
    titleTextSize = context.getResources().getDimensionPixelSize(R.dimen.list_item_title_text_size);
    this.showDay = showDay;
    this.events = events;
}

From source file:edu.stanford.mobisocial.dungbeetle.ui.adapter.ObjectListCursorAdapter.java

@Override
public View newView(Context context, Cursor c, ViewGroup parent) {
    final LayoutInflater inflater = LayoutInflater.from(context);
    View v = inflater.inflate(R.layout.objects_item, parent, false);
    bindView(v, context, c);// ww w.j  ava2  s  . c  o m

    return v;
}

From source file:com.manning.androidhacks.hack025.ModelAdapter.java

public ModelAdapter(Context context, int textViewResourceId, List<Model> objects) {
    super(context, textViewResourceId, objects);
    mInflater = LayoutInflater.from(context);
}

From source file:com.maskyn.fileeditorpro.adapter.AdapterDetailedList.java

public AdapterDetailedList(final Context context, final LinkedList<FileDetail> fileDetails,
        final boolean isRoot) {
    super(context, R.layout.item_file_list, fileDetails);
    this.fileDetails = fileDetails;
    this.orig = fileDetails;
    this.inflater = LayoutInflater.from(context);
    if (!isRoot) {
        this.fileDetails.addFirst(new FileDetail("..", context.getString(R.string.folder), ""));
    } else {//from  w w w. ja  va2s  . co m
        this.fileDetails.addFirst(
                new FileDetail(context.getString(R.string.home), context.getString(R.string.folder), ""));
    }
}

From source file:net.naonedbus.fragment.CustomInfiniteListFragement.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final ListView listView = getListView();
    mLoaderView = LayoutInflater.from(getActivity()).inflate(R.layout.list_item_loader, null);
    mLoaderView.setEnabled(false);//ww  w  .  ja  v  a2  s  .co  m
    mLoaderView.setClickable(false);
    mLoaderView.setFocusable(false);
    mLoaderView.setFocusableInTouchMode(false);

    addOnScrollListener(new OnScrollListener() {
        @Override
        public void onScrollStateChanged(final AbsListView view, final int scrollState) {
        }

        @Override
        public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount,
                final int totalItemCount) {
            final int lastInScreen = firstVisibleItem + visibleItemCount;
            if ((lastInScreen == totalItemCount) && listView.getAdapter() != null && !mHasError) {
                onLoadMoreItems();
            } else if (lastInScreen < totalItemCount) {
                mHasError = false;
                mLoaderView.setVisibility(View.VISIBLE);
            }
        }

    });

    listView.addFooterView(mLoaderView);
}

From source file:com.example.evan.comp296.messaging.FirebasePostQueryAdapter.java

@Override
public PostViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    // create a new view
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_item, parent, false);
    return new PostViewHolder(v);
}

From source file:com.manning.androidhacks.hack042.adapter.PoisAdapter.java

public PoisAdapter(Context context, int textViewResourceId, List<Poi> objects) {
    super(context, textViewResourceId, objects);
    mInflater = LayoutInflater.from(context);
}

From source file:com.manning.androidhacks.hack028.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/*from  w w  w.  ja va 2 s . co  m*/

    mListView = (ListView) findViewById(R.id.main_listview);

    LayoutInflater inflator = LayoutInflater.from(this);
    mHeader = inflator.inflate(R.layout.header, mListView, false);
    mGallery = (Gallery) mHeader.findViewById(R.id.listview_header_gallery);
    mGallery.setAdapter(new ImageAdapter(this));

    ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.FILL_PARENT,
            ListView.LayoutParams.WRAP_CONTENT);
    mHeader.setLayoutParams(params);
    mListView.addHeaderView(mHeader, null, false);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, NUMBERS);
    mListView.setAdapter(adapter);

    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mGallery.setSelection(position - 1, true);
        }
    });
}