diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index 3fe8a731e..d7c4403d4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -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 { + override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean) = false + + override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target?, 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 diff --git a/app/src/main/res/layout/bottom_editor_actions_filter.xml b/app/src/main/res/layout/bottom_editor_actions_filter.xml index 689e81f2e..734942343 100644 --- a/app/src/main/res/layout/bottom_editor_actions_filter.xml +++ b/app/src/main/res/layout/bottom_editor_actions_filter.xml @@ -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"/>