public void setAlbumResult(AlbumResult result) { this.albumResult = result; mTitleView.setText(albumResult.getTitle()); mViewPager.setAdapter(new AlbumPagerAdapter(getContext(), albumResult)); mViewPager.setOnPageChangeListener(this); onPageSelected(mViewPager.getCurrentItem()); }
public void onPageSelected(int position) { Data data = albumResult.getAlbum().getData(); Image image = data.getImages().get(position); int total = data.getTotal(); String order = String.format(getResources().getString(R.string.order), image.getIndex(), total); mOrderView.setText(order); mDescrView.setText(image.getDescr()); }
public AlbumPagerAdapter(Context context, AlbumResult albumResult) { this.images = albumResult.getAlbum().getData().getImages(); this.mContext = context; imageLoader = Utils.getImageLoader(context); }