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

#27 [feat] 스플래쉬 구현 #29

Merged
merged 11 commits into from
Jan 11, 2024
16 changes: 12 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@

<activity
android:name=".ui.storytelling.StoryTellingActivity"
android:exported="true"
android:screenOrientation="portrait" />

android:exported="false"
android:screenOrientation="portrait"></activity>
<activity
android:name=".ui.main.happy.addlist.HappyAddListActivity"
android:name=".ui.onboarding.splash.SplashActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
Expand All @@ -48,10 +47,19 @@
</intent-filter>
</activity>

<activity
android:name=".ui.main.happy.addlist.HappyAddListActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".ui.setting.SettingActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.main.LoginActivity"
android:exported="false"
android:screenOrientation="portrait" />

</application>

Expand Down
25 changes: 25 additions & 0 deletions app/src/main/java/com/sopetit/softie/ui/main/LoginActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.sopetit.softie.ui.main

import android.content.Intent
import android.os.Bundle
import com.sopetit.softie.R
import com.sopetit.softie.databinding.ActivityLoginBinding
import com.sopetit.softie.ui.storytelling.StoryTellingActivity
import com.sopetit.softie.util.binding.BindingActivity

class LoginActivity : BindingActivity<ActivityLoginBinding>(R.layout.activity_login) {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initSetLogInBtn()
}

