Load local media with RxJava for Android
Android 4.0+ (API 14+)
Album class represents a collection including photo and video.
- folder(Folder): Folder of this album
- cover(Media): Cover media of this album
- medias(List): All medias of this album
Folder class represents a directory such as Camera.
- id(String): Internal identity
- name(String): Directory name for display
Media class represents a photo or video.
- id(long): Internal identity
- type(Type): Type of this media (Type.Photo or Type.Video)
- uri(Uri): Uri of this media
RxMediaLoader.medias(this, getSupportLoaderManager())
.subscribe(new Subscriber<List<Album>>() {
@Override
public void onCompleted() {}
@Override
public void onError(Throwable e) {}
@Override
public void onNext(List<Album> albums) {
// Write your awesome code!
}
});
RxMediaLoader.photos(this, getSupportLoaderManager())
.subscribe(new Subscriber<List<Album>>() {
@Override
public void onCompleted() {}
@Override
public void onError(Throwable e) {}
@Override
public void onNext(List<Album> albums) {
// Write your awesome code!
}
});
RxMediaLoader.videos(this, getSupportLoaderManager())
.subscribe(new Subscriber<List<Album>>() {
@Override
public void onCompleted() {}
@Override
public void onError(Throwable e) {}
@Override
public void onNext(List<Album> albums) {
// Write your awesome code!
}
});
RxMediaLoader.medias(this, getSupportLoaderManager(), folder)
.subscribe(new Subscriber<List<Album>>() {
@Override
public void onCompleted() {}
@Override
public void onError(Throwable e) {}
@Override
public void onNext(List<Album> albums) {
// Write your awesome code!
}
});
compile 'com.yuyakaido.android:rx-media-loader:${LatestVersion}'
Copyright 2016 yuyakaido
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.