-
Notifications
You must be signed in to change notification settings - Fork 4
[RUIN] mrege branch; Feature/session and image overlay #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
DokySp
wants to merge
14
commits into
FoKE-Developers:main
from
DokySp:feature/session-and-image-overlay
Closed
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2ab3e2b
update version of libraries [#121]
DokySp e182e78
refactor Session data [#121]
DokySp 2be52d4
seperate cut frame set to default [#41]
DokySp 54768e2
apply new cut frame type to select image [#41]
DokySp 862858a
adjust cut frame images [#41]
DokySp 3d3a361
apply image overlay for generate image screen [#41]
DokySp 0afba12
apply image overlay and adjust image size after test printing [#41]
DokySp ed33b3a
add date display option [#41]
DokySp 453aa3f
adjust designs [#41]
DokySp 9197a45
final touch [#41]
DokySp 18f1a6a
add image auto save [#41]
DokySp 1d9ba54
bug fix. not updated date in view pager [#41]
DokySp 7f5f800
final touch of cuts [#41]
DokySp 05a90c0
Merge branch 'main' into feature/session-and-image-overlay
ing03201 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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
30 changes: 30 additions & 0 deletions
30
domain/src/main/java/com/foke/together/domain/interactor/GenerateImageFromViewUseCase.kt
This file contains hidden or 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,30 @@ | ||
| package com.foke.together.domain.interactor | ||
|
|
||
| import android.net.Uri | ||
| import androidx.compose.ui.graphics.asAndroidBitmap | ||
| import androidx.compose.ui.graphics.layer.GraphicsLayer | ||
| import com.foke.together.domain.output.ImageRepositoryInterface | ||
| import com.foke.together.util.AppLog | ||
| import com.foke.together.util.AppPolicy | ||
| import javax.inject.Inject | ||
|
|
||
| class GenerateImageFromViewUseCase @Inject constructor( | ||
| private val imageRepositoryInterface: ImageRepositoryInterface | ||
| ) { | ||
| // TODO: UI -> UC -> UI 흐름으로 만들어보기 | ||
| suspend operator fun invoke(graphicsLayer: GraphicsLayer, filename: String? = null, isCutFrameForPrint: Boolean = false): Uri { | ||
| val bitmap = graphicsLayer.toImageBitmap().asAndroidBitmap() | ||
| val finalCachedImageUri = imageRepositoryInterface.cachingImage( | ||
| bitmap, | ||
| filename ?: run { | ||
| if (isCutFrameForPrint) AppPolicy.TWO_ROW_FINAL_IMAGE_NAME else AppPolicy.SINGLE_ROW_FINAL_IMAGE_NAME | ||
| } | ||
| ) | ||
| AppLog.d(TAG, "invoke" ,"finalCachedImageUri: $finalCachedImageUri") | ||
| return finalCachedImageUri | ||
| } | ||
|
|
||
| companion object { | ||
| private val TAG = GenerateImageFromViewUseCase::class.java.simpleName | ||
| } | ||
| } |
This file contains hidden or 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
188 changes: 165 additions & 23 deletions
188
domain/src/main/java/com/foke/together/domain/interactor/entity/CutFrameType.kt
This file contains hidden or 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 |
|---|---|---|
| @@ -1,26 +1,168 @@ | ||
| package com.foke.together.domain.interactor.entity | ||
|
|
||
| enum class CutFrameType { | ||
| MAKER_FAIRE, | ||
| FOURCUT_LIGHT, | ||
| FOURCUT_DARK; | ||
|
|
||
| companion object { | ||
| fun findBy(name: String): CutFrameType { | ||
| return when (name) { | ||
| MAKER_FAIRE.name -> MAKER_FAIRE | ||
| FOURCUT_LIGHT.name -> FOURCUT_LIGHT | ||
| FOURCUT_DARK.name -> FOURCUT_DARK | ||
| else -> throw IllegalArgumentException("Unknown value: $name") | ||
| } | ||
| } | ||
| fun findBy(ordinal: Int): CutFrameType { | ||
| return when (ordinal) { | ||
| MAKER_FAIRE.ordinal -> MAKER_FAIRE | ||
| FOURCUT_LIGHT.ordinal -> FOURCUT_LIGHT | ||
| FOURCUT_DARK.ordinal -> FOURCUT_DARK | ||
| else -> throw IllegalArgumentException("Unknown value: $ordinal") | ||
| } | ||
| } | ||
| } | ||
| import androidx.annotation.DrawableRes | ||
| import com.foke.together.domain.R | ||
|
|
||
| abstract class CutFrame( | ||
| val index: Int, | ||
| val frameTitle: String, | ||
| val cutCount: Int, | ||
| val width: Int, | ||
| val height: Int, | ||
| @DrawableRes val frameImageSrc: Int, // !!!!! TODO: asset 에 추가 및 src 값을 넣어서 처리 | ||
| val photoPosition: List<PhotoPosition>, | ||
| val additionalFrameImageSrc: List<Int>, // !!!!! TODO: asset 에 추가 및 src 값을 넣어서 처리 | ||
| ) | ||
|
|
||
| sealed class DefaultCutFrameSet ( | ||
| index: Int, | ||
| frameTitle: String, | ||
| cutCount: Int, | ||
| width: Int, | ||
| height: Int, | ||
| frameImageSrc: Int, // !!!!! TODO: asset 에 추가 및 src 값을 넣어서 처리 | ||
| photoPosition: List<PhotoPosition>, | ||
| additionalFrameImageSrc: List<Int>, // !!!!! TODO: asset 에 추가 및 src 값을 넣어서 처리 | ||
| var isDateString: Boolean = false, | ||
| val dateStringHeight: Int = 0, | ||
| ): CutFrame(index, frameTitle, cutCount, width, height, frameImageSrc, photoPosition, additionalFrameImageSrc) { | ||
| val cutFrameSetTitle = "기본" | ||
| val cutFrameCoverImageSrc = "" | ||
|
|
||
| // TODO: add information of frames | ||
| data object FourCutLight: DefaultCutFrameSet( | ||
| 7, | ||
| "같이네컷 화이트", | ||
| 4, 190, 570, | ||
| R.drawable.fourcut_frame_medium_light, | ||
| listOf( | ||
| PhotoPosition(159, 106, 16, 36), | ||
| PhotoPosition(159, 106, 16, 147), | ||
| PhotoPosition(159, 106, 16, 258), | ||
| PhotoPosition(159, 106, 16, 369), | ||
| ), | ||
| emptyList() | ||
| ) | ||
|
|
||
| data object FourCurDark: DefaultCutFrameSet( | ||
| 8, | ||
| "같이네컷 다크", | ||
| 4, 190, 570, | ||
| R.drawable.fourcut_frame_medium_dark, | ||
| listOf( | ||
| PhotoPosition(159, 106, 16, 36), | ||
| PhotoPosition(159, 106, 16, 147), | ||
| PhotoPosition(159, 106, 16, 258), | ||
| PhotoPosition(159, 106, 16, 369), | ||
| ), | ||
| emptyList() | ||
| ) | ||
|
|
||
| data object MakerFaire: DefaultCutFrameSet( | ||
| 9, | ||
| "Maker Faire Seoul 2024", | ||
| 4, 190, 570, | ||
| R.drawable.maker_faire_frame, | ||
| listOf( | ||
| PhotoPosition(159, 106, 16, 36), | ||
| PhotoPosition(159, 106, 16, 147), | ||
| PhotoPosition(159, 106, 16, 258), | ||
| PhotoPosition(159, 106, 16, 369), | ||
| ), | ||
| emptyList() | ||
| ) | ||
|
|
||
| data object Bride1: DefaultCutFrameSet( | ||
| 3, | ||
| "신부 1", | ||
| 4, 190, 570, | ||
| R.drawable.bride1, | ||
| listOf( | ||
| PhotoPosition(172, 115, 9, 9), | ||
| PhotoPosition(172, 115, 9, 133), | ||
| PhotoPosition(172, 115, 9, 256), | ||
| PhotoPosition(172, 115, 9, 383), | ||
| ), | ||
| emptyList(), | ||
| dateStringHeight = 498 | ||
| ) | ||
|
|
||
| data object Bride2: DefaultCutFrameSet( | ||
| 4, | ||
| "신부 2", | ||
| 4, 190, 570, | ||
| R.drawable.bride2, | ||
| listOf( | ||
| PhotoPosition(172, 115, 9, 9), | ||
| PhotoPosition(172, 115, 9, 133), | ||
| PhotoPosition(172, 115, 9, 256), | ||
| PhotoPosition(172, 115, 9, 383), | ||
| ), | ||
| emptyList(), | ||
| dateStringHeight = 495 | ||
| ) | ||
|
|
||
| data object Groom1: DefaultCutFrameSet( | ||
| 5, | ||
| "신랑 1", | ||
| 4, 190, 570, | ||
| R.drawable.groom1, | ||
| listOf( | ||
| PhotoPosition(172, 115, 9, 9), | ||
| PhotoPosition(172, 115, 9, 133), | ||
| PhotoPosition(172, 115, 9, 256), | ||
| PhotoPosition(172, 115, 9, 383), | ||
| ), | ||
| emptyList(), | ||
| dateStringHeight = 495 | ||
| ) | ||
|
|
||
| data object Groom2: DefaultCutFrameSet( | ||
| 6, | ||
| "신랑 2", | ||
| 4, 190, 570, | ||
| R.drawable.groom2, | ||
| listOf( | ||
| PhotoPosition(172, 115, 9, 9), | ||
| PhotoPosition(172, 115, 9, 133), | ||
| PhotoPosition(172, 115, 9, 256), | ||
| PhotoPosition(172, 115, 9, 383), | ||
| ), | ||
| emptyList(), | ||
| dateStringHeight = 495 | ||
| ) | ||
|
|
||
| data object Wedding1: DefaultCutFrameSet( | ||
| 1, | ||
| "웨딩 1", | ||
| 4, 190, 570, | ||
| R.drawable.wedding, | ||
| listOf( | ||
| PhotoPosition(172, 115, 9, 9), | ||
| PhotoPosition(172, 115, 9, 133), | ||
| PhotoPosition(172, 115, 9, 256), | ||
| PhotoPosition(172, 115, 9, 383), | ||
| ), | ||
| listOf( | ||
| R.drawable.wedding_overlay1 | ||
| ), | ||
| dateStringHeight = 495 | ||
| ) | ||
|
|
||
| data object Wedding2: DefaultCutFrameSet( | ||
| 2, | ||
| "웨딩 2", | ||
| 4, 190, 570, | ||
| R.drawable.wedding, | ||
| listOf( | ||
| PhotoPosition(172, 115, 9, 9), | ||
| PhotoPosition(172, 115, 9, 133), | ||
| PhotoPosition(172, 115, 9, 256), | ||
| PhotoPosition(172, 115, 9, 383), | ||
| ), | ||
| listOf( | ||
| R.drawable.wedding_overlay2 | ||
| ), | ||
| dateStringHeight = 495 | ||
| ) | ||
| } |
26 changes: 26 additions & 0 deletions
26
domain/src/main/java/com/foke/together/domain/interactor/entity/CutFrameTypeV1.kt
This file contains hidden or 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,26 @@ | ||
| package com.foke.together.domain.interactor.entity | ||
|
|
||
| enum class CutFrameTypeV1 { | ||
| MAKER_FAIRE, | ||
| FOURCUT_LIGHT, | ||
| FOURCUT_DARK; | ||
|
|
||
| companion object { | ||
| fun findBy(name: String): CutFrameTypeV1 { | ||
| return when (name) { | ||
| MAKER_FAIRE.name -> MAKER_FAIRE | ||
| FOURCUT_LIGHT.name -> FOURCUT_LIGHT | ||
| FOURCUT_DARK.name -> FOURCUT_DARK | ||
| else -> throw IllegalArgumentException("Unknown value: $name") | ||
| } | ||
| } | ||
| fun findBy(ordinal: Int): CutFrameTypeV1 { | ||
| return when (ordinal) { | ||
| MAKER_FAIRE.ordinal -> MAKER_FAIRE | ||
| FOURCUT_LIGHT.ordinal -> FOURCUT_LIGHT | ||
| FOURCUT_DARK.ordinal -> FOURCUT_DARK | ||
| else -> throw IllegalArgumentException("Unknown value: $ordinal") | ||
| } | ||
| } | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
domain/src/main/java/com/foke/together/domain/interactor/entity/PhotoPosition.kt
This file contains hidden or 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,8 @@ | ||
| package com.foke.together.domain.interactor.entity | ||
|
|
||
| data class PhotoPosition ( | ||
| val width: Int, | ||
| val height: Int, | ||
| val x: Int, | ||
| val y: Int, | ||
| ) |
15 changes: 15 additions & 0 deletions
15
domain/src/main/java/com/foke/together/domain/interactor/entity/SessionData.kt
This file contains hidden or 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 com.foke.together.domain.interactor.entity | ||
|
|
||
| data class SessionData ( | ||
| val sessionId: SessionId, | ||
| val cutFrame: CutFrame? = null, | ||
| val status: Status | ||
| ) | ||
|
|
||
| enum class Status { | ||
| INIT, | ||
| SELECT_FRAME, | ||
| CAPTURE, | ||
| GENERATE_PHOTO, | ||
| SHARE | ||
| } |
9 changes: 9 additions & 0 deletions
9
domain/src/main/java/com/foke/together/domain/interactor/entity/SessionId.kt
This file contains hidden or 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,9 @@ | ||
| package com.foke.together.domain.interactor.entity | ||
|
|
||
| data class SessionId ( | ||
| val startAt: Long | ||
| ) { | ||
| override fun toString(): String { | ||
| return startAt.toString() | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
domain/src/main/java/com/foke/together/domain/interactor/session/ClearSessionUseCase.kt
This file contains hidden or 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 com.foke.together.domain.interactor.session | ||
|
|
||
| import com.foke.together.domain.output.SessionRepositoryInterface | ||
| import javax.inject.Inject | ||
|
|
||
| class ClearSessionUseCase @Inject constructor( | ||
| private val sessionRepository: SessionRepositoryInterface | ||
| ) { | ||
| operator fun invoke() { | ||
| sessionRepository.clearSession() | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
domain/src/main/java/com/foke/together/domain/interactor/session/CreateNewSessionUseCase.kt
This file contains hidden or 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 com.foke.together.domain.interactor.session | ||
|
|
||
| import com.foke.together.domain.output.SessionRepositoryInterface | ||
| import javax.inject.Inject | ||
|
|
||
| class CreateNewSessionUseCase @Inject constructor( | ||
| private val sessionRepository: SessionRepositoryInterface | ||
| ) { | ||
| operator fun invoke() { | ||
| sessionRepository.createSession() | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.