신기성

merge hard

......@@ -5,21 +5,79 @@ import android.content.Intent
import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
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_second_one.*
class InputProfilSecondOneActivity : AppCompatActivity() {
private val firebaseAuth = FirebaseAuth.getInstance()
val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.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_second_one)
val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE)
val editor: SharedPreferences.Editor=prof.edit()
// 1. 툴바 사용 설정
setSupportActionBar(toolbar)
//pushing code start
intent.extras?.let {
for (key in it.keySet()) {
val value = intent.extras?.get(key)
//Log.d(TAG, "Key: $key Value: $value")
}
}
//pushing code end
skipButton.setOnClickListener {
var intent = Intent(this, InputProfilSecondOneActivity::class.java)
sendToken()
val user=firebaseAuth?.currentUser
val cat_list=listOf("c1_1")
val policy_string_list=listOf("")
var policy_string=""
prof.getInt("c1_1",1)
if(prof.getInt("c1_1",1)==1){
policy_string=policy_string
}
writeNewUser(user!!.uid,"$tkn",policy_string)
var intent = Intent(this, SignInActivity::class.java)
startActivity(intent)
}
......@@ -53,8 +111,7 @@ class InputProfilSecondOneActivity : AppCompatActivity() {
startActivity(intent)
}
val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE)
val editor: SharedPreferences.Editor=prof.edit()
nextButton.setOnClickListener {
......
......@@ -14,7 +14,10 @@ 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
......@@ -28,10 +31,8 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
emailSigninBtn.setOnClickListener{
emailSigninBtn.setOnClickListener{
loginEmail()
}
textview2.setOnClickListener{
......@@ -48,6 +49,8 @@ class MainActivity : AppCompatActivity() {
}
private fun loginEmail(){
firebaseAuth!!.signInWithEmailAndPassword(edit_email.text.toString(), edit_password.text.toString())
.addOnCompleteListener(this) {
......@@ -62,12 +65,13 @@ class MainActivity : AppCompatActivity() {
}
} else {
// If sign in fails, display a message to the user.
Toast.makeText(this, "signInWithEmail failed.",Toast.LENGTH_SHORT).show()
}
}
}
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -32,32 +32,31 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기" />
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" />
android:orientation="horizontal"
android:layout_weight="1"/>
<ImageView
android:layout_width="77dp"
android:layout_height="44dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="@drawable/toolbar_logo" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" />
android:orientation="horizontal"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:orientation="horizontal" />
android:orientation="horizontal"
android:layout_weight="1.5"/>
</LinearLayout>
......
......@@ -32,32 +32,31 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기" />
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" />
android:orientation="horizontal"
android:layout_weight="1"/>
<ImageView
android:layout_width="77dp"
android:layout_height="44dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="@drawable/toolbar_logo" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" />
android:orientation="horizontal"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:orientation="horizontal" />
android:orientation="horizontal"
android:layout_weight="1.5"/>
</LinearLayout>
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......
......@@ -31,7 +31,10 @@
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:text="건너뛰기"/>
android:background="#FFFFFF"
android:text="나가기"
android:textColor="#29ABE2"
android:textSize="16dp" />
<LinearLayout
android:layout_width="10dp"
android:layout_height="match_parent"
......