Skip to content

Commit

Permalink
[feat/album_detail]: AlbumList, Album Detail 세부내용 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kez-lab committed Jul 6, 2023
1 parent 0f50c46 commit 7a5f89f
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 34 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ android {

buildTypes {
debug {
//appDistribution upload debug
firebaseAppDistribution {
artifactType = "APK"
releaseNotesFile = "firebase/releaseNote.txt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import androidx.fragment.app.activityViewModels
import com.teampophory.pophory.R
import com.teampophory.pophory.common.view.viewBinding
import com.teampophory.pophory.databinding.FragmentAlbumDeleteDialogBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class AlbumDeleteDialogFragment : DialogFragment() {

private val viewModel by activityViewModels<AlbumDetailViewModel>()
Expand Down Expand Up @@ -41,15 +43,7 @@ class AlbumDeleteDialogFragment : DialogFragment() {
}

companion object {

private const val SELECT_ALBUM_ID = "SELECT_ALBUM_ID"

@JvmStatic
fun newInstance(albumId: Int) =
AlbumDeleteDialogFragment().apply {
arguments = Bundle().apply {
putInt(SELECT_ALBUM_ID, albumId)
}
}
fun newInstance() = AlbumDeleteDialogFragment()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.teampophory.pophory.common.view.showAllowingStateLoss
import com.teampophory.pophory.common.view.viewBinding
import com.teampophory.pophory.databinding.ActivityAlbumDetailBinding
import com.teampophory.pophory.feature.album.model.PhotoDetail
import com.teampophory.pophory.feature.album.model.PhotoItem
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand All @@ -33,9 +32,10 @@ class AlbumDetailActivity : AppCompatActivity() {
}

is AlbumDetailState.SuccessDeleteAlbum -> {
supportFragmentManager.findFragmentByTag(TAG_AlbumDeleteDialogFragment)?.let { fragment ->
(fragment as? AlbumDeleteDialogFragment)?.dismissAllowingStateLoss()
}
supportFragmentManager.findFragmentByTag(TAG_AlbumDeleteDialogFragment)
?.let { fragment ->
(fragment as? AlbumDeleteDialogFragment)?.dismissAllowingStateLoss()
}
toast("앨범이 삭제되었습니다.")
finish()
}
Expand All @@ -47,10 +47,13 @@ class AlbumDetailActivity : AppCompatActivity() {
}
}

private fun initCloseButtonClickListener() {
private fun initButtonClickListener() {
binding.ivBack.setOnClickListener {
finish()
}

binding.ivAlbumDelete.setOnClickListener {
val photoId = viewModel.id.value ?: 0
AlbumDeleteDialogFragment.newInstance(photoId).apply {
AlbumDeleteDialogFragment.newInstance().apply {
showAllowingStateLoss(supportFragmentManager, TAG_AlbumDeleteDialogFragment)
}
}
Expand All @@ -74,9 +77,9 @@ class AlbumDetailActivity : AppCompatActivity() {
}

private fun initViews() {
initCloseButtonClickListener()
initButtonClickListener()
with(binding) {
ivAlbumDetail.load(viewModel.imageUrl.value)
ivMainDetailAlbum.load(viewModel.imageUrl.value)
tvAlbumTakenAt.text = viewModel.takenAt.value
tvStudio.text = viewModel.studio.value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AlbumDetailViewModel @Inject constructor(
private val _imageUrl = MutableLiveData<String>()
val imageUrl: LiveData<String> get() = _imageUrl

private val _albumDetailState = MutableLiveData<AlbumDetailState>()
private val _albumDetailState = MutableLiveData<AlbumDetailState>(AlbumDetailState.Uninitialized)
val albumDetailState: LiveData<AlbumDetailState> get() = _albumDetailState

fun setPhotoId(photoId: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class AlbumListActivity : AppCompatActivity() {
when (albumState) {
is AlbumListState.Uninitialized -> {
initViews()
initRecyclerView()
viewModel.getAlbums(0)
}

Expand All @@ -50,6 +49,22 @@ class AlbumListActivity : AppCompatActivity() {
}

private fun initViews() {
initSortViews()
initToolbar()
initRecyclerView()
}

private fun initToolbar() {
binding.ivAlbumAdd.setOnClickListener {
//TODO 사진 찍는 플로우 추가
}

binding.ivBack.setOnClickListener {
finish()
}
}

private fun initSortViews() {
val modalBottomSheet = ModalBottomSheet()
binding.tvSort.setOnClickListener {
modalBottomSheet.show(supportFragmentManager, ModalBottomSheet.TAG)
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/res/drawable/ic_add_black.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="25dp"
android:height="24dp"
android:viewportWidth="25"
android:viewportHeight="24">
<path
android:pathData="M21.078,12H3.078"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#212121"
android:strokeLineCap="round"/>
<path
android:pathData="M12.078,3V21"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#212121"
android:strokeLineCap="round"/>
</vector>
40 changes: 37 additions & 3 deletions app/src/main/res/layout/activity_album_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,58 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/ivBack"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginVertical="21dp"
android:layout_marginStart="8dp"
android:padding="12dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tvAlbumTitle"
android:text="내 사진"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?textAppearanceHeadline2" />


<ImageView
android:id="@+id/ivAlbumDelete"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginVertical="21dp"
android:layout_marginEnd="20dp"
android:layout_marginEnd="8dp"
android:padding="12dp"
android:src="@drawable/ic_bin_empty"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/gray_30"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<ImageView
android:id="@+id/ivAlbumDetail"
android:id="@+id/ivMainDetailAlbum"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="24dp"
app:layout_constraintDimensionRatio="0.66"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -45,7 +79,7 @@
android:background="#E0E1E5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivAlbumDetail" />
app:layout_constraintTop_toBottomOf="@id/ivMainDetailAlbum" />

<TextView
android:id="@+id/tvAlbumTakenAt"
Expand Down
72 changes: 63 additions & 9 deletions app/src/main/res/layout/activity_album_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,82 @@
android:layout_height="match_parent"
tools:context=".feature.album.list.AlbumListActivity">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clAlbumDetailToolbar"
android:layout_width="0dp"
android:layout_height="?android:attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/ivBack"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginVertical="21dp"
android:layout_marginStart="8dp"
android:padding="12dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tvAlbumTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="내 앨범"
android:textAppearance="?textAppearanceHeadline2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />


<ImageView
android:id="@+id/ivAlbumAdd"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginVertical="21dp"
android:layout_marginEnd="8dp"
android:padding="12dp"
android:src="@drawable/ic_add_black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/gray_30"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/tvSort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="10dp"
android:layout_marginEnd="17dp"
android:drawablePadding="4dp"
android:text="@string/sort_default_text"
android:textSize="14sp"
tools:text="과거에 찍은 순"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/rvAlbum"
app:drawableEndCompat="@drawable/ic_arrow_up_down"
android:layout_marginEnd="17dp"
android:layout_marginVertical="10dp"
android:drawablePadding="4dp"/>
app:layout_constraintBottom_toTopOf="@id/rvAlbum"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/clAlbumDetailToolbar" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvAlbum"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginHorizontal="20dp"
app:layout_constraintTop_toBottomOf="@id/tvSort"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
app:layout_constraintTop_toBottomOf="@id/tvSort" />

</androidx.constraintlayout.widget.ConstraintLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/item_horizontal_photo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginVertical="4dp">

<ImageView
android:id="@+id/ivHorizontalImage"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/item_vertical_photo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginVertical="4dp">

<ImageView
android:id="@+id/ivFirstVerticalImage"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
<string name="sort_newest">최근에 찍은 순</string>
<string name="sort_oldest">과거에 찍은 순</string>
<string name="select_sort">정렬 선택하기</string>
<string name="sort_default_text">과거에 찍은 순</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<item name="textAppearanceHeadlineMedium">@style/TextAppearance.Pophory.HeadLineMedium
</item>
<item name="textAppearanceHeadlineSmall">@style/TextAppearance.Pophory.HeadLineSmall</item>
<item name="textAppearanceHeadline2">@style/TextAppearance.Pophory.HeadLine02</item>
<!-- Title -->
<!-- Modal Title -->
<item name="textAppearanceTitleLarge">@style/TextAppearance.Pophory.TitleLarge</item>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<item name="lineHeight">17sp</item>
</style>

<style name="TextAppearance.Pophory.HeadLine02">
<item name="android:textFontWeight">600</item>
<item name="android:textSize">19sp</item>
<item name="lineHeight">17sp</item>
</style>

<style name="TextAppearance.Pophory.TitleLarge">
<item name="android:textFontWeight">700</item>
<item name="android:textSize">20sp</item>
Expand Down

0 comments on commit 7a5f89f

Please sign in to comment.