An open API service indexing awesome lists of open source software.

https://github.com/oliveroneill/imagefeedview

An android library for displaying Facebook/Instagram inspired feeds
https://github.com/oliveroneill/imagefeedview

android feed kotlin kotlin-android photo-browser

Last synced: 4 months ago
JSON representation

An android library for displaying Facebook/Instagram inspired feeds

Awesome Lists containing this project

README

        

# ImageFeedView

[![Download](https://api.bintray.com/packages/oliveroneill/ImageFeedView/ImageFeedView/images/download.svg)](https://bintray.com/oliveroneill/ImageFeedView/ImageFeedView/_latestVersion)
[![Build Status](https://travis-ci.org/oliveroneill/ImageFeedView.svg?branch=master)](https://travis-ci.org/oliveroneill/ImageFeedView)

A simple Android library for creating data feeds so that data can be loaded
dynamically as the user scrolls. This is inspired by scrolling through photos
on Facebook or Instagram.

This is still a work in progress. See [TODO](#todo)

This library uses [GestureViews](https://github.com/alexvasilkov/GestureViews)
for its photo viewer and wraps this for easy usage with a feed.

This is roughly based on the `FeedCollectionViewController` library for Swift
that you can find [here](https://github.com/oliveroneill/FeedCollectionViewController)

## Example

To run the example project, clone the repo, and run the `sample` configuration.
The example project demonstrates the functionality without using any actual content, it creates
coloured images to illustrate its use with a large amount of content.

## Installation
Through `build.gradle`:
```gradle
compile 'com.oliveroneill:imagefeedview:1.0.2'
```

## Usage

To set up a feed, you need to extend `ImageFeedView` with your image class:
```kotlin
class ExampleImageFeedView : ImageFeedView {
constructor(ctx: Context) : super(ctx)
constructor(ctx: Context, attrs: AttributeSet) : super(ctx, attrs)
}
```
Then use this class in your layout file:
```xml

```
Then implement an `ImageFeedController` for loading images:
```kotlin
override fun loadImage(item: ExampleImageClass, imgView:ImageView, listener: LoadListener?) {
// TODO
}

override fun recycleImage(imgView:ImageView) {
// TODO
}

override fun clear() {
// TODO
}
```
Then set up an `ImageFeedConfig`:
```kotlin
val config = ImageFeedConfig(controller)
.setToolbar(toolbar)
.setTranslucentStatusBar(true)
feed.show(config)
```
For custom grid items or photo viewers, use
`setGridAdapter(adapter : PhotoListAdapter)` and
`setPagerAdapter(adapter : PhotoPagerAdapter)`.

## Testing
Testing is done through JUnit, these tests are located in the `imagefeedview` project.

## Todo
- Figure out why double tap breaks with data uri images when loaded a second time
- Set placeholder images
- Make pager toolbar easily configurable
- Make grid item views configurable
- Make pager item views configurable (specify a common layout and have simple setters for that)
- Allow custom error messages

## Author

Oliver O'Neill

## License

ImageFeedView is available under the MIT license. See the LICENSE file for more info.