/GalleryKit

GalleryKit

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

GalleryKit

API PRs Welcome issues forks GitHub stars GitHub license androidx Gradle Version Hits-of-Code Android CI

GalleryKit is simplest / beautiful and smartest gallery picker

  • Support Images & Videos
  • Support Multiple selecttions
  • Fully Configurable

Setup

Gradle

Add jitpack to build.gradle (Project level)

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add dependency to build.gradle (app level)

dependencies {
	...
	implementation 'com.github.chirag-ji:GalleryKit:${Tagged Release Version}'
	...
}

Integration

Layout

	...
    	<com.github.chiragji.gallerykit.GalleryKitView  
		android:id="@+id/galleryKitView"
		android:layout_width="match_parent" 
		android:layout_height="match_parent"
		app:maxImageSelections="3"
		app:viewStyle="separate" />
	...
AppActivity extends AppCompactActivity
protected void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);  
    setContentView(R.layout.activity_main);  
    ...
    GalleryKitView galleryKitView = findViewById(R.id.galleryKitView);  
    galleryKitView.attach(this);  
    galleryKitView.registerGalleryKitListener(new GalleryKitListener() {  
    
   	@Override  
   	public void onGalleryKitBackAction() {  
            Log.d(TAG, "onBackKeyPressed: back key pressed on gallery kit");  
        }  
  
    	@Override  
    	public void onGalleryKitSelectionConfirmed(@NonNull List<String> selectedDataUris) {  
    	    Log.d(TAG, "onSelectionConfirmed: selectedDataUris.size = " + selectedDataUris.size());  
    	    selectedDataUris.forEach(selectedUri ->  
    	            Log.d(TAG, "onSelectionConfirmed: selectedUri = " + selectedUri));  
    	}  
    });
    ...
}

Apply Selected Images to kit

protected  void  onCreate(Bundle savedInstanceState)  {
	...
	GalleryKitView galleryKitView = findViewById(R.id.galleryKitView);
	galleryKitView.attachToFragmentActivity(this);
	galleryKitView.setSelectedData(dataList);
	...
}

Customizations

  • redirects for single view (images and videos are shown in one tab)
   ...
   app:combinedMaxSelections="<count>"
   app:viewStyle="combined"
   ...
  • redirects for separate view (images and videos are shown in separate tabs)
   ...
   app:maxImageSelections="<count>"  
   app:maxVideoSelections="<count>"
   app:viewStyle="separate"
   ...
  • redirects for images only view
   ...
   app:maxImageSelections="<count>"
   app:viewStyle="imageOnly"
   ...
  • redirects for images only view
   ...
   app:maxVideoSelections="<count>"
   app:viewStyle="videoOnly"
   ...
  • disable top bar showing selected images / videos
    ...
    app:showSelectedResources="false"
    ...
  • change back button image
    ...
    app:backButtonImageSrc="@drawable/ic_clear"
    ...
  • hide back button
    ...
    app:hideBackButton="true"
    ...
  • change done button color
    ...
    app:doneButtonColor="@color/colorAccent"
    ...

More features will come soon


If you think this library is useful, please press star button at upside.

LICENCE

I don't care about any licensing, keen to accept all contributions and making it the most trusted, beautiful and smartest library :)