Skip to content

Commit b138049

Browse files
authored
Merge pull request #76 from TeamFILL-IN/feature/#75
[feature/#75] FilmRoll 화면에서 사진 클릭 시 사진 다이얼로그 제대로 뜰 수 있게 수정
2 parents 6ed0708 + 55d7f40 commit b138049

File tree

15 files changed

+138
-94
lines changed

15 files changed

+138
-94
lines changed

app/src/main/java/com/teamfillin/fillin/domain/entity/Photo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data class CategoryPhoto(
1717
val photoId: Int,
1818
val imageUrl: String,
1919
val filmId: Int,
20-
val fileName: String,
20+
val filmName: String,
2121
val likeCount: Int,
2222
val isLiked: Boolean,
2323
val isGaro: Boolean

app/src/main/java/com/teamfillin/fillin/presentation/dialog/PhotoDialogFragment.kt

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import android.view.ViewGroup
77
import android.view.WindowManager
88
import androidx.fragment.app.DialogFragment
99
import com.bumptech.glide.Glide
10+
import com.teamfillin.fillin.R
11+
import com.teamfillin.fillin.core.intent.stringArgs
1012
import com.teamfillin.fillin.databinding.FragmentPhotoDialogBinding
1113
import dagger.hilt.android.AndroidEntryPoint
1214

@@ -15,29 +17,42 @@ class PhotoDialogFragment : DialogFragment() {
1517
private var _binding: FragmentPhotoDialogBinding? = null
1618
private val binding: FragmentPhotoDialogBinding
1719
get() = requireNotNull(_binding)
20+
private val photoUrl by stringArgs()
21+
private val profileUrl by stringArgs()
22+
private val filmName by stringArgs()
23+
private val userName by stringArgs()
1824

1925
override fun onCreateView(
2026
inflater: LayoutInflater, container: ViewGroup?,
2127
savedInstanceState: Bundle?
2228
): View {
2329
_binding = FragmentPhotoDialogBinding.inflate(layoutInflater, container, false)
24-
25-
binding.btnClose.setOnClickListener {
26-
dismiss()
27-
}
28-
binding.heart.setOnClickListener {
29-
binding.number.text = (
30-
binding.number.text.toString()
31-
.toInt() + (if (!binding.heart.isSelected) 1 else -1)
32-
).toString()
33-
binding.heart.isSelected = !binding.heart.isSelected
34-
}
3530
return binding.root
3631
}
3732

3833
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
39-
val photoUrl = arguments?.getString("photoUrl")
40-
Glide.with(requireActivity()).load(photoUrl).into(binding.ivPhoto)
34+
super.onViewCreated(view, savedInstanceState)
35+
// TODO by Nunu 좋아요 기능 원복
36+
// binding.heart.setOnClickListener {
37+
// binding.number.text = (
38+
// binding.number.text.toString()
39+
// .toInt() + (if (!binding.heart.isSelected) 1 else -1)
40+
// ).toString()
41+
// binding.heart.isSelected = !binding.heart.isSelected
42+
// }
43+
Glide.with(requireContext())
44+
.load(photoUrl)
45+
.into(binding.ivPhoto)
46+
Glide.with(requireContext())
47+
.load(profileUrl)
48+
.circleCrop()
49+
.placeholder(R.drawable.ic_basic_profile)
50+
.into(binding.ivProfile)
51+
with(binding) {
52+
btnClose.setOnClickListener { dismiss() }
53+
tvName.text = userName
54+
tvFilmname.text = filmName
55+
}
4156
}
4257

4358
//휴대폰 크기 맞춰 자동 조절 다이얼로그
@@ -53,4 +68,17 @@ class PhotoDialogFragment : DialogFragment() {
5368
super.onDestroyView()
5469
_binding = null
5570
}
71+
72+
companion object {
73+
@JvmStatic
74+
fun newInstance(photoUrl: String, profileUrl: String, filmName: String, userName: String) =
75+
PhotoDialogFragment().apply {
76+
arguments = Bundle().apply {
77+
putString("photoUrl", photoUrl)
78+
putString("profileUrl", profileUrl)
79+
putString("filmName", filmName)
80+
putString("userName", userName)
81+
}
82+
}
83+
}
5684
}

app/src/main/java/com/teamfillin/fillin/presentation/filmroll/CurationAdapter.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ class CurationAdapter(
6262
binding.root.setOnClickListener {
6363
listener.onClick(input.data)
6464
}
65-
binding.btnLike.setOnSingleClickListener {
66-
binding.btnLike.isSelected = !binding.btnLike.isSelected
67-
}
65+
// TODO by Nunu 좋아요 기능 원복
66+
// binding.btnLike.setOnSingleClickListener {
67+
// binding.btnLike.isSelected = !binding.btnLike.isSelected
68+
// }
6869
}
6970
}
7071
}

