Skip to content

Commit

Permalink
[MOD/#46] 청소년증 이름 인식 로직 보완 및 firebase storage 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
b1urrrr committed Jan 13, 2023
1 parent b394c55 commit 867aabc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 42 deletions.
13 changes: 5 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'dagger.hilt.android.plugin'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.10'
id "org.jlleitschuh.gradle.ktlint" version "10.3.0"
id 'com.google.gms.google-services'
}

apply plugin: 'kotlin-kapt'
Expand Down Expand Up @@ -107,6 +108,7 @@ dependencies {

// google ml kit
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:18.0.2'
implementation 'com.google.mlkit:text-recognition-korean:16.0.0-beta6'

// viewpager2
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
Expand All @@ -115,19 +117,14 @@ dependencies {
implementation "com.tbuonomo:dotsindicator:4.3"

// shared preference
implementation 'androidx.security:security-crypto-ktx:1.1.0-alpha03'

// google ml kit text recognition
implementation 'com.google.mlkit:text-recognition-korean:16.0.0-beta6'
implementation 'androidx.security:security-crypto-ktx:1.1.0-alpha04'

// text features
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.0.0'

// firebase storage
// implementation 'com.google.firebase:firebase-storage'
implementation 'com.google.firebase:firebase-storage:20.1.0'

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ class OcrActivity : BindingActivity<ActivityOcrBinding>(R.layout.activity_ocr) {
return BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
}

// Text Recognition
// CameraX -> OnImageCapturedListener & ImageAnalysis.Analyzer 활용해서 rotation 계산

private fun runTextRecognition(img: Bitmap) {
// 이미지 유형 : Bitmap, media.Image, ByteBuffer, byte array, device file
val image = InputImage.fromBitmap(img, 0)
Expand Down Expand Up @@ -166,6 +163,7 @@ class OcrActivity : BindingActivity<ActivityOcrBinding>(R.layout.activity_ocr) {
}
else -> {
if (isSuccess && viewModel.idName.value == "" && word.length == 3) viewModel.setIdName(word)
if (isSuccess && viewModel.idName.value == "" && word.startsWith("명:")) viewModel.setIdName(word.substring(2, 5))
if (isSuccess && viewModel.isStudentId.value == true && viewModel.idSubEntry.value == "" && word.endsWith("학교")) viewModel.setIdSchool(word)
if (isSuccess && viewModel.isStudentId.value == false && viewModel.idSubEntry.value == "" && word.length == 14 && word.contains('-')) viewModel.setBirthDate(word)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.lab.keyneez.databinding.BotSheetOcrResultBinding

class OcrResultFragment :
BindingBottomSheetDialog<BotSheetOcrResultBinding>(R.layout.bot_sheet_ocr_result) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.vm = (activity as OcrActivity).viewModel
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ object BindingAdapter {
@BindingAdapter("setRoundedImage")
fun ImageView.setRoundedImage(url: String?) {
this.load(url) {
fallback(R.drawable.img_like_background)
placeholder(R.drawable.img_like_background)
transformations(RoundedCornersTransformation(14f))
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/item_like_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
putStartDate="@{@string/like_date(data.start)"
putEndDate="@{@string/like_date(data.end)"
android:text="@{@string/like_date(data.start,data.end)}" />
putEndDate="@{@string/like_date(data.end)" />

<TextView
android:id="@+id/tv_like_title"
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
Expand Down

0 comments on commit 867aabc

Please sign in to comment.