Skip to content

Commit

Permalink
[UI/#12] verification 뷰 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
b1urrrr committed Dec 31, 2022
1 parent 33aabc2 commit 9801d9e
Show file tree
Hide file tree
Showing 14 changed files with 228 additions and 26 deletions.
9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
defaultConfig {
applicationId "com.lab.keyneez"
minSdk 25
targetSdk 32
targetSdk 33
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -81,11 +81,12 @@ dependencies {
// kotlin serialization
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha05")
// constraint layout
implementation "androidx.constraintlayout:constraintlayout:2.2.0-alpha05"

// glide
implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
package com.lab.keyneez.presentation.main.card

import android.content.Intent
import android.os.Bundle
import android.view.View
import com.lab.keyneez.R
import com.lab.keyneez.databinding.FragmentCardBinding
import com.lab.keyneez.presentation.verification.VerificationActivity
import com.lab.keyneez.util.binding.BindingFragment
import com.lab.keyneez.util.extension.setOnSingleClickListener

class CardFragment : BindingFragment<FragmentCardBinding>(R.layout.fragment_card) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

initIssueBtnClickListener()
}

private fun initIssueBtnClickListener() {
binding.btnCardIssue.setOnSingleClickListener {
val toVertification = Intent(activity, VerificationActivity::class.java)
startActivity(toVertification)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
package com.lab.keyneez.presentation.verification

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.lab.keyneez.R
import com.lab.keyneez.databinding.ActivityVerificationBinding
import com.lab.keyneez.util.binding.BindingActivity
import com.lab.keyneez.util.extension.setOnSingleClickListener
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class VerificationActivity : AppCompatActivity() {
class VerificationActivity :
BindingActivity<ActivityVerificationBinding>(R.layout.activity_verification) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_verification)

initBackBtnClickListener()
initStartCameraBtnClickListener()
}

private fun initBackBtnClickListener() {
binding.btnVerificationBack.setOnSingleClickListener { finish() }
}

private fun initStartCameraBtnClickListener() {
// ocr 기능 구현
}
}
21 changes: 21 additions & 0 deletions app/src/main/java/com/lab/keyneez/util/OnSingleClickListener.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.lab.keyneez.util

import android.os.SystemClock
import android.view.View

class OnSingleClickListener(
private var interval: Int = 600,
private var onSingleClick: (View) -> Unit
) : View.OnClickListener {

private var lastClickTime: Long = 0

override fun onClick(v: View) {
val elapsedRealtime = SystemClock.elapsedRealtime()
if ((elapsedRealtime - lastClickTime) < interval) {
return
}
lastClickTime = elapsedRealtime
onSingleClick(v)
}
}
11 changes: 11 additions & 0 deletions app/src/main/java/com/lab/keyneez/util/extension/ViewExt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.lab.keyneez.util.extension // ktlint-disable filename

import android.view.View
import com.lab.keyneez.util.OnSingleClickListener

fun View.setOnSingleClickListener(onSingleClick: (View) -> Unit) {
val oneClick = OnSingleClickListener {
onSingleClick(it)
}
setOnClickListener(oneClick)
}
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_verification_back.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:pathData="M13.333,29.334L0,16L13.333,2.667L15.2,4.567L3.767,16L15.2,27.434L13.333,29.334Z"
android:fillColor="#000000"/>
</vector>
46 changes: 46 additions & 0 deletions app/src/main/res/drawable/img_verification_card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="327dp"
android:height="192dp"
android:viewportWidth="327"
android:viewportHeight="192">
<path
android:pathData="M12,0L315,0A12,12 0,0 1,327 12L327,180A12,12 0,0 1,315 192L12,192A12,12 0,0 1,0 180L0,12A12,12 0,0 1,12 0z"
android:fillColor="#AEEDFC"/>
<path
android:pathData="M47.99,36L135.99,36A16,16 0,0 1,151.99 52L151.99,140A16,16 0,0 1,135.99 156L47.99,156A16,16 0,0 1,31.99 140L31.99,52A16,16 0,0 1,47.99 36z"
android:fillColor="#ffffff"/>
<path
android:pathData="M67,86m-9,0a9,9 0,1 1,18 0a9,9 0,1 1,-18 0"
android:fillColor="#FFDCD2"/>
<path
android:pathData="M83.5,75L83.5,75A2.5,2.5 0,0 1,86 77.5L86,80.5A2.5,2.5 0,0 1,83.5 83L83.5,83A2.5,2.5 0,0 1,81 80.5L81,77.5A2.5,2.5 0,0 1,83.5 75z"
android:fillColor="#000000"/>
<path
android:pathData="M100.5,75L100.5,75A2.5,2.5 0,0 1,103 77.5L103,80.5A2.5,2.5 0,0 1,100.5 83L100.5,83A2.5,2.5 0,0 1,98 80.5L98,77.5A2.5,2.5 0,0 1,100.5 75z"
android:fillColor="#000000"/>
<path
android:pathData="M100,87C100,88.05 99.79,89.09 99.39,90.06C98.99,91.03 98.4,91.91 97.66,92.66C96.91,93.4 96.03,93.99 95.06,94.39C94.09,94.79 93.05,95 92,95C90.95,95 89.91,94.79 88.94,94.39C87.97,93.99 87.09,93.4 86.34,92.66C85.6,91.91 85.01,91.03 84.61,90.06C84.21,89.09 84,88.05 84,87L92,87H100Z"
android:fillColor="#000000"/>
<path
android:pathData="M117,86m-9,0a9,9 0,1 1,18 0a9,9 0,1 1,-18 0"
android:fillColor="#FFDCD2"/>
<path
android:pathData="M92.62,107H101.25C101.8,107 102.25,107.45 102.25,108L102.25,116.77C102.25,117.64 101.23,118.09 100.59,117.52L92,109.89L83.41,117.52C82.77,118.09 81.75,117.64 81.75,116.77V108C81.75,107.45 82.2,107 82.75,107H91.38H92.62Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
<path
android:pathData="M190.42,51L233.42,51A10.5,10.5 0,0 1,243.92 61.5L243.92,61.5A10.5,10.5 0,0 1,233.42 72L190.42,72A10.5,10.5 0,0 1,179.92 61.5L179.92,61.5A10.5,10.5 0,0 1,190.42 51z"
android:strokeAlpha="0.8"
android:fillColor="#ffffff"
android:fillAlpha="0.8"/>
<path
android:pathData="M190.42,92L283.42,92A10.5,10.5 0,0 1,293.92 102.5L293.92,102.5A10.5,10.5 0,0 1,283.42 113L190.42,113A10.5,10.5 0,0 1,179.92 102.5L179.92,102.5A10.5,10.5 0,0 1,190.42 92z"
android:strokeAlpha="0.8"
android:fillColor="#ffffff"
android:fillAlpha="0.8"/>
<path
android:pathData="M190.42,121L283.42,121A10.5,10.5 0,0 1,293.92 131.5L293.92,131.5A10.5,10.5 0,0 1,283.42 142L190.42,142A10.5,10.5 0,0 1,179.92 131.5L179.92,131.5A10.5,10.5 0,0 1,190.42 121z"
android:strokeAlpha="0.8"
android:fillColor="#ffffff"
android:fillAlpha="0.8"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/shape_black_fill_4_rect.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/gray900" />
<corners android:radius="4dp" />
</shape>
</item>
</layer-list>
85 changes: 80 additions & 5 deletions app/src/main/res/layout/activity_verification.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<layout>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".presentation.verification.VerificationActivity">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_verification"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".presentation.verification.VerificationActivity">
android:layout_height="match_parent">

<ImageButton
android:id="@+id/btn_verification_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:background="@null"
android:padding="12dp"
android:src="@drawable/ic_verification_back"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ScrollView
android:id="@+id/sv_verification_description"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_verification_back">

<LinearLayout
android:id="@+id/layout_verification_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/tv_verification_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp"
android:text="@string/verification_description"
android:textColor="@color/gray900"
android:textSize="24sp"
android:textStyle="bold" />

<TextView
android:id="@+id/tv_verification_sub_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/gray500"
android:textSize="18sp"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="24dp"
android:text="@string/verification_sub_description"/>

<ImageView
android:id="@+id/iv_verification_card"
android:layout_marginTop="72dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/img_verification_card" />
</LinearLayout>
</ScrollView>

<TextView
android:id="@+id/btn_verification_start_camera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="44dp"
android:background="@drawable/shape_black_fill_4_rect"
android:gravity="center"
android:paddingVertical="15dp"
android:text="@string/verification_start_camera"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@
android:id="@+id/layout_card_issue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_card_keyneez">
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/iv_card_cards"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<!-- Base application theme. -->
<style name="Theme.Keyneez" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryVariant">@color/black</item>
<item name="colorPrimary">@color/gray900</item>
<item name="colorPrimaryVariant">@color/gray900</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorOnSecondary">@color/gray900</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- android default color -->
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
Expand Down Expand Up @@ -38,7 +39,7 @@
<color name="pink300">#FEC4D6</color>
<color name="pink200">#FFE1E9</color>

<color name="gary900">#000000</color>
<color name="gray900">#000000</color>
<color name="gray800">#1F1F1F</color>
<color name="gray700">#333333</color>
<color name="gary600">#474747</color>
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<resources>
<string name="app_name">Keyneez</string>

//like
<string name="like_save">저장</string>
<string name="like_data">11.24-12.31</string>
<string name="like_content">청소년 영화관 할인</string>

// common
<string name="binding_error">Binding not initialized to reference the view.</string>

Expand All @@ -15,11 +10,21 @@
<string name="main_card">Card</string>
<string name="main_setting">Setting</string>

//like
<string name="like_save">저장</string>
<string name="like_data">11.24-12.31</string>
<string name="like_content">청소년 영화관 할인</string>

// card
<string name="card_my_id">나의 ID</string>
<string name="card_my_id_description">온라인 ID로 더 다양한\n활동을 즐겨보세요</string>
<string name="card_issue">발급하기</string>

// verification
<string name="verification_start_camera">촬영 시작하기</string>
<string name="verification_description">학생증 또는 청소년증을\n준비해주세요.</string>
<string name="verification_sub_description">청소년 인증을 위해 학생증/청소년증\n촬영이 필요해요.</string>

<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
6 changes: 3 additions & 3 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<!-- Base application theme. -->
<style name="Theme.Keyneez" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryVariant">@color/black</item>
<item name="colorPrimary">@color/gray900</item>
<item name="colorPrimaryVariant">@color/gray900</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorOnSecondary">@color/gray900</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>

Expand Down

0 comments on commit 9801d9e

Please sign in to comment.