Git Product home page Git Product logo

matisse's Introduction

Image

Matisse

Build Status Download

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

Download

Gradle:

repositories {
    jcenter()
}

dependencies {
    implementation 'com.zhihu.android:matisse:$latest_version'
}

Check out Matisse releases to see more unstable versions.

ProGuard

If you use Glide as your image engine, add rules as Glide's README says.
And add extra rule:

-dontwarn com.squareup.picasso.**

If you use Picasso as your image engine, add rules as Picasso's README says.
And add extra rule:

-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:

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())
        .showPreview(false) // Default is `true`
        .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:

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);
    }
}

More

Find more details about Matisse in wiki.

Contributing

Matisse is an Open Source Project

Thanks

This library is inspired by 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.

matisse's People

Contributors

borisdamato avatar bruferrari avatar coderkan avatar coxier avatar davidllorca avatar devbalo93 avatar dima-369 avatar dreamersoul avatar drizzlezhang avatar eprendre avatar gejiaheng avatar greenskinmonster avatar guillemroca avatar junyuecao avatar marcinkunert avatar meyersurix avatar minibugdev avatar mthli avatar nevermore1000 avatar oxc avatar rebooters avatar romantruba avatar sherlockgougou avatar smelfungus avatar tanlehua avatar unixzii avatar venkat20390 avatar yccheok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matisse's Issues

微博长图无法显示,一些相机拍摄的大图片预览卡顿明显

Uploading http%3A%2F%2Fclub-img.kdslife.com%2Fattach%2F1k0%(1).jpg…
Uploading http%3A%2F%2Fclub-img.kdslife.com%2Fattach%2F1k0%(2).jpg…
Uploading http%3A%2F%2Fclub-img.kdslife.com%2Fattach%2F1k0%.jpg…
上面的三张图片当预览时,左右切换加载稍慢,并且viewpager的切换卡顿明显。
并且预览界面viewpager的内存限制较小,好像只是保存了相邻两个的图片,滑到第四张图片时,第一页的图片再预览时就需要一段时间重新加载,这是上面三张图片的情况下。
微博长图无法预览。
手机是nexus5 6.0.1系统

怎么获取图片的绝对路径?

我使用的时候,发现根据Uri获取到的图片路径不能生成正确的file,FIie file = new File(uri.getPath());生成的这个file上传给服务器的时候报的路径不对

Any way to change the language of buttons?

Hi, I would like to use Matisse on a project that I'm woking on but I've noticed that this lib doesn't have support to another languages other than english, is it right? is there a way to achieve it?

关于Demo使用中的若干问题

  1. 调用拍照,返回没有反应
    经过排查,发现是onActivityResult中resultCode为0而不是-1;
    进一步排查,发现是MediaStoreCompat.java中createImageFile方法里所创建的tempFile路径不存在造成;
    增加文件路径判断才正常
if (storageDir != null && storageDir.isDirectory() && !storageDir.exists()) {
    storageDir.mkdirs();
}
  1. 拍照成功后的照片,在第二次进入选择器没有出现;
    应该是通知广播问题
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(path))));

不知道为什么Matisse中没有解决上面几个问题。

How do you get the latest photo data

Hi,How do you get the latest photo data? I use ContentResolver to get pictures sometimes can not get the latest pictures, although I saw your source, but the ability is limited, did not see where to do the operation, you can Take the time to help me?

crushException

