InputProfilFourthOneActivity.kt 3.98 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.view.View.GONE
import android.view.View.VISIBLE
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import kotlinx.android.synthetic.main.activity_input_profil_fourth_one.*

class InputProfilFourthOneActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_input_profil_fourth_one)
    //보유
        //미보유 - 전세 월세 공공주택 무상임대 보장기관 기타

        //소유
        //주택세대주 주택세대구성원 무주택자 무주택세대주 무주택세대구성원

        //그냥 소유 미소유-모두무주택자 2개로 함

// 1. 툴바 사용 설정
        setSupportActionBar(toolbar)

        skipButton.setOnClickListener {
            var intent = Intent(this, InputProfilSecondOneActivity::class.java)
            startActivity(intent)
        }

        questionButton.setOnClickListener {
            val builder = AlertDialog.Builder(this)
            val dialogView = layoutInflater.inflate(R.layout.family_member_dialog, null)
            //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt)
            //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb)
            dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?"
            dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람"

            builder.setView(dialogView)
                .setPositiveButton("확인") { dialogInterface, i ->
                    //mainTv.text = dialogText.text.toString()
                    //mainRb.rating = dialogRatingBar.rating
                    /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */

                }
                /*
             .setNegativeButton("취소") { dialogInterface, i ->
                 /* 취소일 때 아무 액션이 없으므로 빈칸 */
             }
             */

                .show()

        }

        val prof: SharedPreferences=getSharedPreferences("profdata", Context.MODE_PRIVATE)
        val editor: SharedPreferences.Editor=prof.edit()

        previousButton.setOnClickListener {
            var intent = Intent(this, InputProfilThirdFourActivity::class.java)
            startActivity(intent)
        }

        yesButton.setOnClickListener {
            subLinearLayout.visibility=GONE
            noButton.isChecked=false
        }

        noButton.setOnClickListener {
            subLinearLayout.visibility=VISIBLE
            yesButton.isChecked=false
        }

        nextButton.setOnClickListener {

            if(yesButton.isChecked){
                editor.putInt("c14_2",1)
                editor.commit()
            }
            if(noButton.isChecked){
                editor.putInt("c14_3",1)
                editor.commit()
            }
            if(jeonsaeButton.isChecked){
                editor.putInt("c16_2",1)
                editor.commit()
            }
            if(wolseButton.isChecked){
                editor.putInt("c16_3",1)
                editor.commit()
            }
            if(kongkongButton.isChecked){
                editor.putInt("c16_4",1)
                editor.commit()
            }
            if(moosangButton.isChecked){
                editor.putInt("c16_5",1)
                editor.commit()
            }
            if(bojangButton.isChecked){
                editor.putInt("c16_6",1)
                editor.commit()
            }
            if(guitarButton.isChecked){
                editor.putInt("c16_7",1)
                editor.commit()
            }

            var intent = Intent(this, InputProfilFourthTwoActivity::class.java)
            startActivity(intent)
        }
    }




}