Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 12 additions & 23 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,33 +16,37 @@ 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,
0, 0
)
}

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

Expand All @@ -58,22 +63,29 @@ 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))
setImageFromUserId(viewAttrs.getString(R.styleable.AppbarIdeaDetails_imageFromUserId))
}
}

override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
Glide.with(context).clear(binding.userAvatarImage)
_binding = null


}

}
104 changes: 1 addition & 103 deletions app/src/main/res/layout/fragment_idea_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<View
Expand All @@ -45,108 +45,6 @@
tools:subtitle="Boris Azazovsky"
tools:title="Reaction Alpha" />


<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/appBar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="?attr/actionBarSize"-->
<!-- android:alpha="0"-->
<!-- android:background="@color/white"-->
<!-- android:padding="@dimen/margin_small"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->

<!-- <ImageView-->
<!-- android:id="@+id/backIcon"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_marginStart="@dimen/margin_default"-->
<!-- android:adjustViewBounds="true"-->
<!-- android:clickable="true"-->
<!-- android:focusable="true"-->
<!-- android:foreground="?attr/selectableItemBackground"-->
<!-- android:padding="@dimen/padding_small"-->
<!-- android:src="@drawable/ic_back"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintDimensionRatio="1:1"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:background="@drawable/bg_rounded_24"-->
<!-- app:tint="@color/black"-->
<!-- android:contentDescription="@string/cd_author_avatar_default"-->
<!-- />-->

<!-- <androidx.cardview.widget.CardView-->
<!-- android:id="@+id/userAvatar"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginStart="@dimen/margin_default"-->
<!-- android:layout_marginTop="@dimen/margin_small"-->
<!-- android:layout_marginBottom="@dimen/margin_small"-->
<!-- android:clickable="true"-->
<!-- android:focusable="true"-->
<!-- android:foreground="?attr/selectableItemBackground"-->
<!-- app:cardCornerRadius="@dimen/corners_radius_small"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintDimensionRatio="1:1"-->
<!-- app:layout_constraintStart_toEndOf="@+id/backIcon"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:cardElevation="0dp"-->
<!-- >-->

<!-- <ImageView-->
<!-- android:id="@+id/userAvatarImage"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:adjustViewBounds="true"-->
<!-- android:scaleType="centerCrop"-->
<!-- tools:src="@raw/sample_image"-->
<!-- app:ideaThumbnailPhotoFromUser="@{alreadyLoadedInfo.ownerIdea.id}"-->
<!-- />-->
<!-- </androidx.cardview.widget.CardView>-->

<!-- <LinearLayout-->
<!-- android:id="@+id/toolbarTitle"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_marginStart="@dimen/margin_default"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="vertical"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toStartOf="@+id/toolbarStatus"-->
<!-- app:layout_constraintStart_toEndOf="@+id/userAvatar"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@{alreadyLoadedInfo.name}"-->
<!-- android:textColor="@color/black"-->
<!-- tools:text="@string/default_idea_title" />-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/default_name" />-->


<!-- </LinearLayout>-->

<!-- <ImageView-->
<!-- android:id="@+id/toolbarStatus"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_marginStart="@dimen/margin_default"-->
<!-- android:layout_marginEnd="@dimen/margin_default"-->
<!-- android:src="@drawable/ic_waiting_for_team"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintDimensionRatio="1:1"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toEndOf="@+id/toolbarTitle"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->


<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->

<TextView
android:id="@+id/updateDate"
android:layout_width="wrap_content"
Expand Down