05-04 11:53:07.868 4608 29537 E Parcel : Class not found when unmarshalling: com.zhihu.matisse.internal.entity.Item
05-04 11:53:07.868 4608 29537 E Parcel : java.lang.ClassNotFoundException: com.zhihu.matisse.internal.entity.Item
05-04 11:53:07.868 4608 29537 E Parcel : at java.lang.Class.classForName(Native Method)
05-04 11:53:07.868 4608 29537 E Parcel : at java.lang.Class.forName(Class.java:400)
05-04 11:53:07.868 4608 29537 E Parcel : at android.os.Parcel.readParcelableCreator(Parcel.java:2517)
05-04 11:53:07.868 4608 29537 E Parcel : at android.os.Parcel.readParcelable(Parcel.java:2471)
05-04 11:53:07.868 4608 29537 E Parcel : at android.os.Parcel.readValue(Parcel.java:2374)
05-04 11:53:07.868 4608 29537 E Parcel : at android.os.Parcel.readArrayMapInternal(Parcel.java:2727)
05-04 11:53:07.868 4608 29537 E Parcel : at android.os.BaseBundle.unparcel(BaseBundle.java:269)
05-04 11:53:07.868 4608 29537 E Parcel : at android.os.BaseBundle.getString(BaseBundle.java:992)
05-04 11:53:07.868 4608 29537 E Parcel : at android.content.Intent.getStringExtra(Intent.java:6702)
05-04 11:53:07.868 4608 29537 E Parcel : at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:336)
05-04 11:53:07.868 4608 29537 E Parcel : at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1097)
05-04 11:53:07.868 4608 29537 E Parcel : at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:5767)
05-04 11:53:07.868 4608 29537 E Parcel : at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5572)
05-04 11:53:07.868 4608 29537 E Parcel : at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:176)
05-04 11:53:07.868 4608 29537 E Parcel : at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3573)
05-04 11:53:07.868 4608 29537 E Parcel : at android.os.Binder.execTransact(Binder.java:573)
05-04 11:53:07.868 4608 29537 E Parcel : Caused by: java.lang.ClassNotFoundException: com.zhihu.matisse.internal.entity.Item
05-04 11:53:07.868 4608 29537 E Parcel : at java.lang.Class.classForName(Native Method)
05-04 11:53:07.868 4608 29537 E Parcel : at java.lang.BootClassLoader.findClass(ClassLoader.java:1346)
05-04 11:53:07.868 4608 29537 E Parcel : at java.lang.BootClassLoader.loadClass(ClassLoader.java:1406)
05-04 11:53:07.868 4608 29537 E Parcel : at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
05-04 11:53:07.868 4608 29537 E Parcel : ... 16 more
05-04 11:53:07.868 4608 29537 E Parcel : Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

Create a new release

Hey there!

As of 0.4.3, the library doesn't support video selection so I was wondering when the recent changes would be released :)

是否考虑支持拍照?

看到README的第一张截图是有拍照的,但是在实际代码中并未有支持拍照的相关配置。

尝试运行了sample之后发现也是不可以的,所以其实是不支持拍照的?

Support video files

I have read source code of the repo, a beautiful project! And I think the library can support more feature , such as select video. So can I create a pull request? Because in your README:

Better to open an issue to discuss with the team and the community if you're intended to work on something BIG.

Please add zh-rTW langs

<string name="album_name_all">全部</string>
<string name="button_preview">預覽</string>
<string name="button_apply_disable">使用</string>
<string name="button_apply">使用(%1$d)</string>
<string name="button_back">返回</string>
<string name="photo_grid_capture">拍一張</string>
<string name="empty_text">還沒有圖片或影片</string>
<string name="button_ok">我知道了</string>
<string name="error_over_count_default">您已經達到最大選擇數量</string>
<string name="error_over_count">最多只能選擇 %1$d 個文件</string>
<string name="error_under_quality">圖片質量太低</string>
<string name="error_over_quality">圖片質量太高</string>
<string name="error_file_type">不支援的文件類型</string>
<string name="error_type_conflict">不能同時選擇圖片和影片</string>
<string name="error_no_video_activity">沒有支援影片預覽的應用程式</string>

红米Note拍照挂掉了

