-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
160 changed files
with
8,324 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
.DS_Store | ||
/build | ||
/captures | ||
|
||
.idea/ | ||
|
||
# .gitignore template from https://github.com/github/gitignore/blob/master/Android.gitignore | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
|
||
# Gradle build files | ||
matisse/build | ||
sample/build | ||
|
||
|
||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
|
||
# Keystore files | ||
*.jks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
![Image](/image/banner.png) | ||
|
||
# Matisse | ||
[![Build Status](https://travis-ci.org/zhihu/Matisse.svg)](https://travis-ci.org/zhihu/Matisse) [ ![Download](https://api.bintray.com/packages/zhihu/maven/matisse/images/download.svg) ](https://bintray.com/zhihu/maven/matisse/_latestVersion) | ||
|
||
Matisse is a well-designed local image and video selector for Android. You can | ||
- Use it in Activity or Fragment | ||
- Select images including JPEG, PNG, GIF and videos including MPEG, MP4 | ||
- Apply different themes, including two built-in themes and custom themes | ||
- Different image loaders | ||
- Define custom filter rules | ||
- More to find out yourself | ||
|
||
| Zhihu Style | Dracula Style | Preview | | ||
|:------------------------------:|:---------------------------------:|:--------------------------------:| | ||
|![](image/screenshot_zhihu.png) | ![](image/screenshot_dracula.png) | ![](image/screenshot_preview.png)| | ||
|
||
## Download | ||
Gradle: | ||
|
||
```groovy | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
compile 'com.zhihu.android:matisse:$latest_version' | ||
} | ||
``` | ||
|
||
Check out [Matisse releases](https://github.com/zhihu/Matisse/releases) to see more unstable versions. | ||
|
||
## ProGuard | ||
If you use [Glide](https://github.com/bumptech/glide) as your image engine, add rules as Glide's README says. | ||
And add extra rule: | ||
```pro | ||
-dontwarn com.squareup.picasso.** | ||
``` | ||
|
||
If you use [Picasso](https://github.com/square/picasso) as your image engine, add rules as Picasso's README says. | ||
And add extra rule: | ||
```pro | ||
-dontwarn com.bumptech.glide.** | ||
``` | ||
**Attention**: The above progurad rules are correct. | ||
|
||
## How do I use Matisse? | ||
#### Permission | ||
The library requires two permissions: | ||
- `android.permission.READ_EXTERNAL_STORAGE` | ||
- `android.permission.WRITE_EXTERNAL_STORAGE` | ||
|
||
So if you are targeting Android 6.0+, you need to handle runtime permission request before next step. | ||
|
||
#### Simple usage snippet | ||
------ | ||
Start `MatisseActivity` from current `Activity` or `Fragment`: | ||
|
||
```java | ||
Matisse.from(MainActivity.this) | ||
.choose(MimeType.allOf()) | ||
.countable(true) | ||
.maxSelectable(9) | ||
.addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K)) | ||
.gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size)) | ||
.restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) | ||
.thumbnailScale(0.85f) | ||
.imageEngine(new GlideEngine()) | ||
.forResult(REQUEST_CODE_CHOOSE); | ||
``` | ||
|
||
#### Themes | ||
There are two built-in themes you can use to start `MatisseActivity`: | ||
- `R.style.Matisse_Zhihu` (light mode) | ||
- `R.style.Matisse_Dracula` (dark mode) | ||
|
||
And Also you can define your own theme as you wish. | ||
|
||
#### Receive Result | ||
In `onActivityResult()` callback of the starting `Activity` or `Fragment`: | ||
|
||
```java | ||
List<Uri> mSelected; | ||
|
||
@Override | ||
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
super.onActivityResult(requestCode, resultCode, data); | ||
if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) { | ||
mSelected = Matisse.obtainResult(data); | ||
Log.d("Matisse", "mSelected: " + mSelected); | ||
} | ||
} | ||
``` | ||
|
||
#### For Glide V4 | ||
|
||
To be honest,the library can't supply GlideEngine for Glide both v3 and v4 at the same time. (Anyone who | ||
have good idea to achieve this. PR is welcomed) | ||
|
||
GlideEngine with Glide v3 is default. | ||
|
||
So if your project's glide version is 4.0+ ,then you must realize GlideEngine by yourself. More details | ||
could refer with [Glide4Engine](https://github.com/zhihu/Matisse/blob/master/sample/src/main/java/com/zhihu/matisse/sample/Glide4Engine.java) in the sample. | ||
|
||
#### More | ||
Find more details about Matisse in [wiki](https://github.com/zhihu/Matisse/wiki). | ||
|
||
## Contributing | ||
[Matisse is an Open Source Project](https://github.com/zhihu/Matisse/blob/master/CONTRIBUTING.md) | ||
|
||
## Thanks | ||
This library is inspired by [Laevatein](https://github.com/nohana/Laevatein) and uses some of its source code. | ||
|
||
## License | ||
|
||
Copyright 2017 Zhihu Inc. | ||
|
||
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. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2017 Zhihu Inc. | ||
* | ||
* 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. | ||
*/ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
google() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.2.1' | ||
classpath 'com.novoda:bintray-release:0.9' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
jcenter() | ||
google() | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Project-wide Gradle settings. | ||
|
||
# IDE (e.g. Android Studio) users: | ||
# Gradle settings configured through the IDE *will override* | ||
# any settings specified in this file. | ||
|
||
# For more details on how to configure your build environment visit | ||
# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
|
||
# Specifies the JVM arguments used for the daemon process. | ||
# The setting is particularly useful for tweaking memory settings. | ||
org.gradle.jvmargs=-Xmx1536m | ||
|
||
# When configured, Gradle will run in incubating parallel mode. | ||
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Wed Jun 27 11:32:18 CST 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip |
Oops, something went wrong.