Skip to content
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

[Feature/qr_qa] 3차 스프린트 QR관련 qa 대응 #321

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
l2hyunwoo marked this conversation as resolved.
Show resolved Hide resolved
import android.net.Uri
import android.os.Bundle
import android.util.Log
Expand Down Expand Up @@ -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()
}
}
}

}
}

Expand All @@ -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
}
}
}
Expand Down Expand Up @@ -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');
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/bg_round_100dp_gray30.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="100dp" />
<solid android:color="?colorOnSurface30" />
</shape>
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/bg_round_20dp_white.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
<solid android:color="@color/white" />
</shape>
12 changes: 12 additions & 0 deletions app/src/main/res/layout/activity_qr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
app:layout_constraintTop_toBottomOf="@id/toolbar_qr"
app:zxing_viewfinder_laser_visibility="false" />

<TextView
android:id="@+id/tv_view_finder_text_detail"
style="@style/TextAppearance.Pophory.Caption2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/qr_view_finder_text_detail"
android:textColor="@color/white"
android:textSize="13sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<WebView
android:id="@+id/webView_qr"
android:layout_width="match_parent"
Expand Down
20 changes: 13 additions & 7 deletions app/src/main/res/layout/bottom_sheet_home_add_photo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@
android:id="@+id/standard_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_round_20dp_white"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

<com.google.android.material.bottomsheet.BottomSheetDragHandleView
<View
android:id="@+id/dragHandle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:layout_width="40dp"
android:layout_height="4dp"
android:layout_margin="13dp"
android:background="@drawable/bg_round_100dp_gray30"
android:paddingHorizontal="22dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/gray_30" />
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_select_feature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="@string/add_photo_bottom_sheet_photo_title"
android:textAppearance="?textAppearanceModalText1"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -30,7 +33,9 @@
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_margin="20dp"
android:layout_marginBottom="15dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_select_feature">
Expand Down Expand Up @@ -83,4 +88,5 @@

</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@
<string name="edit_album_ad_title">앨범을 수정할까요?</string>
<string name="edit_album_ad_description">앨범 커버를 수정하려면 광고 시청 하나 부탁드려요!</string>

<!-- qr -->
<string name="qr_toolbar_text">QR로 등록하기</string>
<string name="qr_image_load_fail">이미지 로드에 실패 하였습니다.</string>
<string name="qr_image_download_fail">이미지 다운로드에 실패하하였습니다.</string>
<string name="qr_view_finder_text">QR 코드를 스캔해주세요.</string>
<string name="qr_view_finder_text">QR코드를 스캔해줘!</string>
<string name="qr_view_finder_text_detail">지원하지 않는 사진관의 경우,웹사이트로 이동할게요</string>

<!-- Add BottomSheet -->
<string name="add_photo_bottom_sheet_photo_title">사진 등록하기</string>
Expand Down
Loading