use of com.example.android.unsplash.data.model.Photo in project atlas by alibaba.
the class PhotoAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final PhotoViewHolder holder, final int position) {
Photo data = photos.get(position);
TextView authorview = holder.itemView.findViewById(R.id.author);
ImageView photoview = holder.itemView.findViewById(R.id.photo);
holder.setAuthor(data.author);
photoview.setTransitionName(String.format(photoTransitionFormat, data.id));
authorview.setText(data.author);
authorview.setTransitionName(String.format(authorTransitionFormat, data.id));
holder.setId(data.id);
Glide.with(layoutInflater.getContext()).load(data.getPhotoUrl(requestedPhotoWidth)).placeholder(R.color.placeholder).override(ImageSize.NORMAL[0], ImageSize.NORMAL[1]).into((ImageView) holder.itemView.findViewById(R.id.photo));
}
use of com.example.android.unsplash.data.model.Photo in project atlas by alibaba.
the class DetailViewPagerAdapter method instantiateItem.
@Override
public Object instantiateItem(ViewGroup container, int position) {
View view = layoutInflater.inflate(R.layout.detail_view, container, false);
ThreeTwoImageView photoview = view.findViewById(R.id.photo);
TextView authorview = view.findViewById(R.id.author);
Photo photo = allPhotos.get(position);
photoview.setTransitionName(String.format(photoTransitionFormat, photo.id));
authorview.setText(photo.author);
authorview.setTransitionName(String.format(authorTransitionFormat, photo.id));
onViewBound(photoview, photo);
container.addView(view);
return view;
}
use of com.example.android.unsplash.data.model.Photo in project atlas by alibaba.
the class DetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_detail);
postponeEnterTransition();
TransitionSet transitions = new TransitionSet();
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
slide.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
transitions.addTransition(slide);
transitions.addTransition(new Fade());
getWindow().setEnterTransition(transitions);
Intent intent = getIntent();
sharedElementCallback = new DetailSharedElementEnterCallback(intent);
setEnterSharedElementCallback(sharedElementCallback);
try {
initialItem = Integer.parseInt(intent.getData().getLastPathSegment());
} catch (NumberFormatException e) {
initialItem = 0;
}
PhotoService.getInstance().getPhotosAsync(new PhotoService.PhotoCallback() {
@Override
public void success(ArrayList<Photo> photos) {
setUpViewPager(photos);
findViewById(android.R.id.empty).setVisibility(View.GONE);
}
@Override
public void error() {
finishAfterTransition();
}
});
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(navigationOnClickListener);
super.onCreate(savedInstanceState);
}
Aggregations