Task 5 : Add-on Slide Image
Adding the slide image
use online library multiviewpager to make slide image.
Following the method I had implemented, I found out a problem of retrieving picture from database as the existing approach was manually stored into array before this was being displayed in the picture
Sample code :
public static SlideImageFragment create(List<SlideImage> imageList, int position) { SlideImageFragment fragment = new SlideImageFragment(); fragment.position = position; fragment.imageList = imageList; return fragment; } @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { SlideImage slideImage = imageList.get(position); View rootView = inflater.inflate(R.layout.sliding_image_layout, container, false); imageView = (ImageView) rootView.findViewById(R.id.sliding_image); Picasso.with(context).load(slideImage.getImg_url()).placeholder(R.mipmap.ic_launcher).centerCrop().fit().into(imageView); rootView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Gson gson = new Gson(); String myJson = gson.toJson(imageList); Intent intent = new Intent(context, ZoomablePhotoGalleryActivity.class); intent.putExtra("portfolioList", myJson); intent.putExtra("position", String.valueOf(position)); context.startActivity(intent); context.overridePendingTransition(R.anim.enter, R.anim.exit); } }); return rootView; }
0 comments