captureStrategy(new CaptureStrategy(true, "com.zhihu.matisse.sample.fileprovider"))这是我拍照的代码

                                                                          Process: com.zhihu.matisse.sample, PID: 18814
                                                                          java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zhihu.matisse.sample/com.zhihu.matisse.ui.MatisseActivity}: android.view.InflateException: Binary XML file line #31: Binary XML file line #31: Error inflating class TextView
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2449)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2509)
                                                                              at android.app.ActivityThread.access$1000(ActivityThread.java:153)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                              at android.os.Looper.loop(Looper.java:154)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5527)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
                                                                           Caused by: android.view.InflateException: Binary XML file line #31: Binary XML file line #31: Error inflating class TextView
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:543)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                              at com.zhihu.matisse.ui.MatisseActivity.onCreate(MatisseActivity.java:83)
                                                                              at android.app.Activity.performCreate(Activity.java:6303)
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2402)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2509) 
                                                                              at android.app.ActivityThread.access$1000(ActivityThread.java:153) 
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373) 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                              at android.os.Looper.loop(Looper.java:154) 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5527) 
                                                                              at java.lang.reflect.Method.invoke(Native Method) 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) 
                                                                           Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class TextView
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:786)
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708)
                                                                              at android.view.LayoutInflater.rInflate(LayoutInflater.java:839)
                                                                              at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
                                                                              at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
                                                                              at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
                                                                              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                                              at com.zhihu.matisse.ui.MatisseActivity.onCreate(MatisseActivity.java:83) 
                                                                              at android.app.Activity.performCreate(Activity.java:6303) 
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2402) 
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2509) 
                                                                              at android.app.ActivityThread.access$1000(ActivityThread.java:153) 
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373) 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                              at android.os.Looper.loop(Looper.java:154) 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5527) 
                                                                              at java.lang.reflect.Method.invoke(Native Method) 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) 
                                                                           Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 5: TypedValue{t=0x2/d=0x7f010004 a=-1}
                                                                              at android.content.res.TypedArray.getColorStateList(TypedArray.java:484)
                                                                              at android.widget.TextView.<init>(TextView.java:1046)
                                                                              at android.widget.TextView.<init>(TextView.java:674)
                                                                              at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:62)
                                                                              at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:58)
                                                                              at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1029)
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1087)
                                                                              at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:47)
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708) 
                                                                              at android.view.LayoutInflater.rInflate(LayoutInflater.java:839) 
                                                                              at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
                                                                              at android.view.LayoutInflater.rInflate(LayoutInflater.java:842) 
                                                                              at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:519) 
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
                                                                              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                                              at com.zhihu.matisse.ui.MatisseActivity.onCreate(MatisseActivity.java:83) 
                                                                              at android.app.Activity.performCreate(Activity.java:6303) 
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2402) 
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2509) 
                                                                              at android.app.ActivityThread.access$1000(ActivityThread.java:153) 
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373) 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                              at android.os.Looper.loop(Looper.java:154) 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5527) 
                                                                              at java.lang.reflect.Method.invoke(Native Method) 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) ```

Preview mode apply text color

Seems like there is no text color customization for preview mode apply text via attrs
bottomToolbar.apply.textColor
That one isn't applied for suggested property.
Thank you.

issue importing

I get this:

Unable to load class 'org.gradle.api.internal.component.Usage'. Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

image

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/Glide;

I have an issue when use lib.
An error occurred with log:
Process: net.awpspace.cutecrop, PID: 26234 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/Glide; at com.zhihu.matisse.engine.impl.GlideEngine.loadThumbnail(GlideEngine.java:35) at com.zhihu.matisse.internal.ui.widget.PhotoGrid.setImage(PhotoGrid.java:112) at com.zhihu.matisse.internal.ui.widget.PhotoGrid.bindPhoto(PhotoGrid.java:80) at com.zhihu.matisse.internal.ui.adapter.AlbumPhotosAdapter.onBindViewHolder(AlbumPhotosAdapter.java:111) at com.zhihu.matisse.internal.ui.adapter.RecyclerViewCursorAdapter.onBindViewHolder(RecyclerViewCursorAdapter.java:44) at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6356) at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6389) at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5335) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5598) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224) at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595) at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) at android.widget.FrameLayout.onLayout(FrameLayout.java:574) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) at android.widget.FrameLayout.onLayout(FrameLayout.java:574) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1195) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) at android.widget.FrameLayout.onLayout(FrameLayout.java:574) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813) at android.widget.LinearLayout.onLayout(LinearLayout.java:1722) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) at android.widget.FrameLayout.onLayout(FrameLayout.java:574) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813) at android.widget.LinearLayout.onLayout(LinearLayout.java:1722) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) at android.widget.FrameLayout.onLayout(FrameLayout.java:574) at android.view.View.layout(View.java:16001) at android.view.ViewGroup.layout(ViewGroup.java:5181) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2484) at android.view.ViewRootImpl.performTra
How to resolve this? thanks!

java.lang.NullPointerException

                                                                                     java.lang.NullPointerException: Attempt to invoke interface method 'void com.zhihu.matisse.engine.ImageEngine.loadThumbnail(android.content.Context, int, android.graphics.drawable.Drawable, android.widget.ImageView, android.net.Uri)' on a null object reference

Matisse.from(MainActivity.this) .choose(MimeType.allOf()) .countable(true) .maxSelectable(9) .restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) // .thumbnailScale(0.85f) // .imageEngine(new GlideEngine()) .forResult(REQUEST_CODE_CHOOSE);

Single selection only

Hi,

Is it possible to add single selection functionality to the library?

I know that you can set maxSelectable(1) but I think that the user experience will be way better if the user can just select the photo, instead of "checking" and then clicking on "apply".

Thanks! Keep up the good work!

Videos?

You stated this is image and video selecting gallery, but I cannot see videos. In the MimeType enum, I only see images...

能否只需要显示图片

新的0.5.2这个版本,我只能设置是选择图片还是视频,但是我希望用户只能看到图片或者视频,这个应该怎么处理

部分照片无法预览

作者你好,感谢分享这么棒的一个 repo,也感谢你积极地回复 issue.

目前我出现了部分照片无法预览的问题。

通过观察发现,我手机里某些文件夹里面的图片,是无法预览的(就是点击缩略图之后,跳转的界面不显示图片)

我总结应该是与这个图片的路径有关吧,整个 Camera 文件夹下的图片都无法预览

搜索了 wiki 好像并不是我使用姿势的问题,请问下作者如何解决呢?

相册刷新问题

我设置完capture和captureStrategy后,拍照完成后可以获取图片uri,但是我再次点击进入,刚才拍摄的照片并没有显示出来,我退出到桌面后,后台杀掉应用再进入,刚才拍摄的照片才出现,问这时什么原因造成的,如何解决???

When to use Matisse

I guess that single select is used for choosing a photo as user's avatar. #55

Up to now,I have not come up with situations where Matisse can be used.

As the author @gejiaheng said

Matisse is a well-designed local image and video selector for Android.

In my life,android app selector has two main usage:

  • Choose a photo and crop it as their avatar
  • Choose less than or equal 9 photos and then edit chosen photos to upload to moments like wechat and QQ

It seems Matisse can not perform well as needed.However developer can develop their selector based on
Matisse.So I do not think the gradle import is necessary because every developer cannt use this lib directly.

How to hide types that are not allowed from Matisse?

Hi guys, me again, I've made a fork of this library because I had to make some minor changes in order to use it into one of my projects, some of them I've already pull requested here, but the point is that I need to hide files that are not allowed by my application, for example, if I have Matisse.from(this).choose(MimeType.ofVideo(), false) I want to hide all the media that aren't video files, that's an UX request from my development team, I've tried to change the AlbumMediaAdapter by filtering and I have some success, but I still have white frames in the RecyclerView, I don't get why, even trying to use notifyItemChanged or notifyDatasetChanged these gaps don't move away. Do you know why or there's a better way to achieve this?

These are the changes that I've made so far, I know that's not the best option doing this on adapter, but I need to achieve a fast prototype of this feature.

@Override
    protected void onBindViewHolder(final RecyclerView.ViewHolder holder, Cursor cursor) {
        final Item item = Item.valueOf(cursor);

        if (holder instanceof CaptureViewHolder) {
            CaptureViewHolder captureViewHolder = (CaptureViewHolder) holder;
            Drawable[] drawables = captureViewHolder.mHint.getCompoundDrawables();
            TypedArray ta = holder.itemView.getContext().getTheme().obtainStyledAttributes(
                    new int[]{R.attr.capture_textColor});
            int color = ta.getColor(0, 0);
            ta.recycle();
            for (Drawable drawable : drawables) {
                if (drawable != null) {
                    drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
                }
            }
        } else if (holder instanceof MediaViewHolder) {
            MediaViewHolder mediaViewHolder = (MediaViewHolder) holder;

            if (mSelectionSpec.mimeTypeSet.toString().contains(item.mimeType)) {
                mediaViewHolder.mMediaGrid.preBindMedia(new MediaGrid.PreBindInfo(
                        getImageResize(mediaViewHolder.mMediaGrid.getContext()),
                        mPlaceholder,
                        mSelectionSpec.countable,
                        holder
                ));

                mediaViewHolder.mMediaGrid.bindMedia(item);
                mediaViewHolder.mMediaGrid.setOnMediaGridClickListener(this);
                setCheckStatus(item, mediaViewHolder.mMediaGrid);
            } else {
                mediaViewHolder.mMediaGrid.setVisibility(View.GONE);
            }
        }
    } 

Thanks in advance. :)

Unable to load class 'org.gradle.api.internal.component.Usage'

gradle 失败,下面是log,请问这个这么破

Error:Unable to load class 'org.gradle.api.internal.component.Usage'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

java.lang.IllegalArgumentException: Width and height must be Target#SIZE_ORIGINAL or > 0

build.grade

    ...
    compile 'com.zhihu.android:matisse:0.4.3'
    compile 'com.github.bumptech.glide:glide:3.7.0'

full crash log

java.lang.IllegalArgumentException: Width and height must be Target#SIZE_ORIGINAL or > 0
                                                                       at com.bumptech.glide.GenericRequestBuilder.override(GenericRequestBuilder.java:564)
                                                                       at com.bumptech.glide.BitmapRequestBuilder.override(BitmapRequestBuilder.java:435)
                                                                       at com.zhihu.matisse.engine.impl.GlideEngine.loadThumbnail(GlideEngine.java:39)
                                                                       at com.zhihu.matisse.internal.ui.widget.PhotoGrid.setImage(PhotoGrid.java:112)
                                                                       at com.zhihu.matisse.internal.ui.widget.PhotoGrid.bindPhoto(PhotoGrid.java:80)
                                                                       at com.zhihu.matisse.internal.ui.adapter.AlbumPhotosAdapter.onBindViewHolder(AlbumPhotosAdapter.java:111)
                                                                       at com.zhihu.matisse.internal.ui.adapter.RecyclerViewCursorAdapter.onBindViewHolder(RecyclerViewCursorAdapter.java:44)
                                                                       at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6356)
                                                                       at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6389)
                                                                       at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5335)
                                                                       at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5598)
                                                                       at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)
                                                                       at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)
                                                                       at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
                                                                       at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556)
                                                                       at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
                                                                       at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
                                                                       at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
                                                                       at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
                                                                       at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312)
                                                                       at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
                                                                       at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
                                                                       at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
                                                                       at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
                                                                       at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
                                                                       at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
                                                                       at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
                                                                       at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
                                                                       at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
05-29 11:46:37.197 11265-11265/didikee.image2pdf E/AndroidRuntime:     at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
                                                                       at com.android.internal.policy.DecorView.onLayout(DecorView.java:818)
                                                                       at android.view.View.layout(View.java:18799)
                                                                       at android.view.ViewGroup.layout(ViewGroup.java:5952)
                                                                       at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2627)
                                                                       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2343)
                                                                       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1502)
                                                                       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7044)
                                                                       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
                                                                       at android.view.Choreographer.doCallbacks(Choreographer.java:702)
                                                                       at android.view.Choreographer.doFrame(Choreographer.java:638)
                                                                       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
                                                                       at android.os.Handler.handleCallback(Handler.java:751)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                       at android.os.Looper.loop(Looper.java:154)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:6646)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

what's wrong?

Convert content:// URI to actual path

This library provides exactly what I need, except that it returns uris. It is not convenient to convert uris to actual path. Though there are some materials about using contentResolver to get the real path, but it is error prone especially for beginners.
hope there is a solution for this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.