I am a beginner to android growth and am engaged on a interest challenge. I am making an attempt so as to add a circulaprogressdrawable in my fragment when the picture is getting loaded. However its not loading in any respect. It used to work once I was not utilizing Fragment and had the code inside an exercise. Can somebody please advise what am I doing incorrect? any options are welcome. 🙏 Thanks. Following is the code for reference
package deal com.instance.demoauthfirebase
import android.content material.Context
import android.graphics.Shade
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.swiperefreshlayout.widget.CircularProgressDrawable
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
/**
* A easy [Fragment] subclass.
*/
class FragmentImage : Fragment() {
companion object {
const val ARG_NAME = "urlVal"
enjoyable newInstance(urlVal: String): FragmentImage {
val fragment = FragmentImage()
val bundle = Bundle().apply {
putString(ARG_NAME, urlVal)
}
fragment.arguments = bundle
return fragment
}
}
override enjoyable onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val exercise = exercise as Context
var circularProgressDrawable = CircularProgressDrawable(exercise)
circularProgressDrawable.strokeWidth = 10f
circularProgressDrawable.centerRadius = 50f
circularProgressDrawable.setColorSchemeColors(Shade.GREEN)
circularProgressDrawable.begin()
val view: View = inflater.inflate(
R.structure.fragment_fragment_image, container,
false
)
val imgView = view.findViewById<ImageView>(R.id.imgView1)
val urlVal = arguments?.getString(ARG_NAME)
val choices = RequestOptions().placeholder(circularProgressDrawable)
choices.fitCenter()
Glide.with(exercise)
.load(urlVal)
.apply(choices)
.override(1200, 3000)
.into(imgView)
// Inflate the structure for this fragment
return view
}
}