mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
apply the selected filter on the fullscreen shown image
This commit is contained in:
parent
c17f77ceda
commit
1112d5f19b
2 changed files with 21 additions and 2 deletions
|
@ -12,6 +12,10 @@ import android.provider.MediaStore
|
|||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.DataSource
|
||||
import com.bumptech.glide.load.engine.GlideException
|
||||
import com.bumptech.glide.request.RequestListener
|
||||
import com.bumptech.glide.request.target.Target
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.OTG_PATH
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||
|
@ -69,6 +73,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
private var isCropIntent = false
|
||||
private var isEditingWithThirdParty = false
|
||||
|
||||
private var shownBitmap: Bitmap? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_edit)
|
||||
|
@ -116,7 +122,18 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
}
|
||||
|
||||
isCropIntent = intent.extras?.get(CROP) == "true"
|
||||
Glide.with(this).load(uri).into(default_image_view)
|
||||
Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(uri)
|
||||
.listener(object : RequestListener<Bitmap> {
|
||||
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>?, isFirstResource: Boolean) = false
|
||||
|
||||
override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||
shownBitmap = resource
|
||||
return false
|
||||
}
|
||||
}).into(default_image_view)
|
||||
|
||||
setupBottomActions()
|
||||
}
|
||||
|
||||
|
@ -270,7 +287,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
|
||||
val filterItems = filterThumbnailsManager.processThumbs()
|
||||
val adapter = FiltersAdapter(filterItems) {
|
||||
|
||||
val newBitmap = Bitmap.createBitmap(shownBitmap)
|
||||
default_image_view.setImageBitmap(it.filter.processFilter(newBitmap))
|
||||
}
|
||||
|
||||
bottom_actions_filter_list.adapter = adapter
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
android:layout_height="@dimen/bottom_filters_height"
|
||||
android:background="@color/crop_image_view_background"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue