Skip to content

Commit

Permalink
update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiNosrati authored Aug 10, 2019
1 parent 2a3e28c commit fb96fed
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# android-media-adapter
An android library for indexing photos and videos in attachment selections

**Sample usage:**
* xml:
```
<com.jess.ui.TwoWayGridView
android:id="@+id/recent_media"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@color/white"
app:gravity="center"
app:horizontalSpacing="8dp"
app:scrollDirectionLandscape="horizontal"
app:scrollDirectionPortrait="horizontal"
app:stretchMode="spacingWidth"
app:verticalSpacing="0dp" />
```

* java:
```
TwoWayGridView mediaView = findViewById(R.id.media_view);
final RecentMedia recentMedia = new RecentMedia();
recentMedia.setWidth(width);
recentMedia.setHeight(height);
final MediaAdapter mediaAdapter = recentImages.getAdapter(context);
mediaView.setAdapter(mediaAdapter);
mediaView.setOnItemClickListener((parent, view, position, id) -> {
//for video
activity.onMediaPicked(ContentUris.withAppendedId(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, id));
//for image
activity.onMediaPicked(ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id));
//your code...
});
```

* credit: [AmirArcane](https://github.com/amirarcane/recent-images) & [JessAnders](https://github.com/jess-anders/two-way-gridview)

0 comments on commit fb96fed

Please sign in to comment.