InputProfilFirstOneActivity.kt 5.89 KB
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)}

        }

    }


}