我有按钮。通过单击此按钮,将打开图像过滤器片段:
filters_menu.setOnClickListener(object : View.OnClickListener {
override fun onClick(v: View?) {
imageFiltersFragment!!.listener = this@MainActivity
/* var fragmentTransaction=supportFragmentManager.beginTransaction().replace(R.id.content_area,imageFiltersFragment).commit()*/
imageFiltersFragment!!.show(supportFragmentManager, imageFiltersFragment!!.tag)
}
})
然后我们获得了过滤器包过滤器缩略图,显示了imageview的位图:
var filters = FilterPack.getFilterPack(activity!!) as MutableList
for (f in filters) {
val item = ThumbnailItem()
item.image = thumbImg
item.filter = f
item.filterName = f.name
ThumbnailsManager.addThumb(item)
Log.d("filterpack", f.name)
}
thumbnailList!!.addAll(ThumbnailsManager.processThumbs(activity))
activity!!.runOnUiThread {
thumbnailAdapter.notifyDataSetChanged()
}
}
Thread(runnable).start()
使用默认图像效果很好。
但是当我从图库中打开图片时,它在var filters = FilterPack.getFilterPack(activity!!) as MutableList