private fun initSetLogInBtn() {
val intent = Intent(this, StoryTellingActivity::class.java)
binding.btnLoginKakao.setOnClickListener {
startActivity(intent)
finish()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.sopetit.softie.ui.onboarding.splash

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import com.sopetit.softie.R
import com.sopetit.softie.databinding.ActivitySplashBinding
import com.sopetit.softie.ui.main.LoginActivity
import com.sopetit.softie.util.binding.BindingActivity
import kotlin.random.Random

class SplashActivity : BindingActivity<ActivitySplashBinding>(R.layout.activity_splash) {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initCreateRandomVersion()
}

private fun initCreateRandomVersion() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스플래쉬 랜덤 로직 결국 해냈네요! 멋져요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋ 생각보다 안 어렵더라구요 ㅎㅎ

when (Random.nextInt(1, 5)) {
1 -> makeSplashImg(R.drawable.ic_splash1)
2 -> makeSplashImg(R.drawable.ic_splash2)
3 -> makeSplashImg(R.drawable.ic_splash3)
4 -> makeSplashImg(R.drawable.ic_splash4)
Comment on lines +23 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

훨씬 리소스가 간단한 것 같아 좋은 것 같습니다!

}
}

private fun makeSplashImg(image: Int) {
binding.ivSplashBackground.setBackgroundResource(image)
initMakeSplash()
}

private fun initMakeSplash() {
Handler(Looper.getMainLooper()).postDelayed({
val intent = Intent(this, LoginActivity::class.java)
startActivity(intent)
finish()
}, SPLASH_DELAY)
}

companion object {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delay 값을 수기로 넣는 것보다 빼놓는 것이 좋은가요?

Copy link
Member Author

@emjayMJkim emjayMJkim Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 매직 넘버를 그냥 써 주는 것보다 companion object 내에 상수로 선언하게 되면 각 값들이 어떤 것을 의미하는 지 파악하기 쉬워집니당

const val SPLASH_DELAY = 2000L
}
}
22 changes: 22 additions & 0 deletions app/src/main/res/drawable/ic_login_kakao.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="319dp"
android:height="45dp"
android:viewportWidth="319"
android:viewportHeight="45">
<path
android:pathData="M6,0L313,0A6,6 0,0 1,319 6L319,39A6,6 0,0 1,313 45L6,45A6,6 0,0 1,0 39L0,6A6,6 0,0 1,6 0z"
android:fillColor="#FEE500"/>
<path
android:pathData="M102.03,16.75C102.03,18.24 101.84,19.61 101.46,20.84C101.09,22.06 100.44,23.2 99.5,24.27C98.56,25.33 97.28,26.26 95.64,27.06L94.83,25.95C96.06,25.35 97.08,24.67 97.87,23.92C98.66,23.17 99.27,22.34 99.7,21.43L95.13,21.86L94.91,20.58L100.16,20.23C100.35,19.55 100.48,18.8 100.54,17.95H95.64V16.75H102.03ZM104.17,15.33H105.66V20.92H107.83V22.14H105.66V29.31H104.17V15.33ZM115.86,16.75C115.85,18.24 115.66,19.61 115.29,20.84C114.92,22.06 114.27,23.2 113.33,24.27C112.39,25.33 111.1,26.26 109.47,27.06L108.66,25.95C109.89,25.35 110.9,24.67 111.69,23.92C112.49,23.17 113.1,22.34 113.52,21.43L108.95,21.86L108.73,20.58L113.98,20.23C114.18,19.55 114.31,18.8 114.37,17.95H109.47V16.75H115.86ZM118,15.33H119.48V20.92H121.66V22.14H119.48V29.31H118V15.33ZM128.78,16.17C129.77,16.17 130.66,16.33 131.45,16.64C132.23,16.95 132.85,17.39 133.29,17.95C133.73,18.51 133.95,19.16 133.95,19.89C133.95,20.58 133.77,21.19 133.39,21.73C133.02,22.26 132.49,22.68 131.82,23.01C131.15,23.33 130.38,23.52 129.52,23.59V26.34H135.22V27.58H122.41V26.34H128.05V23.59C127.18,23.52 126.41,23.33 125.74,23.01C125.08,22.68 124.56,22.26 124.18,21.72C123.81,21.18 123.63,20.57 123.63,19.89C123.63,19.16 123.85,18.52 124.29,17.95C124.73,17.39 125.34,16.95 126.13,16.64C126.91,16.33 127.79,16.17 128.78,16.17ZM125.06,19.89C125.06,20.41 125.22,20.86 125.54,21.24C125.86,21.63 126.3,21.92 126.86,22.13C127.42,22.34 128.06,22.45 128.78,22.45C129.51,22.45 130.15,22.34 130.71,22.13C131.27,21.92 131.71,21.63 132.03,21.24C132.35,20.86 132.52,20.41 132.52,19.89C132.52,19.39 132.35,18.95 132.03,18.57C131.71,18.19 131.27,17.9 130.7,17.7C130.14,17.49 129.5,17.39 128.78,17.39C128.07,17.39 127.43,17.49 126.86,17.7C126.3,17.9 125.86,18.19 125.54,18.58C125.22,18.96 125.06,19.4 125.06,19.89ZM149.05,27.66H136.23V26.41H141.88V23.95H137.8V19.5H146.02V17.53H137.77V16.31H147.48V20.69H139.27V22.73H147.81V23.95H143.34V26.41H149.05V27.66ZM159.11,18.89C159.1,19.73 159.26,20.57 159.57,21.38C159.89,22.2 160.33,22.93 160.89,23.56C161.46,24.19 162.1,24.67 162.81,24.98L161.92,26.16C161.13,25.78 160.42,25.21 159.8,24.47C159.19,23.72 158.72,22.87 158.38,21.91C158.05,22.95 157.58,23.87 156.95,24.66C156.32,25.46 155.59,26.06 154.77,26.47L153.86,25.22C154.58,24.9 155.23,24.41 155.8,23.76C156.37,23.1 156.81,22.34 157.13,21.49C157.45,20.64 157.61,19.77 157.61,18.89V16.5H159.11V18.89ZM164.08,15.33H165.56V29.36H164.08V15.33ZM172.69,17.84C172.68,18.44 172.81,19.02 173.08,19.57C173.35,20.12 173.74,20.61 174.25,21.05C174.76,21.48 175.37,21.81 176.06,22.05L175.31,23.2C174.53,22.93 173.85,22.54 173.27,22.02C172.7,21.49 172.26,20.89 171.95,20.19C171.65,20.95 171.19,21.61 170.59,22.19C170,22.76 169.3,23.18 168.48,23.47L167.69,22.31C168.4,22.07 169.02,21.72 169.55,21.26C170.09,20.8 170.49,20.28 170.77,19.69C171.05,19.09 171.2,18.47 171.2,17.83V17.45H168.13V16.25H175.7V17.45H172.69V17.84ZM169.55,24.45H178.8V29.33H177.31V25.66H169.55V24.45ZM177.31,15.33H178.8V18.92H180.83V20.17H178.8V23.77H177.31V15.33ZM192.53,21H194.78V22.23H192.53V29.33H191.06V15.33H192.53V21ZM181.55,17.52H185V15.52H186.48V17.52H189.84V18.73H181.55V17.52ZM182.27,23.02C182.27,22.39 182.41,21.83 182.71,21.34C183.01,20.84 183.43,20.46 183.95,20.18C184.48,19.9 185.08,19.77 185.75,19.77C186.41,19.77 187.01,19.9 187.53,20.18C188.06,20.46 188.48,20.84 188.78,21.34C189.08,21.83 189.23,22.39 189.23,23.02C189.23,23.65 189.08,24.21 188.78,24.7C188.48,25.2 188.06,25.59 187.53,25.87C187.01,26.14 186.41,26.28 185.75,26.28C185.08,26.28 184.48,26.14 183.95,25.87C183.43,25.59 183.01,25.2 182.71,24.7C182.41,24.21 182.27,23.65 182.27,23.02ZM183.69,23.02C183.69,23.42 183.77,23.77 183.95,24.08C184.12,24.39 184.37,24.62 184.68,24.79C185,24.96 185.35,25.04 185.75,25.03C186.14,25.04 186.49,24.96 186.8,24.79C187.12,24.62 187.36,24.39 187.54,24.08C187.72,23.77 187.81,23.42 187.81,23.02C187.81,22.63 187.72,22.28 187.54,21.97C187.36,21.66 187.12,21.42 186.8,21.25C186.49,21.07 186.14,20.98 185.75,20.98C185.35,20.98 185,21.07 184.68,21.25C184.37,21.42 184.12,21.66 183.95,21.97C183.77,22.28 183.69,22.63 183.69,23.02ZM207.09,29.33H205.59V15.33H207.09V29.33ZM195.59,25.58C197.43,24.7 198.82,23.64 199.77,22.38C200.73,21.13 201.28,19.67 201.42,18.02H196.27V16.83H202.92C202.92,18.99 202.4,20.92 201.37,22.6C200.34,24.28 198.67,25.68 196.38,26.78L195.59,25.58Z"
android:fillColor="#1B1D1F"/>
<group>
<clip-path
android:pathData="M20,13h18v18h-18z"/>
<path
android:pathData="M29,13.94C24.29,13.94 20,17.73 20,20.93C20,23.33 21.56,25.45 23.93,26.71L22.93,30.37C22.84,30.7 23.21,30.96 23.5,30.77L27.87,27.86C28.24,27.9 28.62,27.92 29,27.92C33.97,27.92 38,24.79 38,20.93C38,17.73 33.97,13.94 29,13.94Z"
android:strokeAlpha="0.902"
android:fillColor="#1B1D1F"
android:fillType="evenOdd"
android:fillAlpha="0.902"/>
</group>
</vector>
24 changes: 24 additions & 0 deletions app/src/main/res/drawable/ic_logo_main1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="174dp"
android:height="52dp"
android:viewportWidth="174"
android:viewportHeight="52">
<path
android:pathData="M22.09,26.78C19.43,24.77 16.18,23.43 13.96,23.43C12.26,23.43 10.93,24.62 10.93,26.03C10.93,27.15 11.67,27.75 13.66,28.27C16.32,29.09 18.09,29.68 19.8,30.57C23.71,32.51 25.93,35.93 25.93,40.02C25.93,46.79 20.09,51.93 12.41,51.93C8.05,51.93 3.84,50.29 0,47.24L4.07,40.25C6.5,42.41 9.61,43.6 12.64,43.6C14.78,43.6 15.96,42.7 15.96,41.22C15.96,39.73 15.07,38.91 13.3,38.47C10.79,37.87 9.91,37.65 8.43,36.98C3.26,34.9 0.75,31.55 0.75,27.01C0.75,20.39 6.73,15.26 14.41,15.26C18.4,15.26 21.8,16.45 26.01,19.35L22.09,26.79L22.09,26.78Z"
android:fillColor="#4A4A4A"/>
<path
android:pathData="M61.91,21.72C64.64,24.92 65.91,28.72 65.91,33.48C65.91,43.6 57.48,51.86 47.14,51.86C36.8,51.86 29.26,44.12 29.26,34C29.26,23.89 37.61,14.96 47.88,14.96C53.2,14.96 58.37,17.41 61.92,21.73L61.91,21.72ZM39.3,33.7C39.3,38.46 43,42.55 47.21,42.55C51.71,42.55 55.71,38.16 55.71,33.33C55.71,28.49 52.31,24.47 47.87,24.47C43.07,24.47 39.3,28.57 39.3,33.7Z"
android:fillColor="#4A4A4A"/>
<path
android:pathData="M72.26,20.01V18.3C72.26,11.53 73.15,7.44 75.29,4.54C77.36,1.71 80.69,0 84.3,0C87.33,0 89.92,0.97 93.98,3.57L90.67,11.86C89.37,10.58 87.48,9.89 85.71,9.89C83.71,9.89 82.46,11.68 82.46,14.58V20.01H91.25L91.1,28.12L82.46,28.19V44.56C82.46,44.86 82.53,45.82 82.6,47.31C82.6,48.94 82.75,49.91 82.9,50.88H71.74L71.81,50.36L71.96,47.24C72.11,45 72.11,43.67 72.18,43.36V28.19L67.82,28.11L67.75,20.15L72.26,20.01L72.26,20.01Z"
android:fillColor="#4A4A4A"/>
<path
android:pathData="M116.37,28.65H107.88L107.66,35.34V36.9C107.66,38.83 107.8,39.65 108.4,40.47C109.14,41.58 110.54,42.33 111.72,42.33C112.83,42.33 113.53,41.97 115.37,41.07L118.3,47.98C115.19,50.36 112.16,51.48 109.06,51.48C102.86,51.48 97.83,46.79 97.83,41.06L97.91,28.42L93.25,28.28L93.33,20.02L97.98,19.95L98.05,14.89C97.98,11.31 97.91,9.3 97.83,7.59L108.18,7.66C108.18,8.26 108.18,8.63 108.03,10.26C107.96,11.45 107.96,12.13 107.96,13.01L107.81,20.09L116.45,20.24L116.38,28.65L116.37,28.65Z"
android:fillColor="#4A4A4A"/>
<path
android:pathData="M133.88,7.16C133.88,10.66 130.85,13.78 127.46,13.78C124.06,13.78 121.1,10.66 121.1,7.01C121.1,3.37 124.06,0.39 127.38,0.39C130.71,0.39 133.88,3.59 133.88,7.16ZM133.22,16.37L132.34,50.89H121.99L121.77,16.37H133.22Z"
android:fillColor="#4A4A4A"/>
<path
android:pathData="M171.12,47.09C167.43,50.06 161.44,52 155.98,52C145.56,52 137.65,44.04 137.65,33.55C137.65,23.06 145.85,15.02 156.57,15.02C166.54,15.02 173.34,22.09 173.34,32.36C173.34,34.07 173.19,35.63 172.75,37.35L148.29,37.49C149.7,41.06 153.32,43.22 157.97,43.22C161,43.22 163.59,42.4 165.66,40.84L171.12,47.09V47.09ZM163.44,29.68C162.33,26.04 159.52,23.88 155.68,23.88C152.06,23.88 149.7,25.67 148.22,29.68H163.44Z"
android:fillColor="#4A4A4A"/>
</vector>
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_speech_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="141dp"
android:height="43dp"
android:viewportWidth="141"
android:viewportHeight="43">
<path
android:pathData="M17,0L124,0A17,17 0,0 1,141 17L141,17A17,17 0,0 1,124 34L17,34A17,17 0,0 1,0 17L0,17A17,17 0,0 1,17 0z"
android:fillColor="#4A4A4A"/>
<path
android:pathData="M71.37,41.5C70.98,42.17 70.02,42.17 69.63,41.5L63.14,30.25C62.75,29.58 63.24,28.75 64,28.75L77,28.75C77.76,28.75 78.25,29.58 77.86,30.25L71.37,41.5Z"
android:fillColor="#4A4A4A"/>
</vector>
Binary file added app/src/main/res/drawable/ic_splash1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_splash2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_splash3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_splash4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions app/src/main/res/layout/activity_login.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/background">

