Compare commits

...

2 Commits

Author SHA1 Message Date
dbe97f564e Revert imageview changes 2022-11-11 09:40:36 +01:00
aminecmi
3a3bf03114 Bigger checktile. 2022-11-10 21:41:55 +01:00
3 changed files with 7 additions and 17 deletions

View File

@ -1,23 +1,21 @@
package bou.amine.apps.readerforselfossv2.android.fragments
import android.graphics.drawable.Drawable
import android.graphics.drawable.LayerDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import bou.amine.apps.readerforselfossv2.android.R
import bou.amine.apps.readerforselfossv2.android.databinding.FragmentImageBinding
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.ImageViewTarget
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.RequestOptions
class ImageFragment : Fragment() {
private lateinit var imageUrl : String
private val glideOptions = RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL)
private var _binding: FragmentImageBinding? = null
private val binding get() = _binding
private lateinit var layers: LayerDrawable
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -31,18 +29,10 @@ class ImageFragment : Fragment() {
binding!!.photoView.visibility = View.VISIBLE
Glide.with(activity)
.asBitmap()
.apply(glideOptions)
.load(imageUrl)
.into(object : ImageViewTarget<Drawable>(binding!!.photoView) {
override fun setResource(resource: Drawable?) {
val background = resources.getDrawable(R.drawable.checkerboard, context?.theme)
layers = LayerDrawable(arrayOf(background, resource))
binding!!.photoView.setImageDrawable(layers)
}
override fun onLoadCleared(placeholder: Drawable?) {
layers = LayerDrawable(emptyArray())
}
})
.into(binding!!.photoView)
return view
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

After

Width:  |  Height:  |  Size: 235 B

View File

@ -10,7 +10,7 @@
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:background="?attr/colorOnBackground"
android:background="@drawable/checkerboard"
app:srcCompat="@android:drawable/screen_background_dark" />
</RelativeLayout>