Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fresco support #240

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ Effect on landscape screen:

## Download
```groovy
implementation 'com.yanzhenjie:album:2.1.3'
repositories {
maven { url "https://jitpack.io" }
}

dependencies {
compile 'com.github.imliujun:album:3.0.2'
}
```

## Usage
Expand Down
30 changes: 29 additions & 1 deletion album/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
apply plugin: rootProject.ext.plugins.library
apply plugin: 'com.github.dcendents.android-maven'

group = 'com.github.imliujun'

android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
Expand All @@ -20,4 +23,29 @@ dependencies {
api rootProject.ext.dependencies.mediaScanner
}

apply from: 'https://raw.githubusercontent.com/yanzhenjie/bintray/master/maven.gradle'
//apply from: 'https://raw.githubusercontent.com/yanzhenjie/bintray/master/maven.gradle'


// build a jar with source files
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}

// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}
8 changes: 4 additions & 4 deletions album/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2017 Yan Zhenjie.

Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -21,8 +20,9 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<application>
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>

<application android:requestLegacyExternalStorage="true">
<activity
android:name=".app.album.AlbumActivity"
android:configChanges="orientation|screenSize"
Expand Down
2 changes: 1 addition & 1 deletion album/src/main/java/com/yanzhenjie/album/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.yanzhenjie.album;

import android.support.annotation.NonNull;
import androidx.annotation.NonNull;

