InputProfilFirstOneActivity.kt
5.89 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
package com.example.vip
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.google.android.gms.tasks.OnCompleteListener
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.iid.FirebaseInstanceId
import kotlinx.android.synthetic.main.activity_input_profil_first_one.*
class InputProfilFirstOneActivity : AppCompatActivity() {
private val firebaseAuth = FirebaseAuth.getInstance()
val user_db = FirebaseDatabase.getInstance("https://wello-topic.firebaseio.com/").reference
private fun sendToken(){
FirebaseInstanceId.getInstance().instanceId
.addOnCompleteListener(OnCompleteListener { task ->
if (!task.isSuccessful) {
//Log.w(TAG, "getInstanceId failed", task.exception)
return@OnCompleteListener
}
// Get new Instance ID token
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
private fun writeNewUser(u_id: String, u_token: String, Policy: String?) {
val user = User(u_token, Policy!!)
user_db.child(u_id).setValue(user)/// .setValue(user)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_input_profil_first_one)
val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE)
val editor: SharedPreferences.Editor=prof.edit()
inputStartButton.setOnClickListener {
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()
if(prof.getString("first_two","none")!="done"){var intent = Intent(this, InputProfilFirstTwoActivity::class.java);startActivity(intent)}
else if(prof.getString("first_three","none")!="done"){var intent = Intent(this, InputProfilFirstThreeActivity::class.java);startActivity(intent)}
else if(prof.getString("first_four","none")!="done"){var intent = Intent(this, InputProfilFirstFourActivity::class.java);startActivity(intent)}
else if(prof.getString("first_five","none")!="done"){var intent = Intent(this, InputProfilFirstFiveActivity::class.java);startActivity(intent)}
else if(prof.getString("first_six","none")!="done"){var intent = Intent(this, InputProfilFirstSixActivity::class.java);startActivity(intent)}
else if(prof.getString("second_one","none")!="done"){var intent = Intent(this, InputProfilSecondOneActivity::class.java);startActivity(intent)}
else if(prof.getString("second_two","none")!="done"){var intent = Intent(this, InputProfilSecondTwoActivity::class.java);startActivity(intent)}
else if(prof.getString("second_three","none")!="done"){var intent = Intent(this, InputProfilSecondThreeActivity::class.java);startActivity(intent)}
else if(prof.getString("third_one","none")!="done"){var intent = Intent(this, InputProfilThirdOneActivity::class.java);startActivity(intent)}
else if(prof.getString("third_two","none")!="done"){var intent = Intent(this, InputProfilThirdTwoActivity::class.java);startActivity(intent)}
else if(prof.getString("third_three","none")!="done"){var intent = Intent(this, InputProfilThirdThreeActivity::class.java);startActivity(intent)}
else if(prof.getString("third_four","none")!="done"){var intent = Intent(this, InputProfilThirdFourActivity::class.java);startActivity(intent)}
else if(prof.getString("fourth_one","none")!="done"){var intent = Intent(this, InputProfilFourthOneActivity::class.java);startActivity(intent)}
else if(prof.getString("fourth_two","none")!="done"){var intent = Intent(this, InputProfilFourthTwoActivity::class.java);startActivity(intent)}
else if(prof.getString("fourth_three","none")!="done"){var intent = Intent(this, InputProfilFourthThreeActivity::class.java);startActivity(intent)}
else if(prof.getString("fourth_four","none")!="done"){var intent = Intent(this, InputProfilFourthFourActivity::class.java);startActivity(intent)}
else if(prof.getString("fourth_five","none")!="done"){var intent = Intent(this, InputProfilFourthFiveActivity::class.java);startActivity(intent)}
else if(prof.getString("fifth_one","none")!="done"){var intent = Intent(this, InputProfilFifthOneActivity::class.java);startActivity(intent)}
else if(prof.getString("fifth_two","none")!="done"){var intent = Intent(this, InputProfilFifthTwoActivity::class.java);startActivity(intent)}
else if(prof.getString("fifth_three","none")!="done"){var intent = Intent(this, InputProfilFifthThreeActivity::class.java);startActivity(intent)}
else {var intent = Intent(this, InputProfilFifthFourActivity::class.java);startActivity(intent)}
}
}
}