Skip to content

Commit

Permalink
Merge pull request #18 from TelePigeon/feat-splash-login
Browse files Browse the repository at this point in the history
[feat] 스플래시, 로그인, 알림 권한 구현
  • Loading branch information
jihyunniiii authored Jun 2, 2024
2 parents 5431a45 + 39df232 commit 57da377
Show file tree
Hide file tree
Showing 28 changed files with 535 additions and 38 deletions.
14 changes: 12 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.POST_NOTIFICATIONS"
android:minSdkVersion="33" />

<application
android:name=".TelePigeonApp"
Expand All @@ -18,10 +21,10 @@
tools:targetApi="31">

<activity
android:name="com.dongguk.telepigeon.feature.MainActivity"
android:name=".feature.splash.SplashActivity"
android:exported="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.TelePigeon.Splash"
tools:ignore="LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -30,6 +33,13 @@
</intent-filter>
</activity>

<activity
android:name="com.dongguk.telepigeon.feature.MainActivity"
android:exported="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
tools:ignore="LockedOrientationActivity" />

<meta-data
android:name="io.sentry.dsn"
android:value="${IO_SENTRY_DSN}" />
Expand Down
3 changes: 3 additions & 0 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ android {
}
dependencies {
implementation(project(":core:ui"))

// Splash
implementation(libs.androidx.core.splashscreen)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 61 additions & 27 deletions core/designsystem/src/main/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,64 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
android:viewportWidth="146"
android:viewportHeight="146">
<group android:scaleX="0.57"
android:scaleY="0.57"
android:translateX="31.39"
android:translateY="31.39">
<path
android:pathData="M22.08,0L123.92,0A22.08,22.08 0,0 1,146 22.08L146,123.92A22.08,22.08 0,0 1,123.92 146L22.08,146A22.08,22.08 0,0 1,0 123.92L0,22.08A22.08,22.08 0,0 1,22.08 0z"
android:fillColor="#FFC142"/>
<path
android:pathData="M106.29,45.57C90.4,21.52 59.49,15.51 39.52,45.57C26.97,64.46 29.21,84.21 32.86,94.3C35.5,101.58 41.94,108.31 54.76,111.49C58.49,112.41 62.77,113.04 67.64,113.29C69.23,113.37 70.87,113.41 72.58,113.41C74.27,113.41 75.92,113.39 77.52,113.35C82.52,113.23 87.12,112.88 91.26,112.05C101.22,110.05 108.57,105.29 112.73,94.3C118.74,78.41 116.81,61.49 106.29,45.57Z"
android:strokeWidth="2.5"
android:fillColor="#ffffff"
android:strokeColor="#000000"/>
<path
android:pathData="M39.52,45.57C58.63,14.96 90.4,21.52 106.29,45.57C116.31,60.73 116.31,70.3 116.31,79.32C113.59,79.75 107.25,79.45 103.64,74.81C104.5,79.32 99.99,81.68 95.7,78.25C94.41,82.32 90.11,83.83 85.61,81.04C83.46,84.04 77.02,86.83 72.29,82.32C69.29,84.69 62.85,85.54 59.41,81.25C56.41,84.47 51.68,82.11 49.32,78.67C46.75,79.53 41.59,79.96 41.59,74.81C39.25,78.43 35.22,80.15 30.13,79.34C30.11,79.54 30.07,79.55 30,79.32C30.04,79.33 30.09,79.33 30.13,79.34C30.34,77.61 29.66,61.35 39.52,45.57Z"
android:fillColor="#E2E2E2"/>
<path
android:pathData="M106.29,45.57C90.4,21.52 59.49,15.51 39.52,45.57C26.97,64.46 29.21,84.21 32.86,94.3C35.5,101.58 41.94,108.31 54.76,111.49C58.49,112.41 62.77,113.04 67.64,113.29C69.23,113.37 70.87,113.41 72.58,113.41C74.27,113.41 75.92,113.39 77.52,113.35C82.52,113.23 87.12,112.88 91.26,112.05C101.22,110.05 108.57,105.29 112.73,94.3C118.74,78.41 116.81,61.49 106.29,45.57Z"
android:strokeWidth="2.5"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M66.79,71.97C67.64,66.18 77.95,66.61 78.81,71.97C78.81,76.7 66.79,76.7 66.79,71.97Z"
android:fillColor="#FCB62A"/>
<path
android:pathData="M57.34,115.77C56.05,117.06 50.68,118.13 54.76,111.49C58.49,112.41 62.77,113.04 67.64,113.29C68.5,122.43 63.35,120.71 62.49,117.06C61.85,119.21 57.34,120.92 57.34,115.77Z"
android:fillColor="#FCB62A"/>
<path
android:pathData="M82.89,117.06C80.74,121.35 76.88,121.57 77.52,113.35C82.52,113.23 87.12,112.88 91.26,112.05C92.55,115.77 91.9,119.21 87.61,115.77C87.61,119.64 85.03,120.71 82.89,117.06Z"
android:fillColor="#FCB62A"/>
<path
android:pathData="M41.67,74.55C41.67,80.35 46.82,80.99 49.61,77.99C52.19,83.78 57.12,84.21 59.49,80.78C62.49,86.14 69.36,85.07 72.37,82.06C76.45,86.14 82.89,85.28 85.68,80.78C90.83,84 94.27,82.06 95.55,77.99C101.14,82.06 103.71,79.49 103.71,74.55M66.79,71.97C67.64,66.18 77.95,66.61 78.81,71.97M66.79,71.97C66.79,76.7 78.81,76.7 78.81,71.97M66.79,71.97H78.81M54.76,111.49C50.68,118.13 56.05,117.06 57.34,115.77C57.34,120.92 61.85,119.21 62.49,117.06C63.35,120.71 68.5,122.43 67.64,113.29C62.77,113.04 58.49,112.41 54.76,111.49ZM77.52,113.35C76.88,121.57 80.74,121.35 82.89,117.06C85.03,120.71 87.61,119.64 87.61,115.77C91.9,119.21 92.55,115.77 91.26,112.05C87.12,112.88 82.52,113.23 77.52,113.35Z"
android:strokeLineJoin="round"
android:strokeWidth="2.5"
android:fillColor="#00000000"
android:strokeColor="#000000"
android:strokeLineCap="round"/>
<path
android:pathData="M65.07,60.38a2.15,2.36 0,1 0,4.29 0a2.15,2.36 0,1 0,-4.29 0z"
android:fillColor="#000000"/>
<path
android:pathData="M75.8,60.38a2.15,2.36 0,1 0,4.29 0a2.15,2.36 0,1 0,-4.29 0z"
android:fillColor="#000000"/>
<path
android:pathData="M53.62,74.81L54.47,92.63L91.19,90.27L91.83,71.16L53.62,74.81Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M53.62,74.81L54.47,92.63L91.19,90.27L91.83,71.16M53.62,74.81L91.83,71.16M53.62,74.81L68.64,83.18M91.83,71.16L77.88,81.68"
android:strokeLineJoin="round"
android:strokeWidth="2.5"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M72.08,80.82C72.08,75.24 86.25,77.17 74.01,88.77C60.06,82.75 67.36,76.1 72.08,80.82Z"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#C70000"
android:strokeColor="#C70000"/>
</group>
</vector>
78 changes: 78 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_splash.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified core/designsystem/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary file not shown.
Binary file modified core/designsystem/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified core/designsystem/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file modified core/designsystem/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified core/designsystem/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified core/designsystem/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified core/designsystem/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FEC44D</color>
</resources>
12 changes: 11 additions & 1 deletion core/designsystem/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<resources>
<string name="app_name">TelePigeon</string>
<string name="app_name">텔레피죤</string>

<!-- login -->
<string name="login_kakao">카카오 로그인</string>

<!-- all navi title -->
<string name="all_navi_main">메인</string>
Expand Down Expand Up @@ -41,6 +44,13 @@
<string name="button_complete">완료하기</string>
<string name="button_apply">적용</string>
<string name="button_check">확인하기</string>

<!-- notification -->
<string name="notification_alert">생존신고를 보내려면 꼭 필요해요!</string>
<string name="notification_title">\'텔레피죤\'에서 알림을 보내고자 합니다.</string>
<string name="notification_content">알람 기능이 꺼져있으면 기능 사용이 어려워요</string>
<string name="notification_no_apply">허용 안함</string>
<string name="notification_apply">허용</string>

<!-- home -->
<string name="home_title">홈</string>
Expand Down
11 changes: 11 additions & 0 deletions core/designsystem/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,15 @@
<item name="bottomSheetStyle">@style/Theme.TelePigeon.BottomSheet</item>
</style>

<!-- Splash -->
<style name="Theme.TelePigeon.Splash" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/lemon</item>
<item name="windowSplashScreenAnimatedIcon">@android:color/transparent</item>
<item name="postSplashScreenTheme">@style/Theme.TelePigeon</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowIsTranslucent">true</item>
</style>

</resources>
3 changes: 3 additions & 0 deletions feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ dependencies {
// Navigation
implementation(libs.androidx.navigation.fragment)
implementation(libs.androidx.navigation.ui)

// Splash
implementation(libs.androidx.core.splashscreen)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.dongguk.telepigeon.feature.login

import android.os.Bundle
import android.view.View
import androidx.navigation.fragment.findNavController
import com.dongguk.telepigeon.feature.R
import com.dongguk.telepigeon.feature.databinding.FragmentLoginBinding
import com.dongguk.telpigeon.core.ui.base.BindingFragment

class LoginFragment : BindingFragment<FragmentLoginBinding>({ FragmentLoginBinding.inflate(it) }) {
override fun onViewCreated(
view: View,
savedInstanceState: Bundle?,
) {
super.onViewCreated(view, savedInstanceState)

setLayoutLoginKakaoClickListener()
}

private fun setLayoutLoginKakaoClickListener() {
binding.layoutLoginKakao.setOnClickListener {
navigateToNotification()
}
}

private fun navigateToNotification() {
findNavController().navigate(R.id.action_login_to_notification)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.dongguk.telepigeon.feature.notification

import android.Manifest
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import androidx.navigation.fragment.findNavController
import com.dongguk.telepigeon.feature.R
import com.dongguk.telepigeon.feature.databinding.FragmentNotificationBinding
import com.dongguk.telpigeon.core.ui.base.BindingFragment

class NotificationFragment : BindingFragment<FragmentNotificationBinding>({ FragmentNotificationBinding.inflate(it) }) {
private val postNotificationPermissionRequest =
registerForActivityResult(
ActivityResultContracts.RequestPermission(),
) {
navigateToHome()
}

override fun onViewCreated(
view: View,
savedInstanceState: Bundle?,
) {
super.onViewCreated(view, savedInstanceState)

initLayout()
setBtnNotificationNoApplyClickListener()
setBtnNotificationApplyClickListener()
}

private fun initLayout() {
if (ContextCompat.checkSelfPermission(requireContext().applicationContext, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
navigateToHome()
}
}

private fun setBtnNotificationNoApplyClickListener() {
binding.btnNotificationNoApply.setOnClickListener {
navigateToHome()
}
}

private fun setBtnNotificationApplyClickListener() {
binding.btnNotificationApply.setOnClickListener {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
postNotificationPermissionRequest.launch(Manifest.permission.POST_NOTIFICATIONS)
}
}
}

private fun navigateToHome() {
findNavController().navigate(R.id.action_notification_to_home)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.dongguk.telepigeon.feature.splash

import android.content.Intent
import android.os.Bundle
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.lifecycleScope
import com.dongguk.telepigeon.feature.MainActivity
import com.dongguk.telepigeon.feature.databinding.ActivitySplashBinding
import com.dongguk.telpigeon.core.ui.base.BindingActivity
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

class SplashActivity : BindingActivity<ActivitySplashBinding>({ ActivitySplashBinding.inflate(it) }) {
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
loadSplashScreen()
}

private fun loadSplashScreen() {
lifecycleScope.launch {
delay(SPLASH_SCREEN_DELAY_TIME)
navigateToMain()
}
}

private fun navigateToMain() {
Intent(this@SplashActivity, MainActivity::class.java).apply {
startActivity(this)
finish()
}
}

companion object {
const val SPLASH_SCREEN_DELAY_TIME = 1500L
}
}
18 changes: 18 additions & 0 deletions feature/src/main/res/layout/activity_splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/lemon"
xmlns:app="http://schemas.android.com/apk/res-auto">

<ImageView
android:id="@+id/iv_splash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_splash"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit 57da377

Please sign in to comment.