diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a0e0fd8..2985535 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -14,28 +14,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
@@ -425,7 +406,14 @@
1649327566267
-
+
+ 1649600646145
+
+
+
+ 1649600646145
+
+
@@ -509,6 +497,7 @@
-
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/github/bgrebennikov/devbuff/presentation/ui/customViews/AppbarIdeaDetails.kt b/app/src/main/java/com/github/bgrebennikov/devbuff/presentation/ui/customViews/AppbarIdeaDetails.kt
index d382669..2c09fb0 100644
--- a/app/src/main/java/com/github/bgrebennikov/devbuff/presentation/ui/customViews/AppbarIdeaDetails.kt
+++ b/app/src/main/java/com/github/bgrebennikov/devbuff/presentation/ui/customViews/AppbarIdeaDetails.kt
@@ -4,6 +4,7 @@ import android.content.Context
import android.content.res.TypedArray
import android.util.AttributeSet
import android.view.LayoutInflater
+import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
@@ -15,17 +16,11 @@ class AppbarIdeaDetails @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : ConstraintLayout(context, attrs) {
- private val binding by lazy {
- AppbarIdeaDetailsBinding.bind(
- LayoutInflater.from(context)
- .inflate(
- R.layout.appbar_idea_details,
- this, true
- )
- )
- }
+ private var _binding: AppbarIdeaDetailsBinding? = null
+ val binding get() = _binding!!
+
- private val viewAttrs: TypedArray by lazy{
+ private val viewAttrs: TypedArray by lazy {
context.obtainStyledAttributes(
attrs,
R.styleable.AppbarIdeaDetails,
@@ -33,15 +28,25 @@ class AppbarIdeaDetails @JvmOverloads constructor(
)
}
- init{
+ init {
+
+ _binding = AppbarIdeaDetailsBinding.bind(
+ LayoutInflater.from(context)
+ .inflate(
+ R.layout.appbar_idea_details,
+ this,
+ true
+ )
+ )
+
setupAppBar()
}
- fun onBackPressed(callback: () -> Unit){
+ fun onBackPressed(callback: () -> Unit) {
binding.backIcon.setOnClickListener { callback.invoke() }
}
- fun setImageFromUserId(userId: String?){
+ fun setImageFromUserId(userId: String?) {
if (userId == null) return
@@ -58,17 +63,16 @@ class AppbarIdeaDetails @JvmOverloads constructor(
}
- fun setTitle(title: String?){
+ fun setTitle(title: String?) {
binding.title.text = title
}
- fun setSubtitle(subtitle: String?){
+ fun setSubtitle(subtitle: String?) {
binding.subtitle.text = subtitle
}
-
- private fun setupAppBar(){
+ private fun setupAppBar() {
binding.apply {
setTitle(viewAttrs.getString(R.styleable.AppbarIdeaDetails_title))
setSubtitle(viewAttrs.getString(R.styleable.AppbarIdeaDetails_subtitle))
@@ -76,4 +80,12 @@ class AppbarIdeaDetails @JvmOverloads constructor(
}
}
+ override fun onDetachedFromWindow() {
+ super.onDetachedFromWindow()
+ Glide.with(context).clear(binding.userAvatarImage)
+ _binding = null
+
+
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_idea_details.xml b/app/src/main/res/layout/fragment_idea_details.xml
index fac57c9..ae3f701 100644
--- a/app/src/main/res/layout/fragment_idea_details.xml
+++ b/app/src/main/res/layout/fragment_idea_details.xml
@@ -23,7 +23,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
- app:layoutDescription="@xml/fragment_idea_details_xml_constraintlayout3_scene5"
+ app:layoutDescription="@xml/fragment_idea_details_xml_scene"
tools:context=".presentation.ui.fragments.IdeaDetailsFragment">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-