-
Notifications
You must be signed in to change notification settings - Fork 4
Internal Camera 구현 및 실행 [#110] #154
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
34 changes: 0 additions & 34 deletions
34
domain/src/main/java/com/foke/together/domain/interactor/CaptureWithInternalCameraUseCase.kt
This file was deleted.
Oops, something went wrong.
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
11 changes: 0 additions & 11 deletions
11
.../src/main/java/com/foke/together/domain/interactor/GetInternalCameraAspectRatioUseCase.kt
This file was deleted.
Oops, something went wrong.
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
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
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 |
|---|---|---|
|
|
@@ -4,11 +4,15 @@ import android.content.Context | |
| import android.graphics.Bitmap | ||
| import android.graphics.ImageDecoder | ||
| import android.net.Uri | ||
| import android.provider.MediaStore | ||
| import com.foke.together.domain.interactor.GetCameraSourceTypeUseCase | ||
| import com.foke.together.domain.interactor.entity.CameraSourceType | ||
| import com.foke.together.domain.interactor.entity.CutFrameTypeV1 | ||
| import com.foke.together.domain.output.ImageRepositoryInterface | ||
| import com.foke.together.util.AppPolicy | ||
| import com.foke.together.util.ImageFileUtil | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import kotlinx.coroutines.flow.map | ||
| import javax.inject.Inject | ||
|
|
||
| class ImageRepository @Inject constructor( | ||
|
|
@@ -25,12 +29,53 @@ class ImageRepository @Inject constructor( | |
| return ImageFileUtil.cacheBitmap(context, image, fileName) | ||
| } | ||
|
|
||
| override fun getCachedImageUriList(): List<Uri> { | ||
| override fun getCachedImageUriList(sourceType: CameraSourceType): List<Uri> { | ||
| var uriList = mutableListOf<Uri>() | ||
| context.cacheDir.listFiles().forEach { | ||
| if(it.name.contains(AppPolicy.CAPTURED_FOUR_CUT_IMAGE_NAME)){ | ||
| // capture로 시작하는 파일만 반환 | ||
| uriList.add(Uri.fromFile(it)) | ||
| when(sourceType){ | ||
| CameraSourceType.EXTERNAL -> { | ||
| context.cacheDir.listFiles().forEach { | ||
| if(it.name.contains(AppPolicy.CAPTURED_FOUR_CUT_IMAGE_NAME)){ | ||
| // capture로 시작하는 파일만 반환 | ||
| uriList.add(Uri.fromFile(it)) | ||
| } | ||
| } | ||
| } | ||
| CameraSourceType.INTERNAL -> { | ||
| val projection = arrayOf( | ||
| MediaStore.Images.Media._ID, | ||
| MediaStore.Images.Media.DISPLAY_NAME, | ||
| MediaStore.Images.Media.DATE_ADDED | ||
| ) | ||
| val selection = "${MediaStore.Images.Media.RELATIVE_PATH} LIKE ?" | ||
| val selectionArgs = arrayOf("%Pictures/4cuts/backup%") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: 4cuts 를 4cut 단수형으로 바꿀 필요가 있을까 궁금합니다! |
||
| val sortOrder = "${MediaStore.Images.Media.DATE_ADDED} DESC" | ||
|
|
||
| val cursor = context.contentResolver.query( | ||
| MediaStore.Images.Media.EXTERNAL_CONTENT_URI, | ||
| projection, | ||
| selection, | ||
| selectionArgs, | ||
| sortOrder | ||
| ) | ||
|
|
||
| cursor?.use { | ||
| val idColumn = it.getColumnIndexOrThrow(MediaStore.Images.Media._ID) | ||
| val latestUris = mutableListOf<Uri>() | ||
|
|
||
| var count = 0 | ||
| while (it.moveToNext() && count < AppPolicy.CAPTURE_COUNT) { | ||
| val id = it.getLong(idColumn) | ||
| val contentUri = Uri.withAppendedPath( | ||
| MediaStore.Images.Media.EXTERNAL_CONTENT_URI, | ||
| id.toString() | ||
| ) | ||
| latestUris.add(contentUri) | ||
| count++ | ||
| } | ||
|
|
||
| latestUris.reverse() | ||
| uriList.addAll(latestUris) | ||
| } | ||
| } | ||
| } | ||
| return uriList | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GeneratePhotoFrameUseCaseV1 을 deprecated한 이유가 Session으로 전환 작업을 위한 내용이었는데
아래 커밋 참고해보면 좋을 것 같습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 내용은 InternalCamera로 기존 기초적인 실행을 위해 인자를 추가했습니다.
Deprecated 된 함수인건 확인하고있습니다.