Class NewsfeedAttachmentsViewPagerAdapter


  • public class NewsfeedAttachmentsViewPagerAdapter
    extends androidx.viewpager.widget.PagerAdapter
    The adapter used to display attachments (images and videos) of NewsfeedAttachmentsViewPagerActivity
    • Field Summary

      • Fields inherited from class androidx.viewpager.widget.PagerAdapter

        POSITION_NONE, POSITION_UNCHANGED
    • Constructor Summary

      Constructors 
      Constructor Description
      NewsfeedAttachmentsViewPagerAdapter​(android.app.Activity activity, java.lang.String attachmentUrl, java.util.ArrayList<java.lang.String> allAttachmentUrl, java.util.ArrayList<java.lang.String> allAttachmentThumbnailLink)
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroyItem​(android.view.ViewGroup container, int position, java.lang.Object object)  
      protected void displayImage​(java.lang.String url, android.widget.ImageView imageView, android.view.View progressBar)
      Show image into the imageView
      protected void displayVideo​(int position, android.view.View videoViewLayout, android.widget.VideoView videoView, android.view.View progressBar, android.view.View layout)
      Displays the selected video
      int getCount()  
      java.lang.Object instantiateItem​(android.view.ViewGroup container, int position)  
      boolean isViewFromObject​(android.view.View view, java.lang.Object o)  
      • Methods inherited from class androidx.viewpager.widget.PagerAdapter

        destroyItem, finishUpdate, finishUpdate, getItemPosition, getPageTitle, getPageWidth, instantiateItem, notifyDataSetChanged, registerDataSetObserver, restoreState, saveState, setPrimaryItem, setPrimaryItem, startUpdate, startUpdate, unregisterDataSetObserver
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NewsfeedAttachmentsViewPagerAdapter

        public NewsfeedAttachmentsViewPagerAdapter​(android.app.Activity activity,
                                                   java.lang.String attachmentUrl,
                                                   java.util.ArrayList<java.lang.String> allAttachmentUrl,
                                                   java.util.ArrayList<java.lang.String> allAttachmentThumbnailLink)
        Default constructor
        Parameters:
        activity - source activity for attachment
        attachmentUrl - url link for a single attachment
        allAttachmentUrl - url link for all attachments
        allAttachmentThumbnailLink - url link for all attachments thumbnails
    • Method Detail

      • instantiateItem

        public java.lang.Object instantiateItem​(android.view.ViewGroup container,
                                                int position)
        Overrides:
        instantiateItem in class androidx.viewpager.widget.PagerAdapter
      • displayVideo

        protected void displayVideo​(int position,
                                    android.view.View videoViewLayout,
                                    android.widget.VideoView videoView,
                                    android.view.View progressBar,
                                    android.view.View layout)
        Displays the selected video
        Parameters:
        position - position of item in the adapter
        videoViewLayout - container of video view
        videoView - view to display the ui of the video attachment
        progressBar - progress bar to show loading
        layout - layout of view pager attachment
      • displayImage

        protected void displayImage​(java.lang.String url,
                                    android.widget.ImageView imageView,
                                    android.view.View progressBar)
        Show image into the imageView
        Parameters:
        url - url of image
        imageView - image view container of the image url
        progressBar - progress bar to display while loading the image
      • destroyItem

        public void destroyItem​(android.view.ViewGroup container,
                                int position,
                                java.lang.Object object)
        Overrides:
        destroyItem in class androidx.viewpager.widget.PagerAdapter
      • getCount

        public int getCount()
        Specified by:
        getCount in class androidx.viewpager.widget.PagerAdapter
      • isViewFromObject

        public boolean isViewFromObject​(android.view.View view,
                                        java.lang.Object o)
        Specified by:
        isViewFromObject in class androidx.viewpager.widget.PagerAdapter