신기성

rotate activity complete

1 <component name="ProjectCodeStyleConfiguration"> 1 <component name="ProjectCodeStyleConfiguration">
2 <code_scheme name="Project" version="173"> 2 <code_scheme name="Project" version="173">
3 + <AndroidXmlCodeStyleSettings>
4 + <option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
5 + </AndroidXmlCodeStyleSettings>
3 <JetCodeStyleSettings> 6 <JetCodeStyleSettings>
4 <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> 7 <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
5 </JetCodeStyleSettings> 8 </JetCodeStyleSettings>
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="VcsDirectoryMappings">
4 + <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5 + </component>
6 +</project>
...\ No newline at end of file ...\ No newline at end of file
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
9 android:roundIcon="@mipmap/ic_launcher_round" 9 android:roundIcon="@mipmap/ic_launcher_round"
10 android:supportsRtl="true" 10 android:supportsRtl="true"
11 android:theme="@style/AppTheme"> 11 android:theme="@style/AppTheme">
12 + <activity android:name=".SignInActivity"></activity>
13 + <activity android:name=".SignUpActivity" />
12 <activity android:name=".MainActivity"> 14 <activity android:name=".MainActivity">
13 <intent-filter> 15 <intent-filter>
14 <action android:name="android.intent.action.MAIN" /> 16 <action android:name="android.intent.action.MAIN" />
......
1 package com.example.vip 1 package com.example.vip
2 2
3 +import android.content.Intent
3 import androidx.appcompat.app.AppCompatActivity 4 import androidx.appcompat.app.AppCompatActivity
4 import android.os.Bundle 5 import android.os.Bundle
5 import android.widget.Toast 6 import android.widget.Toast
6 import com.google.firebase.auth.FirebaseAuth 7 import com.google.firebase.auth.FirebaseAuth
7 import kotlinx.android.synthetic.main.activity_main.* 8 import kotlinx.android.synthetic.main.activity_main.*
9 +import org.w3c.dom.Node
8 10
9 11
10 class MainActivity : AppCompatActivity() { 12 class MainActivity : AppCompatActivity() {
...@@ -13,19 +15,6 @@ class MainActivity : AppCompatActivity() { ...@@ -13,19 +15,6 @@ class MainActivity : AppCompatActivity() {
13 private val firebaseAuth = FirebaseAuth.getInstance() 15 private val firebaseAuth = FirebaseAuth.getInstance()
14 16
15 // EmailCreate 17 // EmailCreate
16 - private fun createEmail(){
17 - firebaseAuth!!.createUserWithEmailAndPassword(edit_email.text.toString(), edit_password.text.toString())
18 - .addOnCompleteListener(this) {
19 - if (it.isSuccessful) {
20 - // Sign in success, update UI with the signed-in user's information
21 - val user = firebaseAuth?.currentUser
22 - Toast.makeText(this, "Authentication success.",Toast.LENGTH_SHORT).show()
23 - } else {
24 - // If sign in fails, display a message to the user.
25 - Toast.makeText(this, "Authentication failed.",Toast.LENGTH_SHORT).show()
26 - }
27 - }
28 - }
29 18
30 // Email SignIn 19 // Email SignIn
31 private fun loginEmail(){ 20 private fun loginEmail(){
...@@ -35,9 +24,18 @@ class MainActivity : AppCompatActivity() { ...@@ -35,9 +24,18 @@ class MainActivity : AppCompatActivity() {
35 // Sign in success, update UI with the signed-in user's information 24 // Sign in success, update UI with the signed-in user's information
36 Toast.makeText(this, "signInWithEmail success.",Toast.LENGTH_SHORT).show() 25 Toast.makeText(this, "signInWithEmail success.",Toast.LENGTH_SHORT).show()
37 val user = firebaseAuth?.currentUser 26 val user = firebaseAuth?.currentUser
27 +
28 + if (user!=null){
29 + var intent = Intent(this, SignInActivity::class.java)
30 + startActivity(intent)
31 +
32 + }
33 +
34 +
38 } else { 35 } else {
39 // If sign in fails, display a message to the user. 36 // If sign in fails, display a message to the user.
40 Toast.makeText(this, "signInWithEmail failed.",Toast.LENGTH_SHORT).show() 37 Toast.makeText(this, "signInWithEmail failed.",Toast.LENGTH_SHORT).show()
38 +
41 } 39 }
42 } 40 }
43 } 41 }
...@@ -47,12 +45,19 @@ class MainActivity : AppCompatActivity() { ...@@ -47,12 +45,19 @@ class MainActivity : AppCompatActivity() {
47 super.onCreate(savedInstanceState) 45 super.onCreate(savedInstanceState)
48 46
49 setContentView(R.layout.activity_main) 47 setContentView(R.layout.activity_main)
50 - emailSignupBtn.setOnClickListener{ 48 +
51 - createEmail()
52 - }
53 emailSigninBtn.setOnClickListener{ 49 emailSigninBtn.setOnClickListener{
54 loginEmail() 50 loginEmail()
51 +
55 } 52 }
53 +
54 + emailSignupBtn.setOnClickListener {
55 + var intent = Intent(this, SignUpActivity::class.java)
56 + startActivity(intent)
57 + }
58 +
56 } 59 }
60 +
61 +
57 } 62 }
58 63
......
1 +package com.example.vip
2 +
3 +import androidx.appcompat.app.AppCompatActivity
4 +import android.os.Bundle
5 +
6 +class SignInActivity : AppCompatActivity() {
7 +
8 + override fun onCreate(savedInstanceState: Bundle?) {
9 + super.onCreate(savedInstanceState)
10 + setContentView(R.layout.activity_signin)
11 + }
12 +}
1 +package com.example.vip
2 +
3 +import android.content.Intent
4 +import androidx.appcompat.app.AppCompatActivity
5 +import android.os.Bundle
6 +import android.widget.Toast
7 +import com.google.firebase.auth.FirebaseAuth
8 +import kotlinx.android.synthetic.main.activity_main.*
9 +import kotlinx.android.synthetic.main.activity_signup.*
10 +
11 +class SignUpActivity : AppCompatActivity() {
12 +
13 + private val RC_SIGN_IN = 9001
14 + private val firebaseAuth = FirebaseAuth.getInstance()
15 +
16 + override fun onCreate(savedInstanceState: Bundle?) {
17 + super.onCreate(savedInstanceState)
18 + setContentView(R.layout.activity_signup)
19 +
20 + signupBtn.setOnClickListener{
21 + createEmail()
22 + var intent = Intent(this, MainActivity::class.java)
23 + startActivity(intent)
24 + }
25 + }
26 +
27 + private fun createEmail(){
28 + firebaseAuth!!.createUserWithEmailAndPassword(edit_email_sign_up.text.toString(), edit_password_sign_up.text.toString())
29 + .addOnCompleteListener(this) {
30 + if (it.isSuccessful) {
31 + // Sign in success, update UI with the signed-in user's information
32 + val user = firebaseAuth?.currentUser
33 + Toast.makeText(this, "회원가입 완료!", Toast.LENGTH_SHORT).show()
34 + } else {
35 + // If sign in fails, display a message to the user.
36 + Toast.makeText(this, "회원가입 실패", Toast.LENGTH_SHORT).show()
37 + }
38 + }
39 + }
40 +}
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + xmlns:tools="http://schemas.android.com/tools"
5 + android:layout_width="match_parent"
6 + android:layout_height="match_parent"
7 + tools:context=".SignInActivity">
8 +
9 +
10 + <TextView
11 + android:id="@+id/textView"
12 + android:layout_width="wrap_content"
13 + android:layout_height="wrap_content"
14 + android:text="로그인완료"
15 + app:layout_constraintBottom_toBottomOf="parent"
16 + app:layout_constraintEnd_toEndOf="parent"
17 + app:layout_constraintStart_toStartOf="parent"
18 + app:layout_constraintTop_toTopOf="parent" />
19 +
20 +</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 +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + xmlns:tools="http://schemas.android.com/tools"
5 + android:layout_width="match_parent"
6 + android:layout_height="match_parent"
7 + tools:context=".SignUpActivity">
8 +
9 +
10 + <EditText
11 + android:id="@+id/edit_email_sign_up"
12 + android:layout_width="0dp"
13 + android:layout_height="wrap_content"
14 + android:layout_marginStart="16dp"
15 + android:layout_marginLeft="16dp"
16 + android:layout_marginEnd="16dp"
17 + android:layout_marginRight="16dp"
18 + android:ems="10"
19 + android:hint="Email"
20 + android:inputType="textEmailAddress"
21 + app:layout_constraintBottom_toBottomOf="parent"
22 + app:layout_constraintEnd_toEndOf="parent"
23 + app:layout_constraintStart_toStartOf="parent"
24 + app:layout_constraintTop_toTopOf="parent" />
25 +
26 + <EditText
27 + android:id="@+id/edit_password_sign_up"
28 + android:layout_width="0dp"
29 + android:layout_height="wrap_content"
30 + android:layout_marginStart="16dp"
31 + android:layout_marginLeft="16dp"
32 + android:layout_marginEnd="16dp"
33 + android:layout_marginRight="16dp"
34 + android:ems="10"
35 + android:hint="Password"
36 + android:inputType="textPassword"
37 + app:layout_constraintBottom_toBottomOf="parent"
38 + app:layout_constraintEnd_toEndOf="parent"
39 + app:layout_constraintStart_toStartOf="parent"
40 + app:layout_constraintTop_toBottomOf="@+id/edit_email_sign_up" />
41 +
42 + <Button
43 + android:id="@+id/signupBtn"
44 + android:layout_width="0dp"
45 + android:layout_height="wrap_content"
46 + android:layout_marginStart="16dp"
47 + android:layout_marginLeft="16dp"
48 + android:layout_marginEnd="16dp"
49 + android:layout_marginRight="16dp"
50 + android:background="@color/colorPrimary"
51 + android:text="Sign Up"
52 + android:textColor="@color/common_google_signin_btn_text_dark_default"
53 + app:layout_constraintBottom_toBottomOf="parent"
54 + app:layout_constraintEnd_toEndOf="parent"
55 + app:layout_constraintStart_toStartOf="parent"
56 + app:layout_constraintTop_toBottomOf="@+id/edit_password_sign_up" />
57 +
58 +
59 +</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -8,7 +8,7 @@ buildscript { ...@@ -8,7 +8,7 @@ buildscript {
8 8
9 } 9 }
10 dependencies { 10 dependencies {
11 - classpath 'com.android.tools.build:gradle:3.5.0' 11 + classpath 'com.android.tools.build:gradle:3.5.1'
12 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
13 classpath 'com.google.gms:google-services:4.3.2' 13 classpath 'com.google.gms:google-services:4.3.2'
14 // NOTE: Do not place your application dependencies here; they belong 14 // NOTE: Do not place your application dependencies here; they belong
......