package com.example.easfood
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.google.android.gms.tasks.OnCompleteListener
import com.google.android.gms.tasks.Task
import com.google.firebase.auth.AuthResult
import com.google.firebase.auth.FirebaseAuth
import kotlinx.android.synthetic.main.activity_girish.*
class girish : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_girish)
qeydiyyatbutonu.setOnClickListener {
startActivity(Intent(this,qeydiyyat::class.java))
}
Gbuton.setOnClickListener {
FirebaseAuth.getInstance().signInWithEmailAndPassword(Gnomre.text.toString(),Gsifre.text.toString())
.addOnCompleteListener(object:OnCompleteListener<AuthResult>{
override fun onComplete(p0: Task<AuthResult>) {
if (p0.isSuccessful){
Toast.makeText(this@girish,"Xoş gəlmişsiniz",Toast.LENGTH_SHORT).show()
val qarra = Intent(applicationContext,esas::class.java)
startActivity(qarra)
finish()
}else{
Toast.makeText(this@girish,"Giriş uğursuz oldu",Toast.LENGTH_SHORT).show()
}
}
})
}
}
}
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code> package com.example.easfood
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.google.android.gms.tasks.OnCompleteListener
import com.google.android.gms.tasks.Task
import com.google.firebase.auth.AuthResult
import com.google.firebase.auth.FirebaseAuth
import kotlinx.android.synthetic.main.activity_girish.*
class girish : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_girish)
qeydiyyatbutonu.setOnClickListener {
startActivity(Intent(this,qeydiyyat::class.java))
}
Gbuton.setOnClickListener {
FirebaseAuth.getInstance().signInWithEmailAndPassword(Gnomre.text.toString(),Gsifre.text.toString())
.addOnCompleteListener(object:OnCompleteListener<AuthResult>{
override fun onComplete(p0: Task<AuthResult>) {
if (p0.isSuccessful){
Toast.makeText(this@girish,"Xoş gəlmişsiniz",Toast.LENGTH_SHORT).show()
val qarra = Intent(applicationContext,esas::class.java)
startActivity(qarra)
finish()
}else{
Toast.makeText(this@girish,"Giriş uğursuz oldu",Toast.LENGTH_SHORT).show()
}
}
})
}
}
}