From e1e95b828c9649f8dfed8dc06561015d4a74e775 Mon Sep 17 00:00:00 2001
From: Jaewon Seo <52442547+librarywon@users.noreply.github.com>
Date: Thu, 26 Oct 2023 14:35:18 +0900
Subject: [PATCH] =?UTF-8?q?[Feature/qr=5Fqa]=203=EC=B0=A8=20=EC=8A=A4?=
=?UTF-8?q?=ED=94=84=EB=A6=B0=ED=8A=B8=20QR=EA=B4=80=EB=A0=A8=20qa=20?=
=?UTF-8?q?=EB=8C=80=EC=9D=91=20(#321)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* [feature/qr_qa]: Refactor string
* [feature/qr_qa]: Fix bottom style edit
* [feature/qr_qa]: Feat add tv and not support url logic
* [feature/qr_qa]: Chore remove blank
---
.../pophory/feature/qr/QRActivity.kt | 29 ++++++++++++++++---
.../res/drawable/bg_round_100dp_gray30.xml | 6 ++++
.../main/res/drawable/bg_round_20dp_white.xml | 7 +++++
app/src/main/res/layout/activity_qr.xml | 12 ++++++++
.../layout/bottom_sheet_home_add_photo.xml | 20 ++++++++-----
app/src/main/res/values/strings.xml | 4 ++-
6 files changed, 66 insertions(+), 12 deletions(-)
create mode 100644 app/src/main/res/drawable/bg_round_100dp_gray30.xml
create mode 100644 app/src/main/res/drawable/bg_round_20dp_white.xml
diff --git a/app/src/main/java/com/teampophory/pophory/feature/qr/QRActivity.kt b/app/src/main/java/com/teampophory/pophory/feature/qr/QRActivity.kt
index 349c641c..23cef718 100644
--- a/app/src/main/java/com/teampophory/pophory/feature/qr/QRActivity.kt
+++ b/app/src/main/java/com/teampophory/pophory/feature/qr/QRActivity.kt
@@ -3,6 +3,7 @@ package com.teampophory.pophory.feature.qr
import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
+import android.graphics.Bitmap
import android.net.Uri
import android.os.Bundle
import android.util.Log
@@ -120,11 +121,22 @@ class QRActivity : AppCompatActivity() {
useWideViewPort = true
}
webViewClient = object : WebViewClient() {
+ override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
+ super.onPageStarted(view, url, favicon)
+ if (url != null && NOT_SUPPORT_URLS.contains(url)) {
+ viewModel.uiState.value =
+ QRState.Fail(getString(R.string.qr_image_load_fail))
+ }
+ }
+
override fun onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)
- fetchImageUrlFromWebView()
+ if (url != null && !NOT_SUPPORT_URLS.contains(url)) {
+ fetchImageUrlFromWebView()
+ }
}
}
+
}
}
@@ -148,12 +160,14 @@ class QRActivity : AppCompatActivity() {
private fun adjustStatusTextPosition() {
val statusTextView = binding.decorateBarcodeViewQr.getStatusView()
val barcodeView = binding.decorateBarcodeViewQr.getBarcodeView()
+ val statusDetailTextView = binding.tvViewFinderTextDetail
barcodeView.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ ->
val framingRect = barcodeView.framingRect
framingRect?.let {
- val desiredYPosition = it.bottom + TEXT_MARGIN_TOP.dp
- statusTextView.y = desiredYPosition.toFloat()
+ statusTextView.y = (it.bottom + TEXT_MARGIN_TOP_MAIN.dp).toFloat()
+ statusDetailTextView.y =
+ statusTextView.y + statusTextView.height + TEXT_MARGIN_TOP_DETAIL.dp
}
}
}
@@ -206,9 +220,16 @@ class QRActivity : AppCompatActivity() {
}
companion object {
+ // 예외 처리 사진관
+ const val POZLE_URL = "http://211.110.139.146/PhotoBooth/no_photo.php"
+
+ // 예외 처리 사진관 리스트
+ var NOT_SUPPORT_URLS = arrayOf(POZLE_URL)
+
// 권한 요청시 어떤 권한에 대한 요청인지 구분하기 위한 코드
const val PERMISSION_REQUEST_CODE = 1000
- const val TEXT_MARGIN_TOP = 23
+ const val TEXT_MARGIN_TOP_MAIN = 23
+ const val TEXT_MARGIN_TOP_DETAIL = 150
const val FIND_IMAGE_LOGIC = """(function() {
var images = document.querySelectorAll('img');
diff --git a/app/src/main/res/drawable/bg_round_100dp_gray30.xml b/app/src/main/res/drawable/bg_round_100dp_gray30.xml
new file mode 100644
index 00000000..81e56985
--- /dev/null
+++ b/app/src/main/res/drawable/bg_round_100dp_gray30.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_round_20dp_white.xml b/app/src/main/res/drawable/bg_round_20dp_white.xml
new file mode 100644
index 00000000..be3a7ff3
--- /dev/null
+++ b/app/src/main/res/drawable/bg_round_20dp_white.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/app/src/main/res/layout/activity_qr.xml b/app/src/main/res/layout/activity_qr.xml
index e018c60b..4b427804 100644
--- a/app/src/main/res/layout/activity_qr.xml
+++ b/app/src/main/res/layout/activity_qr.xml
@@ -21,6 +21,18 @@
app:layout_constraintTop_toBottomOf="@id/toolbar_qr"
app:zxing_viewfinder_laser_visibility="false" />
+
+
-
+ app:layout_constraintTop_toTopOf="parent" />
@@ -83,4 +88,5 @@
-
\ No newline at end of file
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3ecd7376..c830b6d1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -63,10 +63,12 @@
앨범을 수정할까요?
앨범 커버를 수정하려면 광고 시청 하나 부탁드려요!
+
QR로 등록하기
이미지 로드에 실패 하였습니다.
이미지 다운로드에 실패하하였습니다.
- QR 코드를 스캔해주세요.
+ QR코드를 스캔해줘!
+ 지원하지 않는 사진관의 경우,웹사이트로 이동할게요
사진 등록하기