app/src/main/java/com/teamfillin/fillin/presentation/filmroll/FilmRollActivity.kt

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,27 @@ package com.teamfillin.fillin.presentation.filmroll
22

33
import android.app.Activity
44
import android.content.Intent
5+
import android.graphics.Rect
56
import android.os.Bundle
67
import androidx.activity.result.ActivityResultLauncher
78
import androidx.activity.result.contract.ActivityResultContracts
89
import androidx.activity.viewModels
910
import androidx.lifecycle.flowWithLifecycle
1011
import androidx.lifecycle.lifecycleScope
1112
import androidx.paging.PagingData
13+
import androidx.recyclerview.widget.RecyclerView
1214
import com.google.android.material.tabs.TabLayout
1315
import com.teamfillin.fillin.R
1416
import com.teamfillin.fillin.core.base.BindingActivity
1517
import com.teamfillin.fillin.core.content.receive
1618
import com.teamfillin.fillin.core.view.setOnSingleClickListener
1719
import com.teamfillin.fillin.data.service.FilmRollService
1820
import com.teamfillin.fillin.databinding.ActivityFilmRollBinding
19-
import com.teamfillin.fillin.presentation.filmroll.add.AddPhotoActivity
21+
import com.teamfillin.fillin.design.dp
2022
import com.teamfillin.fillin.presentation.category.FilmRollCategoryActivity
2123
import com.teamfillin.fillin.presentation.dialog.PhotoDialogFragment
2224
import com.teamfillin.fillin.presentation.filmroll.add.AddCompleteDialog
25+
import com.teamfillin.fillin.presentation.filmroll.add.AddPhotoActivity
2326
import com.teamfillin.fillin.presentation.map.SpaceDecoration
2427
import dagger.hilt.android.AndroidEntryPoint
2528
import kotlinx.coroutines.flow.collectLatest
@@ -33,12 +36,9 @@ class FilmRollActivity : BindingActivity<ActivityFilmRollBinding>(R.layout.activ
3336
lateinit var service: FilmRollService
3437
private val viewModel by viewModels<FilmRollViewModel>()
3538
private val filmRollPagingAdapter = FilmRollPagingAdapter {
36-
val dialog = PhotoDialogFragment()
37-
val bundle = Bundle().apply { putString("photoUrl", it.imageUrl) }
38-
dialog.apply {
39-
arguments = bundle
40-
show(supportFragmentManager, "dialog")
41-
}
39+
val dialog =
40+
PhotoDialogFragment.newInstance(it.imageUrl, it.userImageUrl, it.filmName, it.nickname)
41+
dialog.show(supportFragmentManager, "dialog")
4242
}
4343
private lateinit var curationAdapter: CurationAdapter
4444
private val addPhotoLauncher =
@@ -72,14 +72,27 @@ class FilmRollActivity : BindingActivity<ActivityFilmRollBinding>(R.layout.activ
7272
private fun addCurationList() {
7373
service.getCuration().receive({
7474
curationAdapter = CurationAdapter(it.data.curation) {
75-
val dialog = PhotoDialogFragment()
76-
val bundle = Bundle().apply { putString("photoUrl", it.imageUrl) }
77-
dialog.apply {
78-
arguments = bundle
79-
show(supportFragmentManager, "dialog")
80-
}
75+
val dialog = PhotoDialogFragment.newInstance(
76+
photoUrl = it.imageUrl,
77+
profileUrl = it.userImageUrl,
78+
filmName = it.filmName,
79+
userName = it.nickname
80+
)
81+
dialog.show(supportFragmentManager, "dialog")
8182
}
8283
binding.rvCuration.adapter = curationAdapter
84+
binding.rvCuration.addItemDecoration(object : RecyclerView.ItemDecoration() {
85+
override fun getItemOffsets(
86+
outRect: Rect,
87+
itemPosition: Int,
88+
parent: RecyclerView
89+
) {
90+
with(outRect) {
91+
left = if (itemPosition == 0) 16.dp else 8.dp
92+
right = 8.dp
93+
}
94+
}
95+
})
8396
curationAdapter.submitList(it.data.photos)
8497
}, {
8598
Timber.d("Error $it")

app/src/main/java/com/teamfillin/fillin/presentation/filmroll/FilmRollAdapter.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ class FilmRollAdapter :
1818
Glide.with(binding.root)
1919
.load(film.image)
2020
.into(binding.ivItemFilmroll)
21-
binding.btnLike.setOnSingleClickListener {
22-
binding.btnLike.isSelected = !binding.btnLike.isSelected
23-
}
21+
// TODO 좋아요 기능 복원
22+
// binding.btnLike.setOnSingleClickListener {
23+
// binding.btnLike.isSelected = !binding.btnLike.isSelected
24+
// }
2425
}
2526
}
2627

app/src/main/java/com/teamfillin/fillin/presentation/filmroll/FilmRollPagingAdapter.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ class FilmRollPagingAdapter(
3333
binding.root.setOnSingleClickListener {
3434
itemClickListener.onClick(film)
3535
}
36-
binding.btnLike.setOnSingleClickListener {
37-
binding.btnLike.isSelected = !binding.btnLike.isSelected
38-
}
36+
// TODO by Nunu 좋아요 기능 복원
37+
// binding.btnLike.setOnSingleClickListener {
38+
// binding.btnLike.isSelected = !binding.btnLike.isSelected
39+
// }
3940
}
4041
}
4142

app/src/main/java/com/teamfillin/fillin/presentation/home/HomeActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class HomeActivity : BindingActivity<ActivityHomeBinding>(R.layout.activity_home
152152
}
153153
}
154154
markerLocationEvent()
155-
activityNaverMap?.setOnMapClickListener { pointF, latLng ->
155+
activityNaverMap?.setOnMapClickListener { _, _ ->
156156
val intent = Intent(this, StudioMapActivity::class.java)
157157
startActivity(intent)
158158
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
android:id="@+id/rv_curation"
8585
android:layout_width="match_parent"
8686
android:layout_height="120dp"
87-
android:layout_marginStart="15dp"
8887
android:layout_marginTop="12dp"
8988
android:orientation="horizontal"
9089
android:overScrollMode="never"

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

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
32
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
43
xmlns:app="http://schemas.android.com/apk/res-auto"
54
xmlns:tools="http://schemas.android.com/tools"
@@ -131,36 +130,37 @@
131130
android:layout_height="0dp"
132131
android:layout_weight="1" />
133132

134-
<LinearLayout
135-
android:id="@+id/li_like"
136-
android:layout_width="wrap_content"
137-
android:layout_height="wrap_content"
138-
android:layout_gravity="center"
139-
android:layout_marginRight="10dp"
140-
android:background="@drawable/linearline"
141-
android:visibility="visible">
142-
143-
<ImageView
144-
android:id="@+id/heart"
145-
android:layout_width="wrap_content"
146-
android:layout_height="wrap_content"
147-
android:layout_gravity="center"
148-
android:layout_marginLeft="10dp"
149-
android:backgroundTint="@color/dark_grey_3"
150-
android:src="@drawable/heartbutton" />
151-
152-
<TextView
153-
android:id="@+id/number"
154-
style="@style/Body2"
155-
android:layout_width="wrap_content"
156-
android:layout_height="wrap_content"
157-
android:layout_gravity="center"
158-
android:layout_marginLeft="5dp"
159-
android:layout_marginRight="10dp"
160-
android:text="22"
161-
android:textColor="@color/grey_2" />
162-
163-
</LinearLayout>
133+
<!-- <LinearLayout-->
134+
<!-- android:id="@+id/li_like"-->
135+
<!-- android:layout_width="wrap_content"-->
136+
<!-- android:layout_height="wrap_content"-->
137+
<!-- android:layout_gravity="center"-->
138+
<!-- android:layout_marginRight="10dp"-->
139+
<!-- android:background="@drawable/linearline"-->
140+
<!-- android:src="@drawable/unlike"-->
141+
<!-- android:visibility="visible">-->
142+
143+
<!-- <ImageView-->
144+
<!-- android:id="@+id/heart"-->
145+
<!-- android:layout_width="wrap_content"-->
146+
<!-- android:layout_height="wrap_content"-->
147+
<!-- android:layout_gravity="center"-->
148+
<!-- android:layout_marginLeft="10dp"-->
149+
<!-- android:backgroundTint="@color/dark_grey_3"-->
150+
<!-- android:src="@drawable/heartbutton" />-->
151+
152+
<!-- <TextView-->
153+
<!-- android:id="@+id/number"-->
154+
<!-- style="@style/Body2"-->
155+
<!-- android:layout_width="wrap_content"-->
156+
<!-- android:layout_height="wrap_content"-->
157+
<!-- android:layout_gravity="center"-->
158+
<!-- android:layout_marginLeft="5dp"-->
159+
<!-- android:layout_marginRight="10dp"-->
160+
<!-- android:text="22"-->
161+
<!-- android:textColor="@color/grey_2" />-->
162+
163+
<!-- </LinearLayout>-->
164164

165165
</LinearLayout>
166166
</androidx.constraintlayout.widget.ConstraintLayout>

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@
88

99
<androidx.constraintlayout.widget.ConstraintLayout
1010
android:layout_width="160dp"
11-
android:layout_height="120dp">
11+
android:layout_height="match_parent">
1212

1313
<ImageView
1414
android:id="@+id/iv_curation"
1515
android:layout_width="match_parent"
1616
android:layout_height="match_parent"
1717
android:overScrollMode="never"
1818
android:paddingHorizontal="5dp"
19-
android:scaleType="centerInside"
19+
android:scaleType="center"
2020
app:layout_constraintBottom_toBottomOf="parent"
2121
app:layout_constraintEnd_toEndOf="parent"
2222
app:layout_constraintStart_toStartOf="parent"
2323
app:layout_constraintTop_toTopOf="parent" />
2424

25-
<ImageButton
26-
android:id="@+id/btn_like"
27-
android:layout_width="wrap_content"
28-
android:layout_height="wrap_content"
29-
android:backgroundTint="@android:color/transparent"
30-
android:scaleType="center"
31-
android:src="@drawable/likebutton"
32-
app:layout_constraintBottom_toBottomOf="parent"
33-
app:layout_constraintEnd_toEndOf="parent" />
25+
<!-- <ImageButton-->
26+
<!-- android:id="@+id/btn_like"-->
27+
<!-- android:layout_width="wrap_content"-->
28+
<!-- android:layout_height="wrap_content"-->
29+
<!-- android:backgroundTint="@android:color/transparent"-->
30+
<!-- android:scaleType="center"-->
31+
<!-- android:src="@drawable/likebutton"-->
32+
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
33+
<!-- app:layout_constraintEnd_toEndOf="parent" />-->
3434
</androidx.constraintlayout.widget.ConstraintLayout>
3535
</layout>

0 commit comments

Comments
 (0)