/**
* <p>Any action takes place.</p>
Expand Down
87 changes: 59 additions & 28 deletions album/src/main/java/com/yanzhenjie/album/Album.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.support.annotation.IntDef;
import android.util.Log;

import com.yanzhenjie.album.api.AlbumMultipleWrapper;
Expand All @@ -42,6 +41,10 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
* <p>Entrance.</p>
* Created by Yan Zhenjie on 2016/10/23.
Expand Down Expand Up @@ -103,14 +106,18 @@ public final class Album {
*
* @param albumConfig {@link AlbumConfig}.
*/
public static void initialize(AlbumConfig albumConfig) {
if (sAlbumConfig == null) sAlbumConfig = albumConfig;
else Log.w("Album", new IllegalStateException("Illegal operation, only allowed to configure once."));
public static void initialize(@Nullable AlbumConfig albumConfig) {
if (sAlbumConfig == null) {
sAlbumConfig = albumConfig;
} else {
Log.w("Album", new IllegalStateException("Illegal operation, only allowed to configure once."));
}
}

/**
* Get the album configuration.
*/
@NonNull
public static AlbumConfig getAlbumConfig() {
if (sAlbumConfig == null) {
sAlbumConfig = AlbumConfig.newBuilder(null).build();
Expand All @@ -121,168 +128,192 @@ public static AlbumConfig getAlbumConfig() {
/**
* Open the camera from the activity.
*/
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(Context context) {
@NonNull
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(@NonNull Context context) {
return new AlbumCamera(context);
}

/**
* Select images.
*/
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(Context context) {
@NonNull
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(@NonNull Context context) {
return new ImageChoice(context);
}

/**
* Select videos.
*/
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(Context context) {
@NonNull
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(@NonNull Context context) {
return new VideoChoice(context);
}

/**
* Select images and videos.
*/
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(Context context) {
@NonNull
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(@NonNull Context context) {
return new AlbumChoice(context);
}

/**
* Preview picture.
*/
public static GalleryWrapper gallery(Context context) {
@NonNull
public static GalleryWrapper gallery(@NonNull Context context) {
return new GalleryWrapper(context);
}

/**
* Preview Album.
*/
public static GalleryAlbumWrapper galleryAlbum(Context context) {
@NonNull
public static GalleryAlbumWrapper galleryAlbum(@NonNull Context context) {
return new GalleryAlbumWrapper(context);
}

/**
* Open the camera from the activity.
*/
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(Activity activity) {
@NonNull
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(@NonNull Activity activity) {
return new AlbumCamera(activity);
}

/**
* Select images.
*/
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(Activity activity) {
@NonNull
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(@NonNull Activity activity) {
return new ImageChoice(activity);
}

/**
* Select videos.
*/
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(Activity activity) {
@NonNull
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(@NonNull Activity activity) {
return new VideoChoice(activity);
}

/**
* Select images and videos.
*/
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(Activity activity) {
@NonNull
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(@NonNull Activity activity) {
return new AlbumChoice(activity);
}

/**
* Preview picture.
*/
public static BasicGalleryWrapper<GalleryWrapper, String, String, String> gallery(Activity activity) {
@NonNull
public static BasicGalleryWrapper<GalleryWrapper, String, String, String> gallery(@NonNull Activity activity) {
return new GalleryWrapper(activity);
}

/**
* Preview Album.
*/
public static BasicGalleryWrapper<GalleryAlbumWrapper, AlbumFile, String, AlbumFile> galleryAlbum(Activity activity) {
@NonNull
public static BasicGalleryWrapper<GalleryAlbumWrapper, AlbumFile, String, AlbumFile> galleryAlbum(@NonNull Activity activity) {
return new GalleryAlbumWrapper(activity);
}

/**
* Open the camera from the activity.
*/
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(Fragment fragment) {
@NonNull
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(@NonNull Fragment fragment) {
return new AlbumCamera(fragment.getActivity());
}

/**
* Select images.
*/
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(Fragment fragment) {
@NonNull
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(@NonNull Fragment fragment) {
return new ImageChoice(fragment.getActivity());
}

/**
* Select videos.
*/
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(Fragment fragment) {
@NonNull
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(@NonNull Fragment fragment) {
return new VideoChoice(fragment.getActivity());
}

/**
* Select images and videos.
*/
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(Fragment fragment) {
@NonNull
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(@NonNull Fragment fragment) {
return new AlbumChoice(fragment.getActivity());
}

/**
* Preview picture.
*/
public static BasicGalleryWrapper<GalleryWrapper, String, String, String> gallery(Fragment fragment) {
@NonNull
public static BasicGalleryWrapper<GalleryWrapper, String, String, String> gallery(@NonNull Fragment fragment) {
return new GalleryWrapper(fragment.getActivity());
}

/**
* Preview Album.
*/
public static BasicGalleryWrapper<GalleryAlbumWrapper, AlbumFile, String, AlbumFile> galleryAlbum(Fragment fragment) {
@NonNull
public static BasicGalleryWrapper<GalleryAlbumWrapper, AlbumFile, String, AlbumFile> galleryAlbum(@NonNull Fragment fragment) {
return new GalleryAlbumWrapper(fragment.getActivity());
}

/**
* Open the camera from the activity.
*/
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(android.support.v4.app.Fragment fragment) {
@NonNull
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(@NonNull androidx.fragment.app.Fragment fragment) {
return new AlbumCamera(fragment.getContext());
}

/**
* Select images.
*/
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(android.support.v4.app.Fragment fragment) {
@NonNull
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(@NonNull androidx.fragment.app.Fragment fragment) {
return new ImageChoice(fragment.getContext());
}

/**
* Select videos.
*/
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(android.support.v4.app.Fragment fragment) {
@NonNull
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(@NonNull androidx.fragment.app.Fragment fragment) {
return new VideoChoice(fragment.getContext());
}

/**
* Select images and videos.
*/
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(android.support.v4.app.Fragment fragment) {
@NonNull
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(@NonNull androidx.fragment.app.Fragment fragment) {
return new AlbumChoice(fragment.getContext());
}

/**
* Preview picture.
*/
public static BasicGalleryWrapper<GalleryWrapper, String, String, String> gallery(android.support.v4.app.Fragment fragment) {
@NonNull
public static BasicGalleryWrapper<GalleryWrapper, String, String, String> gallery(@NonNull androidx.fragment.app.Fragment fragment) {
return new GalleryWrapper(fragment.getContext());
}

/**
* Preview Album.
*/
public static BasicGalleryWrapper<GalleryAlbumWrapper, AlbumFile, String, AlbumFile> galleryAlbum(android.support.v4.app.Fragment fragment) {
@NonNull
public static BasicGalleryWrapper<GalleryAlbumWrapper, AlbumFile, String, AlbumFile> galleryAlbum(@NonNull androidx.fragment.app.Fragment fragment) {
return new GalleryAlbumWrapper(fragment.getContext());
}
}
Loading