com.example.android.unsplash.ui.grid.OnItemSelectedListener Java Examples

The following examples show how to use com.example.android.unsplash.ui.grid.OnItemSelectedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From animation-samples with Apache License 2.0 6 votes vote down vote up
private void populateGrid() {
    grid.setAdapter(new PhotoAdapter(this, relevantPhotos));
    grid.addOnItemTouchListener(new OnItemSelectedListener(MainActivity.this) {
        public void onItemSelected(RecyclerView.ViewHolder holder, int position) {
            if (!(holder instanceof PhotoViewHolder)) {
                return;
            }
            PhotoItemBinding binding = ((PhotoViewHolder) holder).getBinding();
            final Intent intent = getDetailActivityStartIntent(MainActivity.this,
                    relevantPhotos, position, binding);
            final ActivityOptions activityOptions = getActivityOptions(binding);

            MainActivity.this.startActivityForResult(intent, IntentUtil.REQUEST_CODE,
                    activityOptions.toBundle());
        }
    });
    empty.setVisibility(View.GONE);
}
 
Example #2
Source File: MainActivity.java    From atlas with Apache License 2.0 6 votes vote down vote up
private void populateGrid() {
    grid.setAdapter(new PhotoAdapter(this, relevantPhotos));
    grid.addOnItemTouchListener(new OnItemSelectedListener(MainActivity.this) {
        public void onItemSelected(RecyclerView.ViewHolder holder, int position) {
            if (!(holder instanceof PhotoViewHolder)) {
                return;
            }
            MainActivity activity = MainActivity.this;
            PhotoViewHolder pvh = (PhotoViewHolder) holder;
            final Intent intent = getDetailActivityStartIntent(
                    activity, position, pvh);
            final ActivityOptions activityOptions = getActivityOptions(pvh);

            activity.startActivityForResult(
                    intent, IntentUtil.INSTANCE.getREQUEST_CODE(), activityOptions.toBundle());
        }
    });
    empty.setVisibility(View.GONE);
}
 
Example #3
Source File: MainActivity.java    From android-instant-apps with Apache License 2.0 6 votes vote down vote up
private void populateGrid() {
    grid.setAdapter(new PhotoAdapter(this, relevantPhotos));
    grid.addOnItemTouchListener(new OnItemSelectedListener(MainActivity.this) {
        public void onItemSelected(RecyclerView.ViewHolder holder, int position) {
            if (!(holder instanceof PhotoViewHolder)) {
                return;
            }
            MainActivity activity = MainActivity.this;
            PhotoViewHolder pvh = (PhotoViewHolder) holder;
            final Intent intent = getDetailActivityStartIntent(
                    activity, position, pvh);
            final ActivityOptions activityOptions = getActivityOptions(pvh);

            activity.startActivityForResult(
                    intent, IntentUtil.REQUEST_CODE, activityOptions.toBundle());
        }
    });
    empty.setVisibility(View.GONE);
}