Android Code Snippet Image viewer. A zoomable image within each sliding panel

agraham's ScaleImageView library allows you to zoom the image by pinching and double-clicking.
Dominex's SlidingPanels class allows in part to place large, horizontally sliding panels.

I have put them together by making some modifications to the SlidingPanels class and adaptations with the ScaleImageView library.



Features:
  • Shows a space with painted arrows that allows you to slide the SlidingPanels
  • A SlidingPanels is not allowed to slide if its ScaleImageView has been zoomed in
  • We make the ACToolBarDark1 semi-transparent when orienting the device in landscape position
  • Allows you to remove each SlidingPanels with their contents
  • It fills the list of initial scales when changing the panel (SlidPan1_Change) or onResume
  • Now it copies the images from DirAssets to rp.GetSafeDirDefaultExternal("Images") and gets their paths, but the idea is to select them via the system MediaStore class or from a multiple attempt of the Android Gallery
  • Optionally put a space for in the future to put a Horizontal ScrollView with the thumbnails with a selector frame for the images. Which I will post soon
  • You may also be given the option to edit the image by cropping and rotating it in the future
  • Now it only allows to show images, but you could also take representative images from videos without zoom option and show them with a play icon on top
  • Images could also be sent in the future
  • If the agraham's Gestures library is added, SlidingPanels can be slid directly from displayed images, but ScaleImageView's double-click event to modify the zoom is lost
  • If you want to change the sample images in DirAssets you have to uninstall the example, manage the images in the File Manager, and maybe clean the project

Dependencies: the AppCompat, ScaleImageView, RuntimePermissions and XmlLayoutBuilder libraries. And the SlidingPanels class

I am attaching the example and the images to be placed inside the Files folder
 

Attachments

  • SlidingPanels_ScaleImageView4_Remove_Runtime.zip
    25.4 KB · Views: 157
  • dream_tradingcard.jpg
    115.8 KB · Views: 115
  • einstein.jpg
    62.7 KB · Views: 109
  • geometrias.jpg
    194.6 KB · Views: 107
  • loffit-groucho-marx-11-600x450-1538404429.jpg
    154.8 KB · Views: 124
Last edited:

peacemaker

Expert
Licensed User
Longtime User
 

GeoT

Active Member
Licensed User
Thank you peacemaker.
I didn't know about this library that also saves memory like ScaleImageView.
Maybe you could also put each image inside each SlidingPanels?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…