<ImageView
android:id="@+id/iv_login_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_logo_main1"
android:layout_marginTop="187dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="회원가입하고 봉인해제"
android:textAppearance="@style/caption1"
android:textColor="@color/gray100"
android:background="@drawable/ic_speech_dark"
android:gravity="center"
android:paddingHorizontal="17dp"
android:paddingTop="10dp"
android:paddingBottom="19dp"
app:layout_constraintStart_toStartOf="@id/iv_login_bear"
app:layout_constraintEnd_toEndOf="@id/iv_login_bear"
app:layout_constraintBottom_toTopOf="@id/iv_login_bear" />

<ImageView
android:id="@+id/iv_login_bear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_bear_brown_down"
android:layout_marginBottom="44dp"
app:layout_constraintBottom_toTopOf="@id/btn_login_kakao"
app:layout_constraintStart_toStartOf="@id/iv_login_logo"
app:layout_constraintEnd_toEndOf="@id/iv_login_logo" />

<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_login_kakao"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_login_kakao"
android:background="@android:color/transparent"
android:layout_marginHorizontal="20dp"
android:layout_marginBottom="104dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
24 changes: 24 additions & 0 deletions app/src/main/res/layout/activity_splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<ImageView
android:id="@+id/iv_splash_background"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
3 changes: 3 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@

<!-- story telling -->
<color name="story_telling_background">#FFE1E1E1</color>

<!-- splash -->
<color name="splash_bottom">#CEB59E</color>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<string name="doll_selection_subtitle">한 번 선택한 인형은 바꿀 수 없어요</string>
<string name="doll_selection_button">이 친구와 함께 할래</string>

<!-- splash -->
<string name="splash_content">친구와 함께 하는 일상 속 작은 습관</string>

<!-- bottom navigation -->
<string name="bottom_navigation_progress">진행 중</string>
<string name="bottom_navigation_home">홈</string>
Expand Down