Coder Social home page Coder Social logo

gallerydialog's Introduction

GalleryDialog

Jitpack Link

GalleryDialog is a library created to display images and 360 panoramic images in a comfortable and simple way. It allows adding explanatory text for the photo in a footer that appears and hides dynamically.

Currently, it only works with image loading via URL using Glide. In the future, I would like to add the option to pass created drawables or bitmaps.

Standard images use the TouchImageView library, which allows zooming through gestures.

360 images use the PanoramaGL library, which allows zooming through gestures and activating sensor rotation.

Demonstration

GalleryDialog ->

GalleryDialog demo

GalleryDialog360 ->

GalleryDialog360 demo

(Both galleries support screen rotation using the rotation button)

How to use

Both classes are DialogFragments, with a static function newInstance() to facilitate their creation.

I recommend creating an extended function to show the dialog when clicking on an ImageView.

// GalleryDialog
    private fun ImageView.setGalleryDialogOnClick(position: Int) = setOnClickListener {
        GalleryDialog.newInstance(
            images,
            position,
            GalleryDialogOptions(
                fileProviderAuthorities = "com.marcosanz.app",
                errorDrawable = R.drawable.ic_launcher_foreground,
                rotation = false
            )
        ).show(supportFragmentManager, "gallery_dialog")
    }
// Gallery360Dialog
private fun ImageView.setGallery360DialogOnClick(position: Int) = setOnClickListener {
        Gallery360Dialog.newInstance(
            images360[position],
            Gallery360DialogOptions(
                rotation = true,
                sensorialRotation = true
            )
        ).show(supportFragmentManager, "gallery_dialog")
    }

With the DialogOptions classes, you can customize some minor settings, such as the texts displayed, allow rotation, or enable sensor rotation.

Check the sample app to see all these features implemented.

Additional Configuration

  • To share images, you must declare a FileProvider and pass the FileProviderAuthorities through GalleryDialogOptions.
  • If the Activity has the android:configChanges="layoutDirection" field set in the Manifest, screen rotation will not work correctly.

Installation

Add the Jitpack repository to your build.gradle file

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add the dependency in your module

dependencies {
	        implementation 'com.github.MarcoSanz12:GalleryDialog:{ LATEST_VERSION }'
	}

License

GalleryDialog is available under the MIT license. Read the LICENSE.txt file for more information.

gallerydialog's People

Contributors

marcosanz12 avatar

Watchers

Daniel Francos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.