Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장연우
/
WELLO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
신기성
2019-11-17 15:07:06 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6d0d209d4627d0c76a05f233cb7a1527f7c1e582
6d0d209d
1 parent
017ebe57
subscribe activated
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
5497 additions
and
243 deletions
vip/app/src/main/java/com/example/vip/InputProfilFifthFourActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFifthOneActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFifthThreeActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFifthTwoActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFirstFiveActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFirstFourActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFirstOneActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFirstSixActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFirstThreeActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFirstTwoActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFourthFiveActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFourthFourActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFourthOneActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFourthThreeActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilFourthTwoActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilSecondOneActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilSecondThreeActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilSecondTwoActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilThirdFourActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilThirdOneActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilThirdThreeActivity.kt
vip/app/src/main/java/com/example/vip/InputProfilThirdTwoActivity.kt
vip/app/src/main/java/com/example/vip/SignInActivity.kt
vip/app/src/main/res/layout/activity_input_profil_first_five.xml
vip/app/src/main/res/layout/activity_input_profil_first_four.xml
vip/app/src/main/res/layout/activity_input_profil_first_six.xml
vip/app/src/main/res/layout/activity_input_profil_first_three.xml
vip/app/src/main/res/layout/activity_input_profil_first_two.xml
vip/app/src/main/java/com/example/vip/InputProfilFifthFourActivity.kt
View file @
6d0d209
...
...
@@ -5,22 +5,261 @@ 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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fifth_four.*
class
InputProfilFifthFourActivity
:
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_fifth_four
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFifthThreeActivity
::
class
.
java
)
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
editor
.
putInt
(
"c1_1"
,
1
);
editor
.
commit
()
...
...
vip/app/src/main/java/com/example/vip/InputProfilFifthOneActivity.kt
View file @
6d0d209
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.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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fifth_one.*
class
InputProfilFifthOneActivity
:
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_fifth_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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFourthFiveActivity
::
class
.
java
)
...
...
vip/app/src/main/java/com/example/vip/InputProfilFifthThreeActivity.kt
View file @
6d0d209
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.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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fifth_three.*
class
InputProfilFifthThreeActivity
:
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_fifth_three
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFifthTwoActivity
::
class
.
java
)
...
...
vip/app/src/main/java/com/example/vip/InputProfilFifthTwoActivity.kt
View file @
6d0d209
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.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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fifth_two.*
class
InputProfilFifthTwoActivity
:
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_fifth_two
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFifthOneActivity
::
class
.
java
)
...
...
vip/app/src/main/java/com/example/vip/InputProfilFirstFiveActivity.kt
View file @
6d0d209
...
...
@@ -6,14 +6,257 @@ import android.content.SharedPreferences
import
android.graphics.Color
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_first_five.*
class
InputProfilFirstFiveActivity
:
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_first_five
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
inmanButton
.
setOnClickListener
{
if
(
outmanButton
.
isChecked
){
outmanButton
.
isChecked
=
false
...
...
@@ -30,9 +273,6 @@ class InputProfilFirstFiveActivity : AppCompatActivity() {
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
inmanButton
.
isChecked
){
editor
.
putInt
(
"c1_2"
,
1
);
editor
.
commit
()
...
...
vip/app/src/main/java/com/example/vip/InputProfilFirstFourActivity.kt
View file @
6d0d209
...
...
@@ -6,21 +6,237 @@ import android.content.SharedPreferences
import
android.icu.lang.UCharacter.GraphemeClusterBreak.T
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.widget.AdapterView
import
android.widget.ArrayAdapter
import
android.widget.EditText
import
android.widget.*
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_first_four.*
import
kotlinx.android.synthetic.main.activity_input_profil_first_four.nextButton
import
kotlinx.android.synthetic.main.activity_input_profil_first_four.previousButton
import
kotlinx.android.synthetic.main.activity_input_profil_first_three.*
class
InputProfilFirstFourActivity
:
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_first_four
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFirstThreeActivity
::
class
.
java
)
startActivity
(
intent
)
...
...
@@ -109,8 +325,6 @@ class InputProfilFirstFourActivity : AppCompatActivity() {
}
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
doSpinner
.
selectedItem
.
toString
()==
"서울특별시"
){
editor
.
putInt
(
"c11_2"
,
1
);
editor
.
commit
()}
if
(
doSpinner
.
selectedItem
.
toString
()==
"부산광역시"
){
editor
.
putInt
(
"c11_3"
,
1
);
editor
.
commit
()}
...
...
vip/app/src/main/java/com/example/vip/InputProfilFirstOneActivity.kt
View file @
6d0d209
...
...
@@ -3,16 +3,53 @@ package com.example.vip
import
android.content.Intent
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://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_first_one
)
inputStartButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFirstTwoActivity
::
class
.
java
)
startActivity
(
intent
)
...
...
vip/app/src/main/java/com/example/vip/InputProfilFirstSixActivity.kt
View file @
6d0d209
...
...
@@ -5,22 +5,262 @@ 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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_first_six.*
class
InputProfilFirstSixActivity
:
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_first_six
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFirstFiveActivity
::
class
.
java
)
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
gagoojooButton
.
isChecked
){
editor
.
putInt
(
"c13_2"
,
1
);
editor
.
commit
()
...
...
vip/app/src/main/java/com/example/vip/InputProfilFirstThreeActivity.kt
View file @
6d0d209
...
...
@@ -8,21 +8,255 @@ import android.os.Bundle
import
android.util.Log
import
android.util.MonthDisplayHelper
import
android.view.View
import
android.widget.EditText
import
android.widget.RadioButton
import
android.widget.RadioGroup
import
android.widget.Toast
import
kotlinx.android.synthetic.main.activity_input_profil_first_one.*
import
android.widget.*
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_first_three.*
import
kotlinx.android.synthetic.main.activity_input_profil_first_three.nextButton
import
kotlinx.android.synthetic.main.activity_input_profil_first_two.*
class
InputProfilFirstThreeActivity
:
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_first_three
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
/* not use this code start
radio_group.setOnCheckedChangeListener(
RadioGroup.OnCheckedChangeListener { group, checkedId ->
...
...
@@ -37,9 +271,6 @@ class InputProfilFirstThreeActivity : AppCompatActivity() {
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFirstFourActivity
::
class
.
java
)
startActivity
(
intent
)
...
...
vip/app/src/main/java/com/example/vip/InputProfilFirstTwoActivity.kt
View file @
6d0d209
...
...
@@ -7,14 +7,45 @@ import androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.widget.EditText
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_first_two.*
import
kotlinx.android.synthetic.main.activity_input_profil_first_two.nextButton
import
kotlinx.android.synthetic.main.activity_input_profil_second_two.*
class
InputProfilFirstTwoActivity
:
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_first_two
)
...
...
@@ -22,12 +53,211 @@ class InputProfilFirstTwoActivity : AppCompatActivity() {
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
//editor.putString("birthdate","none")
// 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
nextButton
.
setOnClickListener
{
skipButton
.
setOnClickListener
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
//editor.putString("birthdate","none")
nextButton
.
setOnClickListener
{
var
birthdateinput
=
findViewById
<
EditText
>(
R
.
id
.
editText
).
text
.
toString
()
var
birthdateint
=
0
if
(
birthdateinput
==
""
)
{
...
...
vip/app/src/main/java/com/example/vip/InputProfilFourthFiveActivity.kt
View file @
6d0d209
...
...
@@ -5,22 +5,259 @@ 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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fourth_five.*
class
InputProfilFourthFiveActivity
:
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_fourth_five
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFourthFourActivity
::
class
.
java
)
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
nothingButton
.
isChecked
){
editor
.
putInt
(
"c8_1"
,
1
);
editor
.
commit
()}
if
(
iljaeButton
.
isChecked
){
editor
.
putInt
(
"c8_12"
,
1
);
editor
.
commit
()}
...
...
@@ -29,6 +266,7 @@ class InputProfilFourthFiveActivity : AppCompatActivity() {
if
(
guitarButton
.
isChecked
){
editor
.
putInt
(
"c8_17"
,
1
);
editor
.
commit
()}
//기타가 똑같은거 지정
/*
editor.putInt("c1_1",1); editor.commit()
editor.putInt("c2_1",1); editor.commit()
editor.putInt("c3_1",1); editor.commit()
...
...
@@ -45,6 +283,7 @@ class InputProfilFourthFiveActivity : AppCompatActivity() {
editor.putInt("c14_1",1); editor.commit()
editor.putInt("c15_1",1); editor.commit()
editor.putInt("c16_1",1); editor.commit()
*/
...
...
vip/app/src/main/java/com/example/vip/InputProfilFourthFourActivity.kt
View file @
6d0d209
...
...
@@ -5,22 +5,261 @@ 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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fourth_four.*
class
InputProfilFourthFourActivity
:
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_fourth_four
)
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFourthThreeActivity
::
class
.
java
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFourthThreeActivity
::
class
.
java
)
startActivity
(
intent
)
}
nextButton
.
setOnClickListener
{
if
(
nothingButton
.
isChecked
){
editor
.
putInt
(
"c8_1"
,
1
);
editor
.
commit
()}
...
...
vip/app/src/main/java/com/example/vip/InputProfilFourthOneActivity.kt
View file @
6d0d209
...
...
@@ -5,17 +5,258 @@ import android.content.Intent
import
android.content.SharedPreferences
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.view.View.GONE
import
android.view.View.VISIBLE
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fourth_one.*
class
InputProfilFourthOneActivity
:
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_fourth_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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
//보유
//미보유 - 전세 월세 공공주택 무상임대 보장기관 기타
...
...
@@ -57,8 +298,6 @@ class InputProfilFourthOneActivity : AppCompatActivity() {
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilThirdFourActivity
::
class
.
java
)
...
...
vip/app/src/main/java/com/example/vip/InputProfilFourthThreeActivity.kt
View file @
6d0d209
...
...
@@ -5,22 +5,262 @@ 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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fourth_three.*
class
InputProfilFourthThreeActivity
:
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_fourth_three
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFourthTwoActivity
::
class
.
java
)
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
nothingButton
.
isChecked
){
editor
.
putInt
(
"c8_1"
,
1
);
editor
.
commit
()}
...
...
vip/app/src/main/java/com/example/vip/InputProfilFourthTwoActivity.kt
View file @
6d0d209
...
...
@@ -5,23 +5,264 @@ import android.content.Intent
import
android.content.SharedPreferences
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.view.View.GONE
import
android.view.View.VISIBLE
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_fourth_two.*
class
InputProfilFourthTwoActivity
:
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_fourth_two
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilFourthOneActivity
::
class
.
java
)
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
yesButton
.
isChecked
){
editor
.
putInt
(
"c15_2"
,
1
);
editor
.
commit
()}
...
...
vip/app/src/main/java/com/example/vip/InputProfilSecondOneActivity.kt
View file @
6d0d209
...
...
@@ -181,6 +181,9 @@ class InputProfilSecondOneActivity : AppCompatActivity() {
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
...
...
vip/app/src/main/java/com/example/vip/InputProfilSecondThreeActivity.kt
View file @
6d0d209
...
...
@@ -5,7 +5,16 @@ import android.content.Intent
import
android.content.SharedPreferences
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.widget.EditText
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_second_three.*
import
kotlinx.android.synthetic.main.activity_input_profil_second_three.nextButton
import
kotlinx.android.synthetic.main.activity_input_profil_second_three.previousButton
...
...
@@ -14,13 +23,219 @@ import kotlinx.android.synthetic.main.activity_input_profil_second_three.toolbar
class
InputProfilSecondThreeActivity
:
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_three
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
setSupportActionBar
(
toolbar
)
...
...
vip/app/src/main/java/com/example/vip/InputProfilSecondTwoActivity.kt
View file @
6d0d209
...
...
@@ -5,16 +5,50 @@ import android.content.Intent
import
android.content.SharedPreferences
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.view.View.GONE
import
android.view.View.VISIBLE
import
android.widget.EditText
import
android.widget.TextView
import
android.widget.Toast
import
androidx.appcompat.app.AlertDialog
import
androidx.core.content.ContextCompat
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_second_two.*
import
kotlinx.android.synthetic.main.item_child.view.*
class
InputProfilSecondTwoActivity
:
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_two
)
...
...
@@ -22,6 +56,185 @@ class InputProfilSecondTwoActivity : AppCompatActivity() {
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
setSupportActionBar
(
toolbar
)
skipButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilSecondOneActivity
::
class
.
java
)
...
...
vip/app/src/main/java/com/example/vip/InputProfilThirdFourActivity.kt
View file @
6d0d209
...
...
@@ -5,25 +5,264 @@ import android.content.Intent
import
android.content.SharedPreferences
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.view.View.GONE
import
android.view.View.VISIBLE
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_third_four.*
class
InputProfilThirdFourActivity
:
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_third_four
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
previousButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilThirdThreeActivity
::
class
.
java
)
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
yesButton
.
isChecked
){
...
...
vip/app/src/main/java/com/example/vip/InputProfilThirdOneActivity.kt
View file @
6d0d209
...
...
@@ -5,24 +5,259 @@ import android.content.Intent
import
android.content.SharedPreferences
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.widget.Button
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_third_one.*
class
InputProfilThirdOneActivity
:
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_third_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
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
elementaryButton
.
setOnClickListener
{
middleButton
.
isChecked
=
false
highButton
.
isChecked
=
false
...
...
@@ -85,9 +320,6 @@ class InputProfilThirdOneActivity : AppCompatActivity() {
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
elementaryButton
.
isChecked
){
editor
.
putInt
(
"c6_2"
,
1
);
editor
.
commit
()
...
...
vip/app/src/main/java/com/example/vip/InputProfilThirdThreeActivity.kt
View file @
6d0d209
...
...
@@ -5,17 +5,256 @@ 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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_third_three.*
class
InputProfilThirdThreeActivity
:
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_third_three
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
skipButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilSecondOneActivity
::
class
.
java
)
startActivity
(
intent
)
...
...
@@ -26,9 +265,6 @@ class InputProfilThirdThreeActivity : AppCompatActivity() {
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
nothingButton
.
isChecked
){
editor
.
putInt
(
"c4_11"
,
1
);
editor
.
commit
()}
if
(
mipilButton
.
isChecked
){
editor
.
putInt
(
"c4_2"
,
1
);
editor
.
commit
()}
...
...
vip/app/src/main/java/com/example/vip/InputProfilThirdTwoActivity.kt
View file @
6d0d209
...
...
@@ -5,19 +5,259 @@ import android.content.Intent
import
android.content.SharedPreferences
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
android.util.Log
import
android.view.View.GONE
import
android.view.View.VISIBLE
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
com.google.firebase.messaging.FirebaseMessaging
import
kotlinx.android.synthetic.main.activity_input_profil_third_two.*
class
InputProfilThirdTwoActivity
:
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_third_two
)
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
{
sendToken
()
val
user
=
firebaseAuth
?.
currentUser
!!
.
uid
Log
.
d
(
"test:"
,
user
.
toString
())
val
cat_1
=
listOf
(
"c1_1"
,
"c1_2"
,
"c1_3"
)
val
cat_2
=
listOf
(
"c2_1"
,
"c2_2"
,
"c2_3"
,
"c2_4"
,
"c2_5"
,
"c2_6"
,
"c2_7"
)
val
cat_3
=
listOf
(
"c3_1"
,
"c3_2"
,
"c3_3"
)
val
cat_4
=
listOf
(
"c4_1"
,
"c4_2"
,
"c4_3"
,
"c4_4"
,
"c4_5"
,
"c4_6"
,
"c4_7"
,
"c4_8"
,
"c4_9"
,
"c4_10"
,
"c4_11"
)
val
cat_5
=
listOf
(
"c5_1"
,
"c5_2"
,
"c5_3"
,
"c5_4"
,
"c5_5"
,
"c5_6"
,
"c5_7"
,
"c5_8"
,
"c5_9"
)
val
cat_6
=
listOf
(
"c6_1"
,
"c6_2"
,
"c6_3"
,
"c6_4"
,
"c6_5"
,
"c6_6"
,
"c6_7"
)
val
cat_7
=
listOf
(
"c7_1"
,
"c7_2"
,
"c7_3"
)
val
cat_8
=
listOf
(
"c8_1"
,
"c8_2"
,
"c8_3"
,
"c8_4"
,
"c8_5"
,
"c8_6"
,
"c8_7"
,
"c8_8"
,
"c8_9"
,
"c8_10"
,
"c8_11"
,
"c8_12"
,
"c8_13"
,
"c8_14"
,
"c8_15"
,
"c8_16"
,
"c8_17"
)
val
cat_9
=
listOf
(
"c9_1"
,
"c9_2"
,
"c9_3"
,
"c9_4"
,
"c9_5"
,
"c9_6"
,
"c9_7"
,
"c9_8"
,
"c9_9"
,
"c9_10"
,
"c9_11"
,
"c9_12"
,
"c9_13"
,
"c9_14"
,
"c9_15"
,
"c9_16"
,
"c9_17"
,
"c9_18"
,
"c9_19"
)
val
cat_10
=
listOf
(
"c10_1"
,
"c10_2"
,
"c10_3"
,
"c10_4"
,
"c10_5"
,
"c10_6"
,
"c10_7"
,
"c10_8"
,
"c10_9"
,
"c10_10"
,
"c10_11"
,
"c10_12"
,
"c10_13"
,
"c10_14"
,
"c10_15"
,
"c10_16"
,
"c10_17"
,
"c10_18"
)
val
cat_11
=
listOf
(
"c11_1"
,
"c11_2"
,
"c11_3"
,
"c11_4"
,
"c11_5"
,
"c11_6"
,
"c11_7"
,
"c11_8"
,
"c11_9"
,
"c11_10"
,
"c11_11"
,
"c11_12"
,
"c11_13"
,
"c11_14"
,
"c11_15"
,
"c11_16"
,
"c11_17"
,
"c11_18"
)
val
cat_12
=
listOf
(
"c12_1"
,
"c12_100"
,
"c12_101"
,
"c12_102"
,
"c12_103"
,
"c12_104"
,
"c12_105"
,
"c12_106"
,
"c12_107"
,
"c12_108"
,
"c12_109"
,
"c12_110"
,
"c12_111"
,
"c12_112"
,
"c12_113"
,
"c12_114"
,
"c12_115"
,
"c12_116"
,
"c12_117"
,
"c12_118"
,
"c12_119"
,
"c12_120"
,
"c12_121"
,
"c12_122"
,
"c12_123"
,
"c12_124"
,
"c12_125"
,
"c12_126"
,
"c12_127"
,
"c12_128"
,
"c12_129"
,
"c12_130"
,
"c12_131"
,
"c12_132"
,
"c12_133"
,
"c12_134"
,
"c12_135"
,
"c12_136"
,
"c12_137"
,
"c12_138"
,
"c12_139"
,
"c12_140"
,
"c12_141"
,
"c12_142"
,
"c12_143"
,
"c12_144"
,
"c12_145"
,
"c12_146"
,
"c12_147"
,
"c12_148"
,
"c12_149"
,
"c12_150"
,
"c12_151"
,
"c12_152"
,
"c12_153"
,
"c12_154"
,
"c12_155"
,
"c12_156"
,
"c12_157"
,
"c12_158"
,
"c12_159"
,
"c12_160"
,
"c12_161"
,
"c12_162"
,
"c12_163"
,
"c12_164"
,
"c12_165"
,
"c12_166"
,
"c12_167"
,
"c12_168"
,
"c12_169"
,
"c12_170"
,
"c12_171"
,
"c12_172"
,
"c12_173"
,
"c12_174"
,
"c12_175"
,
"c12_176"
,
"c12_177"
,
"c12_178"
,
"c12_179"
,
"c12_180"
,
"c12_181"
,
"c12_182"
,
"c12_183"
,
"c12_184"
,
"c12_185"
,
"c12_186"
,
"c12_187"
,
"c12_188"
,
"c12_189"
,
"c12_190"
,
"c12_191"
,
"c12_192"
,
"c12_193"
,
"c12_194"
,
"c12_195"
,
"c12_196"
,
"c12_197"
,
"c12_198"
,
"c12_199"
,
"c12_200"
,
"c12_201"
,
"c12_202"
,
"c12_203"
,
"c12_204"
,
"c12_205"
,
"c12_206"
,
"c12_207"
,
"c12_208"
,
"c12_209"
,
"c12_210"
,
"c12_211"
,
"c12_212"
,
"c12_213"
,
"c12_214"
,
"c12_215"
,
"c12_216"
,
"c12_217"
,
"c12_218"
,
"c12_219"
,
"c12_220"
,
"c12_221"
,
"c12_222"
,
"c12_223"
,
"c12_224"
,
"c12_225"
,
"c12_226"
,
"c12_227"
,
"c12_228"
,
"c12_229"
,
"c12_230"
,
"c12_231"
,
"c12_232"
,
"c12_233"
,
"c12_234"
,
"c12_235"
,
"c12_236"
,
"c12_237"
,
"c12_238"
,
"c12_239"
,
"c12_240"
,
"c12_241"
,
"c12_242"
,
"c12_243"
,
"c12_244"
,
"c12_245"
,
"c12_246"
,
"c12_247"
,
"c12_248"
,
"c12_249"
,
"c12_250"
,
"c12_251"
,
"c12_252"
,
"c12_253"
,
"c12_254"
,
"c12_255"
,
"c12_256"
,
"c12_257"
,
"c12_258"
,
"c12_259"
,
"c12_260"
,
"c12_261"
,
"c12_262"
,
"c12_263"
,
"c12_264"
,
"c12_265"
,
"c12_266"
,
"c12_267"
,
"c12_268"
,
"c12_269"
,
"c12_270"
,
"c12_271"
,
"c12_272"
,
"c12_273"
,
"c12_274"
,
"c12_275"
,
"c12_276"
,
"c12_277"
,
"c12_278"
,
"c12_279"
,
"c12_280"
,
"c12_281"
,
"c12_282"
,
"c12_283"
,
"c12_284"
,
"c12_285"
,
"c12_286"
,
"c12_287"
,
"c12_288"
,
"c12_289"
,
"c12_290"
,
"c12_291"
,
"c12_292"
,
"c12_293"
,
"c12_294"
,
"c12_295"
,
"c12_296"
,
"c12_297"
,
"c12_298"
,
"c12_299"
,
"c12_300"
,
"c12_301"
,
"c12_302"
,
"c12_303"
,
"c12_304"
,
"c12_305"
,
"c12_306"
,
"c12_307"
,
"c12_308"
,
"c12_309"
,
"c12_310"
,
"c12_311"
,
"c12_312"
,
"c12_313"
,
"c12_314"
,
"c12_315"
,
"c12_316"
,
"c12_317"
,
"c12_318"
,
"c12_319"
,
"c12_320"
,
"c12_321"
,
"c12_322"
,
"c12_323"
,
"c12_324"
,
"c12_325"
,
"c12_326"
,
"c12_327"
,
"c12_328"
,
"c12_329"
,
"c12_330"
,
"c12_331"
,
"c12_332"
,
"c12_333"
,
"c12_334"
,
"c12_335"
,
"c12_336"
,
"c12_337"
,
"c12_338"
,
"c12_339"
,
"c12_340"
,
"c12_341"
,
"c12_342"
,
"c12_343"
,
"c12_344"
,
"c12_345"
,
"c12_346"
,
"c12_347"
,
"c12_348"
,
"c12_349"
,
"c12_350"
)
val
cat_13
=
listOf
(
"c13_1"
,
"c13_2"
,
"c13_3"
)
val
cat_14
=
listOf
(
"c14_1"
,
"c14_2"
,
"c14_3"
)
val
cat_15
=
listOf
(
"c15_1"
,
"c15_2"
,
"c15_3"
)
val
cat_16
=
listOf
(
"c16_1"
,
"c16_2"
,
"c16_3"
,
"c16_4"
,
"c16_5"
,
"c16_6"
,
"c16_7"
)
//val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1")
//var policy_string=""
var
user_cat_1
=
mutableListOf
(
"c1_1"
)
var
user_cat_2
=
mutableListOf
(
"c2_1"
)
var
user_cat_3
=
mutableListOf
(
"c3_1"
)
var
user_cat_4
=
mutableListOf
(
"c4_1"
)
var
user_cat_5
=
mutableListOf
(
"c5_1"
)
var
user_cat_6
=
mutableListOf
(
"c6_1"
)
var
user_cat_7
=
mutableListOf
(
"c7_1"
)
var
user_cat_8
=
mutableListOf
(
"c8_1"
)
var
user_cat_9
=
mutableListOf
(
"c9_1"
)
var
user_cat_10
=
mutableListOf
(
"c10_1"
)
var
user_cat_11
=
mutableListOf
(
"c11_1"
)
var
user_cat_12
=
mutableListOf
(
"c12_1"
)
var
user_cat_13
=
mutableListOf
(
"c13_1"
)
var
user_cat_14
=
mutableListOf
(
"c14_1"
)
var
user_cat_15
=
mutableListOf
(
"c15_1"
)
var
user_cat_16
=
mutableListOf
(
"c16_1"
)
for
(
item
in
cat_1
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_1
.
add
(
item
)}}
for
(
item
in
cat_2
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_2
.
add
(
item
)}}
for
(
item
in
cat_3
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_3
.
add
(
item
)}}
for
(
item
in
cat_4
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_4
.
add
(
item
)}}
for
(
item
in
cat_5
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_5
.
add
(
item
)}}
for
(
item
in
cat_6
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_6
.
add
(
item
)}}
for
(
item
in
cat_7
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_7
.
add
(
item
)}}
for
(
item
in
cat_8
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_8
.
add
(
item
)}}
for
(
item
in
cat_9
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_9
.
add
(
item
)}}
for
(
item
in
cat_10
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_10
.
add
(
item
)}}
for
(
item
in
cat_11
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_11
.
add
(
item
)}}
for
(
item
in
cat_12
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_12
.
add
(
item
)}}
for
(
item
in
cat_13
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_13
.
add
(
item
)}}
for
(
item
in
cat_14
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_14
.
add
(
item
)}}
for
(
item
in
cat_15
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_15
.
add
(
item
)}}
for
(
item
in
cat_16
){
if
(
prof
.
getInt
(
item
,
3
)==
1
){
user_cat_16
.
add
(
item
)}}
var
topic
=
""
var
user_topic
=
""
Log
.
d
(
"hell gate1 : "
,
user_cat_1
.
toString
())
Log
.
d
(
"hell gate2 : "
,
user_cat_2
.
toString
())
Log
.
d
(
"hell gate3 : "
,
user_cat_3
.
toString
())
Log
.
d
(
"hell gate4 : "
,
user_cat_4
.
toString
())
Log
.
d
(
"hell gate5 : "
,
user_cat_5
.
toString
())
Log
.
d
(
"hell gate6 : "
,
user_cat_6
.
toString
())
Log
.
d
(
"hell gate7 : "
,
user_cat_7
.
toString
())
Log
.
d
(
"hell gate8 : "
,
user_cat_8
.
toString
())
Log
.
d
(
"hell gate9 : "
,
user_cat_9
.
toString
())
Log
.
d
(
"hell gate10 : "
,
user_cat_10
.
toString
())
Log
.
d
(
"hell gate11 : "
,
user_cat_11
.
toString
())
Log
.
d
(
"hell gate12 : "
,
user_cat_12
.
toString
())
Log
.
d
(
"hell gate13 : "
,
user_cat_13
.
toString
())
Log
.
d
(
"hell gate14 : "
,
user_cat_14
.
toString
())
Log
.
d
(
"hell gate15 : "
,
user_cat_15
.
toString
())
Log
.
d
(
"hell gate16 : "
,
user_cat_16
.
toString
())
for
(
c1
in
user_cat_1
)
{
topic
+=
c1
for
(
c2
in
user_cat_2
)
{
topic
+=
c2
for
(
c3
in
user_cat_3
)
{
topic
+=
c3
for
(
c4
in
user_cat_4
)
{
topic
+=
c4
for
(
c5
in
user_cat_5
)
{
topic
+=
c5
for
(
c6
in
user_cat_6
)
{
topic
+=
c6
for
(
c7
in
user_cat_7
)
{
topic
+=
c7
for
(
c8
in
user_cat_8
)
{
topic
+=
c8
for
(
c9
in
user_cat_9
)
{
topic
+=
c9
for
(
c10
in
user_cat_10
)
{
topic
+=
c10
for
(
c11
in
user_cat_11
)
{
topic
+=
c11
for
(
c12
in
user_cat_12
)
{
topic
+=
c12
for
(
c13
in
user_cat_13
)
{
topic
+=
c13
for
(
c14
in
user_cat_14
)
{
topic
+=
c14
for
(
c15
in
user_cat_15
)
{
topic
+=
c15
for
(
c16
in
user_cat_16
)
{
topic
+=
c16
user_topic
+=
(
topic
+
"/"
)
// debug
// Log.d("topic : ", topic)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
).
addOnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
}
// 성공
}
/* topic 구독 코드
FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task ->
if (!task.isSuccessful) { } // 성공
}
*/
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c16
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c15
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c14
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c13
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c12
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c11
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c10
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c9
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c8
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c7
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c6
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c5
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c4
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c3
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c2
.
length
)
}
topic
=
topic
.
substring
(
0
,
topic
.
length
-
c1
.
length
)
}
//Log.d("re:", user_topic)
writeNewUser
(
user
,
"null"
,
user_topic
)
// db에 쓰기
var
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
}
questionButton
.
setOnClickListener
{
val
builder
=
AlertDialog
.
Builder
(
this
)
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
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
()
}
skipButton
.
setOnClickListener
{
var
intent
=
Intent
(
this
,
InputProfilSecondOneActivity
::
class
.
java
)
startActivity
(
intent
)
...
...
@@ -28,9 +268,6 @@ class InputProfilThirdTwoActivity : AppCompatActivity() {
startActivity
(
intent
)
}
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
nextButton
.
setOnClickListener
{
if
(
companyButton
.
isChecked
){
editor
.
putInt
(
"c5_6"
,
1
);
editor
.
commit
()}
if
(
workerButton
.
isChecked
){
editor
.
putInt
(
"c5_7"
,
1
);
editor
.
commit
()}
...
...
vip/app/src/main/java/com/example/vip/SignInActivity.kt
View file @
6d0d209
package
com.example.vip
import
android.content.Context
import
android.content.Intent
import
android.content.SharedPreferences
import
android.os.Bundle
import
android.view.Menu
import
android.view.MenuItem
...
...
@@ -29,6 +31,9 @@ class SignInActivity : AppCompatActivity() {
val
dialogView
=
layoutInflater
.
inflate
(
R
.
layout
.
dialog_example
,
null
)
//val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt)
//val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb)
val
prof
:
SharedPreferences
=
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
dialogView
.
findViewById
<
TextView
>(
R
.
id
.
dialogTitle
).
text
=
"프로필을 입력해주세요!"
dialogView
.
findViewById
<
TextView
>(
R
.
id
.
dialogContent
).
text
=
"정확한 정책 추천을 얻으려면 더 많은 프로필 정보가 필요해요!"
...
...
@@ -39,7 +44,8 @@ class SignInActivity : AppCompatActivity() {
/* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */
}
.
setNegativeButton
(
"지금할게요 :)"
)
{
dialogInterface
,
i
->
/* 취소일 때 아무 액션이 없으므로 빈칸 */
editor
.
clear
()
val
intent
=
Intent
(
this
,
InputProfilFirstOneActivity
::
class
.
java
)
startActivity
(
intent
)
}
...
...
vip/app/src/main/res/layout/activity_input_profil_first_five.xml
View file @
6d0d209
...
...
@@ -4,13 +4,64 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".InputProfilF
irst
FiveActivity"
>
tools:context=
".InputProfilF
ourth
FiveActivity"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"11dp"
android:background=
"#FFF"
android:elevation=
"5dp"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/skipButton"
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1.5"
android:background=
"#FFFFFF"
android:text=
"나가기"
android:textColor=
"#29ABE2"
android:textSize=
"16dp"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
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:orientation=
"horizontal"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
android:layout_weight=
"1.5"
/>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
...
...
@@ -20,20 +71,52 @@
<TextView
android:id=
"@+id/stageTextView1"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"1
단계
"
/>
android:text=
"1"
/>
<TextView
android:id=
"@+id/
neccesaryTextView
"
android:id=
"@+id/
stageTextView2
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"2"
/>
<TextView
android:id=
"@+id/stageTextView3"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"3"
/>
<TextView
android:id=
"@+id/stageTextView4"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"필수항목"
/>
android:text=
"4"
/>
<TextView
android:id=
"@+id/stageTextView5"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:gravity=
"center"
android:text=
"5"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -53,47 +136,68 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/explainTextView"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"4. 내/외국인 여부를 선택해주세요."
/>
android:layout_height=
"match_parent"
>
<TextView
android:id=
"@+id/explainTextView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"4. 내/외국인 여부를 선택해주세요."
/>
<Button
android:id=
"@+id/questionButton"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center"
android:layout_toRightOf=
"@id/explainTextView"
android:backgroundTint=
"#1E90FF"
android:gravity=
"center"
android:text=
" ? "
android:textSize=
"8sp"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ToggleButton
android:id=
"@+id/inmanButton"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/profil_selector"
android:text=
"내국인"
android:textOff=
"내국인"
android:textOn=
"내국인"
/>
</LinearLayout>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<ToggleButton
android:id=
"@+id/outmanButton"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/profil_selector"
android:text=
"외국인"
android:textOff=
"외국인"
android:textOn=
"외국인"
/>
</LinearLayout>
android:orientation=
"vertical"
>
<ToggleButton
android:id=
"@+id/inmanButton"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/profil_selector"
android:text=
"내국인"
android:textOff=
"내국인"
android:textOn=
"내국인"
/>
<ToggleButton
android:id=
"@+id/outmanButton"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/profil_selector"
android:text=
"외국인"
android:textOff=
"외국인"
android:textOn=
"외국인"
/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -113,12 +217,6 @@
android:layout_weight=
"1"
android:text=
"이전 단계로"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<Button
android:id=
"@+id/nextButton"
android:layout_width=
"10dp"
...
...
vip/app/src/main/res/layout/activity_input_profil_first_four.xml
View file @
6d0d209
...
...
@@ -4,13 +4,64 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".InputProfilF
irstFour
Activity"
>
tools:context=
".InputProfilF
ourthFive
Activity"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"11dp"
android:background=
"#FFF"
android:elevation=
"5dp"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/skipButton"
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1.5"
android:background=
"#FFFFFF"
android:text=
"나가기"
android:textColor=
"#29ABE2"
android:textSize=
"16dp"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
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:orientation=
"horizontal"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
android:layout_weight=
"1.5"
/>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
...
...
@@ -20,20 +71,52 @@
<TextView
android:id=
"@+id/stageTextView1"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"1
단계
"
/>
android:text=
"1"
/>
<TextView
android:id=
"@+id/
neccesaryTextView
"
android:id=
"@+id/
stageTextView2
"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"필수항목"
/>
android:text=
"2"
/>
<TextView
android:id=
"@+id/stageTextView3"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"3"
/>
<TextView
android:id=
"@+id/stageTextView4"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"4"
/>
<TextView
android:id=
"@+id/stageTextView5"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:gravity=
"center"
android:text=
"5"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -53,28 +136,49 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/explainTextView"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"3. 주민등록상 거주지를 선택해 주세요."
/>
android:layout_height=
"match_parent"
>
<TextView
android:id=
"@+id/explainTextView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"3. 자신의 주민등록상 거주지를 선택해주세요."
/>
<Button
android:id=
"@+id/questionButton"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center"
android:layout_toRightOf=
"@id/explainTextView"
android:backgroundTint=
"#1E90FF"
android:gravity=
"center"
android:text=
" ? "
android:textSize=
"8sp"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
</LinearLayout>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/doTextView"
android:layout_width=
"match_parent"
...
...
@@ -96,8 +200,8 @@
android:id=
"@+id/gooSpinner"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
/>
</
LinearLayout
>
</LinearLayout>
</
ScrollView
>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -117,12 +221,6 @@
android:layout_weight=
"1"
android:text=
"이전 단계로"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<Button
android:id=
"@+id/nextButton"
android:layout_width=
"10dp"
...
...
vip/app/src/main/res/layout/activity_input_profil_first_six.xml
View file @
6d0d209
...
...
@@ -4,13 +4,64 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".InputProfilF
irstSix
Activity"
>
tools:context=
".InputProfilF
ourthFive
Activity"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"11dp"
android:background=
"#FFF"
android:elevation=
"5dp"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/skipButton"
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1.5"
android:background=
"#FFFFFF"
android:text=
"나가기"
android:textColor=
"#29ABE2"
android:textSize=
"16dp"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
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:orientation=
"horizontal"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
android:layout_weight=
"1.5"
/>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
...
...
@@ -20,20 +71,52 @@
<TextView
android:id=
"@+id/stageTextView1"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"1
단계
"
/>
android:text=
"1"
/>
<TextView
android:id=
"@+id/
neccesaryTextView
"
android:id=
"@+id/
stageTextView2
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"2"
/>
<TextView
android:id=
"@+id/stageTextView3"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"3"
/>
<TextView
android:id=
"@+id/stageTextView4"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"필수항목"
/>
android:text=
"4"
/>
<TextView
android:id=
"@+id/stageTextView5"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:gravity=
"center"
android:text=
"5"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -53,47 +136,67 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/explainTextView"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"5. 가구주 여부를 선택해 주세요"
/>
android:layout_height=
"match_parent"
>
<TextView
android:id=
"@+id/explainTextView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"5. 가구주 여부를 선택해 주세요"
/>
<Button
android:id=
"@+id/questionButton"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center"
android:layout_toRightOf=
"@id/explainTextView"
android:backgroundTint=
"#1E90FF"
android:gravity=
"center"
android:text=
" ? "
android:textSize=
"8sp"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ToggleButton
android:id=
"@+id/gagoojooButton"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/profil_selector"
android:text=
"가구주"
android:textOff=
"가구주"
android:textOn=
"가구주"
/>
</LinearLayout>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<ToggleButton
android:id=
"@+id/gagoowonButton"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/profil_selector"
android:text=
"가구원"
android:textOff=
"가구원"
android:textOn=
"외국인"
/>
</LinearLayout>
android:orientation=
"vertical"
>
<ToggleButton
android:id=
"@+id/gagoojooButton"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/profil_selector"
android:text=
"가구주"
android:textOff=
"가구주"
android:textOn=
"가구주"
/>
<ToggleButton
android:id=
"@+id/gagoowonButton"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/profil_selector"
android:text=
"가구원"
android:textOff=
"가구원"
android:textOn=
"가구원"
/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -113,12 +216,6 @@
android:layout_weight=
"1"
android:text=
"이전 단계로"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<Button
android:id=
"@+id/nextButton"
android:layout_width=
"10dp"
...
...
vip/app/src/main/res/layout/activity_input_profil_first_three.xml
View file @
6d0d209
...
...
@@ -4,13 +4,64 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".InputProfilF
irstThre
eActivity"
>
tools:context=
".InputProfilF
ourthFiv
eActivity"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"11dp"
android:background=
"#FFF"
android:elevation=
"5dp"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/skipButton"
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1.5"
android:background=
"#FFFFFF"
android:text=
"나가기"
android:textColor=
"#29ABE2"
android:textSize=
"16dp"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
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:orientation=
"horizontal"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
android:layout_weight=
"1.5"
/>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
...
...
@@ -20,20 +71,52 @@
<TextView
android:id=
"@+id/stageTextView1"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"1
단계
"
/>
android:text=
"1"
/>
<TextView
android:id=
"@+id/
neccesaryTextView
"
android:id=
"@+id/
stageTextView2
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"2"
/>
<TextView
android:id=
"@+id/stageTextView3"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"3"
/>
<TextView
android:id=
"@+id/stageTextView4"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"필수항목"
/>
android:text=
"4"
/>
<TextView
android:id=
"@+id/stageTextView5"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:gravity=
"center"
android:text=
"5"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -53,47 +136,92 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/explainTextView"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"2. 성별을 선택해 주세요."
/>
android:layout_height=
"match_parent"
>
<TextView
android:id=
"@+id/explainTextView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"2. 성별을 선택해 주세요."
/>
<Button
android:id=
"@+id/questionButton"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center"
android:layout_toRightOf=
"@id/explainTextView"
android:backgroundTint=
"#1E90FF"
android:gravity=
"center"
android:text=
" ? "
android:textSize=
"8sp"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
<RadioGroup
android:id=
"@+id/radio_group"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</LinearLayout>
<RadioButton
android:id=
"@+id/manButton"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"남자"
/>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<RadioButton
android:id=
"@+id/womanButton"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"여자"
/>
</RadioGroup>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<ToggleButton
android:id=
"@+id/manButton"
android:layout_width=
"300dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@drawable/profil_selector"
android:text=
"남자"
android:textOff=
"남자"
android:textOn=
"남자"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<ToggleButton
android:id=
"@+id/womanButton"
android:layout_width=
"300dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:background=
"@drawable/profil_selector"
android:text=
"여자"
android:textOff=
"여자"
android:textOn=
"여자"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -113,12 +241,6 @@
android:layout_weight=
"1"
android:text=
"이전 단계로"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<Button
android:id=
"@+id/nextButton"
android:layout_width=
"10dp"
...
...
vip/app/src/main/res/layout/activity_input_profil_first_two.xml
View file @
6d0d209
...
...
@@ -4,13 +4,64 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".InputProfilF
irstTwo
Activity"
>
tools:context=
".InputProfilF
ourthFive
Activity"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"11dp"
android:background=
"#FFF"
android:elevation=
"5dp"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/skipButton"
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1.5"
android:background=
"#FFFFFF"
android:text=
"나가기"
android:textColor=
"#29ABE2"
android:textSize=
"16dp"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
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:orientation=
"horizontal"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
android:layout_weight=
"1.5"
/>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
...
...
@@ -20,20 +71,52 @@
<TextView
android:id=
"@+id/stageTextView1"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"1
단계
"
/>
android:text=
"1"
/>
<TextView
android:id=
"@+id/
neccesaryTextView
"
android:id=
"@+id/
stageTextView2
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"2"
/>
<TextView
android:id=
"@+id/stageTextView3"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"3"
/>
<TextView
android:id=
"@+id/stageTextView4"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:background=
"#1E90FF"
android:gravity=
"center"
android:text=
"필수항목"
/>
android:text=
"4"
/>
<TextView
android:id=
"@+id/stageTextView5"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:gravity=
"center"
android:text=
"5"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -53,37 +136,60 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/explainTextView"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"1. 생년월일을 입력해 주세요."
/>
android:layout_height=
"match_parent"
>
<TextView
android:id=
"@+id/explainTextView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"1. 생년월일을 입력해 주세요."
/>
<Button
android:id=
"@+id/questionButton"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center"
android:layout_toRightOf=
"@id/explainTextView"
android:backgroundTint=
"#1E90FF"
android:gravity=
"center"
android:text=
" ? "
android:textSize=
"8sp"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
></LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
<EditText
android:id=
"@+id/editText"
</LinearLayout>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:ems=
"10"
android:gravity=
"center"
android:inputType=
"date"
/>
</LinearLayout>
android:orientation=
"vertical"
>
<EditText
android:id=
"@+id/editText"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:ems=
"10"
android:gravity=
"center"
android:inputType=
"date"
/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -96,19 +202,12 @@
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<LinearLayout
android:layout_width=
"10dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
</LinearLayout>
<LinearLayout
<Button
android:id=
"@+id/previousButton"
android:layout_width=
"10dp"
android:layout_height=
"
match_par
ent"
android:layout_height=
"
wrap_cont
ent"
android:layout_weight=
"1"
android:
orientation=
"vertical"
></LinearLayout
>
android:
text=
"이전 단계로"
/
>
<Button
android:id=
"@+id/nextButton"
...
...
Please
register
or
login
to post a comment