Skip to content

Commit

Permalink
[FEAT/#2]초기설정 화면구현
Browse files Browse the repository at this point in the history
  • Loading branch information
yjs616 committed Jan 11, 2023
1 parent 184d354 commit ba15fe9
Show file tree
Hide file tree
Showing 24 changed files with 640 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
viewBinding{
enabled true
}
}

dependencies {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@
android:supportsRtl="true"
android:theme="@style/Theme.FreePreAndroid"
tools:targetApi="31">
<activity
android:name=".RecentPeriodActivity"
android:exported="false" />
<activity
android:name=".FirstPeriodActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".NicknameActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.free_pre_android

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.free_pre_android.databinding.ActivityFirstPeriodBinding

class FirstPeriodActivity : AppCompatActivity() {
private lateinit var viewBinding: ActivityFirstPeriodBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

viewBinding = ActivityFirstPeriodBinding.inflate(layoutInflater)
setContentView(viewBinding.root)

viewBinding.btnYes.setOnClickListener {
val intent = Intent(this,RecentPeriodActivity::class.java)
startActivity(intent)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package com.example.free_pre_android

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.free_pre_android.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
private lateinit var viewBinding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/java/com/example/free_pre_android/NicknameActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.example.free_pre_android

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.free_pre_android.databinding.ActivityNicknameBinding

class NicknameActivity : AppCompatActivity() {
private lateinit var viewBinding: ActivityNicknameBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewBinding = ActivityNicknameBinding.inflate(layoutInflater)
setContentView(viewBinding.root)

viewBinding.btnNext.setOnClickListener {
val intent = Intent(this, FirstPeriodActivity::class.java)
startActivity(intent)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.example.free_pre_android

import android.content.Intent
import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.free_pre_android.databinding.ActivityRecentPeriodBinding

class RecentPeriodActivity : AppCompatActivity() {
private lateinit var viewBinding: ActivityRecentPeriodBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewBinding = ActivityRecentPeriodBinding.inflate(layoutInflater)
setContentView(viewBinding.root)

//초기화면
supportFragmentManager
.beginTransaction()
.replace(viewBinding.frameFragment.id,RecentPeriodStartFragment())
.commitAllowingStateLoss()
//startBtn 색 채우기(초기)
viewBinding.startBtn.setBackgroundResource(R.drawable.primary_light_filled_round_bg)
//viewBinding.startBtn.setTextColor(application.resources.getColor(R.color.primary_dark))
viewBinding.startBtn.setTextColor(Color.parseColor("#1A2A46")) //dark

//start 버튼 누를 시
viewBinding.startBtn.setOnClickListener{
supportFragmentManager
.beginTransaction()
.replace(viewBinding.frameFragment.id,RecentPeriodStartFragment())
.commitAllowingStateLoss()

//startBtn 색 채우기-start 버튼
viewBinding.startBtn.setBackgroundResource(R.drawable.primary_light_filled_round_bg)
viewBinding.startBtn.setTextColor(Color.parseColor("#1A2A46")) //dark

//endBtn 색 없애기 - end 버튼
viewBinding.endBtn.setBackgroundResource(R.drawable.primary_light_dark_round_bg)
viewBinding.endBtn.setTextColor(Color.parseColor("#FDE3F4"))
}
//end 버튼 누를 시
viewBinding.endBtn.setOnClickListener {
supportFragmentManager
.beginTransaction()
.replace(viewBinding.frameFragment.id,RecentPeriodEndFragment())
.commitAllowingStateLoss()

//endBtn 색 채우기-end 버튼
viewBinding.endBtn.setBackgroundResource(R.drawable.primary_light_filled_round_bg)
viewBinding.endBtn.setTextColor(Color.parseColor("#1A2A46")) //dark

//startBtn 색 없애기 -start 버튼
viewBinding.startBtn.setBackgroundResource(R.drawable.primary_light_dark_round_bg)
viewBinding.startBtn.setTextColor(Color.parseColor("#FDE3F4"))

}

viewBinding.btnSave.setOnClickListener {
val intent = Intent(this,MainActivity::class.java)
startActivity(intent)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.free_pre_android

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup


class RecentPeriodEndFragment : Fragment() {


override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_recent_peroid_end, container, false)
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.free_pre_android

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup


class RecentPeriodStartFragment : Fragment() {

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_recent_peroid_start, container, false)
}


}
15 changes: 15 additions & 0 deletions app/src/main/res/drawable/primary_dark_bottom_line.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item android:top="-10dp"
android:right="-10dp"
android:left="-10dp">
<shape android:shape="rectangle">
<solid android:color="@null"/>

<stroke android:width="10dp"
android:color="@color/primary_dark"/>
</shape>

</item>
</layer-list>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/primary_dark_light_round_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/primary_light"/>
<stroke android:width="8dp"
android:color="@color/primary_dark"/>
<corners
android:radius="40dp"></corners>

</shape>
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/primary_dark_right_line.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="-10dp"
android:bottom="-10dp"
android:left="-10dp">
<shape android:shape="rectangle">
<solid android:color="@color/primary_light"/>

<stroke android:width="10dp"
android:color="@color/primary_dark"/>
</shape>

</item>
</layer-list>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/primary_dark_round_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/primary_dark"/>
<stroke android:color="@color/primary_dark"/>

<corners
android:radius="20dp"/>

</shape>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/primary_light_dark_round_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/primary_dark"/>
<stroke android:width="8dp"
android:color="@color/primary_light"/>
<corners
android:radius="40dp"></corners>

</shape>
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/primary_light_filled_round_bg.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">
<solid android:color="@color/primary_light"/>
<corners
android:radius="40dp"></corners>
</shape>
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/primary_light_line.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="-10dp"
android:right="-10dp"
android:left="-10dp">
<shape android:shape="rectangle">
<solid android:color="@null"/>

<stroke android:width="8dp"
android:color="@color/primary_light"/>
</shape>

</item>
</layer-list>
59 changes: 59 additions & 0 deletions app/src/main/res/layout/activity_first_period.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FirstPeriodActivity"
android:background="@color/primary_light">

<TextView
android:id="@+id/txt_start_first_period"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="143dp"
android:text="Did you start\nyour first period?"
android:textColor="@color/primary_dark"
android:textSize="36dp"
android:textStyle="bold"
android:gravity="center">
</TextView>

<Button
android:id="@+id/btn_yes"
android:layout_width="148dp"
android:layout_height="148dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_start_first_period"
app:layout_constraintEnd_toStartOf="@id/btn_no"
android:layout_marginStart="24dp"
android:layout_marginTop="65dp"
android:background="@drawable/primary_dark_round_bg"
android:text="yes"
android:textAllCaps="false"
android:textColor="@color/primary_light"
android:textSize="48dp">
</Button>

<Button
android:id="@+id/btn_no"
android:layout_width="148dp"
android:layout_height="148dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_start_first_period"
app:layout_constraintStart_toEndOf="@id/btn_yes"
android:layout_marginEnd="24dp"
android:layout_marginTop="65dp"
android:background="@drawable/primary_dark_round_bg"
android:text="no"
android:textAllCaps="false"
android:textColor="@color/primary_light"
android:textSize="48dp">
</Button>



</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit ba15fe9

Please sign in to comment.