You may already know of MediaPicker, the all in one solution for capturing pictures and selecting images. Based on the same concept that powers MediaPicker, MediaGallery has a clearer flow based on albums and focuses on the use case of selecting images.
Maven
<dependency>
<groupId>net.alhazmy13.mediagallery</groupId>
<artifactId>library</artifactId>
<version>1.0.1</version>
<type>pom</type>
</dependency>
Gradle
dependencies {
compile 'net.alhazmy13.mediagallery:library:1.0.1'
}
MediaGallery.Builder(this,list)
.title("Title")
.backgroundColor(R.color.colorAccent)
.placeHolder(R.drawable.placeholder)
.selectedImagePosition(1)
.show();
<net.alhazmy13.mediagallery.library.views.MediaGalleryView
android:id="@+id/gallery"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:place_holder="@drawable/placeholder"
app:span_count="3" />
And from your activity :
MediaGalleryView view = (MediaGalleryView) findViewById(R.id.gallery);
view.setImages(list);
view.setOnImageClickListener(this);
view.notifyDataSetChanged();
- Scrolling type
view.setOrientation(MediaGalleryView.VERTICAL);
// OR from xml file
<net.alhazmy13.mediagallery.library.views.MediaGalleryView
...
app:gallery_orientation="horizontal"
/>
- Custom image size.
view.setImageSize(500,MediaGalleryView.DEFAULT);
//OR
<net.alhazmy13.mediagallery.library.views.MediaGalleryView
...
app:image_width="300dp"
app:image_height="200dp"/>
- Custom Place Holder.
view.setPlaceHolder(R.drawable.media_gallery_placeholder);
//OR
<net.alhazmy13.mediagallery.library.views.MediaGalleryView
...
app:place_holder="@drawable/media_gallery_placeholder"/>
- Abdullah Alhazmy
MediaGallery is available under the Apache 2 license. See the LICENSE file for more info.