-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] detail_image / 뷰 화면 기초세팅 (메뉴 띄우기(#90)
- Loading branch information
Showing
4 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...ult/src/main/java/com/photosurfer/android/search_result/detailimage/DetailImageAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.photosurfer.android.search_result.detailimage | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.DiffUtil | ||
import androidx.recyclerview.widget.ListAdapter | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.photosurfer.android.domain.entity.TagInfo | ||
import com.photosurfer.android.search_result.detailimage.DetailImageActivity.Companion.ADD | ||
import com.photosurfer.android.shared.databinding.ItemMutableChipDetailBinding | ||
|
||
class DetailImageAdapter() : | ||
ListAdapter<TagInfo, DetailImageAdapter.DetailImageViewHolder>(MutableChipComparator()) { | ||
|
||
private var processState = ADD | ||
|
||
fun updateProcessState(state: String) { | ||
processState = state | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DetailImageViewHolder { | ||
val layoutInflater = LayoutInflater.from(parent.context) | ||
val binding = ItemMutableChipDetailBinding.inflate(layoutInflater, parent, false) | ||
return DetailImageViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: DetailImageViewHolder, position: Int) { | ||
val mutableChip = getItem(position) | ||
holder.bind(mutableChip) | ||
} | ||
|
||
class DetailImageViewHolder( | ||
private val binding: ItemMutableChipDetailBinding | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
fun bind(MutableChip: TagInfo) { | ||
binding.tagInfo = MutableChip | ||
} | ||
} | ||
|
||
private class MutableChipComparator : DiffUtil.ItemCallback<TagInfo>() { | ||
override fun areItemsTheSame(oldItem: TagInfo, newItem: TagInfo): Boolean { | ||
return oldItem.id == newItem.id | ||
} | ||
|
||
override fun areContentsTheSame(oldItem: TagInfo, newItem: TagInfo): Boolean { | ||
return oldItem == newItem | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...t/src/main/java/com/photosurfer/android/search_result/detailimage/DetailImageViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.photosurfer.android.search_result.detailimage | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import com.photosurfer.android.core.base.BaseViewModel | ||
import com.photosurfer.android.domain.entity.TagInfo | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class DetailImageViewModel @Inject constructor() : BaseViewModel(){ | ||
|
||
private val _tagInfoList = MutableLiveData<TagInfo>() | ||
val tagInfoList: LiveData<TagInfo> = _tagInfoList | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
|
||
<import type="android.view.View" /> | ||
|
||
|
||
<variable | ||
name="processState" | ||
type="String" /> | ||
|