-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/AOS-develop' into release
- Loading branch information
Showing
16 changed files
with
214 additions
and
71 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
AOS/app/src/main/java/boostcamp/and07/mindsync/data/model/Node.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
2 changes: 2 additions & 0 deletions
2
AOS/app/src/main/java/boostcamp/and07/mindsync/data/model/NodePath.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
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
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
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
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
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
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
15 changes: 15 additions & 0 deletions
15
AOS/app/src/main/java/boostcamp/and07/mindsync/ui/mindmap/MindMapViewModelFactory.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,15 @@ | ||
package boostcamp.and07.mindsync.ui.mindmap | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.ViewModelProvider | ||
|
||
class MindMapViewModelFactory : | ||
ViewModelProvider.Factory { | ||
override fun <T : ViewModel> create(modelClass: Class<T>): T { | ||
if (modelClass.isAssignableFrom(MindMapViewModel::class.java)) { | ||
@Suppress("UNCHECKED_CAST") | ||
return MindMapViewModel() as T | ||
} | ||
throw IllegalArgumentException("Unknown ViewModel class") | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
AOS/app/src/main/java/boostcamp/and07/mindsync/ui/recyclebin/RecycleBinAdapter.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,70 @@ | ||
package boostcamp.and07.mindsync.ui.recyclebin | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.DiffUtil | ||
import androidx.recyclerview.widget.ListAdapter | ||
import androidx.recyclerview.widget.RecyclerView | ||
import boostcamp.and07.mindsync.data.model.Board | ||
import boostcamp.and07.mindsync.databinding.ItemRecycleBoardBinding | ||
|
||
class RecycleBinAdapter : | ||
ListAdapter<Board, RecycleBinAdapter.RecycleBinViewHolder>(DIFF_CALLBACK) { | ||
private var clickListener: RecycleBinClickListener? = null | ||
|
||
fun setRecycleBinClickListener(listener: RecycleBinClickListener) { | ||
this.clickListener = listener | ||
} | ||
|
||
class RecycleBinViewHolder( | ||
private val binding: ItemRecycleBoardBinding, | ||
private val clickListener: RecycleBinClickListener?, | ||
) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun bind(item: Board) { | ||
with(binding) { | ||
board = item | ||
cbBoard.isChecked = item.isChecked | ||
cbBoard.setOnClickListener { | ||
item.isChecked = !item.isChecked | ||
clickListener?.onCheckBoxClick(item) | ||
} | ||
} | ||
} | ||
} | ||
|
||
override fun onCreateViewHolder( | ||
parent: ViewGroup, | ||
viewType: Int, | ||
): RecycleBinViewHolder { | ||
val binding = | ||
ItemRecycleBoardBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return RecycleBinViewHolder(binding, clickListener) | ||
} | ||
|
||
override fun onBindViewHolder( | ||
holder: RecycleBinViewHolder, | ||
position: Int, | ||
) { | ||
holder.bind(getItem(position)) | ||
} | ||
|
||
companion object { | ||
val DIFF_CALLBACK = | ||
object : DiffUtil.ItemCallback<Board>() { | ||
override fun areItemsTheSame( | ||
oldItem: Board, | ||
newItem: Board, | ||
): Boolean { | ||
return oldItem.id == newItem.id | ||
} | ||
|
||
override fun areContentsTheSame( | ||
oldItem: Board, | ||
newItem: Board, | ||
): Boolean { | ||
return oldItem == newItem | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
AOS/app/src/main/java/boostcamp/and07/mindsync/ui/recyclebin/RecycleBinBindingAdpater.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,12 @@ | ||
package boostcamp.and07.mindsync.ui.recyclebin | ||
|
||
import androidx.databinding.BindingAdapter | ||
import androidx.recyclerview.widget.RecyclerView | ||
import boostcamp.and07.mindsync.data.model.Board | ||
|
||
@BindingAdapter("app:restoreBoards") | ||
fun RecyclerView.bindRestoreBoards(boards: List<Board>) { | ||
if (this.adapter != null) { | ||
(this.adapter as RecycleBinAdapter).submitList(boards.toMutableList()) | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
AOS/app/src/main/java/boostcamp/and07/mindsync/ui/recyclebin/RecycleBinClickListener.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,7 @@ | ||
package boostcamp.and07.mindsync.ui.recyclebin | ||
|
||
import boostcamp.and07.mindsync.data.model.Board | ||
|
||
interface RecycleBinClickListener { | ||
fun onCheckBoxClick(board: Board) | ||
} |
Oops, something went wrong.