-
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.
Merge pull request #22 from develop-playground/feature/remove-feed-item
피드에서 추억 제거
- Loading branch information
Showing
16 changed files
with
243 additions
and
18 deletions.
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
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
17 changes: 17 additions & 0 deletions
17
domain/src/main/java/com/dev/playground/domain/usecase/memory/DeleteMemoryUseCase.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,17 @@ | ||
package com.dev.playground.domain.usecase.memory | ||
|
||
import com.dev.playground.domain.repository.MemoryRepository | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.withContext | ||
|
||
class DeleteMemoryUseCase( | ||
private val repository: MemoryRepository, | ||
private val dispatcher: CoroutineDispatcher | ||
) { | ||
|
||
suspend operator fun invoke(id: Int) = withContext(dispatcher) { | ||
runCatching { | ||
repository.deleteMemory(id) | ||
} | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
presentation/src/main/java/com/dev/playground/presentation/ui/dialog/DropDialog.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,53 @@ | ||
package com.dev.playground.presentation.ui.dialog | ||
|
||
import android.app.Dialog | ||
import android.content.Context | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import androidx.databinding.DataBindingUtil | ||
import com.dev.playground.presentation.R | ||
import com.dev.playground.presentation.databinding.DialogDropBinding | ||
|
||
class DropDialog(context: Context) : Dialog(context) { | ||
|
||
companion object { | ||
private const val EMPTY = "" | ||
} | ||
|
||
private lateinit var binding: DialogDropBinding | ||
|
||
var contentText: String = EMPTY | ||
var leftText: String = EMPTY | ||
var rightText: String = EMPTY | ||
|
||
var onLeftClick: (() -> Unit)? = null | ||
var onRightClick: (() -> Unit)? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = DataBindingUtil.inflate( | ||
LayoutInflater.from(context), | ||
R.layout.dialog_drop, | ||
null, | ||
false | ||
) | ||
setContentView(binding.root) | ||
initViews() | ||
} | ||
|
||
private fun initViews() = with(binding) { | ||
tvContent.text = contentText | ||
tvLeft.text = leftText | ||
tvRight.text = rightText | ||
|
||
tvLeft.setOnClickListener { | ||
onLeftClick?.invoke() | ||
} | ||
tvRight.setOnClickListener { | ||
onRightClick?.invoke() | ||
} | ||
} | ||
|
||
} | ||
|
||
fun DropDialog.show(action: DropDialog.() -> Unit) = DropDialog(context).apply(action).show() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="17.6dp" | ||
android:height="16dp" | ||
android:viewportWidth="17.6" | ||
android:viewportHeight="16"> | ||
<group> | ||
<clip-path | ||
android:pathData="M0,0h17.6v16h-17.6z"/> | ||
<path | ||
android:pathData="M17.464,14.435 L9.674,0.49a1.025,1.025 0,0 0,-1.749 0L0.137,14.435a1.062,1.062 0,0 0,0 1.043A0.993,0.993 0,0 0,1.01 16H16.589a1,1 0,0 0,0.875 -0.521,1.068 1.068,0 0,0 0,-1.043M8.634,0.912A0.187,0.187 0,0 1,8.8 0.813a0.185,0.185 0,0 1,0.165 0.1l7.789,13.945a0.2,0.2 0,0 1,0 0.2,0.185 0.185,0 0,1 -0.165,0.1H1.01a0.185,0.185 0,0 1,-0.165 -0.1,0.2 0.2,0 0,1 0,-0.2Z" | ||
android:fillColor="#c8d94d"/> | ||
<path | ||
android:pathData="M8.795,11.962a0.694,0.694 0,0 1,0.684 0.707,0.685 0.685,0 1,1 -1.368,0 0.694,0.694 0,0 1,0.684 -0.707m0.4,-0.894h-0.81a0.046,0.046 0,0 1,-0.046 -0.045l-0.276,-5.356a0.319,0.319 0,0 1,0.313 -0.341h0.829a0.319,0.319 0,0 1,0.313 0.341l-0.276,5.356a0.047,0.047 0,0 1,-0.046 0.045" | ||
android:fillColor="#c8d94d"/> | ||
</group> | ||
</vector> |
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,81 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@color/white"> | ||
|
||
<ImageView | ||
android:id="@+id/ivWarning" | ||
android:layout_width="0dp" | ||
android:layout_height="@dimen/drop_dialog_warning_icon_height" | ||
android:background="@color/black" | ||
android:scaleType="centerInside" | ||
android:src="@drawable/ic_warning_lime" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/tvContent" | ||
style="@style/Pretendard.Light.14" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:paddingVertical="@dimen/spacing_20" | ||
android:textColor="@color/black" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/ivWarning" | ||
tools:text="안내 안내 안내 안내" /> | ||
|
||
<View | ||
android:id="@+id/vHorizontalDivider" | ||
android:layout_width="match_parent" | ||
android:layout_height="0.5dp" | ||
android:background="@color/gray_light" | ||
app:layout_constraintTop_toBottomOf="@id/tvContent" /> | ||
|
||
<TextView | ||
android:id="@+id/tvLeft" | ||
style="@style/Pretendard.Light.14" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:background="?attr/selectableItemBackground" | ||
android:gravity="center" | ||
android:paddingVertical="@dimen/spacing_12" | ||
android:textColor="@color/black" | ||
app:layout_constraintEnd_toStartOf="@id/vVerticalDivider" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/vHorizontalDivider" | ||
tools:text="취소" /> | ||
|
||
<View | ||
android:id="@+id/vVerticalDivider" | ||
android:layout_width="0.5dp" | ||
android:layout_height="0dp" | ||
android:background="@color/gray_light" | ||
app:layout_constraintBottom_toBottomOf="@id/tvLeft" | ||
app:layout_constraintEnd_toStartOf="@id/tvRight" | ||
app:layout_constraintStart_toEndOf="@id/tvLeft" | ||
app:layout_constraintTop_toTopOf="@id/tvLeft" /> | ||
|
||
<TextView | ||
android:id="@+id/tvRight" | ||
style="@style/Pretendard.Light.14" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:background="?attr/selectableItemBackground" | ||
android:gravity="center" | ||
android:paddingVertical="@dimen/spacing_12" | ||
android:textColor="@color/red" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/vVerticalDivider" | ||
app:layout_constraintTop_toBottomOf="@id/vHorizontalDivider" | ||
tools:text="삭제" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |
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
Oops, something went wrong.