신기성

rotate activity complete

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