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

2.2.0版本自定义UI会闪退 #94

Open
MrNANMU opened this issue Aug 13, 2020 · 0 comments
Open

2.2.0版本自定义UI会闪退 #94

MrNANMU opened this issue Aug 13, 2020 · 0 comments

Comments

@MrNANMU
Copy link

MrNANMU commented Aug 13, 2020

kotlin.KotlinNullPointerException at com.qingmei2.rximagepicker_extension.ui.adapter.AlbumsAdapter.bindView(AlbumsAdapter.kt:67) at android.widget.CursorAdapter.getView(CursorAdapter.java:289) at android.support.v7.widget.DropDownListView.measureHeightOfChildrenCompat(DropDownListView.java:321) at android.support.v7.widget.ListPopupWindow.buildDropDown(ListPopupWindow.java:1301) at android.support.v7.widget.ListPopupWindow.show(ListPopupWindow.java:647) at com.qingmei2.rximagepicker_extension.ui.widget.AlbumsSpinner$setSelectedTextView$1.onClick(AlbumsSpinner.kt:113) at android.view.View.performClick(View.java:6333) at android.view.View$PerformClick.run(View.java:24985) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:192) at android.app.ActivityThread.main(ActivityThread.java:6842) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
定位到是AlbumsAdapter的构造方法中的mPlaceholder为空,导致bindView失败。
`constructor(context: Context, c: Cursor?, autoRequery: Boolean) : super(context, c, autoRequery) {

    val ta = context.theme.obtainStyledAttributes(
            intArrayOf(R.attr.album_thumbnail_placeholder))
    mPlaceholder = ta.getDrawable(0)

//这个是空
ta.recycle()
}我自定义的ConfigBuilder:public class WeShootConfigBuilder {

private SelectionSpec selectionSpec;

public WeShootConfigBuilder(Set<MimeType> mimeTypes,boolean mediaTypeExclusive) {
    selectionSpec = SelectionSpec.Companion.getNewCleanInstance(new Glide4Engine());
    selectionSpec.setMimeTypeSet(mimeTypes);
    selectionSpec.setMediaTypeExclusive(mediaTypeExclusive);
    selectionSpec.setOrientation(SCREEN_ORIENTATION_UNSPECIFIED);
    selectionSpec.setShowSingleMediaType(true);
    selectionSpec.setMaxSelectable(10);
    selectionSpec.setCountable(true);
    selectionSpec.setThemeId(com.qingmei2.rximagepicker_extension_zhihu.R.style.Zhihu_Dracula);
}

public SelectionSpec build(){
    return selectionSpec;
}

}`
使用了知乎主题。
另外希望作者可以在readme中详细写一下如何自定义UI,比如主题需要配置什么,每个属性是什么意思等...我至今都没有摸索出如何自定义,自定义都应该增加什么配置等。这个不是只看Demo就能很快掌握的...(尤其我的项目中的UI还是高度自定义,类似抖音上传时候的那种,图片和视频在两个Fragment中还能滑动切换)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant