MainActivity.kt
4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.example.vip
import android.animation.Animator
import android.animation.AnimatorInflater
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.preference.PreferenceManager
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.Toast
import com.google.android.gms.tasks.OnCompleteListener
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.iid.FirebaseInstanceId
import com.google.firebase.iid.FirebaseInstanceId.getInstance
import kotlinx.android.synthetic.main.activity_main.*
import org.w3c.dom.Node
import java.lang.Boolean.getBoolean
class MainActivity : AppCompatActivity() {
private val firebaseAuth = FirebaseAuth.getInstance()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
/////
val prof: SharedPreferences = getSharedPreferences("policy_key", Context.MODE_PRIVATE)
val editor: SharedPreferences.Editor=prof.edit()
editor.putString("0", "[신한금융그룹] 신한 희망사회프로젝트 위기가정 재기지원사업 2년차 사업(2019년 5월~2020년 4월)")
editor.putString("1", "2020년 동계 아름드리 대학생 해외봉사단원 모집")
editor.putString("2", "초록우산 어린이재단 인재양성사업 - 2020 아이리더 모집공고")
editor.putString("3", "(열매나눔복지재단, 처갓집양념치킨)2019 저소득가구 창업지원사업 처갓집양념치킨 창업자 모집공고(5.31-)")
editor.putString("4", "[2017년도] 예비부부교실 / 신혼부부교실 : 연간일정")
editor.putString("5", "신생아지원")
editor.putString("6", "성폭력피해아동청소년 전용쉼터운영지원")
editor.putString("7", "국가유공자등취업지원")
editor.putString("8", "결혼이민자 통번역 서비스")
editor.putString("9", "한부모가족자녀 교육비 지원")
editor.commit()
/////
emailSigninBtn.setOnClickListener{
loginEmail()
}
textview2.setOnClickListener{
}
textview3.setOnClickListener{
}
emailSignupBtn.setOnClickListener {
var intent = Intent(this, SignUpActivity::class.java)
startActivity(intent)
}
}
private fun loginEmail(){
firebaseAuth!!.signInWithEmailAndPassword(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
//Toast.makeText(this, "signInWithEmail success.",Toast.LENGTH_SHORT).show()
val user = firebaseAuth?.currentUser
val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE)
val editor: SharedPreferences.Editor=prof.edit()
if (user!=null){
editor.putInt("c1_1",1); editor.commit()
editor.putInt("c2_1",1); editor.commit()
editor.putInt("c3_1",1); editor.commit()
editor.putInt("c4_1",1); editor.commit()
editor.putInt("c5_1",1); editor.commit()
editor.putInt("c6_1",1); editor.commit()
editor.putInt("c7_1",1); editor.commit()
editor.putInt("c8_1",1); editor.commit()
editor.putInt("c9_1",1); editor.commit()
editor.putInt("c10_1",1); editor.commit()
editor.putInt("c11_1",1); editor.commit()
editor.putInt("c12_1",1); editor.commit()
editor.putInt("c13_1",1); editor.commit()
editor.putInt("c14_1",1); editor.commit()
editor.putInt("c15_1",1); editor.commit()
editor.putInt("c16_1",1); editor.commit()
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()
}
}
}
}