신기성

adding signup confirm

...@@ -35,6 +35,7 @@ dependencies { ...@@ -35,6 +35,7 @@ dependencies {
35 testImplementation 'junit:junit:4.12' 35 testImplementation 'junit:junit:4.12'
36 androidTestImplementation 'androidx.test:runner:1.2.0' 36 androidTestImplementation 'androidx.test:runner:1.2.0'
37 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 37 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
38 + implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05'
38 } 39 }
39 40
40 apply plugin: 'com.google.gms.google-services' 41 apply plugin: 'com.google.gms.google-services'
......
1 +package com.example.vip
2 +
3 +import android.view.LayoutInflater
4 +import android.view.ViewGroup
5 +import androidx.recyclerview.widget.RecyclerView
6 +import kotlinx.android.synthetic.main.field.view.*
7 +
8 +class MainAdapter : RecyclerView.Adapter<MainAdapter.MainViewHolder>() {
9 +
10 + var items: MutableList<PolicyField> = mutableListOf(PolicyField("Title1", "Content1"),
11 + PolicyField("Title2", "Content2"),PolicyField("Title3", "Content3"))
12 +
13 + override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = MainViewHolder(parent)
14 +
15 +
16 + override fun getItemCount(): Int = items.size
17 +
18 + override fun onBindViewHolder(holer: MainViewHolder, position: Int) {
19 + items[position].let { item ->
20 + with(holer) {
21 + tvTitle.text = item.title
22 + tvContent.text = item.content
23 + }
24 + }
25 + }
26 +
27 + inner class MainViewHolder(parent: ViewGroup) : RecyclerView.ViewHolder(
28 + LayoutInflater.from(parent.context).inflate(R.layout.field, parent, false)) {
29 + val tvTitle = itemView.tv_main_title
30 + val tvContent = itemView.tv_main_content
31 + }
32 +}
1 +package com.example.vip
2 +
3 +class PolicyField(val title:String, val content:String)
...\ No newline at end of file ...\ No newline at end of file
1 package com.example.vip 1 package com.example.vip
2 2
3 -import androidx.appcompat.app.AppCompatActivity
4 import android.os.Bundle 3 import android.os.Bundle
4 +import androidx.appcompat.app.AppCompatActivity
5 +import androidx.recyclerview.widget.LinearLayoutManager
6 +import kotlinx.android.synthetic.main.activity_signin.*
5 7
6 class SignInActivity : AppCompatActivity() { 8 class SignInActivity : AppCompatActivity() {
7 9
8 override fun onCreate(savedInstanceState: Bundle?) { 10 override fun onCreate(savedInstanceState: Bundle?) {
9 super.onCreate(savedInstanceState) 11 super.onCreate(savedInstanceState)
10 setContentView(R.layout.activity_signin) 12 setContentView(R.layout.activity_signin)
13 +
14 + rv_field.adapter=MainAdapter()
15 + rv_field.layoutManager=LinearLayoutManager(this)
11 } 16 }
17 +
18 +
12 } 19 }
......
1 package com.example.vip 1 package com.example.vip
2 2
3 import android.content.Intent 3 import android.content.Intent
4 -import androidx.appcompat.app.AppCompatActivity
5 import android.os.Bundle 4 import android.os.Bundle
6 import android.widget.Toast 5 import android.widget.Toast
6 +import androidx.appcompat.app.AppCompatActivity
7 import com.google.firebase.auth.FirebaseAuth 7 import com.google.firebase.auth.FirebaseAuth
8 -import kotlinx.android.synthetic.main.activity_main.*
9 import kotlinx.android.synthetic.main.activity_signup.* 8 import kotlinx.android.synthetic.main.activity_signup.*
10 9
11 class SignUpActivity : AppCompatActivity() { 10 class SignUpActivity : AppCompatActivity() {
...@@ -19,8 +18,6 @@ class SignUpActivity : AppCompatActivity() { ...@@ -19,8 +18,6 @@ class SignUpActivity : AppCompatActivity() {
19 18
20 signupBtn.setOnClickListener{ 19 signupBtn.setOnClickListener{
21 createEmail() 20 createEmail()
22 - var intent = Intent(this, MainActivity::class.java)
23 - startActivity(intent)
24 } 21 }
25 } 22 }
26 23
...@@ -31,6 +28,10 @@ class SignUpActivity : AppCompatActivity() { ...@@ -31,6 +28,10 @@ class SignUpActivity : AppCompatActivity() {
31 // Sign in success, update UI with the signed-in user's information 28 // Sign in success, update UI with the signed-in user's information
32 val user = firebaseAuth?.currentUser 29 val user = firebaseAuth?.currentUser
33 Toast.makeText(this, "회원가입 완료!", Toast.LENGTH_SHORT).show() 30 Toast.makeText(this, "회원가입 완료!", Toast.LENGTH_SHORT).show()
31 + if(user!=null){
32 + var intent = Intent(this, MainActivity::class.java)
33 + startActivity(intent)
34 + }
34 } else { 35 } else {
35 // If sign in fails, display a message to the user. 36 // If sign in fails, display a message to the user.
36 Toast.makeText(this, "회원가입 실패", Toast.LENGTH_SHORT).show() 37 Toast.makeText(this, "회원가입 실패", Toast.LENGTH_SHORT).show()
......
...@@ -17,4 +17,13 @@ ...@@ -17,4 +17,13 @@
17 app:layout_constraintStart_toStartOf="parent" 17 app:layout_constraintStart_toStartOf="parent"
18 app:layout_constraintTop_toTopOf="parent" /> 18 app:layout_constraintTop_toTopOf="parent" />
19 19
20 + <androidx.recyclerview.widget.RecyclerView
21 + android:id="@+id/rv_field"
22 + android:layout_width="200dp"
23 + android:layout_height="50dp"
24 + app:layout_constraintBottom_toBottomOf="parent"
25 + app:layout_constraintEnd_toEndOf="parent"
26 + app:layout_constraintStart_toStartOf="parent"
27 + app:layout_constraintTop_toBottomOf="@+id/textView" />
28 +
20 </androidx.constraintlayout.widget.ConstraintLayout> 29 </androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:orientation="vertical"
5 + android:layout_width="match_parent"
6 + android:layout_height="match_parent">
7 +
8 + <RelativeLayout
9 + android:layout_width="match_parent"
10 + android:layout_height="match_parent"
11 + android:layout_margin="20dp"
12 + android:orientation="vertical">
13 + <TextView
14 + android:id="@+id/tv_main_title"
15 + android:layout_width="wrap_content"
16 + android:layout_height="wrap_content"
17 + tools:text="TITLE"
18 + />
19 + <TextView
20 + android:id="@+id/tv_main_content"
21 + android:layout_width="match_parent"
22 + android:layout_height="wrap_content"
23 + android:layout_below="@id/tv_main_title"
24 + android:layout_marginTop="10dp"
25 + android:autoLink="web"
26 + tools:text="Content"/>
27 + </RelativeLayout>
28 +
29 +</LinearLayout>
...\ No newline at end of file ...\ No newline at end of file