Skip to content

Commit cfc4d39

Browse files
authored
Merge pull request #3 from DevBuffProject/presentation
Presentation
2 parents 7d6d50f + 3ccbd91 commit cfc4d39

File tree

4 files changed

+42
-143
lines changed

4 files changed

+42
-143
lines changed

.idea/workspace.xml

Lines changed: 12 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/github/bgrebennikov/devbuff/presentation/ui/customViews/AppbarIdeaDetails.kt

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.content.res.TypedArray
55
import android.util.AttributeSet
66
import android.view.LayoutInflater
7+
import android.view.View
78
import androidx.constraintlayout.widget.ConstraintLayout
89
import com.bumptech.glide.Glide
910
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
@@ -15,33 +16,37 @@ class AppbarIdeaDetails @JvmOverloads constructor(
1516
context: Context, attrs: AttributeSet? = null
1617
) : ConstraintLayout(context, attrs) {
1718

18-
private val binding by lazy {
19-
AppbarIdeaDetailsBinding.bind(
20-
LayoutInflater.from(context)
21-
.inflate(
22-
R.layout.appbar_idea_details,
23-
this, true
24-
)
25-
)
26-
}
19+
private var _binding: AppbarIdeaDetailsBinding? = null
20+
val binding get() = _binding!!
21+
2722

28-
private val viewAttrs: TypedArray by lazy{
23+
private val viewAttrs: TypedArray by lazy {
2924
context.obtainStyledAttributes(
3025
attrs,
3126
R.styleable.AppbarIdeaDetails,
3227
0, 0
3328
)
3429
}
3530

36-
init{
31+
init {
32+
33+
_binding = AppbarIdeaDetailsBinding.bind(
34+
LayoutInflater.from(context)
35+
.inflate(
36+
R.layout.appbar_idea_details,
37+
this,
38+
true
39+
)
40+
)
41+
3742
setupAppBar()
3843
}
3944

40-
fun onBackPressed(callback: () -> Unit){
45+
fun onBackPressed(callback: () -> Unit) {
4146
binding.backIcon.setOnClickListener { callback.invoke() }
4247
}
4348

44-
fun setImageFromUserId(userId: String?){
49+
fun setImageFromUserId(userId: String?) {
4550

4651
if (userId == null) return
4752

@@ -58,22 +63,29 @@ class AppbarIdeaDetails @JvmOverloads constructor(
5863

5964
}
6065

61-
fun setTitle(title: String?){
66+
fun setTitle(title: String?) {
6267
binding.title.text = title
6368
}
6469

65-
fun setSubtitle(subtitle: String?){
70+
fun setSubtitle(subtitle: String?) {
6671
binding.subtitle.text = subtitle
6772
}
6873

6974

70-
71-
private fun setupAppBar(){
75+
private fun setupAppBar() {
7276
binding.apply {
7377
setTitle(viewAttrs.getString(R.styleable.AppbarIdeaDetails_title))
7478
setSubtitle(viewAttrs.getString(R.styleable.AppbarIdeaDetails_subtitle))
7579
setImageFromUserId(viewAttrs.getString(R.styleable.AppbarIdeaDetails_imageFromUserId))
7680
}
7781
}
7882

83+
override fun onDetachedFromWindow() {
84+
super.onDetachedFromWindow()
85+
Glide.with(context).clear(binding.userAvatarImage)
86+
_binding = null
87+
88+
89+
}
90+
7991
}

app/src/main/res/layout/fragment_idea_details.xml

Lines changed: 1 addition & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
android:layout_width="match_parent"
2424
android:layout_height="match_parent"
2525
android:background="@color/white"
26-
app:layoutDescription="@xml/fragment_idea_details_xml_constraintlayout3_scene5"
26+
app:layoutDescription="@xml/fragment_idea_details_xml_scene"
2727
tools:context=".presentation.ui.fragments.IdeaDetailsFragment">
2828

2929
<View
@@ -45,108 +45,6 @@
4545
tools:subtitle="Boris Azazovsky"
4646
tools:title="Reaction Alpha" />
4747

48-
49-
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
50-
<!-- android:id="@+id/appBar"-->
51-
<!-- android:layout_width="match_parent"-->
52-
<!-- android:layout_height="?attr/actionBarSize"-->
53-
<!-- android:alpha="0"-->
54-
<!-- android:background="@color/white"-->
55-
<!-- android:padding="@dimen/margin_small"-->
56-
<!-- app:layout_constraintTop_toTopOf="parent">-->
57-
58-
<!-- <ImageView-->
59-
<!-- android:id="@+id/backIcon"-->
60-
<!-- android:layout_width="wrap_content"-->
61-
<!-- android:layout_height="0dp"-->
62-
<!-- android:layout_marginStart="@dimen/margin_default"-->
63-
<!-- android:adjustViewBounds="true"-->
64-
<!-- android:clickable="true"-->
65-
<!-- android:focusable="true"-->
66-
<!-- android:foreground="?attr/selectableItemBackground"-->
67-
<!-- android:padding="@dimen/padding_small"-->
68-
<!-- android:src="@drawable/ic_back"-->
69-
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
70-
<!-- app:layout_constraintDimensionRatio="1:1"-->
71-
<!-- app:layout_constraintStart_toStartOf="parent"-->
72-
<!-- app:layout_constraintTop_toTopOf="parent"-->
73-
<!-- android:background="@drawable/bg_rounded_24"-->
74-
<!-- app:tint="@color/black"-->
75-
<!-- android:contentDescription="@string/cd_author_avatar_default"-->
76-
<!-- />-->
77-
78-
<!-- <androidx.cardview.widget.CardView-->
79-
<!-- android:id="@+id/userAvatar"-->
80-
<!-- android:layout_width="wrap_content"-->
81-
<!-- android:layout_height="match_parent"-->
82-
<!-- android:layout_marginStart="@dimen/margin_default"-->
83-
<!-- android:layout_marginTop="@dimen/margin_small"-->
84-
<!-- android:layout_marginBottom="@dimen/margin_small"-->
85-
<!-- android:clickable="true"-->
86-
<!-- android:focusable="true"-->
87-
<!-- android:foreground="?attr/selectableItemBackground"-->
88-
<!-- app:cardCornerRadius="@dimen/corners_radius_small"-->
89-
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
90-
<!-- app:layout_constraintDimensionRatio="1:1"-->
91-
<!-- app:layout_constraintStart_toEndOf="@+id/backIcon"-->
92-
<!-- app:layout_constraintTop_toTopOf="parent"-->
93-
<!-- app:cardElevation="0dp"-->
94-
<!-- >-->
95-
96-
<!-- <ImageView-->
97-
<!-- android:id="@+id/userAvatarImage"-->
98-
<!-- android:layout_width="match_parent"-->
99-
<!-- android:layout_height="wrap_content"-->
100-
<!-- android:adjustViewBounds="true"-->
101-
<!-- android:scaleType="centerCrop"-->
102-
<!-- tools:src="@raw/sample_image"-->
103-
<!-- app:ideaThumbnailPhotoFromUser="@{alreadyLoadedInfo.ownerIdea.id}"-->
104-
<!-- />-->
105-
<!-- </androidx.cardview.widget.CardView>-->
106-
107-
<!-- <LinearLayout-->
108-
<!-- android:id="@+id/toolbarTitle"-->
109-
<!-- android:layout_width="0dp"-->
110-
<!-- android:layout_height="0dp"-->
111-
<!-- android:layout_marginStart="@dimen/margin_default"-->
112-
<!-- android:gravity="center_vertical"-->
113-
<!-- android:orientation="vertical"-->
114-
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
115-
<!-- app:layout_constraintEnd_toStartOf="@+id/toolbarStatus"-->
116-
<!-- app:layout_constraintStart_toEndOf="@+id/userAvatar"-->
117-
<!-- app:layout_constraintTop_toTopOf="parent">-->
118-
119-
<!-- <TextView-->
120-
<!-- android:layout_width="wrap_content"-->
121-
<!-- android:layout_height="wrap_content"-->
122-
<!-- android:text="@{alreadyLoadedInfo.name}"-->
123-
<!-- android:textColor="@color/black"-->
124-
<!-- tools:text="@string/default_idea_title" />-->
125-
126-
<!-- <TextView-->
127-
<!-- android:layout_width="wrap_content"-->
128-
<!-- android:layout_height="wrap_content"-->
129-
<!-- android:text="@string/default_name" />-->
130-
131-
132-
<!-- </LinearLayout>-->
133-
134-
<!-- <ImageView-->
135-
<!-- android:id="@+id/toolbarStatus"-->
136-
<!-- android:layout_width="wrap_content"-->
137-
<!-- android:layout_height="0dp"-->
138-
<!-- android:layout_marginStart="@dimen/margin_default"-->
139-
<!-- android:layout_marginEnd="@dimen/margin_default"-->
140-
<!-- android:src="@drawable/ic_waiting_for_team"-->
141-
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
142-
<!-- app:layout_constraintDimensionRatio="1:1"-->
143-
<!-- app:layout_constraintEnd_toEndOf="parent"-->
144-
<!-- app:layout_constraintStart_toEndOf="@+id/toolbarTitle"-->
145-
<!-- app:layout_constraintTop_toTopOf="parent" />-->
146-
147-
148-
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
149-
15048
<TextView
15149
android:id="@+id/updateDate"
15250
android:layout_width="wrap_content"

app/src/main/res/xml/fragment_idea_details_xml_constraintlayout3_scene5.xml renamed to app/src/main/res/xml/fragment_idea_details_xml_scene.xml

File renamed without changes.

0 commit comments

Comments
 (0)