Showing
28 changed files
with
5497 additions
and
243 deletions
... | @@ -5,22 +5,261 @@ import android.content.Intent | ... | @@ -5,22 +5,261 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
8 | import kotlinx.android.synthetic.main.activity_input_profil_fifth_four.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_fifth_four.* |
9 | 18 | ||
10 | class InputProfilFifthFourActivity : AppCompatActivity() { | 19 | class InputProfilFifthFourActivity : AppCompatActivity() { |
11 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
12 | override fun onCreate(savedInstanceState: Bundle?) { | 51 | override fun onCreate(savedInstanceState: Bundle?) { |
13 | super.onCreate(savedInstanceState) | 52 | super.onCreate(savedInstanceState) |
14 | setContentView(R.layout.activity_input_profil_fifth_four) | 53 | setContentView(R.layout.activity_input_profil_fifth_four) |
15 | 54 | ||
55 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
56 | + val editor: SharedPreferences.Editor=prof.edit() | ||
57 | + | ||
58 | + // 1. 툴바 사용 설정 | ||
59 | + setSupportActionBar(toolbar) | ||
60 | + | ||
61 | + //pushing code start | ||
62 | + intent.extras?.let { | ||
63 | + for (key in it.keySet()) { | ||
64 | + val value = intent.extras?.get(key) | ||
65 | + //Log.d(TAG, "Key: $key Value: $value") | ||
66 | + } | ||
67 | + } | ||
68 | + //pushing code end | ||
69 | + | ||
70 | + | ||
71 | + skipButton.setOnClickListener { | ||
72 | + sendToken() | ||
73 | + val user=firebaseAuth?.currentUser!!.uid | ||
74 | + Log.d("test:", user.toString()) | ||
75 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
76 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
77 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
78 | + 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") | ||
79 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
80 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
81 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
88 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
89 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
90 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
91 | + | ||
92 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
93 | + //var policy_string="" | ||
94 | + | ||
95 | + var user_cat_1 = mutableListOf("c1_1") | ||
96 | + var user_cat_2 = mutableListOf("c2_1") | ||
97 | + var user_cat_3 = mutableListOf("c3_1") | ||
98 | + var user_cat_4 = mutableListOf("c4_1") | ||
99 | + var user_cat_5 = mutableListOf("c5_1") | ||
100 | + var user_cat_6 = mutableListOf("c6_1") | ||
101 | + var user_cat_7 = mutableListOf("c7_1") | ||
102 | + var user_cat_8 = mutableListOf("c8_1") | ||
103 | + var user_cat_9 = mutableListOf("c9_1") | ||
104 | + var user_cat_10 = mutableListOf("c10_1") | ||
105 | + var user_cat_11 = mutableListOf("c11_1") | ||
106 | + var user_cat_12 = mutableListOf("c12_1") | ||
107 | + var user_cat_13 = mutableListOf("c13_1") | ||
108 | + var user_cat_14 = mutableListOf("c14_1") | ||
109 | + var user_cat_15 = mutableListOf("c15_1") | ||
110 | + var user_cat_16 = mutableListOf("c16_1") | ||
111 | + | ||
112 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
113 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
114 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
115 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
116 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
117 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
118 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
119 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
120 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
121 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
122 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
123 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
124 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
125 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
126 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
127 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
128 | + | ||
129 | + var topic = "" | ||
130 | + var user_topic = "" | ||
131 | + | ||
132 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
133 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
134 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
135 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
136 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
137 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
138 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
139 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
140 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
141 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
142 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
143 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
144 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
145 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
146 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
147 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
148 | + | ||
149 | + | ||
150 | + for(c1 in user_cat_1) { | ||
151 | + topic += c1 | ||
152 | + for (c2 in user_cat_2) { | ||
153 | + topic += c2 | ||
154 | + for (c3 in user_cat_3) { | ||
155 | + topic += c3 | ||
156 | + for (c4 in user_cat_4) { | ||
157 | + topic += c4 | ||
158 | + for (c5 in user_cat_5) { | ||
159 | + topic += c5 | ||
160 | + for (c6 in user_cat_6) { | ||
161 | + topic += c6 | ||
162 | + for (c7 in user_cat_7) { | ||
163 | + topic += c7 | ||
164 | + for (c8 in user_cat_8) { | ||
165 | + topic += c8 | ||
166 | + for (c9 in user_cat_9) { | ||
167 | + topic += c9 | ||
168 | + for (c10 in user_cat_10) { | ||
169 | + topic += c10 | ||
170 | + for (c11 in user_cat_11) { | ||
171 | + topic += c11 | ||
172 | + for (c12 in user_cat_12) { | ||
173 | + topic += c12 | ||
174 | + for (c13 in user_cat_13) { | ||
175 | + topic += c13 | ||
176 | + for (c14 in user_cat_14) { | ||
177 | + topic += c14 | ||
178 | + for (c15 in user_cat_15) { | ||
179 | + topic += c15 | ||
180 | + for (c16 in user_cat_16) { | ||
181 | + topic += c16 | ||
182 | + user_topic += (topic + "/") | ||
183 | + // debug | ||
184 | + // Log.d("topic : ", topic) | ||
185 | + | ||
186 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
187 | + if (!task.isSuccessful) { } // 성공 | ||
188 | + } | ||
189 | + /* topic 구독 코드 | ||
190 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
191 | + if (!task.isSuccessful) { } // 성공 | ||
192 | + } | ||
193 | + */ | ||
194 | + | ||
195 | + topic = topic.substring(0, topic.length - c16.length) | ||
196 | + } | ||
197 | + topic = topic.substring(0, topic.length - c15.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c14.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c13.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c12.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c11.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c10.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c9.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c8.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c7.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c6.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c5.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c4.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c3.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c2.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length-c1.length) | ||
226 | + } | ||
227 | + | ||
228 | + //Log.d("re:", user_topic) | ||
229 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
230 | + | ||
231 | + | ||
232 | + var intent = Intent(this, SignInActivity::class.java) | ||
233 | + startActivity(intent) | ||
234 | + } | ||
235 | + | ||
236 | + questionButton.setOnClickListener { | ||
237 | + val builder = AlertDialog.Builder(this) | ||
238 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
239 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
240 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
241 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
242 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
243 | + | ||
244 | + builder.setView(dialogView) | ||
245 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
246 | + //mainTv.text = dialogText.text.toString() | ||
247 | + //mainRb.rating = dialogRatingBar.rating | ||
248 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
249 | + | ||
250 | + } | ||
251 | + /* | ||
252 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
253 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
254 | + } | ||
255 | + */ | ||
256 | + .show() | ||
257 | + } | ||
16 | previousButton.setOnClickListener { | 258 | previousButton.setOnClickListener { |
17 | var intent = Intent(this, InputProfilFifthThreeActivity::class.java) | 259 | var intent = Intent(this, InputProfilFifthThreeActivity::class.java) |
18 | startActivity(intent) | 260 | startActivity(intent) |
19 | } | 261 | } |
20 | 262 | ||
21 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
22 | - val editor: SharedPreferences.Editor=prof.edit() | ||
23 | - | ||
24 | nextButton.setOnClickListener { | 263 | nextButton.setOnClickListener { |
25 | 264 | ||
26 | editor.putInt("c1_1",1); editor.commit() | 265 | editor.putInt("c1_1",1); editor.commit() | ... | ... |
1 | package com.example.vip | 1 | package com.example.vip |
2 | 2 | ||
3 | +import android.content.Context | ||
3 | import android.content.Intent | 4 | import android.content.Intent |
5 | +import android.content.SharedPreferences | ||
4 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
5 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
6 | import kotlinx.android.synthetic.main.activity_input_profil_fifth_one.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_fifth_one.* |
7 | 18 | ||
8 | class InputProfilFifthOneActivity : AppCompatActivity() { | 19 | class InputProfilFifthOneActivity : AppCompatActivity() { |
9 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
10 | override fun onCreate(savedInstanceState: Bundle?) { | 51 | override fun onCreate(savedInstanceState: Bundle?) { |
11 | super.onCreate(savedInstanceState) | 52 | super.onCreate(savedInstanceState) |
12 | setContentView(R.layout.activity_input_profil_fifth_one) | 53 | setContentView(R.layout.activity_input_profil_fifth_one) |
54 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
55 | + val editor: SharedPreferences.Editor=prof.edit() | ||
56 | + | ||
57 | + // 1. 툴바 사용 설정 | ||
58 | + setSupportActionBar(toolbar) | ||
59 | + | ||
60 | + //pushing code start | ||
61 | + intent.extras?.let { | ||
62 | + for (key in it.keySet()) { | ||
63 | + val value = intent.extras?.get(key) | ||
64 | + //Log.d(TAG, "Key: $key Value: $value") | ||
65 | + } | ||
66 | + } | ||
67 | + //pushing code end | ||
68 | + | ||
69 | + | ||
70 | + skipButton.setOnClickListener { | ||
71 | + sendToken() | ||
72 | + val user=firebaseAuth?.currentUser!!.uid | ||
73 | + Log.d("test:", user.toString()) | ||
74 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
75 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
76 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
77 | + 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") | ||
78 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
79 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
80 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
81 | + 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") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
87 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
88 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
89 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
90 | + | ||
91 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
92 | + //var policy_string="" | ||
93 | + | ||
94 | + var user_cat_1 = mutableListOf("c1_1") | ||
95 | + var user_cat_2 = mutableListOf("c2_1") | ||
96 | + var user_cat_3 = mutableListOf("c3_1") | ||
97 | + var user_cat_4 = mutableListOf("c4_1") | ||
98 | + var user_cat_5 = mutableListOf("c5_1") | ||
99 | + var user_cat_6 = mutableListOf("c6_1") | ||
100 | + var user_cat_7 = mutableListOf("c7_1") | ||
101 | + var user_cat_8 = mutableListOf("c8_1") | ||
102 | + var user_cat_9 = mutableListOf("c9_1") | ||
103 | + var user_cat_10 = mutableListOf("c10_1") | ||
104 | + var user_cat_11 = mutableListOf("c11_1") | ||
105 | + var user_cat_12 = mutableListOf("c12_1") | ||
106 | + var user_cat_13 = mutableListOf("c13_1") | ||
107 | + var user_cat_14 = mutableListOf("c14_1") | ||
108 | + var user_cat_15 = mutableListOf("c15_1") | ||
109 | + var user_cat_16 = mutableListOf("c16_1") | ||
110 | + | ||
111 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
112 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
113 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
114 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
115 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
116 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
117 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
118 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
119 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
120 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
121 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
122 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
123 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
124 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
125 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
126 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
127 | + | ||
128 | + var topic = "" | ||
129 | + var user_topic = "" | ||
130 | + | ||
131 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
132 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
133 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
134 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
135 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
136 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
137 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
138 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
139 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
140 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
141 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
142 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
143 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
144 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
145 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
146 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
147 | + | ||
148 | + | ||
149 | + for(c1 in user_cat_1) { | ||
150 | + topic += c1 | ||
151 | + for (c2 in user_cat_2) { | ||
152 | + topic += c2 | ||
153 | + for (c3 in user_cat_3) { | ||
154 | + topic += c3 | ||
155 | + for (c4 in user_cat_4) { | ||
156 | + topic += c4 | ||
157 | + for (c5 in user_cat_5) { | ||
158 | + topic += c5 | ||
159 | + for (c6 in user_cat_6) { | ||
160 | + topic += c6 | ||
161 | + for (c7 in user_cat_7) { | ||
162 | + topic += c7 | ||
163 | + for (c8 in user_cat_8) { | ||
164 | + topic += c8 | ||
165 | + for (c9 in user_cat_9) { | ||
166 | + topic += c9 | ||
167 | + for (c10 in user_cat_10) { | ||
168 | + topic += c10 | ||
169 | + for (c11 in user_cat_11) { | ||
170 | + topic += c11 | ||
171 | + for (c12 in user_cat_12) { | ||
172 | + topic += c12 | ||
173 | + for (c13 in user_cat_13) { | ||
174 | + topic += c13 | ||
175 | + for (c14 in user_cat_14) { | ||
176 | + topic += c14 | ||
177 | + for (c15 in user_cat_15) { | ||
178 | + topic += c15 | ||
179 | + for (c16 in user_cat_16) { | ||
180 | + topic += c16 | ||
181 | + user_topic += (topic + "/") | ||
182 | + // debug | ||
183 | + // Log.d("topic : ", topic) | ||
184 | + | ||
185 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
186 | + if (!task.isSuccessful) { } // 성공 | ||
187 | + } | ||
188 | + /* topic 구독 코드 | ||
189 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
190 | + if (!task.isSuccessful) { } // 성공 | ||
191 | + } | ||
192 | + */ | ||
193 | + | ||
194 | + topic = topic.substring(0, topic.length - c16.length) | ||
195 | + } | ||
196 | + topic = topic.substring(0, topic.length - c15.length) | ||
197 | + } | ||
198 | + topic = topic.substring(0, topic.length - c14.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c13.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c12.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c11.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c10.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c9.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c8.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c7.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c6.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c5.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c4.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c3.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length - c2.length) | ||
223 | + } | ||
224 | + topic = topic.substring(0, topic.length-c1.length) | ||
225 | + } | ||
226 | + | ||
227 | + //Log.d("re:", user_topic) | ||
228 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
229 | + | ||
230 | + | ||
231 | + var intent = Intent(this, SignInActivity::class.java) | ||
232 | + startActivity(intent) | ||
233 | + } | ||
234 | + | ||
235 | + questionButton.setOnClickListener { | ||
236 | + val builder = AlertDialog.Builder(this) | ||
237 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
238 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
239 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
240 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
241 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
242 | + | ||
243 | + builder.setView(dialogView) | ||
244 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
245 | + //mainTv.text = dialogText.text.toString() | ||
246 | + //mainRb.rating = dialogRatingBar.rating | ||
247 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
248 | + | ||
249 | + } | ||
250 | + /* | ||
251 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
252 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
253 | + } | ||
254 | + */ | ||
255 | + .show() | ||
256 | + } | ||
13 | 257 | ||
14 | previousButton.setOnClickListener { | 258 | previousButton.setOnClickListener { |
15 | var intent = Intent(this, InputProfilFourthFiveActivity::class.java) | 259 | var intent = Intent(this, InputProfilFourthFiveActivity::class.java) | ... | ... |
1 | package com.example.vip | 1 | package com.example.vip |
2 | 2 | ||
3 | +import android.content.Context | ||
3 | import android.content.Intent | 4 | import android.content.Intent |
5 | +import android.content.SharedPreferences | ||
4 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
5 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
6 | import kotlinx.android.synthetic.main.activity_input_profil_fifth_three.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_fifth_three.* |
7 | 18 | ||
8 | class InputProfilFifthThreeActivity : AppCompatActivity() { | 19 | class InputProfilFifthThreeActivity : AppCompatActivity() { |
9 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
10 | override fun onCreate(savedInstanceState: Bundle?) { | 51 | override fun onCreate(savedInstanceState: Bundle?) { |
11 | super.onCreate(savedInstanceState) | 52 | super.onCreate(savedInstanceState) |
12 | setContentView(R.layout.activity_input_profil_fifth_three) | 53 | setContentView(R.layout.activity_input_profil_fifth_three) |
54 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
55 | + val editor: SharedPreferences.Editor=prof.edit() | ||
56 | + | ||
57 | + // 1. 툴바 사용 설정 | ||
58 | + setSupportActionBar(toolbar) | ||
59 | + | ||
60 | + //pushing code start | ||
61 | + intent.extras?.let { | ||
62 | + for (key in it.keySet()) { | ||
63 | + val value = intent.extras?.get(key) | ||
64 | + //Log.d(TAG, "Key: $key Value: $value") | ||
65 | + } | ||
66 | + } | ||
67 | + //pushing code end | ||
68 | + | ||
69 | + | ||
70 | + skipButton.setOnClickListener { | ||
71 | + sendToken() | ||
72 | + val user=firebaseAuth?.currentUser!!.uid | ||
73 | + Log.d("test:", user.toString()) | ||
74 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
75 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
76 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
77 | + 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") | ||
78 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
79 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
80 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
81 | + 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") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
87 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
88 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
89 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
90 | + | ||
91 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
92 | + //var policy_string="" | ||
13 | 93 | ||
94 | + var user_cat_1 = mutableListOf("c1_1") | ||
95 | + var user_cat_2 = mutableListOf("c2_1") | ||
96 | + var user_cat_3 = mutableListOf("c3_1") | ||
97 | + var user_cat_4 = mutableListOf("c4_1") | ||
98 | + var user_cat_5 = mutableListOf("c5_1") | ||
99 | + var user_cat_6 = mutableListOf("c6_1") | ||
100 | + var user_cat_7 = mutableListOf("c7_1") | ||
101 | + var user_cat_8 = mutableListOf("c8_1") | ||
102 | + var user_cat_9 = mutableListOf("c9_1") | ||
103 | + var user_cat_10 = mutableListOf("c10_1") | ||
104 | + var user_cat_11 = mutableListOf("c11_1") | ||
105 | + var user_cat_12 = mutableListOf("c12_1") | ||
106 | + var user_cat_13 = mutableListOf("c13_1") | ||
107 | + var user_cat_14 = mutableListOf("c14_1") | ||
108 | + var user_cat_15 = mutableListOf("c15_1") | ||
109 | + var user_cat_16 = mutableListOf("c16_1") | ||
110 | + | ||
111 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
112 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
113 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
114 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
115 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
116 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
117 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
118 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
119 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
120 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
121 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
122 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
123 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
124 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
125 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
126 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
127 | + | ||
128 | + var topic = "" | ||
129 | + var user_topic = "" | ||
130 | + | ||
131 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
132 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
133 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
134 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
135 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
136 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
137 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
138 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
139 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
140 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
141 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
142 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
143 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
144 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
145 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
146 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
147 | + | ||
148 | + | ||
149 | + for(c1 in user_cat_1) { | ||
150 | + topic += c1 | ||
151 | + for (c2 in user_cat_2) { | ||
152 | + topic += c2 | ||
153 | + for (c3 in user_cat_3) { | ||
154 | + topic += c3 | ||
155 | + for (c4 in user_cat_4) { | ||
156 | + topic += c4 | ||
157 | + for (c5 in user_cat_5) { | ||
158 | + topic += c5 | ||
159 | + for (c6 in user_cat_6) { | ||
160 | + topic += c6 | ||
161 | + for (c7 in user_cat_7) { | ||
162 | + topic += c7 | ||
163 | + for (c8 in user_cat_8) { | ||
164 | + topic += c8 | ||
165 | + for (c9 in user_cat_9) { | ||
166 | + topic += c9 | ||
167 | + for (c10 in user_cat_10) { | ||
168 | + topic += c10 | ||
169 | + for (c11 in user_cat_11) { | ||
170 | + topic += c11 | ||
171 | + for (c12 in user_cat_12) { | ||
172 | + topic += c12 | ||
173 | + for (c13 in user_cat_13) { | ||
174 | + topic += c13 | ||
175 | + for (c14 in user_cat_14) { | ||
176 | + topic += c14 | ||
177 | + for (c15 in user_cat_15) { | ||
178 | + topic += c15 | ||
179 | + for (c16 in user_cat_16) { | ||
180 | + topic += c16 | ||
181 | + user_topic += (topic + "/") | ||
182 | + // debug | ||
183 | + // Log.d("topic : ", topic) | ||
184 | + | ||
185 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
186 | + if (!task.isSuccessful) { } // 성공 | ||
187 | + } | ||
188 | + /* topic 구독 코드 | ||
189 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
190 | + if (!task.isSuccessful) { } // 성공 | ||
191 | + } | ||
192 | + */ | ||
193 | + | ||
194 | + topic = topic.substring(0, topic.length - c16.length) | ||
195 | + } | ||
196 | + topic = topic.substring(0, topic.length - c15.length) | ||
197 | + } | ||
198 | + topic = topic.substring(0, topic.length - c14.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c13.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c12.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c11.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c10.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c9.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c8.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c7.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c6.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c5.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c4.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c3.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length - c2.length) | ||
223 | + } | ||
224 | + topic = topic.substring(0, topic.length-c1.length) | ||
225 | + } | ||
226 | + | ||
227 | + //Log.d("re:", user_topic) | ||
228 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
229 | + | ||
230 | + | ||
231 | + var intent = Intent(this, SignInActivity::class.java) | ||
232 | + startActivity(intent) | ||
233 | + } | ||
234 | + | ||
235 | + questionButton.setOnClickListener { | ||
236 | + val builder = AlertDialog.Builder(this) | ||
237 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
238 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
239 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
240 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
241 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
242 | + | ||
243 | + builder.setView(dialogView) | ||
244 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
245 | + //mainTv.text = dialogText.text.toString() | ||
246 | + //mainRb.rating = dialogRatingBar.rating | ||
247 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
248 | + | ||
249 | + } | ||
250 | + /* | ||
251 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
252 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
253 | + } | ||
254 | + */ | ||
255 | + .show() | ||
256 | + } | ||
14 | 257 | ||
15 | previousButton.setOnClickListener { | 258 | previousButton.setOnClickListener { |
16 | var intent = Intent(this, InputProfilFifthTwoActivity::class.java) | 259 | var intent = Intent(this, InputProfilFifthTwoActivity::class.java) | ... | ... |
1 | package com.example.vip | 1 | package com.example.vip |
2 | 2 | ||
3 | +import android.content.Context | ||
3 | import android.content.Intent | 4 | import android.content.Intent |
5 | +import android.content.SharedPreferences | ||
4 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
5 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
6 | import kotlinx.android.synthetic.main.activity_input_profil_fifth_two.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_fifth_two.* |
7 | 18 | ||
8 | class InputProfilFifthTwoActivity : AppCompatActivity() { | 19 | class InputProfilFifthTwoActivity : AppCompatActivity() { |
9 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
10 | override fun onCreate(savedInstanceState: Bundle?) { | 51 | override fun onCreate(savedInstanceState: Bundle?) { |
11 | super.onCreate(savedInstanceState) | 52 | super.onCreate(savedInstanceState) |
12 | setContentView(R.layout.activity_input_profil_fifth_two) | 53 | setContentView(R.layout.activity_input_profil_fifth_two) |
54 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
55 | + val editor: SharedPreferences.Editor=prof.edit() | ||
56 | + | ||
57 | + // 1. 툴바 사용 설정 | ||
58 | + setSupportActionBar(toolbar) | ||
59 | + | ||
60 | + //pushing code start | ||
61 | + intent.extras?.let { | ||
62 | + for (key in it.keySet()) { | ||
63 | + val value = intent.extras?.get(key) | ||
64 | + //Log.d(TAG, "Key: $key Value: $value") | ||
65 | + } | ||
66 | + } | ||
67 | + //pushing code end | ||
68 | + | ||
69 | + | ||
70 | + skipButton.setOnClickListener { | ||
71 | + sendToken() | ||
72 | + val user=firebaseAuth?.currentUser!!.uid | ||
73 | + Log.d("test:", user.toString()) | ||
74 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
75 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
76 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
77 | + 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") | ||
78 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
79 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
80 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
81 | + 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") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
87 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
88 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
89 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
90 | + | ||
91 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
92 | + //var policy_string="" | ||
13 | 93 | ||
94 | + var user_cat_1 = mutableListOf("c1_1") | ||
95 | + var user_cat_2 = mutableListOf("c2_1") | ||
96 | + var user_cat_3 = mutableListOf("c3_1") | ||
97 | + var user_cat_4 = mutableListOf("c4_1") | ||
98 | + var user_cat_5 = mutableListOf("c5_1") | ||
99 | + var user_cat_6 = mutableListOf("c6_1") | ||
100 | + var user_cat_7 = mutableListOf("c7_1") | ||
101 | + var user_cat_8 = mutableListOf("c8_1") | ||
102 | + var user_cat_9 = mutableListOf("c9_1") | ||
103 | + var user_cat_10 = mutableListOf("c10_1") | ||
104 | + var user_cat_11 = mutableListOf("c11_1") | ||
105 | + var user_cat_12 = mutableListOf("c12_1") | ||
106 | + var user_cat_13 = mutableListOf("c13_1") | ||
107 | + var user_cat_14 = mutableListOf("c14_1") | ||
108 | + var user_cat_15 = mutableListOf("c15_1") | ||
109 | + var user_cat_16 = mutableListOf("c16_1") | ||
110 | + | ||
111 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
112 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
113 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
114 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
115 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
116 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
117 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
118 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
119 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
120 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
121 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
122 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
123 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
124 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
125 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
126 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
127 | + | ||
128 | + var topic = "" | ||
129 | + var user_topic = "" | ||
130 | + | ||
131 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
132 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
133 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
134 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
135 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
136 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
137 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
138 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
139 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
140 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
141 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
142 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
143 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
144 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
145 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
146 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
147 | + | ||
148 | + | ||
149 | + for(c1 in user_cat_1) { | ||
150 | + topic += c1 | ||
151 | + for (c2 in user_cat_2) { | ||
152 | + topic += c2 | ||
153 | + for (c3 in user_cat_3) { | ||
154 | + topic += c3 | ||
155 | + for (c4 in user_cat_4) { | ||
156 | + topic += c4 | ||
157 | + for (c5 in user_cat_5) { | ||
158 | + topic += c5 | ||
159 | + for (c6 in user_cat_6) { | ||
160 | + topic += c6 | ||
161 | + for (c7 in user_cat_7) { | ||
162 | + topic += c7 | ||
163 | + for (c8 in user_cat_8) { | ||
164 | + topic += c8 | ||
165 | + for (c9 in user_cat_9) { | ||
166 | + topic += c9 | ||
167 | + for (c10 in user_cat_10) { | ||
168 | + topic += c10 | ||
169 | + for (c11 in user_cat_11) { | ||
170 | + topic += c11 | ||
171 | + for (c12 in user_cat_12) { | ||
172 | + topic += c12 | ||
173 | + for (c13 in user_cat_13) { | ||
174 | + topic += c13 | ||
175 | + for (c14 in user_cat_14) { | ||
176 | + topic += c14 | ||
177 | + for (c15 in user_cat_15) { | ||
178 | + topic += c15 | ||
179 | + for (c16 in user_cat_16) { | ||
180 | + topic += c16 | ||
181 | + user_topic += (topic + "/") | ||
182 | + // debug | ||
183 | + // Log.d("topic : ", topic) | ||
184 | + | ||
185 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
186 | + if (!task.isSuccessful) { } // 성공 | ||
187 | + } | ||
188 | + /* topic 구독 코드 | ||
189 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
190 | + if (!task.isSuccessful) { } // 성공 | ||
191 | + } | ||
192 | + */ | ||
193 | + | ||
194 | + topic = topic.substring(0, topic.length - c16.length) | ||
195 | + } | ||
196 | + topic = topic.substring(0, topic.length - c15.length) | ||
197 | + } | ||
198 | + topic = topic.substring(0, topic.length - c14.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c13.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c12.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c11.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c10.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c9.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c8.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c7.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c6.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c5.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c4.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c3.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length - c2.length) | ||
223 | + } | ||
224 | + topic = topic.substring(0, topic.length-c1.length) | ||
225 | + } | ||
226 | + | ||
227 | + //Log.d("re:", user_topic) | ||
228 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
229 | + | ||
230 | + | ||
231 | + var intent = Intent(this, SignInActivity::class.java) | ||
232 | + startActivity(intent) | ||
233 | + } | ||
234 | + | ||
235 | + questionButton.setOnClickListener { | ||
236 | + val builder = AlertDialog.Builder(this) | ||
237 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
238 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
239 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
240 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
241 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
242 | + | ||
243 | + builder.setView(dialogView) | ||
244 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
245 | + //mainTv.text = dialogText.text.toString() | ||
246 | + //mainRb.rating = dialogRatingBar.rating | ||
247 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
248 | + | ||
249 | + } | ||
250 | + /* | ||
251 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
252 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
253 | + } | ||
254 | + */ | ||
255 | + .show() | ||
256 | + } | ||
14 | 257 | ||
15 | previousButton.setOnClickListener { | 258 | previousButton.setOnClickListener { |
16 | var intent = Intent(this, InputProfilFifthOneActivity::class.java) | 259 | var intent = Intent(this, InputProfilFifthOneActivity::class.java) | ... | ... |
... | @@ -6,14 +6,257 @@ import android.content.SharedPreferences | ... | @@ -6,14 +6,257 @@ import android.content.SharedPreferences |
6 | import android.graphics.Color | 6 | import android.graphics.Color |
7 | import androidx.appcompat.app.AppCompatActivity | 7 | import androidx.appcompat.app.AppCompatActivity |
8 | import android.os.Bundle | 8 | import android.os.Bundle |
9 | +import android.util.Log | ||
10 | +import android.widget.TextView | ||
11 | +import android.widget.Toast | ||
12 | +import androidx.appcompat.app.AlertDialog | ||
13 | +import com.google.android.gms.tasks.OnCompleteListener | ||
14 | +import com.google.firebase.auth.FirebaseAuth | ||
15 | +import com.google.firebase.database.FirebaseDatabase | ||
16 | +import com.google.firebase.iid.FirebaseInstanceId | ||
17 | +import com.google.firebase.messaging.FirebaseMessaging | ||
9 | import kotlinx.android.synthetic.main.activity_input_profil_first_five.* | 18 | import kotlinx.android.synthetic.main.activity_input_profil_first_five.* |
10 | 19 | ||
11 | class InputProfilFirstFiveActivity : AppCompatActivity() { | 20 | class InputProfilFirstFiveActivity : AppCompatActivity() { |
12 | 21 | ||
22 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
23 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
24 | + | ||
25 | + private fun sendToken(){ | ||
26 | + FirebaseInstanceId.getInstance().instanceId | ||
27 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
28 | + if (!task.isSuccessful) { | ||
29 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
30 | + return@OnCompleteListener | ||
31 | + } | ||
32 | + | ||
33 | + // Get new Instance ID token | ||
34 | + tkn = task.result!!.token | ||
35 | + | ||
36 | + // Log and toast | ||
37 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
38 | + //Log.d(TAG, msg) | ||
39 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
40 | + }) | ||
41 | + } | ||
42 | + | ||
43 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
44 | + val user = User(u_token, Policy!!) | ||
45 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
46 | + } | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
13 | override fun onCreate(savedInstanceState: Bundle?) { | 52 | override fun onCreate(savedInstanceState: Bundle?) { |
14 | super.onCreate(savedInstanceState) | 53 | super.onCreate(savedInstanceState) |
15 | setContentView(R.layout.activity_input_profil_first_five) | 54 | setContentView(R.layout.activity_input_profil_first_five) |
16 | 55 | ||
56 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
57 | + val editor: SharedPreferences.Editor=prof.edit() | ||
58 | + | ||
59 | + // 1. 툴바 사용 설정 | ||
60 | + setSupportActionBar(toolbar) | ||
61 | + | ||
62 | + //pushing code start | ||
63 | + intent.extras?.let { | ||
64 | + for (key in it.keySet()) { | ||
65 | + val value = intent.extras?.get(key) | ||
66 | + //Log.d(TAG, "Key: $key Value: $value") | ||
67 | + } | ||
68 | + } | ||
69 | + //pushing code end | ||
70 | + | ||
71 | + | ||
72 | + skipButton.setOnClickListener { | ||
73 | + sendToken() | ||
74 | + val user=firebaseAuth?.currentUser!!.uid | ||
75 | + Log.d("test:", user.toString()) | ||
76 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
77 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
78 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
79 | + 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") | ||
80 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
81 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
82 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
89 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
90 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
91 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
92 | + | ||
93 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
94 | + //var policy_string="" | ||
95 | + | ||
96 | + var user_cat_1 = mutableListOf("c1_1") | ||
97 | + var user_cat_2 = mutableListOf("c2_1") | ||
98 | + var user_cat_3 = mutableListOf("c3_1") | ||
99 | + var user_cat_4 = mutableListOf("c4_1") | ||
100 | + var user_cat_5 = mutableListOf("c5_1") | ||
101 | + var user_cat_6 = mutableListOf("c6_1") | ||
102 | + var user_cat_7 = mutableListOf("c7_1") | ||
103 | + var user_cat_8 = mutableListOf("c8_1") | ||
104 | + var user_cat_9 = mutableListOf("c9_1") | ||
105 | + var user_cat_10 = mutableListOf("c10_1") | ||
106 | + var user_cat_11 = mutableListOf("c11_1") | ||
107 | + var user_cat_12 = mutableListOf("c12_1") | ||
108 | + var user_cat_13 = mutableListOf("c13_1") | ||
109 | + var user_cat_14 = mutableListOf("c14_1") | ||
110 | + var user_cat_15 = mutableListOf("c15_1") | ||
111 | + var user_cat_16 = mutableListOf("c16_1") | ||
112 | + | ||
113 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
114 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
115 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
116 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
117 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
118 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
119 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
120 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
121 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
122 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
123 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
124 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
125 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
126 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
127 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
128 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
129 | + | ||
130 | + var topic = "" | ||
131 | + var user_topic = "" | ||
132 | + | ||
133 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
134 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
135 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
136 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
137 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
138 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
139 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
140 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
141 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
142 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
143 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
144 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
145 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
146 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
147 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
148 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
149 | + | ||
150 | + | ||
151 | + for(c1 in user_cat_1) { | ||
152 | + topic += c1 | ||
153 | + for (c2 in user_cat_2) { | ||
154 | + topic += c2 | ||
155 | + for (c3 in user_cat_3) { | ||
156 | + topic += c3 | ||
157 | + for (c4 in user_cat_4) { | ||
158 | + topic += c4 | ||
159 | + for (c5 in user_cat_5) { | ||
160 | + topic += c5 | ||
161 | + for (c6 in user_cat_6) { | ||
162 | + topic += c6 | ||
163 | + for (c7 in user_cat_7) { | ||
164 | + topic += c7 | ||
165 | + for (c8 in user_cat_8) { | ||
166 | + topic += c8 | ||
167 | + for (c9 in user_cat_9) { | ||
168 | + topic += c9 | ||
169 | + for (c10 in user_cat_10) { | ||
170 | + topic += c10 | ||
171 | + for (c11 in user_cat_11) { | ||
172 | + topic += c11 | ||
173 | + for (c12 in user_cat_12) { | ||
174 | + topic += c12 | ||
175 | + for (c13 in user_cat_13) { | ||
176 | + topic += c13 | ||
177 | + for (c14 in user_cat_14) { | ||
178 | + topic += c14 | ||
179 | + for (c15 in user_cat_15) { | ||
180 | + topic += c15 | ||
181 | + for (c16 in user_cat_16) { | ||
182 | + topic += c16 | ||
183 | + user_topic += (topic + "/") | ||
184 | + // debug | ||
185 | + // Log.d("topic : ", topic) | ||
186 | + | ||
187 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
188 | + if (!task.isSuccessful) { } // 성공 | ||
189 | + } | ||
190 | + /* topic 구독 코드 | ||
191 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
192 | + if (!task.isSuccessful) { } // 성공 | ||
193 | + } | ||
194 | + */ | ||
195 | + | ||
196 | + topic = topic.substring(0, topic.length - c16.length) | ||
197 | + } | ||
198 | + topic = topic.substring(0, topic.length - c15.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c14.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c13.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c12.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c11.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c10.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c9.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c8.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c7.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c6.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c5.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c4.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length - c3.length) | ||
223 | + } | ||
224 | + topic = topic.substring(0, topic.length - c2.length) | ||
225 | + } | ||
226 | + topic = topic.substring(0, topic.length-c1.length) | ||
227 | + } | ||
228 | + | ||
229 | + //Log.d("re:", user_topic) | ||
230 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
231 | + | ||
232 | + | ||
233 | + var intent = Intent(this, SignInActivity::class.java) | ||
234 | + startActivity(intent) | ||
235 | + } | ||
236 | + | ||
237 | + questionButton.setOnClickListener { | ||
238 | + val builder = AlertDialog.Builder(this) | ||
239 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
240 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
241 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
242 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
243 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
244 | + | ||
245 | + builder.setView(dialogView) | ||
246 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
247 | + //mainTv.text = dialogText.text.toString() | ||
248 | + //mainRb.rating = dialogRatingBar.rating | ||
249 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
250 | + | ||
251 | + } | ||
252 | + /* | ||
253 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
254 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
255 | + } | ||
256 | + */ | ||
257 | + .show() | ||
258 | + } | ||
259 | + | ||
17 | inmanButton.setOnClickListener { | 260 | inmanButton.setOnClickListener { |
18 | if(outmanButton.isChecked){ | 261 | if(outmanButton.isChecked){ |
19 | outmanButton.isChecked=false | 262 | outmanButton.isChecked=false |
... | @@ -30,9 +273,6 @@ class InputProfilFirstFiveActivity : AppCompatActivity() { | ... | @@ -30,9 +273,6 @@ class InputProfilFirstFiveActivity : AppCompatActivity() { |
30 | startActivity(intent) | 273 | startActivity(intent) |
31 | } | 274 | } |
32 | 275 | ||
33 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
34 | - val editor: SharedPreferences.Editor=prof.edit() | ||
35 | - | ||
36 | nextButton.setOnClickListener { | 276 | nextButton.setOnClickListener { |
37 | if(inmanButton.isChecked){ | 277 | if(inmanButton.isChecked){ |
38 | editor.putInt("c1_2",1); editor.commit() | 278 | editor.putInt("c1_2",1); editor.commit() | ... | ... |
... | @@ -6,21 +6,237 @@ import android.content.SharedPreferences | ... | @@ -6,21 +6,237 @@ import android.content.SharedPreferences |
6 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T | 6 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T |
7 | import androidx.appcompat.app.AppCompatActivity | 7 | import androidx.appcompat.app.AppCompatActivity |
8 | import android.os.Bundle | 8 | import android.os.Bundle |
9 | +import android.util.Log | ||
9 | import android.view.View | 10 | import android.view.View |
10 | -import android.widget.AdapterView | 11 | +import android.widget.* |
11 | -import android.widget.ArrayAdapter | 12 | +import androidx.appcompat.app.AlertDialog |
12 | -import android.widget.EditText | 13 | +import com.google.android.gms.tasks.OnCompleteListener |
14 | +import com.google.firebase.auth.FirebaseAuth | ||
15 | +import com.google.firebase.database.FirebaseDatabase | ||
16 | +import com.google.firebase.iid.FirebaseInstanceId | ||
17 | +import com.google.firebase.messaging.FirebaseMessaging | ||
13 | import kotlinx.android.synthetic.main.activity_input_profil_first_four.* | 18 | import kotlinx.android.synthetic.main.activity_input_profil_first_four.* |
14 | import kotlinx.android.synthetic.main.activity_input_profil_first_four.nextButton | 19 | import kotlinx.android.synthetic.main.activity_input_profil_first_four.nextButton |
15 | import kotlinx.android.synthetic.main.activity_input_profil_first_four.previousButton | 20 | import kotlinx.android.synthetic.main.activity_input_profil_first_four.previousButton |
16 | -import kotlinx.android.synthetic.main.activity_input_profil_first_three.* | ||
17 | 21 | ||
18 | class InputProfilFirstFourActivity : AppCompatActivity() { | 22 | class InputProfilFirstFourActivity : AppCompatActivity() { |
19 | 23 | ||
24 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
25 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
26 | + | ||
27 | + private fun sendToken(){ | ||
28 | + FirebaseInstanceId.getInstance().instanceId | ||
29 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
30 | + if (!task.isSuccessful) { | ||
31 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
32 | + return@OnCompleteListener | ||
33 | + } | ||
34 | + | ||
35 | + // Get new Instance ID token | ||
36 | + tkn = task.result!!.token | ||
37 | + | ||
38 | + // Log and toast | ||
39 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
40 | + //Log.d(TAG, msg) | ||
41 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
42 | + }) | ||
43 | + } | ||
44 | + | ||
45 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
46 | + val user = User(u_token, Policy!!) | ||
47 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
48 | + } | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
20 | override fun onCreate(savedInstanceState: Bundle?) { | 54 | override fun onCreate(savedInstanceState: Bundle?) { |
21 | super.onCreate(savedInstanceState) | 55 | super.onCreate(savedInstanceState) |
22 | setContentView(R.layout.activity_input_profil_first_four) | 56 | setContentView(R.layout.activity_input_profil_first_four) |
23 | 57 | ||
58 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
59 | + val editor: SharedPreferences.Editor=prof.edit() | ||
60 | + | ||
61 | + // 1. 툴바 사용 설정 | ||
62 | + setSupportActionBar(toolbar) | ||
63 | + | ||
64 | + //pushing code start | ||
65 | + intent.extras?.let { | ||
66 | + for (key in it.keySet()) { | ||
67 | + val value = intent.extras?.get(key) | ||
68 | + //Log.d(TAG, "Key: $key Value: $value") | ||
69 | + } | ||
70 | + } | ||
71 | + //pushing code end | ||
72 | + | ||
73 | + | ||
74 | + skipButton.setOnClickListener { | ||
75 | + sendToken() | ||
76 | + val user=firebaseAuth?.currentUser!!.uid | ||
77 | + Log.d("test:", user.toString()) | ||
78 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
79 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
80 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
81 | + 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") | ||
82 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
83 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
84 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + 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") | ||
89 | + 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") | ||
90 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
91 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
92 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
93 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
94 | + | ||
95 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
96 | + //var policy_string="" | ||
97 | + | ||
98 | + var user_cat_1 = mutableListOf("c1_1") | ||
99 | + var user_cat_2 = mutableListOf("c2_1") | ||
100 | + var user_cat_3 = mutableListOf("c3_1") | ||
101 | + var user_cat_4 = mutableListOf("c4_1") | ||
102 | + var user_cat_5 = mutableListOf("c5_1") | ||
103 | + var user_cat_6 = mutableListOf("c6_1") | ||
104 | + var user_cat_7 = mutableListOf("c7_1") | ||
105 | + var user_cat_8 = mutableListOf("c8_1") | ||
106 | + var user_cat_9 = mutableListOf("c9_1") | ||
107 | + var user_cat_10 = mutableListOf("c10_1") | ||
108 | + var user_cat_11 = mutableListOf("c11_1") | ||
109 | + var user_cat_12 = mutableListOf("c12_1") | ||
110 | + var user_cat_13 = mutableListOf("c13_1") | ||
111 | + var user_cat_14 = mutableListOf("c14_1") | ||
112 | + var user_cat_15 = mutableListOf("c15_1") | ||
113 | + var user_cat_16 = mutableListOf("c16_1") | ||
114 | + | ||
115 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
116 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
117 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
118 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
119 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
120 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
121 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
122 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
123 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
124 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
125 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
126 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
127 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
128 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
129 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
130 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
131 | + | ||
132 | + var topic = "" | ||
133 | + var user_topic = "" | ||
134 | + | ||
135 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
136 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
137 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
138 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
139 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
140 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
141 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
142 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
143 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
144 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
145 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
146 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
147 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
148 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
149 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
150 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
151 | + | ||
152 | + | ||
153 | + for(c1 in user_cat_1) { | ||
154 | + topic += c1 | ||
155 | + for (c2 in user_cat_2) { | ||
156 | + topic += c2 | ||
157 | + for (c3 in user_cat_3) { | ||
158 | + topic += c3 | ||
159 | + for (c4 in user_cat_4) { | ||
160 | + topic += c4 | ||
161 | + for (c5 in user_cat_5) { | ||
162 | + topic += c5 | ||
163 | + for (c6 in user_cat_6) { | ||
164 | + topic += c6 | ||
165 | + for (c7 in user_cat_7) { | ||
166 | + topic += c7 | ||
167 | + for (c8 in user_cat_8) { | ||
168 | + topic += c8 | ||
169 | + for (c9 in user_cat_9) { | ||
170 | + topic += c9 | ||
171 | + for (c10 in user_cat_10) { | ||
172 | + topic += c10 | ||
173 | + for (c11 in user_cat_11) { | ||
174 | + topic += c11 | ||
175 | + for (c12 in user_cat_12) { | ||
176 | + topic += c12 | ||
177 | + for (c13 in user_cat_13) { | ||
178 | + topic += c13 | ||
179 | + for (c14 in user_cat_14) { | ||
180 | + topic += c14 | ||
181 | + for (c15 in user_cat_15) { | ||
182 | + topic += c15 | ||
183 | + for (c16 in user_cat_16) { | ||
184 | + topic += c16 | ||
185 | + user_topic += (topic + "/") | ||
186 | + // debug | ||
187 | + // Log.d("topic : ", topic) | ||
188 | + | ||
189 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
190 | + if (!task.isSuccessful) { } // 성공 | ||
191 | + } | ||
192 | + /* topic 구독 코드 | ||
193 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
194 | + if (!task.isSuccessful) { } // 성공 | ||
195 | + } | ||
196 | + */ | ||
197 | + | ||
198 | + topic = topic.substring(0, topic.length - c16.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c15.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c14.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c13.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c12.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c11.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c10.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c9.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c8.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c7.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c6.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c5.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length - c4.length) | ||
223 | + } | ||
224 | + topic = topic.substring(0, topic.length - c3.length) | ||
225 | + } | ||
226 | + topic = topic.substring(0, topic.length - c2.length) | ||
227 | + } | ||
228 | + topic = topic.substring(0, topic.length-c1.length) | ||
229 | + } | ||
230 | + | ||
231 | + //Log.d("re:", user_topic) | ||
232 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
233 | + | ||
234 | + | ||
235 | + var intent = Intent(this, SignInActivity::class.java) | ||
236 | + startActivity(intent) | ||
237 | + } | ||
238 | + | ||
239 | + | ||
24 | previousButton.setOnClickListener { | 240 | previousButton.setOnClickListener { |
25 | var intent = Intent(this, InputProfilFirstThreeActivity::class.java) | 241 | var intent = Intent(this, InputProfilFirstThreeActivity::class.java) |
26 | startActivity(intent) | 242 | startActivity(intent) |
... | @@ -109,8 +325,6 @@ class InputProfilFirstFourActivity : AppCompatActivity() { | ... | @@ -109,8 +325,6 @@ class InputProfilFirstFourActivity : AppCompatActivity() { |
109 | } | 325 | } |
110 | } | 326 | } |
111 | 327 | ||
112 | - val prof: SharedPreferences=getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
113 | - val editor: SharedPreferences.Editor=prof.edit() | ||
114 | nextButton.setOnClickListener { | 328 | nextButton.setOnClickListener { |
115 | if(doSpinner.selectedItem.toString()=="서울특별시"){ editor.putInt("c11_2",1); editor.commit()} | 329 | if(doSpinner.selectedItem.toString()=="서울특별시"){ editor.putInt("c11_2",1); editor.commit()} |
116 | if(doSpinner.selectedItem.toString()=="부산광역시"){ editor.putInt("c11_3",1); editor.commit()} | 330 | if(doSpinner.selectedItem.toString()=="부산광역시"){ editor.putInt("c11_3",1); editor.commit()} | ... | ... |
... | @@ -3,16 +3,53 @@ package com.example.vip | ... | @@ -3,16 +3,53 @@ package com.example.vip |
3 | import android.content.Intent | 3 | import android.content.Intent |
4 | import androidx.appcompat.app.AppCompatActivity | 4 | import androidx.appcompat.app.AppCompatActivity |
5 | import android.os.Bundle | 5 | import android.os.Bundle |
6 | +import android.widget.Toast | ||
7 | +import com.google.android.gms.tasks.OnCompleteListener | ||
8 | +import com.google.firebase.auth.FirebaseAuth | ||
9 | +import com.google.firebase.database.FirebaseDatabase | ||
10 | +import com.google.firebase.iid.FirebaseInstanceId | ||
6 | import kotlinx.android.synthetic.main.activity_input_profil_first_one.* | 11 | import kotlinx.android.synthetic.main.activity_input_profil_first_one.* |
7 | 12 | ||
8 | class InputProfilFirstOneActivity : AppCompatActivity() { | 13 | class InputProfilFirstOneActivity : AppCompatActivity() { |
9 | 14 | ||
15 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
16 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
17 | + | ||
18 | + private fun sendToken(){ | ||
19 | + FirebaseInstanceId.getInstance().instanceId | ||
20 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
21 | + if (!task.isSuccessful) { | ||
22 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
23 | + return@OnCompleteListener | ||
24 | + } | ||
25 | + | ||
26 | + // Get new Instance ID token | ||
27 | + tkn = task.result!!.token | ||
28 | + | ||
29 | + // Log and toast | ||
30 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
31 | + //Log.d(TAG, msg) | ||
32 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
33 | + }) | ||
34 | + } | ||
35 | + | ||
36 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
37 | + val user = User(u_token, Policy!!) | ||
38 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
39 | + } | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
10 | override fun onCreate(savedInstanceState: Bundle?) { | 45 | override fun onCreate(savedInstanceState: Bundle?) { |
11 | super.onCreate(savedInstanceState) | 46 | super.onCreate(savedInstanceState) |
12 | setContentView(R.layout.activity_input_profil_first_one) | 47 | setContentView(R.layout.activity_input_profil_first_one) |
13 | 48 | ||
14 | 49 | ||
15 | 50 | ||
51 | + | ||
52 | + | ||
16 | inputStartButton.setOnClickListener { | 53 | inputStartButton.setOnClickListener { |
17 | var intent = Intent(this, InputProfilFirstTwoActivity::class.java) | 54 | var intent = Intent(this, InputProfilFirstTwoActivity::class.java) |
18 | startActivity(intent) | 55 | startActivity(intent) | ... | ... |
... | @@ -5,22 +5,262 @@ import android.content.Intent | ... | @@ -5,22 +5,262 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
8 | import kotlinx.android.synthetic.main.activity_input_profil_first_six.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_first_six.* |
9 | 18 | ||
10 | class InputProfilFirstSixActivity : AppCompatActivity() { | 19 | class InputProfilFirstSixActivity : AppCompatActivity() { |
11 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
12 | override fun onCreate(savedInstanceState: Bundle?) { | 51 | override fun onCreate(savedInstanceState: Bundle?) { |
13 | super.onCreate(savedInstanceState) | 52 | super.onCreate(savedInstanceState) |
14 | setContentView(R.layout.activity_input_profil_first_six) | 53 | setContentView(R.layout.activity_input_profil_first_six) |
15 | 54 | ||
55 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
56 | + val editor: SharedPreferences.Editor=prof.edit() | ||
57 | + | ||
58 | + // 1. 툴바 사용 설정 | ||
59 | + setSupportActionBar(toolbar) | ||
60 | + | ||
61 | + //pushing code start | ||
62 | + intent.extras?.let { | ||
63 | + for (key in it.keySet()) { | ||
64 | + val value = intent.extras?.get(key) | ||
65 | + //Log.d(TAG, "Key: $key Value: $value") | ||
66 | + } | ||
67 | + } | ||
68 | + //pushing code end | ||
69 | + | ||
70 | + | ||
71 | + skipButton.setOnClickListener { | ||
72 | + sendToken() | ||
73 | + val user=firebaseAuth?.currentUser!!.uid | ||
74 | + Log.d("test:", user.toString()) | ||
75 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
76 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
77 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
78 | + 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") | ||
79 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
80 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
81 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
88 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
89 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
90 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
91 | + | ||
92 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
93 | + //var policy_string="" | ||
94 | + | ||
95 | + var user_cat_1 = mutableListOf("c1_1") | ||
96 | + var user_cat_2 = mutableListOf("c2_1") | ||
97 | + var user_cat_3 = mutableListOf("c3_1") | ||
98 | + var user_cat_4 = mutableListOf("c4_1") | ||
99 | + var user_cat_5 = mutableListOf("c5_1") | ||
100 | + var user_cat_6 = mutableListOf("c6_1") | ||
101 | + var user_cat_7 = mutableListOf("c7_1") | ||
102 | + var user_cat_8 = mutableListOf("c8_1") | ||
103 | + var user_cat_9 = mutableListOf("c9_1") | ||
104 | + var user_cat_10 = mutableListOf("c10_1") | ||
105 | + var user_cat_11 = mutableListOf("c11_1") | ||
106 | + var user_cat_12 = mutableListOf("c12_1") | ||
107 | + var user_cat_13 = mutableListOf("c13_1") | ||
108 | + var user_cat_14 = mutableListOf("c14_1") | ||
109 | + var user_cat_15 = mutableListOf("c15_1") | ||
110 | + var user_cat_16 = mutableListOf("c16_1") | ||
111 | + | ||
112 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
113 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
114 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
115 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
116 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
117 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
118 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
119 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
120 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
121 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
122 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
123 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
124 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
125 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
126 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
127 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
128 | + | ||
129 | + var topic = "" | ||
130 | + var user_topic = "" | ||
131 | + | ||
132 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
133 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
134 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
135 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
136 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
137 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
138 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
139 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
140 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
141 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
142 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
143 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
144 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
145 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
146 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
147 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
148 | + | ||
149 | + | ||
150 | + for(c1 in user_cat_1) { | ||
151 | + topic += c1 | ||
152 | + for (c2 in user_cat_2) { | ||
153 | + topic += c2 | ||
154 | + for (c3 in user_cat_3) { | ||
155 | + topic += c3 | ||
156 | + for (c4 in user_cat_4) { | ||
157 | + topic += c4 | ||
158 | + for (c5 in user_cat_5) { | ||
159 | + topic += c5 | ||
160 | + for (c6 in user_cat_6) { | ||
161 | + topic += c6 | ||
162 | + for (c7 in user_cat_7) { | ||
163 | + topic += c7 | ||
164 | + for (c8 in user_cat_8) { | ||
165 | + topic += c8 | ||
166 | + for (c9 in user_cat_9) { | ||
167 | + topic += c9 | ||
168 | + for (c10 in user_cat_10) { | ||
169 | + topic += c10 | ||
170 | + for (c11 in user_cat_11) { | ||
171 | + topic += c11 | ||
172 | + for (c12 in user_cat_12) { | ||
173 | + topic += c12 | ||
174 | + for (c13 in user_cat_13) { | ||
175 | + topic += c13 | ||
176 | + for (c14 in user_cat_14) { | ||
177 | + topic += c14 | ||
178 | + for (c15 in user_cat_15) { | ||
179 | + topic += c15 | ||
180 | + for (c16 in user_cat_16) { | ||
181 | + topic += c16 | ||
182 | + user_topic += (topic + "/") | ||
183 | + // debug | ||
184 | + // Log.d("topic : ", topic) | ||
185 | + | ||
186 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
187 | + if (!task.isSuccessful) { } // 성공 | ||
188 | + } | ||
189 | + /* topic 구독 코드 | ||
190 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
191 | + if (!task.isSuccessful) { } // 성공 | ||
192 | + } | ||
193 | + */ | ||
194 | + | ||
195 | + topic = topic.substring(0, topic.length - c16.length) | ||
196 | + } | ||
197 | + topic = topic.substring(0, topic.length - c15.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c14.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c13.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c12.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c11.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c10.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c9.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c8.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c7.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c6.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c5.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c4.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c3.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c2.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length-c1.length) | ||
226 | + } | ||
227 | + | ||
228 | + //Log.d("re:", user_topic) | ||
229 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
230 | + | ||
231 | + | ||
232 | + var intent = Intent(this, SignInActivity::class.java) | ||
233 | + startActivity(intent) | ||
234 | + } | ||
235 | + | ||
236 | + questionButton.setOnClickListener { | ||
237 | + val builder = AlertDialog.Builder(this) | ||
238 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
239 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
240 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
241 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
242 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
243 | + | ||
244 | + builder.setView(dialogView) | ||
245 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
246 | + //mainTv.text = dialogText.text.toString() | ||
247 | + //mainRb.rating = dialogRatingBar.rating | ||
248 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
249 | + | ||
250 | + } | ||
251 | + /* | ||
252 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
253 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
254 | + } | ||
255 | + */ | ||
256 | + .show() | ||
257 | + } | ||
258 | + | ||
16 | previousButton.setOnClickListener { | 259 | previousButton.setOnClickListener { |
17 | var intent = Intent(this, InputProfilFirstFiveActivity::class.java) | 260 | var intent = Intent(this, InputProfilFirstFiveActivity::class.java) |
18 | startActivity(intent) | 261 | startActivity(intent) |
19 | } | 262 | } |
20 | 263 | ||
21 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
22 | - val editor: SharedPreferences.Editor=prof.edit() | ||
23 | - | ||
24 | nextButton.setOnClickListener { | 264 | nextButton.setOnClickListener { |
25 | if(gagoojooButton.isChecked){ | 265 | if(gagoojooButton.isChecked){ |
26 | editor.putInt("c13_2",1); editor.commit() | 266 | editor.putInt("c13_2",1); editor.commit() | ... | ... |
... | @@ -8,21 +8,255 @@ import android.os.Bundle | ... | @@ -8,21 +8,255 @@ import android.os.Bundle |
8 | import android.util.Log | 8 | import android.util.Log |
9 | import android.util.MonthDisplayHelper | 9 | import android.util.MonthDisplayHelper |
10 | import android.view.View | 10 | import android.view.View |
11 | -import android.widget.EditText | 11 | +import android.widget.* |
12 | -import android.widget.RadioButton | 12 | +import androidx.appcompat.app.AlertDialog |
13 | -import android.widget.RadioGroup | 13 | +import com.google.android.gms.tasks.OnCompleteListener |
14 | -import android.widget.Toast | 14 | +import com.google.firebase.auth.FirebaseAuth |
15 | -import kotlinx.android.synthetic.main.activity_input_profil_first_one.* | 15 | +import com.google.firebase.database.FirebaseDatabase |
16 | +import com.google.firebase.iid.FirebaseInstanceId | ||
17 | +import com.google.firebase.messaging.FirebaseMessaging | ||
16 | import kotlinx.android.synthetic.main.activity_input_profil_first_three.* | 18 | import kotlinx.android.synthetic.main.activity_input_profil_first_three.* |
17 | import kotlinx.android.synthetic.main.activity_input_profil_first_three.nextButton | 19 | import kotlinx.android.synthetic.main.activity_input_profil_first_three.nextButton |
18 | -import kotlinx.android.synthetic.main.activity_input_profil_first_two.* | ||
19 | 20 | ||
20 | class InputProfilFirstThreeActivity : AppCompatActivity() { | 21 | class InputProfilFirstThreeActivity : AppCompatActivity() { |
21 | 22 | ||
23 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
24 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
25 | + | ||
26 | + private fun sendToken(){ | ||
27 | + FirebaseInstanceId.getInstance().instanceId | ||
28 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
29 | + if (!task.isSuccessful) { | ||
30 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
31 | + return@OnCompleteListener | ||
32 | + } | ||
33 | + | ||
34 | + // Get new Instance ID token | ||
35 | + tkn = task.result!!.token | ||
36 | + | ||
37 | + // Log and toast | ||
38 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
39 | + //Log.d(TAG, msg) | ||
40 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
41 | + }) | ||
42 | + } | ||
43 | + | ||
44 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
45 | + val user = User(u_token, Policy!!) | ||
46 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
47 | + } | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
22 | override fun onCreate(savedInstanceState: Bundle?) { | 53 | override fun onCreate(savedInstanceState: Bundle?) { |
23 | super.onCreate(savedInstanceState) | 54 | super.onCreate(savedInstanceState) |
24 | setContentView(R.layout.activity_input_profil_first_three) | 55 | setContentView(R.layout.activity_input_profil_first_three) |
25 | 56 | ||
57 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
58 | + val editor: SharedPreferences.Editor=prof.edit() | ||
59 | + | ||
60 | + // 1. 툴바 사용 설정 | ||
61 | + setSupportActionBar(toolbar) | ||
62 | + | ||
63 | + //pushing code start | ||
64 | + intent.extras?.let { | ||
65 | + for (key in it.keySet()) { | ||
66 | + val value = intent.extras?.get(key) | ||
67 | + //Log.d(TAG, "Key: $key Value: $value") | ||
68 | + } | ||
69 | + } | ||
70 | + //pushing code end | ||
71 | + | ||
72 | + | ||
73 | + skipButton.setOnClickListener { | ||
74 | + sendToken() | ||
75 | + val user=firebaseAuth?.currentUser!!.uid | ||
76 | + Log.d("test:", user.toString()) | ||
77 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
78 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
79 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
80 | + 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") | ||
81 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
82 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
83 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + 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") | ||
89 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
90 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
91 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
92 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
93 | + | ||
94 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
95 | + //var policy_string="" | ||
96 | + | ||
97 | + var user_cat_1 = mutableListOf("c1_1") | ||
98 | + var user_cat_2 = mutableListOf("c2_1") | ||
99 | + var user_cat_3 = mutableListOf("c3_1") | ||
100 | + var user_cat_4 = mutableListOf("c4_1") | ||
101 | + var user_cat_5 = mutableListOf("c5_1") | ||
102 | + var user_cat_6 = mutableListOf("c6_1") | ||
103 | + var user_cat_7 = mutableListOf("c7_1") | ||
104 | + var user_cat_8 = mutableListOf("c8_1") | ||
105 | + var user_cat_9 = mutableListOf("c9_1") | ||
106 | + var user_cat_10 = mutableListOf("c10_1") | ||
107 | + var user_cat_11 = mutableListOf("c11_1") | ||
108 | + var user_cat_12 = mutableListOf("c12_1") | ||
109 | + var user_cat_13 = mutableListOf("c13_1") | ||
110 | + var user_cat_14 = mutableListOf("c14_1") | ||
111 | + var user_cat_15 = mutableListOf("c15_1") | ||
112 | + var user_cat_16 = mutableListOf("c16_1") | ||
113 | + | ||
114 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
115 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
116 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
117 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
118 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
119 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
120 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
121 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
122 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
123 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
124 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
125 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
126 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
127 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
128 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
129 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
130 | + | ||
131 | + var topic = "" | ||
132 | + var user_topic = "" | ||
133 | + | ||
134 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
135 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
136 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
137 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
138 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
139 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
140 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
141 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
142 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
143 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
144 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
145 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
146 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
147 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
148 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
149 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
150 | + | ||
151 | + | ||
152 | + for(c1 in user_cat_1) { | ||
153 | + topic += c1 | ||
154 | + for (c2 in user_cat_2) { | ||
155 | + topic += c2 | ||
156 | + for (c3 in user_cat_3) { | ||
157 | + topic += c3 | ||
158 | + for (c4 in user_cat_4) { | ||
159 | + topic += c4 | ||
160 | + for (c5 in user_cat_5) { | ||
161 | + topic += c5 | ||
162 | + for (c6 in user_cat_6) { | ||
163 | + topic += c6 | ||
164 | + for (c7 in user_cat_7) { | ||
165 | + topic += c7 | ||
166 | + for (c8 in user_cat_8) { | ||
167 | + topic += c8 | ||
168 | + for (c9 in user_cat_9) { | ||
169 | + topic += c9 | ||
170 | + for (c10 in user_cat_10) { | ||
171 | + topic += c10 | ||
172 | + for (c11 in user_cat_11) { | ||
173 | + topic += c11 | ||
174 | + for (c12 in user_cat_12) { | ||
175 | + topic += c12 | ||
176 | + for (c13 in user_cat_13) { | ||
177 | + topic += c13 | ||
178 | + for (c14 in user_cat_14) { | ||
179 | + topic += c14 | ||
180 | + for (c15 in user_cat_15) { | ||
181 | + topic += c15 | ||
182 | + for (c16 in user_cat_16) { | ||
183 | + topic += c16 | ||
184 | + user_topic += (topic + "/") | ||
185 | + // debug | ||
186 | + // Log.d("topic : ", topic) | ||
187 | + | ||
188 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
189 | + if (!task.isSuccessful) { } // 성공 | ||
190 | + } | ||
191 | + /* topic 구독 코드 | ||
192 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
193 | + if (!task.isSuccessful) { } // 성공 | ||
194 | + } | ||
195 | + */ | ||
196 | + | ||
197 | + topic = topic.substring(0, topic.length - c16.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c15.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c14.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c13.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c12.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c11.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c10.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c9.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c8.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c7.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c6.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c5.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c4.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c3.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length - c2.length) | ||
226 | + } | ||
227 | + topic = topic.substring(0, topic.length-c1.length) | ||
228 | + } | ||
229 | + | ||
230 | + //Log.d("re:", user_topic) | ||
231 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
232 | + | ||
233 | + | ||
234 | + var intent = Intent(this, SignInActivity::class.java) | ||
235 | + startActivity(intent) | ||
236 | + } | ||
237 | + | ||
238 | + questionButton.setOnClickListener { | ||
239 | + val builder = AlertDialog.Builder(this) | ||
240 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
241 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
242 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
243 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
244 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
245 | + | ||
246 | + builder.setView(dialogView) | ||
247 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
248 | + //mainTv.text = dialogText.text.toString() | ||
249 | + //mainRb.rating = dialogRatingBar.rating | ||
250 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
251 | + | ||
252 | + } | ||
253 | + /* | ||
254 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
255 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
256 | + } | ||
257 | + */ | ||
258 | + .show() | ||
259 | + } | ||
26 | /* not use this code start | 260 | /* not use this code start |
27 | radio_group.setOnCheckedChangeListener( | 261 | radio_group.setOnCheckedChangeListener( |
28 | RadioGroup.OnCheckedChangeListener { group, checkedId -> | 262 | RadioGroup.OnCheckedChangeListener { group, checkedId -> |
... | @@ -37,9 +271,6 @@ class InputProfilFirstThreeActivity : AppCompatActivity() { | ... | @@ -37,9 +271,6 @@ class InputProfilFirstThreeActivity : AppCompatActivity() { |
37 | startActivity(intent) | 271 | startActivity(intent) |
38 | } | 272 | } |
39 | 273 | ||
40 | - val prof: SharedPreferences=getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
41 | - val editor: SharedPreferences.Editor=prof.edit() | ||
42 | - | ||
43 | nextButton.setOnClickListener { | 274 | nextButton.setOnClickListener { |
44 | var intent = Intent(this, InputProfilFirstFourActivity::class.java) | 275 | var intent = Intent(this, InputProfilFirstFourActivity::class.java) |
45 | startActivity(intent) | 276 | startActivity(intent) | ... | ... |
... | @@ -7,14 +7,45 @@ import androidx.appcompat.app.AppCompatActivity | ... | @@ -7,14 +7,45 @@ import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | import android.util.Log | 8 | import android.util.Log |
9 | import android.widget.EditText | 9 | import android.widget.EditText |
10 | +import android.widget.TextView | ||
10 | import android.widget.Toast | 11 | import android.widget.Toast |
12 | +import androidx.appcompat.app.AlertDialog | ||
13 | +import com.google.android.gms.tasks.OnCompleteListener | ||
14 | +import com.google.firebase.auth.FirebaseAuth | ||
15 | +import com.google.firebase.database.FirebaseDatabase | ||
16 | +import com.google.firebase.iid.FirebaseInstanceId | ||
11 | import com.google.firebase.messaging.FirebaseMessaging | 17 | import com.google.firebase.messaging.FirebaseMessaging |
12 | import kotlinx.android.synthetic.main.activity_input_profil_first_two.* | 18 | import kotlinx.android.synthetic.main.activity_input_profil_first_two.* |
13 | import kotlinx.android.synthetic.main.activity_input_profil_first_two.nextButton | 19 | import kotlinx.android.synthetic.main.activity_input_profil_first_two.nextButton |
14 | -import kotlinx.android.synthetic.main.activity_input_profil_second_two.* | ||
15 | 20 | ||
16 | class InputProfilFirstTwoActivity : AppCompatActivity() { | 21 | class InputProfilFirstTwoActivity : AppCompatActivity() { |
17 | 22 | ||
23 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
24 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
25 | + | ||
26 | + private fun sendToken(){ | ||
27 | + FirebaseInstanceId.getInstance().instanceId | ||
28 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
29 | + if (!task.isSuccessful) { | ||
30 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
31 | + return@OnCompleteListener | ||
32 | + } | ||
33 | + | ||
34 | + // Get new Instance ID token | ||
35 | + tkn = task.result!!.token | ||
36 | + | ||
37 | + // Log and toast | ||
38 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
39 | + //Log.d(TAG, msg) | ||
40 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
41 | + }) | ||
42 | + } | ||
43 | + | ||
44 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
45 | + val user = User(u_token, Policy!!) | ||
46 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
47 | + } | ||
48 | + | ||
18 | override fun onCreate(savedInstanceState: Bundle?) { | 49 | override fun onCreate(savedInstanceState: Bundle?) { |
19 | super.onCreate(savedInstanceState) | 50 | super.onCreate(savedInstanceState) |
20 | setContentView(R.layout.activity_input_profil_first_two) | 51 | setContentView(R.layout.activity_input_profil_first_two) |
... | @@ -22,12 +53,211 @@ class InputProfilFirstTwoActivity : AppCompatActivity() { | ... | @@ -22,12 +53,211 @@ class InputProfilFirstTwoActivity : AppCompatActivity() { |
22 | val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | 53 | val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) |
23 | val editor: SharedPreferences.Editor=prof.edit() | 54 | val editor: SharedPreferences.Editor=prof.edit() |
24 | 55 | ||
25 | - //editor.putString("birthdate","none") | 56 | + // 1. 툴바 사용 설정 |
57 | + setSupportActionBar(toolbar) | ||
58 | + | ||
59 | + //pushing code start | ||
60 | + intent.extras?.let { | ||
61 | + for (key in it.keySet()) { | ||
62 | + val value = intent.extras?.get(key) | ||
63 | + //Log.d(TAG, "Key: $key Value: $value") | ||
64 | + } | ||
65 | + } | ||
66 | + //pushing code end | ||
26 | 67 | ||
27 | 68 | ||
28 | - nextButton.setOnClickListener { | 69 | + skipButton.setOnClickListener { |
70 | + sendToken() | ||
71 | + val user=firebaseAuth?.currentUser!!.uid | ||
72 | + Log.d("test:", user.toString()) | ||
73 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
74 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
75 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
76 | + 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") | ||
77 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
78 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
79 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
80 | + 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") | ||
81 | + 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") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
86 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
87 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
88 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
89 | + | ||
90 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
91 | + //var policy_string="" | ||
92 | + | ||
93 | + var user_cat_1 = mutableListOf("c1_1") | ||
94 | + var user_cat_2 = mutableListOf("c2_1") | ||
95 | + var user_cat_3 = mutableListOf("c3_1") | ||
96 | + var user_cat_4 = mutableListOf("c4_1") | ||
97 | + var user_cat_5 = mutableListOf("c5_1") | ||
98 | + var user_cat_6 = mutableListOf("c6_1") | ||
99 | + var user_cat_7 = mutableListOf("c7_1") | ||
100 | + var user_cat_8 = mutableListOf("c8_1") | ||
101 | + var user_cat_9 = mutableListOf("c9_1") | ||
102 | + var user_cat_10 = mutableListOf("c10_1") | ||
103 | + var user_cat_11 = mutableListOf("c11_1") | ||
104 | + var user_cat_12 = mutableListOf("c12_1") | ||
105 | + var user_cat_13 = mutableListOf("c13_1") | ||
106 | + var user_cat_14 = mutableListOf("c14_1") | ||
107 | + var user_cat_15 = mutableListOf("c15_1") | ||
108 | + var user_cat_16 = mutableListOf("c16_1") | ||
109 | + | ||
110 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
111 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
112 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
113 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
114 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
115 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
116 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
117 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
118 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
119 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
120 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
121 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
122 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
123 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
124 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
125 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
126 | + | ||
127 | + var topic = "" | ||
128 | + var user_topic = "" | ||
129 | + | ||
130 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
131 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
132 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
133 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
134 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
135 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
136 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
137 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
138 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
139 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
140 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
141 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
142 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
143 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
144 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
145 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
146 | + | ||
29 | 147 | ||
148 | + for(c1 in user_cat_1) { | ||
149 | + topic += c1 | ||
150 | + for (c2 in user_cat_2) { | ||
151 | + topic += c2 | ||
152 | + for (c3 in user_cat_3) { | ||
153 | + topic += c3 | ||
154 | + for (c4 in user_cat_4) { | ||
155 | + topic += c4 | ||
156 | + for (c5 in user_cat_5) { | ||
157 | + topic += c5 | ||
158 | + for (c6 in user_cat_6) { | ||
159 | + topic += c6 | ||
160 | + for (c7 in user_cat_7) { | ||
161 | + topic += c7 | ||
162 | + for (c8 in user_cat_8) { | ||
163 | + topic += c8 | ||
164 | + for (c9 in user_cat_9) { | ||
165 | + topic += c9 | ||
166 | + for (c10 in user_cat_10) { | ||
167 | + topic += c10 | ||
168 | + for (c11 in user_cat_11) { | ||
169 | + topic += c11 | ||
170 | + for (c12 in user_cat_12) { | ||
171 | + topic += c12 | ||
172 | + for (c13 in user_cat_13) { | ||
173 | + topic += c13 | ||
174 | + for (c14 in user_cat_14) { | ||
175 | + topic += c14 | ||
176 | + for (c15 in user_cat_15) { | ||
177 | + topic += c15 | ||
178 | + for (c16 in user_cat_16) { | ||
179 | + topic += c16 | ||
180 | + user_topic += (topic + "/") | ||
181 | + // debug | ||
182 | + // Log.d("topic : ", topic) | ||
30 | 183 | ||
184 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
185 | + if (!task.isSuccessful) { } // 성공 | ||
186 | + } | ||
187 | + /* topic 구독 코드 | ||
188 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
189 | + if (!task.isSuccessful) { } // 성공 | ||
190 | + } | ||
191 | + */ | ||
192 | + | ||
193 | + topic = topic.substring(0, topic.length - c16.length) | ||
194 | + } | ||
195 | + topic = topic.substring(0, topic.length - c15.length) | ||
196 | + } | ||
197 | + topic = topic.substring(0, topic.length - c14.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c13.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c12.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c11.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c10.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c9.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c8.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c7.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c6.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c5.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c4.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c3.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c2.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length-c1.length) | ||
224 | + } | ||
225 | + | ||
226 | + //Log.d("re:", user_topic) | ||
227 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
228 | + | ||
229 | + | ||
230 | + var intent = Intent(this, SignInActivity::class.java) | ||
231 | + startActivity(intent) | ||
232 | + } | ||
233 | + | ||
234 | + questionButton.setOnClickListener { | ||
235 | + val builder = AlertDialog.Builder(this) | ||
236 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
237 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
238 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
239 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
240 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
241 | + | ||
242 | + builder.setView(dialogView) | ||
243 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
244 | + //mainTv.text = dialogText.text.toString() | ||
245 | + //mainRb.rating = dialogRatingBar.rating | ||
246 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
247 | + | ||
248 | + } | ||
249 | + /* | ||
250 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
251 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
252 | + } | ||
253 | + */ | ||
254 | + .show() | ||
255 | + } | ||
256 | + | ||
257 | + //editor.putString("birthdate","none") | ||
258 | + | ||
259 | + | ||
260 | + nextButton.setOnClickListener { | ||
31 | var birthdateinput=findViewById<EditText>(R.id.editText).text.toString() | 261 | var birthdateinput=findViewById<EditText>(R.id.editText).text.toString() |
32 | var birthdateint = 0 | 262 | var birthdateint = 0 |
33 | if (birthdateinput == "") { | 263 | if (birthdateinput == "") { | ... | ... |
... | @@ -5,22 +5,259 @@ import android.content.Intent | ... | @@ -5,22 +5,259 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
8 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_five.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_five.* |
9 | 18 | ||
10 | class InputProfilFourthFiveActivity : AppCompatActivity() { | 19 | class InputProfilFourthFiveActivity : AppCompatActivity() { |
11 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
12 | override fun onCreate(savedInstanceState: Bundle?) { | 48 | override fun onCreate(savedInstanceState: Bundle?) { |
13 | super.onCreate(savedInstanceState) | 49 | super.onCreate(savedInstanceState) |
14 | setContentView(R.layout.activity_input_profil_fourth_five) | 50 | setContentView(R.layout.activity_input_profil_fourth_five) |
15 | 51 | ||
52 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
53 | + val editor: SharedPreferences.Editor=prof.edit() | ||
54 | + | ||
55 | + // 1. 툴바 사용 설정 | ||
56 | + setSupportActionBar(toolbar) | ||
57 | + | ||
58 | + //pushing code start | ||
59 | + intent.extras?.let { | ||
60 | + for (key in it.keySet()) { | ||
61 | + val value = intent.extras?.get(key) | ||
62 | + //Log.d(TAG, "Key: $key Value: $value") | ||
63 | + } | ||
64 | + } | ||
65 | + //pushing code end | ||
66 | + | ||
67 | + | ||
68 | + skipButton.setOnClickListener { | ||
69 | + sendToken() | ||
70 | + val user=firebaseAuth?.currentUser!!.uid | ||
71 | + Log.d("test:", user.toString()) | ||
72 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
73 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
74 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
75 | + 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") | ||
76 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
77 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
78 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
79 | + 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") | ||
80 | + 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") | ||
81 | + 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") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
85 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
86 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
87 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
88 | + | ||
89 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
90 | + //var policy_string="" | ||
91 | + | ||
92 | + var user_cat_1 = mutableListOf("c1_1") | ||
93 | + var user_cat_2 = mutableListOf("c2_1") | ||
94 | + var user_cat_3 = mutableListOf("c3_1") | ||
95 | + var user_cat_4 = mutableListOf("c4_1") | ||
96 | + var user_cat_5 = mutableListOf("c5_1") | ||
97 | + var user_cat_6 = mutableListOf("c6_1") | ||
98 | + var user_cat_7 = mutableListOf("c7_1") | ||
99 | + var user_cat_8 = mutableListOf("c8_1") | ||
100 | + var user_cat_9 = mutableListOf("c9_1") | ||
101 | + var user_cat_10 = mutableListOf("c10_1") | ||
102 | + var user_cat_11 = mutableListOf("c11_1") | ||
103 | + var user_cat_12 = mutableListOf("c12_1") | ||
104 | + var user_cat_13 = mutableListOf("c13_1") | ||
105 | + var user_cat_14 = mutableListOf("c14_1") | ||
106 | + var user_cat_15 = mutableListOf("c15_1") | ||
107 | + var user_cat_16 = mutableListOf("c16_1") | ||
108 | + | ||
109 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
110 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
111 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
112 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
113 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
114 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
115 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
116 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
117 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
118 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
119 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
120 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
121 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
122 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
123 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
124 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
125 | + | ||
126 | + var topic = "" | ||
127 | + var user_topic = "" | ||
128 | + | ||
129 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
130 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
131 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
132 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
133 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
134 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
135 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
136 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
137 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
138 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
139 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
140 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
141 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
142 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
143 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
144 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
145 | + | ||
146 | + | ||
147 | + for(c1 in user_cat_1) { | ||
148 | + topic += c1 | ||
149 | + for (c2 in user_cat_2) { | ||
150 | + topic += c2 | ||
151 | + for (c3 in user_cat_3) { | ||
152 | + topic += c3 | ||
153 | + for (c4 in user_cat_4) { | ||
154 | + topic += c4 | ||
155 | + for (c5 in user_cat_5) { | ||
156 | + topic += c5 | ||
157 | + for (c6 in user_cat_6) { | ||
158 | + topic += c6 | ||
159 | + for (c7 in user_cat_7) { | ||
160 | + topic += c7 | ||
161 | + for (c8 in user_cat_8) { | ||
162 | + topic += c8 | ||
163 | + for (c9 in user_cat_9) { | ||
164 | + topic += c9 | ||
165 | + for (c10 in user_cat_10) { | ||
166 | + topic += c10 | ||
167 | + for (c11 in user_cat_11) { | ||
168 | + topic += c11 | ||
169 | + for (c12 in user_cat_12) { | ||
170 | + topic += c12 | ||
171 | + for (c13 in user_cat_13) { | ||
172 | + topic += c13 | ||
173 | + for (c14 in user_cat_14) { | ||
174 | + topic += c14 | ||
175 | + for (c15 in user_cat_15) { | ||
176 | + topic += c15 | ||
177 | + for (c16 in user_cat_16) { | ||
178 | + topic += c16 | ||
179 | + user_topic += (topic + "/") | ||
180 | + // debug | ||
181 | + // Log.d("topic : ", topic) | ||
182 | + | ||
183 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
184 | + if (!task.isSuccessful) { } // 성공 | ||
185 | + } | ||
186 | + /* topic 구독 코드 | ||
187 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
188 | + if (!task.isSuccessful) { } // 성공 | ||
189 | + } | ||
190 | + */ | ||
191 | + | ||
192 | + topic = topic.substring(0, topic.length - c16.length) | ||
193 | + } | ||
194 | + topic = topic.substring(0, topic.length - c15.length) | ||
195 | + } | ||
196 | + topic = topic.substring(0, topic.length - c14.length) | ||
197 | + } | ||
198 | + topic = topic.substring(0, topic.length - c13.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c12.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c11.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c10.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c9.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c8.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c7.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c6.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c5.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c4.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c3.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c2.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length-c1.length) | ||
223 | + } | ||
224 | + | ||
225 | + //Log.d("re:", user_topic) | ||
226 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
227 | + | ||
228 | + | ||
229 | + var intent = Intent(this, SignInActivity::class.java) | ||
230 | + startActivity(intent) | ||
231 | + } | ||
232 | + | ||
233 | + questionButton.setOnClickListener { | ||
234 | + val builder = AlertDialog.Builder(this) | ||
235 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
236 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
237 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
238 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
239 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
240 | + | ||
241 | + builder.setView(dialogView) | ||
242 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
243 | + //mainTv.text = dialogText.text.toString() | ||
244 | + //mainRb.rating = dialogRatingBar.rating | ||
245 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
246 | + | ||
247 | + } | ||
248 | + /* | ||
249 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
250 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
251 | + } | ||
252 | + */ | ||
253 | + .show() | ||
254 | + } | ||
255 | + | ||
16 | previousButton.setOnClickListener { | 256 | previousButton.setOnClickListener { |
17 | var intent = Intent(this, InputProfilFourthFourActivity::class.java) | 257 | var intent = Intent(this, InputProfilFourthFourActivity::class.java) |
18 | startActivity(intent) | 258 | startActivity(intent) |
19 | } | 259 | } |
20 | 260 | ||
21 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
22 | - val editor: SharedPreferences.Editor=prof.edit() | ||
23 | - | ||
24 | nextButton.setOnClickListener { | 261 | nextButton.setOnClickListener { |
25 | if(nothingButton.isChecked){editor.putInt("c8_1",1); editor.commit()} | 262 | if(nothingButton.isChecked){editor.putInt("c8_1",1); editor.commit()} |
26 | if(iljaeButton.isChecked){editor.putInt("c8_12",1); editor.commit()} | 263 | if(iljaeButton.isChecked){editor.putInt("c8_12",1); editor.commit()} |
... | @@ -29,6 +266,7 @@ class InputProfilFourthFiveActivity : AppCompatActivity() { | ... | @@ -29,6 +266,7 @@ class InputProfilFourthFiveActivity : AppCompatActivity() { |
29 | if(guitarButton.isChecked){editor.putInt("c8_17",1); editor.commit()} | 266 | if(guitarButton.isChecked){editor.putInt("c8_17",1); editor.commit()} |
30 | //기타가 똑같은거 지정 | 267 | //기타가 똑같은거 지정 |
31 | 268 | ||
269 | + /* | ||
32 | editor.putInt("c1_1",1); editor.commit() | 270 | editor.putInt("c1_1",1); editor.commit() |
33 | editor.putInt("c2_1",1); editor.commit() | 271 | editor.putInt("c2_1",1); editor.commit() |
34 | editor.putInt("c3_1",1); editor.commit() | 272 | editor.putInt("c3_1",1); editor.commit() |
... | @@ -45,6 +283,7 @@ class InputProfilFourthFiveActivity : AppCompatActivity() { | ... | @@ -45,6 +283,7 @@ class InputProfilFourthFiveActivity : AppCompatActivity() { |
45 | editor.putInt("c14_1",1); editor.commit() | 283 | editor.putInt("c14_1",1); editor.commit() |
46 | editor.putInt("c15_1",1); editor.commit() | 284 | editor.putInt("c15_1",1); editor.commit() |
47 | editor.putInt("c16_1",1); editor.commit() | 285 | editor.putInt("c16_1",1); editor.commit() |
286 | + */ | ||
48 | 287 | ||
49 | 288 | ||
50 | 289 | ... | ... |
... | @@ -5,22 +5,261 @@ import android.content.Intent | ... | @@ -5,22 +5,261 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
8 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_four.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_four.* |
9 | 18 | ||
10 | class InputProfilFourthFourActivity : AppCompatActivity() { | 19 | class InputProfilFourthFourActivity : AppCompatActivity() { |
11 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
12 | override fun onCreate(savedInstanceState: Bundle?) { | 51 | override fun onCreate(savedInstanceState: Bundle?) { |
13 | super.onCreate(savedInstanceState) | 52 | super.onCreate(savedInstanceState) |
14 | setContentView(R.layout.activity_input_profil_fourth_four) | 53 | setContentView(R.layout.activity_input_profil_fourth_four) |
15 | 54 | ||
16 | - previousButton.setOnClickListener { | 55 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) |
17 | - var intent = Intent(this, InputProfilFourthThreeActivity::class.java) | 56 | + val editor: SharedPreferences.Editor=prof.edit() |
57 | + | ||
58 | + // 1. 툴바 사용 설정 | ||
59 | + setSupportActionBar(toolbar) | ||
60 | + | ||
61 | + //pushing code start | ||
62 | + intent.extras?.let { | ||
63 | + for (key in it.keySet()) { | ||
64 | + val value = intent.extras?.get(key) | ||
65 | + //Log.d(TAG, "Key: $key Value: $value") | ||
66 | + } | ||
67 | + } | ||
68 | + //pushing code end | ||
69 | + | ||
70 | + | ||
71 | + skipButton.setOnClickListener { | ||
72 | + sendToken() | ||
73 | + val user=firebaseAuth?.currentUser!!.uid | ||
74 | + Log.d("test:", user.toString()) | ||
75 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
76 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
77 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
78 | + 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") | ||
79 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
80 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
81 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
88 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
89 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
90 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
91 | + | ||
92 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
93 | + //var policy_string="" | ||
94 | + | ||
95 | + var user_cat_1 = mutableListOf("c1_1") | ||
96 | + var user_cat_2 = mutableListOf("c2_1") | ||
97 | + var user_cat_3 = mutableListOf("c3_1") | ||
98 | + var user_cat_4 = mutableListOf("c4_1") | ||
99 | + var user_cat_5 = mutableListOf("c5_1") | ||
100 | + var user_cat_6 = mutableListOf("c6_1") | ||
101 | + var user_cat_7 = mutableListOf("c7_1") | ||
102 | + var user_cat_8 = mutableListOf("c8_1") | ||
103 | + var user_cat_9 = mutableListOf("c9_1") | ||
104 | + var user_cat_10 = mutableListOf("c10_1") | ||
105 | + var user_cat_11 = mutableListOf("c11_1") | ||
106 | + var user_cat_12 = mutableListOf("c12_1") | ||
107 | + var user_cat_13 = mutableListOf("c13_1") | ||
108 | + var user_cat_14 = mutableListOf("c14_1") | ||
109 | + var user_cat_15 = mutableListOf("c15_1") | ||
110 | + var user_cat_16 = mutableListOf("c16_1") | ||
111 | + | ||
112 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
113 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
114 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
115 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
116 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
117 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
118 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
119 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
120 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
121 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
122 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
123 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
124 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
125 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
126 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
127 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
128 | + | ||
129 | + var topic = "" | ||
130 | + var user_topic = "" | ||
131 | + | ||
132 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
133 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
134 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
135 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
136 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
137 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
138 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
139 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
140 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
141 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
142 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
143 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
144 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
145 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
146 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
147 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
148 | + | ||
149 | + | ||
150 | + for(c1 in user_cat_1) { | ||
151 | + topic += c1 | ||
152 | + for (c2 in user_cat_2) { | ||
153 | + topic += c2 | ||
154 | + for (c3 in user_cat_3) { | ||
155 | + topic += c3 | ||
156 | + for (c4 in user_cat_4) { | ||
157 | + topic += c4 | ||
158 | + for (c5 in user_cat_5) { | ||
159 | + topic += c5 | ||
160 | + for (c6 in user_cat_6) { | ||
161 | + topic += c6 | ||
162 | + for (c7 in user_cat_7) { | ||
163 | + topic += c7 | ||
164 | + for (c8 in user_cat_8) { | ||
165 | + topic += c8 | ||
166 | + for (c9 in user_cat_9) { | ||
167 | + topic += c9 | ||
168 | + for (c10 in user_cat_10) { | ||
169 | + topic += c10 | ||
170 | + for (c11 in user_cat_11) { | ||
171 | + topic += c11 | ||
172 | + for (c12 in user_cat_12) { | ||
173 | + topic += c12 | ||
174 | + for (c13 in user_cat_13) { | ||
175 | + topic += c13 | ||
176 | + for (c14 in user_cat_14) { | ||
177 | + topic += c14 | ||
178 | + for (c15 in user_cat_15) { | ||
179 | + topic += c15 | ||
180 | + for (c16 in user_cat_16) { | ||
181 | + topic += c16 | ||
182 | + user_topic += (topic + "/") | ||
183 | + // debug | ||
184 | + // Log.d("topic : ", topic) | ||
185 | + | ||
186 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
187 | + if (!task.isSuccessful) { } // 성공 | ||
188 | + } | ||
189 | + /* topic 구독 코드 | ||
190 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
191 | + if (!task.isSuccessful) { } // 성공 | ||
192 | + } | ||
193 | + */ | ||
194 | + | ||
195 | + topic = topic.substring(0, topic.length - c16.length) | ||
196 | + } | ||
197 | + topic = topic.substring(0, topic.length - c15.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c14.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c13.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c12.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c11.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c10.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c9.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c8.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c7.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c6.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c5.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c4.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c3.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c2.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length-c1.length) | ||
226 | + } | ||
227 | + | ||
228 | + //Log.d("re:", user_topic) | ||
229 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
230 | + | ||
231 | + | ||
232 | + var intent = Intent(this, SignInActivity::class.java) | ||
18 | startActivity(intent) | 233 | startActivity(intent) |
19 | } | 234 | } |
20 | 235 | ||
21 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | 236 | + questionButton.setOnClickListener { |
22 | - val editor: SharedPreferences.Editor=prof.edit() | 237 | + val builder = AlertDialog.Builder(this) |
238 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
239 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
240 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
241 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
242 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
243 | + | ||
244 | + builder.setView(dialogView) | ||
245 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
246 | + //mainTv.text = dialogText.text.toString() | ||
247 | + //mainRb.rating = dialogRatingBar.rating | ||
248 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
249 | + | ||
250 | + } | ||
251 | + /* | ||
252 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
253 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
254 | + } | ||
255 | + */ | ||
256 | + .show() | ||
257 | + } | ||
23 | 258 | ||
259 | + previousButton.setOnClickListener { | ||
260 | + var intent = Intent(this, InputProfilFourthThreeActivity::class.java) | ||
261 | + startActivity(intent) | ||
262 | + } | ||
24 | nextButton.setOnClickListener { | 263 | nextButton.setOnClickListener { |
25 | 264 | ||
26 | if(nothingButton.isChecked){editor.putInt("c8_1",1); editor.commit()} | 265 | if(nothingButton.isChecked){editor.putInt("c8_1",1); editor.commit()} | ... | ... |
... | @@ -5,17 +5,258 @@ import android.content.Intent | ... | @@ -5,17 +5,258 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
8 | import android.view.View.GONE | 9 | import android.view.View.GONE |
9 | import android.view.View.VISIBLE | 10 | import android.view.View.VISIBLE |
10 | import android.widget.TextView | 11 | import android.widget.TextView |
12 | +import android.widget.Toast | ||
11 | import androidx.appcompat.app.AlertDialog | 13 | import androidx.appcompat.app.AlertDialog |
14 | +import com.google.android.gms.tasks.OnCompleteListener | ||
15 | +import com.google.firebase.auth.FirebaseAuth | ||
16 | +import com.google.firebase.database.FirebaseDatabase | ||
17 | +import com.google.firebase.iid.FirebaseInstanceId | ||
18 | +import com.google.firebase.messaging.FirebaseMessaging | ||
12 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_one.* | 19 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_one.* |
13 | 20 | ||
14 | class InputProfilFourthOneActivity : AppCompatActivity() { | 21 | class InputProfilFourthOneActivity : AppCompatActivity() { |
15 | 22 | ||
23 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
24 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
25 | + | ||
26 | + private fun sendToken(){ | ||
27 | + FirebaseInstanceId.getInstance().instanceId | ||
28 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
29 | + if (!task.isSuccessful) { | ||
30 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
31 | + return@OnCompleteListener | ||
32 | + } | ||
33 | + | ||
34 | + // Get new Instance ID token | ||
35 | + tkn = task.result!!.token | ||
36 | + | ||
37 | + // Log and toast | ||
38 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
39 | + //Log.d(TAG, msg) | ||
40 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
41 | + }) | ||
42 | + } | ||
43 | + | ||
44 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
45 | + val user = User(u_token, Policy!!) | ||
46 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
47 | + } | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
16 | override fun onCreate(savedInstanceState: Bundle?) { | 53 | override fun onCreate(savedInstanceState: Bundle?) { |
17 | super.onCreate(savedInstanceState) | 54 | super.onCreate(savedInstanceState) |
18 | setContentView(R.layout.activity_input_profil_fourth_one) | 55 | setContentView(R.layout.activity_input_profil_fourth_one) |
56 | + | ||
57 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
58 | + val editor: SharedPreferences.Editor=prof.edit() | ||
59 | + | ||
60 | + // 1. 툴바 사용 설정 | ||
61 | + setSupportActionBar(toolbar) | ||
62 | + | ||
63 | + //pushing code start | ||
64 | + intent.extras?.let { | ||
65 | + for (key in it.keySet()) { | ||
66 | + val value = intent.extras?.get(key) | ||
67 | + //Log.d(TAG, "Key: $key Value: $value") | ||
68 | + } | ||
69 | + } | ||
70 | + //pushing code end | ||
71 | + | ||
72 | + | ||
73 | + skipButton.setOnClickListener { | ||
74 | + sendToken() | ||
75 | + val user=firebaseAuth?.currentUser!!.uid | ||
76 | + Log.d("test:", user.toString()) | ||
77 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
78 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
79 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
80 | + 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") | ||
81 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
82 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
83 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + 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") | ||
89 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
90 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
91 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
92 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
93 | + | ||
94 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
95 | + //var policy_string="" | ||
96 | + | ||
97 | + var user_cat_1 = mutableListOf("c1_1") | ||
98 | + var user_cat_2 = mutableListOf("c2_1") | ||
99 | + var user_cat_3 = mutableListOf("c3_1") | ||
100 | + var user_cat_4 = mutableListOf("c4_1") | ||
101 | + var user_cat_5 = mutableListOf("c5_1") | ||
102 | + var user_cat_6 = mutableListOf("c6_1") | ||
103 | + var user_cat_7 = mutableListOf("c7_1") | ||
104 | + var user_cat_8 = mutableListOf("c8_1") | ||
105 | + var user_cat_9 = mutableListOf("c9_1") | ||
106 | + var user_cat_10 = mutableListOf("c10_1") | ||
107 | + var user_cat_11 = mutableListOf("c11_1") | ||
108 | + var user_cat_12 = mutableListOf("c12_1") | ||
109 | + var user_cat_13 = mutableListOf("c13_1") | ||
110 | + var user_cat_14 = mutableListOf("c14_1") | ||
111 | + var user_cat_15 = mutableListOf("c15_1") | ||
112 | + var user_cat_16 = mutableListOf("c16_1") | ||
113 | + | ||
114 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
115 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
116 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
117 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
118 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
119 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
120 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
121 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
122 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
123 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
124 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
125 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
126 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
127 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
128 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
129 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
130 | + | ||
131 | + var topic = "" | ||
132 | + var user_topic = "" | ||
133 | + | ||
134 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
135 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
136 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
137 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
138 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
139 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
140 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
141 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
142 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
143 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
144 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
145 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
146 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
147 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
148 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
149 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
150 | + | ||
151 | + | ||
152 | + for(c1 in user_cat_1) { | ||
153 | + topic += c1 | ||
154 | + for (c2 in user_cat_2) { | ||
155 | + topic += c2 | ||
156 | + for (c3 in user_cat_3) { | ||
157 | + topic += c3 | ||
158 | + for (c4 in user_cat_4) { | ||
159 | + topic += c4 | ||
160 | + for (c5 in user_cat_5) { | ||
161 | + topic += c5 | ||
162 | + for (c6 in user_cat_6) { | ||
163 | + topic += c6 | ||
164 | + for (c7 in user_cat_7) { | ||
165 | + topic += c7 | ||
166 | + for (c8 in user_cat_8) { | ||
167 | + topic += c8 | ||
168 | + for (c9 in user_cat_9) { | ||
169 | + topic += c9 | ||
170 | + for (c10 in user_cat_10) { | ||
171 | + topic += c10 | ||
172 | + for (c11 in user_cat_11) { | ||
173 | + topic += c11 | ||
174 | + for (c12 in user_cat_12) { | ||
175 | + topic += c12 | ||
176 | + for (c13 in user_cat_13) { | ||
177 | + topic += c13 | ||
178 | + for (c14 in user_cat_14) { | ||
179 | + topic += c14 | ||
180 | + for (c15 in user_cat_15) { | ||
181 | + topic += c15 | ||
182 | + for (c16 in user_cat_16) { | ||
183 | + topic += c16 | ||
184 | + user_topic += (topic + "/") | ||
185 | + // debug | ||
186 | + // Log.d("topic : ", topic) | ||
187 | + | ||
188 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
189 | + if (!task.isSuccessful) { } // 성공 | ||
190 | + } | ||
191 | + /* topic 구독 코드 | ||
192 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
193 | + if (!task.isSuccessful) { } // 성공 | ||
194 | + } | ||
195 | + */ | ||
196 | + | ||
197 | + topic = topic.substring(0, topic.length - c16.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c15.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c14.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c13.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c12.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c11.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c10.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c9.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c8.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c7.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c6.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c5.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c4.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c3.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length - c2.length) | ||
226 | + } | ||
227 | + topic = topic.substring(0, topic.length-c1.length) | ||
228 | + } | ||
229 | + | ||
230 | + //Log.d("re:", user_topic) | ||
231 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
232 | + | ||
233 | + | ||
234 | + var intent = Intent(this, SignInActivity::class.java) | ||
235 | + startActivity(intent) | ||
236 | + } | ||
237 | + | ||
238 | + questionButton.setOnClickListener { | ||
239 | + val builder = AlertDialog.Builder(this) | ||
240 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
241 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
242 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
243 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
244 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
245 | + | ||
246 | + builder.setView(dialogView) | ||
247 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
248 | + //mainTv.text = dialogText.text.toString() | ||
249 | + //mainRb.rating = dialogRatingBar.rating | ||
250 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
251 | + | ||
252 | + } | ||
253 | + /* | ||
254 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
255 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
256 | + } | ||
257 | + */ | ||
258 | + .show() | ||
259 | + } | ||
19 | //보유 | 260 | //보유 |
20 | //미보유 - 전세 월세 공공주택 무상임대 보장기관 기타 | 261 | //미보유 - 전세 월세 공공주택 무상임대 보장기관 기타 |
21 | 262 | ||
... | @@ -57,8 +298,6 @@ class InputProfilFourthOneActivity : AppCompatActivity() { | ... | @@ -57,8 +298,6 @@ class InputProfilFourthOneActivity : AppCompatActivity() { |
57 | 298 | ||
58 | } | 299 | } |
59 | 300 | ||
60 | - val prof: SharedPreferences=getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
61 | - val editor: SharedPreferences.Editor=prof.edit() | ||
62 | 301 | ||
63 | previousButton.setOnClickListener { | 302 | previousButton.setOnClickListener { |
64 | var intent = Intent(this, InputProfilThirdFourActivity::class.java) | 303 | var intent = Intent(this, InputProfilThirdFourActivity::class.java) | ... | ... |
... | @@ -5,22 +5,262 @@ import android.content.Intent | ... | @@ -5,22 +5,262 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
8 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_three.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_three.* |
9 | 18 | ||
10 | class InputProfilFourthThreeActivity : AppCompatActivity() { | 19 | class InputProfilFourthThreeActivity : AppCompatActivity() { |
11 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
12 | override fun onCreate(savedInstanceState: Bundle?) { | 51 | override fun onCreate(savedInstanceState: Bundle?) { |
13 | super.onCreate(savedInstanceState) | 52 | super.onCreate(savedInstanceState) |
14 | setContentView(R.layout.activity_input_profil_fourth_three) | 53 | setContentView(R.layout.activity_input_profil_fourth_three) |
15 | 54 | ||
55 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
56 | + val editor: SharedPreferences.Editor=prof.edit() | ||
57 | + | ||
58 | + // 1. 툴바 사용 설정 | ||
59 | + setSupportActionBar(toolbar) | ||
60 | + | ||
61 | + //pushing code start | ||
62 | + intent.extras?.let { | ||
63 | + for (key in it.keySet()) { | ||
64 | + val value = intent.extras?.get(key) | ||
65 | + //Log.d(TAG, "Key: $key Value: $value") | ||
66 | + } | ||
67 | + } | ||
68 | + //pushing code end | ||
69 | + | ||
70 | + | ||
71 | + skipButton.setOnClickListener { | ||
72 | + sendToken() | ||
73 | + val user=firebaseAuth?.currentUser!!.uid | ||
74 | + Log.d("test:", user.toString()) | ||
75 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
76 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
77 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
78 | + 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") | ||
79 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
80 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
81 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
88 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
89 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
90 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
91 | + | ||
92 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
93 | + //var policy_string="" | ||
94 | + | ||
95 | + var user_cat_1 = mutableListOf("c1_1") | ||
96 | + var user_cat_2 = mutableListOf("c2_1") | ||
97 | + var user_cat_3 = mutableListOf("c3_1") | ||
98 | + var user_cat_4 = mutableListOf("c4_1") | ||
99 | + var user_cat_5 = mutableListOf("c5_1") | ||
100 | + var user_cat_6 = mutableListOf("c6_1") | ||
101 | + var user_cat_7 = mutableListOf("c7_1") | ||
102 | + var user_cat_8 = mutableListOf("c8_1") | ||
103 | + var user_cat_9 = mutableListOf("c9_1") | ||
104 | + var user_cat_10 = mutableListOf("c10_1") | ||
105 | + var user_cat_11 = mutableListOf("c11_1") | ||
106 | + var user_cat_12 = mutableListOf("c12_1") | ||
107 | + var user_cat_13 = mutableListOf("c13_1") | ||
108 | + var user_cat_14 = mutableListOf("c14_1") | ||
109 | + var user_cat_15 = mutableListOf("c15_1") | ||
110 | + var user_cat_16 = mutableListOf("c16_1") | ||
111 | + | ||
112 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
113 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
114 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
115 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
116 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
117 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
118 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
119 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
120 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
121 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
122 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
123 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
124 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
125 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
126 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
127 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
128 | + | ||
129 | + var topic = "" | ||
130 | + var user_topic = "" | ||
131 | + | ||
132 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
133 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
134 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
135 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
136 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
137 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
138 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
139 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
140 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
141 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
142 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
143 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
144 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
145 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
146 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
147 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
148 | + | ||
149 | + | ||
150 | + for(c1 in user_cat_1) { | ||
151 | + topic += c1 | ||
152 | + for (c2 in user_cat_2) { | ||
153 | + topic += c2 | ||
154 | + for (c3 in user_cat_3) { | ||
155 | + topic += c3 | ||
156 | + for (c4 in user_cat_4) { | ||
157 | + topic += c4 | ||
158 | + for (c5 in user_cat_5) { | ||
159 | + topic += c5 | ||
160 | + for (c6 in user_cat_6) { | ||
161 | + topic += c6 | ||
162 | + for (c7 in user_cat_7) { | ||
163 | + topic += c7 | ||
164 | + for (c8 in user_cat_8) { | ||
165 | + topic += c8 | ||
166 | + for (c9 in user_cat_9) { | ||
167 | + topic += c9 | ||
168 | + for (c10 in user_cat_10) { | ||
169 | + topic += c10 | ||
170 | + for (c11 in user_cat_11) { | ||
171 | + topic += c11 | ||
172 | + for (c12 in user_cat_12) { | ||
173 | + topic += c12 | ||
174 | + for (c13 in user_cat_13) { | ||
175 | + topic += c13 | ||
176 | + for (c14 in user_cat_14) { | ||
177 | + topic += c14 | ||
178 | + for (c15 in user_cat_15) { | ||
179 | + topic += c15 | ||
180 | + for (c16 in user_cat_16) { | ||
181 | + topic += c16 | ||
182 | + user_topic += (topic + "/") | ||
183 | + // debug | ||
184 | + // Log.d("topic : ", topic) | ||
185 | + | ||
186 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
187 | + if (!task.isSuccessful) { } // 성공 | ||
188 | + } | ||
189 | + /* topic 구독 코드 | ||
190 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
191 | + if (!task.isSuccessful) { } // 성공 | ||
192 | + } | ||
193 | + */ | ||
194 | + | ||
195 | + topic = topic.substring(0, topic.length - c16.length) | ||
196 | + } | ||
197 | + topic = topic.substring(0, topic.length - c15.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c14.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c13.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c12.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c11.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c10.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c9.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c8.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c7.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c6.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c5.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c4.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c3.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c2.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length-c1.length) | ||
226 | + } | ||
227 | + | ||
228 | + //Log.d("re:", user_topic) | ||
229 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
230 | + | ||
231 | + | ||
232 | + var intent = Intent(this, SignInActivity::class.java) | ||
233 | + startActivity(intent) | ||
234 | + } | ||
235 | + | ||
236 | + questionButton.setOnClickListener { | ||
237 | + val builder = AlertDialog.Builder(this) | ||
238 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
239 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
240 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
241 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
242 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
243 | + | ||
244 | + builder.setView(dialogView) | ||
245 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
246 | + //mainTv.text = dialogText.text.toString() | ||
247 | + //mainRb.rating = dialogRatingBar.rating | ||
248 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
249 | + | ||
250 | + } | ||
251 | + /* | ||
252 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
253 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
254 | + } | ||
255 | + */ | ||
256 | + .show() | ||
257 | + } | ||
258 | + | ||
16 | previousButton.setOnClickListener { | 259 | previousButton.setOnClickListener { |
17 | var intent = Intent(this, InputProfilFourthTwoActivity::class.java) | 260 | var intent = Intent(this, InputProfilFourthTwoActivity::class.java) |
18 | startActivity(intent) | 261 | startActivity(intent) |
19 | } | 262 | } |
20 | 263 | ||
21 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
22 | - val editor: SharedPreferences.Editor=prof.edit() | ||
23 | - | ||
24 | 264 | ||
25 | nextButton.setOnClickListener { | 265 | nextButton.setOnClickListener { |
26 | if(nothingButton.isChecked){editor.putInt("c8_1",1); editor.commit()} | 266 | if(nothingButton.isChecked){editor.putInt("c8_1",1); editor.commit()} | ... | ... |
... | @@ -5,23 +5,264 @@ import android.content.Intent | ... | @@ -5,23 +5,264 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
8 | import android.view.View.GONE | 9 | import android.view.View.GONE |
9 | import android.view.View.VISIBLE | 10 | import android.view.View.VISIBLE |
11 | +import android.widget.TextView | ||
12 | +import android.widget.Toast | ||
13 | +import androidx.appcompat.app.AlertDialog | ||
14 | +import com.google.android.gms.tasks.OnCompleteListener | ||
15 | +import com.google.firebase.auth.FirebaseAuth | ||
16 | +import com.google.firebase.database.FirebaseDatabase | ||
17 | +import com.google.firebase.iid.FirebaseInstanceId | ||
18 | +import com.google.firebase.messaging.FirebaseMessaging | ||
10 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_two.* | 19 | import kotlinx.android.synthetic.main.activity_input_profil_fourth_two.* |
11 | 20 | ||
12 | class InputProfilFourthTwoActivity : AppCompatActivity() { | 21 | class InputProfilFourthTwoActivity : AppCompatActivity() { |
13 | 22 | ||
23 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
24 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
25 | + | ||
26 | + private fun sendToken(){ | ||
27 | + FirebaseInstanceId.getInstance().instanceId | ||
28 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
29 | + if (!task.isSuccessful) { | ||
30 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
31 | + return@OnCompleteListener | ||
32 | + } | ||
33 | + | ||
34 | + // Get new Instance ID token | ||
35 | + tkn = task.result!!.token | ||
36 | + | ||
37 | + // Log and toast | ||
38 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
39 | + //Log.d(TAG, msg) | ||
40 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
41 | + }) | ||
42 | + } | ||
43 | + | ||
44 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
45 | + val user = User(u_token, Policy!!) | ||
46 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
47 | + } | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
14 | override fun onCreate(savedInstanceState: Bundle?) { | 53 | override fun onCreate(savedInstanceState: Bundle?) { |
15 | super.onCreate(savedInstanceState) | 54 | super.onCreate(savedInstanceState) |
16 | setContentView(R.layout.activity_input_profil_fourth_two) | 55 | setContentView(R.layout.activity_input_profil_fourth_two) |
17 | 56 | ||
57 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
58 | + val editor: SharedPreferences.Editor=prof.edit() | ||
59 | + | ||
60 | + // 1. 툴바 사용 설정 | ||
61 | + setSupportActionBar(toolbar) | ||
62 | + | ||
63 | + //pushing code start | ||
64 | + intent.extras?.let { | ||
65 | + for (key in it.keySet()) { | ||
66 | + val value = intent.extras?.get(key) | ||
67 | + //Log.d(TAG, "Key: $key Value: $value") | ||
68 | + } | ||
69 | + } | ||
70 | + //pushing code end | ||
71 | + | ||
72 | + | ||
73 | + skipButton.setOnClickListener { | ||
74 | + sendToken() | ||
75 | + val user=firebaseAuth?.currentUser!!.uid | ||
76 | + Log.d("test:", user.toString()) | ||
77 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
78 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
79 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
80 | + 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") | ||
81 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
82 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
83 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + 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") | ||
89 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
90 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
91 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
92 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
93 | + | ||
94 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
95 | + //var policy_string="" | ||
96 | + | ||
97 | + var user_cat_1 = mutableListOf("c1_1") | ||
98 | + var user_cat_2 = mutableListOf("c2_1") | ||
99 | + var user_cat_3 = mutableListOf("c3_1") | ||
100 | + var user_cat_4 = mutableListOf("c4_1") | ||
101 | + var user_cat_5 = mutableListOf("c5_1") | ||
102 | + var user_cat_6 = mutableListOf("c6_1") | ||
103 | + var user_cat_7 = mutableListOf("c7_1") | ||
104 | + var user_cat_8 = mutableListOf("c8_1") | ||
105 | + var user_cat_9 = mutableListOf("c9_1") | ||
106 | + var user_cat_10 = mutableListOf("c10_1") | ||
107 | + var user_cat_11 = mutableListOf("c11_1") | ||
108 | + var user_cat_12 = mutableListOf("c12_1") | ||
109 | + var user_cat_13 = mutableListOf("c13_1") | ||
110 | + var user_cat_14 = mutableListOf("c14_1") | ||
111 | + var user_cat_15 = mutableListOf("c15_1") | ||
112 | + var user_cat_16 = mutableListOf("c16_1") | ||
113 | + | ||
114 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
115 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
116 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
117 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
118 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
119 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
120 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
121 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
122 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
123 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
124 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
125 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
126 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
127 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
128 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
129 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
130 | + | ||
131 | + var topic = "" | ||
132 | + var user_topic = "" | ||
133 | + | ||
134 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
135 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
136 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
137 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
138 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
139 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
140 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
141 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
142 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
143 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
144 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
145 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
146 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
147 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
148 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
149 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
150 | + | ||
151 | + | ||
152 | + for(c1 in user_cat_1) { | ||
153 | + topic += c1 | ||
154 | + for (c2 in user_cat_2) { | ||
155 | + topic += c2 | ||
156 | + for (c3 in user_cat_3) { | ||
157 | + topic += c3 | ||
158 | + for (c4 in user_cat_4) { | ||
159 | + topic += c4 | ||
160 | + for (c5 in user_cat_5) { | ||
161 | + topic += c5 | ||
162 | + for (c6 in user_cat_6) { | ||
163 | + topic += c6 | ||
164 | + for (c7 in user_cat_7) { | ||
165 | + topic += c7 | ||
166 | + for (c8 in user_cat_8) { | ||
167 | + topic += c8 | ||
168 | + for (c9 in user_cat_9) { | ||
169 | + topic += c9 | ||
170 | + for (c10 in user_cat_10) { | ||
171 | + topic += c10 | ||
172 | + for (c11 in user_cat_11) { | ||
173 | + topic += c11 | ||
174 | + for (c12 in user_cat_12) { | ||
175 | + topic += c12 | ||
176 | + for (c13 in user_cat_13) { | ||
177 | + topic += c13 | ||
178 | + for (c14 in user_cat_14) { | ||
179 | + topic += c14 | ||
180 | + for (c15 in user_cat_15) { | ||
181 | + topic += c15 | ||
182 | + for (c16 in user_cat_16) { | ||
183 | + topic += c16 | ||
184 | + user_topic += (topic + "/") | ||
185 | + // debug | ||
186 | + // Log.d("topic : ", topic) | ||
187 | + | ||
188 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
189 | + if (!task.isSuccessful) { } // 성공 | ||
190 | + } | ||
191 | + /* topic 구독 코드 | ||
192 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
193 | + if (!task.isSuccessful) { } // 성공 | ||
194 | + } | ||
195 | + */ | ||
196 | + | ||
197 | + topic = topic.substring(0, topic.length - c16.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c15.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c14.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c13.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c12.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c11.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c10.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c9.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c8.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c7.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c6.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c5.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c4.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c3.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length - c2.length) | ||
226 | + } | ||
227 | + topic = topic.substring(0, topic.length-c1.length) | ||
228 | + } | ||
229 | + | ||
230 | + //Log.d("re:", user_topic) | ||
231 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
232 | + | ||
233 | + | ||
234 | + var intent = Intent(this, SignInActivity::class.java) | ||
235 | + startActivity(intent) | ||
236 | + } | ||
237 | + | ||
238 | + questionButton.setOnClickListener { | ||
239 | + val builder = AlertDialog.Builder(this) | ||
240 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
241 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
242 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
243 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
244 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
245 | + | ||
246 | + builder.setView(dialogView) | ||
247 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
248 | + //mainTv.text = dialogText.text.toString() | ||
249 | + //mainRb.rating = dialogRatingBar.rating | ||
250 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
251 | + | ||
252 | + } | ||
253 | + /* | ||
254 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
255 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
256 | + } | ||
257 | + */ | ||
258 | + .show() | ||
259 | + } | ||
260 | + | ||
18 | previousButton.setOnClickListener { | 261 | previousButton.setOnClickListener { |
19 | var intent = Intent(this, InputProfilFourthOneActivity::class.java) | 262 | var intent = Intent(this, InputProfilFourthOneActivity::class.java) |
20 | startActivity(intent) | 263 | startActivity(intent) |
21 | } | 264 | } |
22 | 265 | ||
23 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
24 | - val editor: SharedPreferences.Editor=prof.edit() | ||
25 | 266 | ||
26 | nextButton.setOnClickListener { | 267 | nextButton.setOnClickListener { |
27 | if(yesButton.isChecked){editor.putInt("c15_2",1); editor.commit()} | 268 | if(yesButton.isChecked){editor.putInt("c15_2",1); editor.commit()} | ... | ... |
... | @@ -181,6 +181,9 @@ class InputProfilSecondOneActivity : AppCompatActivity() { | ... | @@ -181,6 +181,9 @@ class InputProfilSecondOneActivity : AppCompatActivity() { |
181 | // debug | 181 | // debug |
182 | // Log.d("topic : ", topic) | 182 | // Log.d("topic : ", topic) |
183 | 183 | ||
184 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
185 | + if (!task.isSuccessful) { } // 성공 | ||
186 | + } | ||
184 | /* topic 구독 코드 | 187 | /* topic 구독 코드 |
185 | FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | 188 | FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> |
186 | if (!task.isSuccessful) { } // 성공 | 189 | if (!task.isSuccessful) { } // 성공 | ... | ... |
... | @@ -5,7 +5,16 @@ import android.content.Intent | ... | @@ -5,7 +5,16 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
8 | import android.widget.EditText | 9 | import android.widget.EditText |
10 | +import android.widget.TextView | ||
11 | +import android.widget.Toast | ||
12 | +import androidx.appcompat.app.AlertDialog | ||
13 | +import com.google.android.gms.tasks.OnCompleteListener | ||
14 | +import com.google.firebase.auth.FirebaseAuth | ||
15 | +import com.google.firebase.database.FirebaseDatabase | ||
16 | +import com.google.firebase.iid.FirebaseInstanceId | ||
17 | +import com.google.firebase.messaging.FirebaseMessaging | ||
9 | import kotlinx.android.synthetic.main.activity_input_profil_second_three.* | 18 | import kotlinx.android.synthetic.main.activity_input_profil_second_three.* |
10 | import kotlinx.android.synthetic.main.activity_input_profil_second_three.nextButton | 19 | import kotlinx.android.synthetic.main.activity_input_profil_second_three.nextButton |
11 | import kotlinx.android.synthetic.main.activity_input_profil_second_three.previousButton | 20 | 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 | ... | @@ -14,13 +23,219 @@ import kotlinx.android.synthetic.main.activity_input_profil_second_three.toolbar |
14 | 23 | ||
15 | class InputProfilSecondThreeActivity : AppCompatActivity() { | 24 | class InputProfilSecondThreeActivity : AppCompatActivity() { |
16 | 25 | ||
26 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
27 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
28 | + | ||
29 | + private fun sendToken(){ | ||
30 | + FirebaseInstanceId.getInstance().instanceId | ||
31 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
32 | + if (!task.isSuccessful) { | ||
33 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
34 | + return@OnCompleteListener | ||
35 | + } | ||
36 | + | ||
37 | + // Get new Instance ID token | ||
38 | + tkn = task.result!!.token | ||
39 | + | ||
40 | + // Log and toast | ||
41 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
42 | + //Log.d(TAG, msg) | ||
43 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
44 | + }) | ||
45 | + } | ||
46 | + | ||
47 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
48 | + val user = User(u_token, Policy!!) | ||
49 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
50 | + } | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
17 | override fun onCreate(savedInstanceState: Bundle?) { | 56 | override fun onCreate(savedInstanceState: Bundle?) { |
18 | super.onCreate(savedInstanceState) | 57 | super.onCreate(savedInstanceState) |
19 | setContentView(R.layout.activity_input_profil_second_three) | 58 | setContentView(R.layout.activity_input_profil_second_three) |
20 | - | ||
21 | val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | 59 | val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) |
22 | val editor: SharedPreferences.Editor=prof.edit() | 60 | val editor: SharedPreferences.Editor=prof.edit() |
23 | 61 | ||
62 | + // 1. 툴바 사용 설정 | ||
63 | + setSupportActionBar(toolbar) | ||
64 | + | ||
65 | + //pushing code start | ||
66 | + intent.extras?.let { | ||
67 | + for (key in it.keySet()) { | ||
68 | + val value = intent.extras?.get(key) | ||
69 | + //Log.d(TAG, "Key: $key Value: $value") | ||
70 | + } | ||
71 | + } | ||
72 | + //pushing code end | ||
73 | + | ||
74 | + | ||
75 | + skipButton.setOnClickListener { | ||
76 | + sendToken() | ||
77 | + val user=firebaseAuth?.currentUser!!.uid | ||
78 | + Log.d("test:", user.toString()) | ||
79 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
80 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
81 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
82 | + 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") | ||
83 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
84 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
85 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + 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") | ||
89 | + 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") | ||
90 | + 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") | ||
91 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
92 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
93 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
94 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
95 | + | ||
96 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
97 | + //var policy_string="" | ||
98 | + | ||
99 | + var user_cat_1 = mutableListOf("c1_1") | ||
100 | + var user_cat_2 = mutableListOf("c2_1") | ||
101 | + var user_cat_3 = mutableListOf("c3_1") | ||
102 | + var user_cat_4 = mutableListOf("c4_1") | ||
103 | + var user_cat_5 = mutableListOf("c5_1") | ||
104 | + var user_cat_6 = mutableListOf("c6_1") | ||
105 | + var user_cat_7 = mutableListOf("c7_1") | ||
106 | + var user_cat_8 = mutableListOf("c8_1") | ||
107 | + var user_cat_9 = mutableListOf("c9_1") | ||
108 | + var user_cat_10 = mutableListOf("c10_1") | ||
109 | + var user_cat_11 = mutableListOf("c11_1") | ||
110 | + var user_cat_12 = mutableListOf("c12_1") | ||
111 | + var user_cat_13 = mutableListOf("c13_1") | ||
112 | + var user_cat_14 = mutableListOf("c14_1") | ||
113 | + var user_cat_15 = mutableListOf("c15_1") | ||
114 | + var user_cat_16 = mutableListOf("c16_1") | ||
115 | + | ||
116 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
117 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
118 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
119 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
120 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
121 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
122 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
123 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
124 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
125 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
126 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
127 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
128 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
129 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
130 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
131 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
132 | + | ||
133 | + var topic = "" | ||
134 | + var user_topic = "" | ||
135 | + | ||
136 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
137 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
138 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
139 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
140 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
141 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
142 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
143 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
144 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
145 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
146 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
147 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
148 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
149 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
150 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
151 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
152 | + | ||
153 | + | ||
154 | + for(c1 in user_cat_1) { | ||
155 | + topic += c1 | ||
156 | + for (c2 in user_cat_2) { | ||
157 | + topic += c2 | ||
158 | + for (c3 in user_cat_3) { | ||
159 | + topic += c3 | ||
160 | + for (c4 in user_cat_4) { | ||
161 | + topic += c4 | ||
162 | + for (c5 in user_cat_5) { | ||
163 | + topic += c5 | ||
164 | + for (c6 in user_cat_6) { | ||
165 | + topic += c6 | ||
166 | + for (c7 in user_cat_7) { | ||
167 | + topic += c7 | ||
168 | + for (c8 in user_cat_8) { | ||
169 | + topic += c8 | ||
170 | + for (c9 in user_cat_9) { | ||
171 | + topic += c9 | ||
172 | + for (c10 in user_cat_10) { | ||
173 | + topic += c10 | ||
174 | + for (c11 in user_cat_11) { | ||
175 | + topic += c11 | ||
176 | + for (c12 in user_cat_12) { | ||
177 | + topic += c12 | ||
178 | + for (c13 in user_cat_13) { | ||
179 | + topic += c13 | ||
180 | + for (c14 in user_cat_14) { | ||
181 | + topic += c14 | ||
182 | + for (c15 in user_cat_15) { | ||
183 | + topic += c15 | ||
184 | + for (c16 in user_cat_16) { | ||
185 | + topic += c16 | ||
186 | + user_topic += (topic + "/") | ||
187 | + // debug | ||
188 | + // Log.d("topic : ", topic) | ||
189 | + | ||
190 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
191 | + if (!task.isSuccessful) { } // 성공 | ||
192 | + } | ||
193 | + /* topic 구독 코드 | ||
194 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
195 | + if (!task.isSuccessful) { } // 성공 | ||
196 | + } | ||
197 | + */ | ||
198 | + | ||
199 | + topic = topic.substring(0, topic.length - c16.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c15.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c14.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c13.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c12.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c11.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c10.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c9.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c8.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c7.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c6.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c5.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c4.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length - c3.length) | ||
226 | + } | ||
227 | + topic = topic.substring(0, topic.length - c2.length) | ||
228 | + } | ||
229 | + topic = topic.substring(0, topic.length-c1.length) | ||
230 | + } | ||
231 | + | ||
232 | + //Log.d("re:", user_topic) | ||
233 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
234 | + | ||
235 | + | ||
236 | + var intent = Intent(this, SignInActivity::class.java) | ||
237 | + startActivity(intent) | ||
238 | + } | ||
24 | 239 | ||
25 | setSupportActionBar(toolbar) | 240 | setSupportActionBar(toolbar) |
26 | 241 | ... | ... |
... | @@ -5,16 +5,50 @@ import android.content.Intent | ... | @@ -5,16 +5,50 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
8 | import android.view.View.GONE | 9 | import android.view.View.GONE |
9 | import android.view.View.VISIBLE | 10 | import android.view.View.VISIBLE |
10 | import android.widget.EditText | 11 | import android.widget.EditText |
12 | +import android.widget.TextView | ||
11 | import android.widget.Toast | 13 | import android.widget.Toast |
14 | +import androidx.appcompat.app.AlertDialog | ||
12 | import androidx.core.content.ContextCompat | 15 | import androidx.core.content.ContextCompat |
16 | +import com.google.android.gms.tasks.OnCompleteListener | ||
17 | +import com.google.firebase.auth.FirebaseAuth | ||
18 | +import com.google.firebase.database.FirebaseDatabase | ||
19 | +import com.google.firebase.iid.FirebaseInstanceId | ||
20 | +import com.google.firebase.messaging.FirebaseMessaging | ||
13 | import kotlinx.android.synthetic.main.activity_input_profil_second_two.* | 21 | import kotlinx.android.synthetic.main.activity_input_profil_second_two.* |
14 | import kotlinx.android.synthetic.main.item_child.view.* | 22 | import kotlinx.android.synthetic.main.item_child.view.* |
15 | 23 | ||
16 | class InputProfilSecondTwoActivity : AppCompatActivity() { | 24 | class InputProfilSecondTwoActivity : AppCompatActivity() { |
17 | 25 | ||
26 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
27 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
28 | + | ||
29 | + private fun sendToken(){ | ||
30 | + FirebaseInstanceId.getInstance().instanceId | ||
31 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
32 | + if (!task.isSuccessful) { | ||
33 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
34 | + return@OnCompleteListener | ||
35 | + } | ||
36 | + | ||
37 | + // Get new Instance ID token | ||
38 | + tkn = task.result!!.token | ||
39 | + | ||
40 | + // Log and toast | ||
41 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
42 | + //Log.d(TAG, msg) | ||
43 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
44 | + }) | ||
45 | + } | ||
46 | + | ||
47 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
48 | + val user = User(u_token, Policy!!) | ||
49 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
50 | + } | ||
51 | + | ||
18 | override fun onCreate(savedInstanceState: Bundle?) { | 52 | override fun onCreate(savedInstanceState: Bundle?) { |
19 | super.onCreate(savedInstanceState) | 53 | super.onCreate(savedInstanceState) |
20 | setContentView(R.layout.activity_input_profil_second_two) | 54 | setContentView(R.layout.activity_input_profil_second_two) |
... | @@ -22,6 +56,185 @@ class InputProfilSecondTwoActivity : AppCompatActivity() { | ... | @@ -22,6 +56,185 @@ class InputProfilSecondTwoActivity : AppCompatActivity() { |
22 | val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | 56 | val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) |
23 | val editor: SharedPreferences.Editor=prof.edit() | 57 | val editor: SharedPreferences.Editor=prof.edit() |
24 | 58 | ||
59 | + // 1. 툴바 사용 설정 | ||
60 | + setSupportActionBar(toolbar) | ||
61 | + | ||
62 | + //pushing code start | ||
63 | + intent.extras?.let { | ||
64 | + for (key in it.keySet()) { | ||
65 | + val value = intent.extras?.get(key) | ||
66 | + //Log.d(TAG, "Key: $key Value: $value") | ||
67 | + } | ||
68 | + } | ||
69 | + //pushing code end | ||
70 | + | ||
71 | + | ||
72 | + skipButton.setOnClickListener { | ||
73 | + sendToken() | ||
74 | + val user=firebaseAuth?.currentUser!!.uid | ||
75 | + Log.d("test:", user.toString()) | ||
76 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
77 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
78 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
79 | + 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") | ||
80 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
81 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
82 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
89 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
90 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
91 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
92 | + | ||
93 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
94 | + //var policy_string="" | ||
95 | + | ||
96 | + var user_cat_1 = mutableListOf("c1_1") | ||
97 | + var user_cat_2 = mutableListOf("c2_1") | ||
98 | + var user_cat_3 = mutableListOf("c3_1") | ||
99 | + var user_cat_4 = mutableListOf("c4_1") | ||
100 | + var user_cat_5 = mutableListOf("c5_1") | ||
101 | + var user_cat_6 = mutableListOf("c6_1") | ||
102 | + var user_cat_7 = mutableListOf("c7_1") | ||
103 | + var user_cat_8 = mutableListOf("c8_1") | ||
104 | + var user_cat_9 = mutableListOf("c9_1") | ||
105 | + var user_cat_10 = mutableListOf("c10_1") | ||
106 | + var user_cat_11 = mutableListOf("c11_1") | ||
107 | + var user_cat_12 = mutableListOf("c12_1") | ||
108 | + var user_cat_13 = mutableListOf("c13_1") | ||
109 | + var user_cat_14 = mutableListOf("c14_1") | ||
110 | + var user_cat_15 = mutableListOf("c15_1") | ||
111 | + var user_cat_16 = mutableListOf("c16_1") | ||
112 | + | ||
113 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
114 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
115 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
116 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
117 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
118 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
119 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
120 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
121 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
122 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
123 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
124 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
125 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
126 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
127 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
128 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
129 | + | ||
130 | + var topic = "" | ||
131 | + var user_topic = "" | ||
132 | + | ||
133 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
134 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
135 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
136 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
137 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
138 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
139 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
140 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
141 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
142 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
143 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
144 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
145 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
146 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
147 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
148 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
149 | + | ||
150 | + | ||
151 | + for(c1 in user_cat_1) { | ||
152 | + topic += c1 | ||
153 | + for (c2 in user_cat_2) { | ||
154 | + topic += c2 | ||
155 | + for (c3 in user_cat_3) { | ||
156 | + topic += c3 | ||
157 | + for (c4 in user_cat_4) { | ||
158 | + topic += c4 | ||
159 | + for (c5 in user_cat_5) { | ||
160 | + topic += c5 | ||
161 | + for (c6 in user_cat_6) { | ||
162 | + topic += c6 | ||
163 | + for (c7 in user_cat_7) { | ||
164 | + topic += c7 | ||
165 | + for (c8 in user_cat_8) { | ||
166 | + topic += c8 | ||
167 | + for (c9 in user_cat_9) { | ||
168 | + topic += c9 | ||
169 | + for (c10 in user_cat_10) { | ||
170 | + topic += c10 | ||
171 | + for (c11 in user_cat_11) { | ||
172 | + topic += c11 | ||
173 | + for (c12 in user_cat_12) { | ||
174 | + topic += c12 | ||
175 | + for (c13 in user_cat_13) { | ||
176 | + topic += c13 | ||
177 | + for (c14 in user_cat_14) { | ||
178 | + topic += c14 | ||
179 | + for (c15 in user_cat_15) { | ||
180 | + topic += c15 | ||
181 | + for (c16 in user_cat_16) { | ||
182 | + topic += c16 | ||
183 | + user_topic += (topic + "/") | ||
184 | + // debug | ||
185 | + // Log.d("topic : ", topic) | ||
186 | + | ||
187 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
188 | + if (!task.isSuccessful) { } // 성공 | ||
189 | + } | ||
190 | + /* topic 구독 코드 | ||
191 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
192 | + if (!task.isSuccessful) { } // 성공 | ||
193 | + } | ||
194 | + */ | ||
195 | + | ||
196 | + topic = topic.substring(0, topic.length - c16.length) | ||
197 | + } | ||
198 | + topic = topic.substring(0, topic.length - c15.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c14.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c13.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c12.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c11.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c10.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c9.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c8.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c7.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c6.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c5.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c4.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length - c3.length) | ||
223 | + } | ||
224 | + topic = topic.substring(0, topic.length - c2.length) | ||
225 | + } | ||
226 | + topic = topic.substring(0, topic.length-c1.length) | ||
227 | + } | ||
228 | + | ||
229 | + //Log.d("re:", user_topic) | ||
230 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
231 | + | ||
232 | + | ||
233 | + var intent = Intent(this, SignInActivity::class.java) | ||
234 | + startActivity(intent) | ||
235 | + } | ||
236 | + | ||
237 | + | ||
25 | setSupportActionBar(toolbar) | 238 | setSupportActionBar(toolbar) |
26 | skipButton.setOnClickListener { | 239 | skipButton.setOnClickListener { |
27 | var intent = Intent(this, InputProfilSecondOneActivity::class.java) | 240 | var intent = Intent(this, InputProfilSecondOneActivity::class.java) | ... | ... |
... | @@ -5,25 +5,264 @@ import android.content.Intent | ... | @@ -5,25 +5,264 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
8 | import android.view.View.GONE | 9 | import android.view.View.GONE |
9 | import android.view.View.VISIBLE | 10 | import android.view.View.VISIBLE |
11 | +import android.widget.TextView | ||
12 | +import android.widget.Toast | ||
13 | +import androidx.appcompat.app.AlertDialog | ||
14 | +import com.google.android.gms.tasks.OnCompleteListener | ||
15 | +import com.google.firebase.auth.FirebaseAuth | ||
16 | +import com.google.firebase.database.FirebaseDatabase | ||
17 | +import com.google.firebase.iid.FirebaseInstanceId | ||
18 | +import com.google.firebase.messaging.FirebaseMessaging | ||
10 | import kotlinx.android.synthetic.main.activity_input_profil_third_four.* | 19 | import kotlinx.android.synthetic.main.activity_input_profil_third_four.* |
11 | 20 | ||
12 | class InputProfilThirdFourActivity : AppCompatActivity() { | 21 | class InputProfilThirdFourActivity : AppCompatActivity() { |
13 | 22 | ||
23 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
24 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
25 | + | ||
26 | + private fun sendToken(){ | ||
27 | + FirebaseInstanceId.getInstance().instanceId | ||
28 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
29 | + if (!task.isSuccessful) { | ||
30 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
31 | + return@OnCompleteListener | ||
32 | + } | ||
33 | + | ||
34 | + // Get new Instance ID token | ||
35 | + tkn = task.result!!.token | ||
36 | + | ||
37 | + // Log and toast | ||
38 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
39 | + //Log.d(TAG, msg) | ||
40 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
41 | + }) | ||
42 | + } | ||
43 | + | ||
44 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
45 | + val user = User(u_token, Policy!!) | ||
46 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
47 | + } | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
14 | override fun onCreate(savedInstanceState: Bundle?) { | 53 | override fun onCreate(savedInstanceState: Bundle?) { |
15 | super.onCreate(savedInstanceState) | 54 | super.onCreate(savedInstanceState) |
16 | setContentView(R.layout.activity_input_profil_third_four) | 55 | setContentView(R.layout.activity_input_profil_third_four) |
17 | 56 | ||
57 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
58 | + val editor: SharedPreferences.Editor=prof.edit() | ||
59 | + | ||
60 | + // 1. 툴바 사용 설정 | ||
61 | + setSupportActionBar(toolbar) | ||
62 | + | ||
63 | + //pushing code start | ||
64 | + intent.extras?.let { | ||
65 | + for (key in it.keySet()) { | ||
66 | + val value = intent.extras?.get(key) | ||
67 | + //Log.d(TAG, "Key: $key Value: $value") | ||
68 | + } | ||
69 | + } | ||
70 | + //pushing code end | ||
71 | + | ||
72 | + | ||
73 | + skipButton.setOnClickListener { | ||
74 | + sendToken() | ||
75 | + val user=firebaseAuth?.currentUser!!.uid | ||
76 | + Log.d("test:", user.toString()) | ||
77 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
78 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
79 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
80 | + 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") | ||
81 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
82 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
83 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + 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") | ||
89 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
90 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
91 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
92 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
93 | + | ||
94 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
95 | + //var policy_string="" | ||
96 | + | ||
97 | + var user_cat_1 = mutableListOf("c1_1") | ||
98 | + var user_cat_2 = mutableListOf("c2_1") | ||
99 | + var user_cat_3 = mutableListOf("c3_1") | ||
100 | + var user_cat_4 = mutableListOf("c4_1") | ||
101 | + var user_cat_5 = mutableListOf("c5_1") | ||
102 | + var user_cat_6 = mutableListOf("c6_1") | ||
103 | + var user_cat_7 = mutableListOf("c7_1") | ||
104 | + var user_cat_8 = mutableListOf("c8_1") | ||
105 | + var user_cat_9 = mutableListOf("c9_1") | ||
106 | + var user_cat_10 = mutableListOf("c10_1") | ||
107 | + var user_cat_11 = mutableListOf("c11_1") | ||
108 | + var user_cat_12 = mutableListOf("c12_1") | ||
109 | + var user_cat_13 = mutableListOf("c13_1") | ||
110 | + var user_cat_14 = mutableListOf("c14_1") | ||
111 | + var user_cat_15 = mutableListOf("c15_1") | ||
112 | + var user_cat_16 = mutableListOf("c16_1") | ||
113 | + | ||
114 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
115 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
116 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
117 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
118 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
119 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
120 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
121 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
122 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
123 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
124 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
125 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
126 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
127 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
128 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
129 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
130 | + | ||
131 | + var topic = "" | ||
132 | + var user_topic = "" | ||
133 | + | ||
134 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
135 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
136 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
137 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
138 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
139 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
140 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
141 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
142 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
143 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
144 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
145 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
146 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
147 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
148 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
149 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
150 | + | ||
151 | + | ||
152 | + for(c1 in user_cat_1) { | ||
153 | + topic += c1 | ||
154 | + for (c2 in user_cat_2) { | ||
155 | + topic += c2 | ||
156 | + for (c3 in user_cat_3) { | ||
157 | + topic += c3 | ||
158 | + for (c4 in user_cat_4) { | ||
159 | + topic += c4 | ||
160 | + for (c5 in user_cat_5) { | ||
161 | + topic += c5 | ||
162 | + for (c6 in user_cat_6) { | ||
163 | + topic += c6 | ||
164 | + for (c7 in user_cat_7) { | ||
165 | + topic += c7 | ||
166 | + for (c8 in user_cat_8) { | ||
167 | + topic += c8 | ||
168 | + for (c9 in user_cat_9) { | ||
169 | + topic += c9 | ||
170 | + for (c10 in user_cat_10) { | ||
171 | + topic += c10 | ||
172 | + for (c11 in user_cat_11) { | ||
173 | + topic += c11 | ||
174 | + for (c12 in user_cat_12) { | ||
175 | + topic += c12 | ||
176 | + for (c13 in user_cat_13) { | ||
177 | + topic += c13 | ||
178 | + for (c14 in user_cat_14) { | ||
179 | + topic += c14 | ||
180 | + for (c15 in user_cat_15) { | ||
181 | + topic += c15 | ||
182 | + for (c16 in user_cat_16) { | ||
183 | + topic += c16 | ||
184 | + user_topic += (topic + "/") | ||
185 | + // debug | ||
186 | + // Log.d("topic : ", topic) | ||
187 | + | ||
188 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
189 | + if (!task.isSuccessful) { } // 성공 | ||
190 | + } | ||
191 | + /* topic 구독 코드 | ||
192 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
193 | + if (!task.isSuccessful) { } // 성공 | ||
194 | + } | ||
195 | + */ | ||
196 | + | ||
197 | + topic = topic.substring(0, topic.length - c16.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c15.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c14.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c13.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c12.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c11.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c10.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c9.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c8.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c7.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c6.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c5.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c4.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c3.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length - c2.length) | ||
226 | + } | ||
227 | + topic = topic.substring(0, topic.length-c1.length) | ||
228 | + } | ||
229 | + | ||
230 | + //Log.d("re:", user_topic) | ||
231 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
232 | + | ||
233 | + | ||
234 | + var intent = Intent(this, SignInActivity::class.java) | ||
235 | + startActivity(intent) | ||
236 | + } | ||
237 | + | ||
238 | + questionButton.setOnClickListener { | ||
239 | + val builder = AlertDialog.Builder(this) | ||
240 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
241 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
242 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
243 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
244 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
245 | + | ||
246 | + builder.setView(dialogView) | ||
247 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
248 | + //mainTv.text = dialogText.text.toString() | ||
249 | + //mainRb.rating = dialogRatingBar.rating | ||
250 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
251 | + | ||
252 | + } | ||
253 | + /* | ||
254 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
255 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
256 | + } | ||
257 | + */ | ||
258 | + .show() | ||
259 | + } | ||
18 | 260 | ||
19 | previousButton.setOnClickListener { | 261 | previousButton.setOnClickListener { |
20 | var intent = Intent(this, InputProfilThirdThreeActivity::class.java) | 262 | var intent = Intent(this, InputProfilThirdThreeActivity::class.java) |
21 | startActivity(intent) | 263 | startActivity(intent) |
22 | } | 264 | } |
23 | 265 | ||
24 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
25 | - val editor: SharedPreferences.Editor=prof.edit() | ||
26 | - | ||
27 | nextButton.setOnClickListener { | 266 | nextButton.setOnClickListener { |
28 | 267 | ||
29 | if(yesButton.isChecked){ | 268 | if(yesButton.isChecked){ | ... | ... |
... | @@ -5,24 +5,259 @@ import android.content.Intent | ... | @@ -5,24 +5,259 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
8 | import android.widget.Button | 9 | import android.widget.Button |
9 | import android.widget.TextView | 10 | import android.widget.TextView |
11 | +import android.widget.Toast | ||
12 | +import androidx.appcompat.app.AlertDialog | ||
13 | +import com.google.android.gms.tasks.OnCompleteListener | ||
14 | +import com.google.firebase.auth.FirebaseAuth | ||
15 | +import com.google.firebase.database.FirebaseDatabase | ||
16 | +import com.google.firebase.iid.FirebaseInstanceId | ||
17 | +import com.google.firebase.messaging.FirebaseMessaging | ||
10 | import kotlinx.android.synthetic.main.activity_input_profil_third_one.* | 18 | import kotlinx.android.synthetic.main.activity_input_profil_third_one.* |
11 | 19 | ||
12 | class InputProfilThirdOneActivity : AppCompatActivity() { | 20 | class InputProfilThirdOneActivity : AppCompatActivity() { |
13 | 21 | ||
22 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
23 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
24 | + | ||
25 | + private fun sendToken(){ | ||
26 | + FirebaseInstanceId.getInstance().instanceId | ||
27 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
28 | + if (!task.isSuccessful) { | ||
29 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
30 | + return@OnCompleteListener | ||
31 | + } | ||
32 | + | ||
33 | + // Get new Instance ID token | ||
34 | + tkn = task.result!!.token | ||
35 | + | ||
36 | + // Log and toast | ||
37 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
38 | + //Log.d(TAG, msg) | ||
39 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
40 | + }) | ||
41 | + } | ||
42 | + | ||
43 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
44 | + val user = User(u_token, Policy!!) | ||
45 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
46 | + } | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
14 | override fun onCreate(savedInstanceState: Bundle?) { | 52 | override fun onCreate(savedInstanceState: Bundle?) { |
15 | super.onCreate(savedInstanceState) | 53 | super.onCreate(savedInstanceState) |
16 | setContentView(R.layout.activity_input_profil_third_one) | 54 | setContentView(R.layout.activity_input_profil_third_one) |
17 | 55 | ||
56 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
57 | + val editor: SharedPreferences.Editor=prof.edit() | ||
58 | + | ||
18 | // 1. 툴바 사용 설정 | 59 | // 1. 툴바 사용 설정 |
19 | setSupportActionBar(toolbar) | 60 | setSupportActionBar(toolbar) |
20 | 61 | ||
62 | + //pushing code start | ||
63 | + intent.extras?.let { | ||
64 | + for (key in it.keySet()) { | ||
65 | + val value = intent.extras?.get(key) | ||
66 | + //Log.d(TAG, "Key: $key Value: $value") | ||
67 | + } | ||
68 | + } | ||
69 | + //pushing code end | ||
70 | + | ||
71 | + | ||
21 | skipButton.setOnClickListener { | 72 | skipButton.setOnClickListener { |
22 | - var intent = Intent(this, InputProfilSecondOneActivity::class.java) | 73 | + sendToken() |
74 | + val user=firebaseAuth?.currentUser!!.uid | ||
75 | + Log.d("test:", user.toString()) | ||
76 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
77 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
78 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
79 | + 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") | ||
80 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
81 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
82 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
89 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
90 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
91 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
92 | + | ||
93 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
94 | + //var policy_string="" | ||
95 | + | ||
96 | + var user_cat_1 = mutableListOf("c1_1") | ||
97 | + var user_cat_2 = mutableListOf("c2_1") | ||
98 | + var user_cat_3 = mutableListOf("c3_1") | ||
99 | + var user_cat_4 = mutableListOf("c4_1") | ||
100 | + var user_cat_5 = mutableListOf("c5_1") | ||
101 | + var user_cat_6 = mutableListOf("c6_1") | ||
102 | + var user_cat_7 = mutableListOf("c7_1") | ||
103 | + var user_cat_8 = mutableListOf("c8_1") | ||
104 | + var user_cat_9 = mutableListOf("c9_1") | ||
105 | + var user_cat_10 = mutableListOf("c10_1") | ||
106 | + var user_cat_11 = mutableListOf("c11_1") | ||
107 | + var user_cat_12 = mutableListOf("c12_1") | ||
108 | + var user_cat_13 = mutableListOf("c13_1") | ||
109 | + var user_cat_14 = mutableListOf("c14_1") | ||
110 | + var user_cat_15 = mutableListOf("c15_1") | ||
111 | + var user_cat_16 = mutableListOf("c16_1") | ||
112 | + | ||
113 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
114 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
115 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
116 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
117 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
118 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
119 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
120 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
121 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
122 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
123 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
124 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
125 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
126 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
127 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
128 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
129 | + | ||
130 | + var topic = "" | ||
131 | + var user_topic = "" | ||
132 | + | ||
133 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
134 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
135 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
136 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
137 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
138 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
139 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
140 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
141 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
142 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
143 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
144 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
145 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
146 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
147 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
148 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
149 | + | ||
150 | + | ||
151 | + for(c1 in user_cat_1) { | ||
152 | + topic += c1 | ||
153 | + for (c2 in user_cat_2) { | ||
154 | + topic += c2 | ||
155 | + for (c3 in user_cat_3) { | ||
156 | + topic += c3 | ||
157 | + for (c4 in user_cat_4) { | ||
158 | + topic += c4 | ||
159 | + for (c5 in user_cat_5) { | ||
160 | + topic += c5 | ||
161 | + for (c6 in user_cat_6) { | ||
162 | + topic += c6 | ||
163 | + for (c7 in user_cat_7) { | ||
164 | + topic += c7 | ||
165 | + for (c8 in user_cat_8) { | ||
166 | + topic += c8 | ||
167 | + for (c9 in user_cat_9) { | ||
168 | + topic += c9 | ||
169 | + for (c10 in user_cat_10) { | ||
170 | + topic += c10 | ||
171 | + for (c11 in user_cat_11) { | ||
172 | + topic += c11 | ||
173 | + for (c12 in user_cat_12) { | ||
174 | + topic += c12 | ||
175 | + for (c13 in user_cat_13) { | ||
176 | + topic += c13 | ||
177 | + for (c14 in user_cat_14) { | ||
178 | + topic += c14 | ||
179 | + for (c15 in user_cat_15) { | ||
180 | + topic += c15 | ||
181 | + for (c16 in user_cat_16) { | ||
182 | + topic += c16 | ||
183 | + user_topic += (topic + "/") | ||
184 | + // debug | ||
185 | + // Log.d("topic : ", topic) | ||
186 | + | ||
187 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
188 | + if (!task.isSuccessful) { } // 성공 | ||
189 | + } | ||
190 | + /* topic 구독 코드 | ||
191 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
192 | + if (!task.isSuccessful) { } // 성공 | ||
193 | + } | ||
194 | + */ | ||
195 | + | ||
196 | + topic = topic.substring(0, topic.length - c16.length) | ||
197 | + } | ||
198 | + topic = topic.substring(0, topic.length - c15.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c14.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c13.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c12.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c11.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c10.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c9.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c8.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c7.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c6.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c5.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c4.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length - c3.length) | ||
223 | + } | ||
224 | + topic = topic.substring(0, topic.length - c2.length) | ||
225 | + } | ||
226 | + topic = topic.substring(0, topic.length-c1.length) | ||
227 | + } | ||
228 | + | ||
229 | + //Log.d("re:", user_topic) | ||
230 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
231 | + | ||
232 | + | ||
233 | + var intent = Intent(this, SignInActivity::class.java) | ||
23 | startActivity(intent) | 234 | startActivity(intent) |
24 | } | 235 | } |
25 | 236 | ||
237 | + questionButton.setOnClickListener { | ||
238 | + val builder = AlertDialog.Builder(this) | ||
239 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
240 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
241 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
242 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
243 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
244 | + | ||
245 | + builder.setView(dialogView) | ||
246 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
247 | + //mainTv.text = dialogText.text.toString() | ||
248 | + //mainRb.rating = dialogRatingBar.rating | ||
249 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
250 | + | ||
251 | + } | ||
252 | + /* | ||
253 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
254 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
255 | + } | ||
256 | + */ | ||
257 | + .show() | ||
258 | + } | ||
259 | + | ||
260 | + | ||
26 | elementaryButton.setOnClickListener { | 261 | elementaryButton.setOnClickListener { |
27 | middleButton.isChecked=false | 262 | middleButton.isChecked=false |
28 | highButton.isChecked=false | 263 | highButton.isChecked=false |
... | @@ -85,9 +320,6 @@ class InputProfilThirdOneActivity : AppCompatActivity() { | ... | @@ -85,9 +320,6 @@ class InputProfilThirdOneActivity : AppCompatActivity() { |
85 | startActivity(intent) | 320 | startActivity(intent) |
86 | } | 321 | } |
87 | 322 | ||
88 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
89 | - val editor: SharedPreferences.Editor=prof.edit() | ||
90 | - | ||
91 | nextButton.setOnClickListener { | 323 | nextButton.setOnClickListener { |
92 | if(elementaryButton.isChecked){ | 324 | if(elementaryButton.isChecked){ |
93 | editor.putInt("c6_2",1); editor.commit() | 325 | editor.putInt("c6_2",1); editor.commit() | ... | ... |
... | @@ -5,17 +5,256 @@ import android.content.Intent | ... | @@ -5,17 +5,256 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
9 | +import android.widget.TextView | ||
10 | +import android.widget.Toast | ||
11 | +import androidx.appcompat.app.AlertDialog | ||
12 | +import com.google.android.gms.tasks.OnCompleteListener | ||
13 | +import com.google.firebase.auth.FirebaseAuth | ||
14 | +import com.google.firebase.database.FirebaseDatabase | ||
15 | +import com.google.firebase.iid.FirebaseInstanceId | ||
16 | +import com.google.firebase.messaging.FirebaseMessaging | ||
8 | import kotlinx.android.synthetic.main.activity_input_profil_third_three.* | 17 | import kotlinx.android.synthetic.main.activity_input_profil_third_three.* |
9 | 18 | ||
10 | class InputProfilThirdThreeActivity : AppCompatActivity() { | 19 | class InputProfilThirdThreeActivity : AppCompatActivity() { |
11 | 20 | ||
21 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
22 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
23 | + | ||
24 | + private fun sendToken(){ | ||
25 | + FirebaseInstanceId.getInstance().instanceId | ||
26 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
27 | + if (!task.isSuccessful) { | ||
28 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
29 | + return@OnCompleteListener | ||
30 | + } | ||
31 | + | ||
32 | + // Get new Instance ID token | ||
33 | + tkn = task.result!!.token | ||
34 | + | ||
35 | + // Log and toast | ||
36 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
37 | + //Log.d(TAG, msg) | ||
38 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
39 | + }) | ||
40 | + } | ||
41 | + | ||
42 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
43 | + val user = User(u_token, Policy!!) | ||
44 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
12 | override fun onCreate(savedInstanceState: Bundle?) { | 51 | override fun onCreate(savedInstanceState: Bundle?) { |
13 | super.onCreate(savedInstanceState) | 52 | super.onCreate(savedInstanceState) |
14 | setContentView(R.layout.activity_input_profil_third_three) | 53 | setContentView(R.layout.activity_input_profil_third_three) |
54 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
55 | + val editor: SharedPreferences.Editor=prof.edit() | ||
15 | 56 | ||
16 | // 1. 툴바 사용 설정 | 57 | // 1. 툴바 사용 설정 |
17 | setSupportActionBar(toolbar) | 58 | setSupportActionBar(toolbar) |
18 | 59 | ||
60 | + //pushing code start | ||
61 | + intent.extras?.let { | ||
62 | + for (key in it.keySet()) { | ||
63 | + val value = intent.extras?.get(key) | ||
64 | + //Log.d(TAG, "Key: $key Value: $value") | ||
65 | + } | ||
66 | + } | ||
67 | + //pushing code end | ||
68 | + | ||
69 | + | ||
70 | + skipButton.setOnClickListener { | ||
71 | + sendToken() | ||
72 | + val user=firebaseAuth?.currentUser!!.uid | ||
73 | + Log.d("test:", user.toString()) | ||
74 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
75 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
76 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
77 | + 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") | ||
78 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
79 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
80 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
81 | + 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") | ||
82 | + 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") | ||
83 | + 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") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
87 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
88 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
89 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
90 | + | ||
91 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
92 | + //var policy_string="" | ||
93 | + | ||
94 | + var user_cat_1 = mutableListOf("c1_1") | ||
95 | + var user_cat_2 = mutableListOf("c2_1") | ||
96 | + var user_cat_3 = mutableListOf("c3_1") | ||
97 | + var user_cat_4 = mutableListOf("c4_1") | ||
98 | + var user_cat_5 = mutableListOf("c5_1") | ||
99 | + var user_cat_6 = mutableListOf("c6_1") | ||
100 | + var user_cat_7 = mutableListOf("c7_1") | ||
101 | + var user_cat_8 = mutableListOf("c8_1") | ||
102 | + var user_cat_9 = mutableListOf("c9_1") | ||
103 | + var user_cat_10 = mutableListOf("c10_1") | ||
104 | + var user_cat_11 = mutableListOf("c11_1") | ||
105 | + var user_cat_12 = mutableListOf("c12_1") | ||
106 | + var user_cat_13 = mutableListOf("c13_1") | ||
107 | + var user_cat_14 = mutableListOf("c14_1") | ||
108 | + var user_cat_15 = mutableListOf("c15_1") | ||
109 | + var user_cat_16 = mutableListOf("c16_1") | ||
110 | + | ||
111 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
112 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
113 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
114 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
115 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
116 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
117 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
118 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
119 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
120 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
121 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
122 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
123 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
124 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
125 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
126 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
127 | + | ||
128 | + var topic = "" | ||
129 | + var user_topic = "" | ||
130 | + | ||
131 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
132 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
133 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
134 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
135 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
136 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
137 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
138 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
139 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
140 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
141 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
142 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
143 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
144 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
145 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
146 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
147 | + | ||
148 | + | ||
149 | + for(c1 in user_cat_1) { | ||
150 | + topic += c1 | ||
151 | + for (c2 in user_cat_2) { | ||
152 | + topic += c2 | ||
153 | + for (c3 in user_cat_3) { | ||
154 | + topic += c3 | ||
155 | + for (c4 in user_cat_4) { | ||
156 | + topic += c4 | ||
157 | + for (c5 in user_cat_5) { | ||
158 | + topic += c5 | ||
159 | + for (c6 in user_cat_6) { | ||
160 | + topic += c6 | ||
161 | + for (c7 in user_cat_7) { | ||
162 | + topic += c7 | ||
163 | + for (c8 in user_cat_8) { | ||
164 | + topic += c8 | ||
165 | + for (c9 in user_cat_9) { | ||
166 | + topic += c9 | ||
167 | + for (c10 in user_cat_10) { | ||
168 | + topic += c10 | ||
169 | + for (c11 in user_cat_11) { | ||
170 | + topic += c11 | ||
171 | + for (c12 in user_cat_12) { | ||
172 | + topic += c12 | ||
173 | + for (c13 in user_cat_13) { | ||
174 | + topic += c13 | ||
175 | + for (c14 in user_cat_14) { | ||
176 | + topic += c14 | ||
177 | + for (c15 in user_cat_15) { | ||
178 | + topic += c15 | ||
179 | + for (c16 in user_cat_16) { | ||
180 | + topic += c16 | ||
181 | + user_topic += (topic + "/") | ||
182 | + // debug | ||
183 | + // Log.d("topic : ", topic) | ||
184 | + | ||
185 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
186 | + if (!task.isSuccessful) { } // 성공 | ||
187 | + } | ||
188 | + /* topic 구독 코드 | ||
189 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
190 | + if (!task.isSuccessful) { } // 성공 | ||
191 | + } | ||
192 | + */ | ||
193 | + | ||
194 | + topic = topic.substring(0, topic.length - c16.length) | ||
195 | + } | ||
196 | + topic = topic.substring(0, topic.length - c15.length) | ||
197 | + } | ||
198 | + topic = topic.substring(0, topic.length - c14.length) | ||
199 | + } | ||
200 | + topic = topic.substring(0, topic.length - c13.length) | ||
201 | + } | ||
202 | + topic = topic.substring(0, topic.length - c12.length) | ||
203 | + } | ||
204 | + topic = topic.substring(0, topic.length - c11.length) | ||
205 | + } | ||
206 | + topic = topic.substring(0, topic.length - c10.length) | ||
207 | + } | ||
208 | + topic = topic.substring(0, topic.length - c9.length) | ||
209 | + } | ||
210 | + topic = topic.substring(0, topic.length - c8.length) | ||
211 | + } | ||
212 | + topic = topic.substring(0, topic.length - c7.length) | ||
213 | + } | ||
214 | + topic = topic.substring(0, topic.length - c6.length) | ||
215 | + } | ||
216 | + topic = topic.substring(0, topic.length - c5.length) | ||
217 | + } | ||
218 | + topic = topic.substring(0, topic.length - c4.length) | ||
219 | + } | ||
220 | + topic = topic.substring(0, topic.length - c3.length) | ||
221 | + } | ||
222 | + topic = topic.substring(0, topic.length - c2.length) | ||
223 | + } | ||
224 | + topic = topic.substring(0, topic.length-c1.length) | ||
225 | + } | ||
226 | + | ||
227 | + //Log.d("re:", user_topic) | ||
228 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
229 | + | ||
230 | + | ||
231 | + var intent = Intent(this, SignInActivity::class.java) | ||
232 | + startActivity(intent) | ||
233 | + } | ||
234 | + | ||
235 | + questionButton.setOnClickListener { | ||
236 | + val builder = AlertDialog.Builder(this) | ||
237 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
238 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
239 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
240 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
241 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
242 | + | ||
243 | + builder.setView(dialogView) | ||
244 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
245 | + //mainTv.text = dialogText.text.toString() | ||
246 | + //mainRb.rating = dialogRatingBar.rating | ||
247 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
248 | + | ||
249 | + } | ||
250 | + /* | ||
251 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
252 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
253 | + } | ||
254 | + */ | ||
255 | + .show() | ||
256 | + } | ||
257 | + | ||
19 | skipButton.setOnClickListener { | 258 | skipButton.setOnClickListener { |
20 | var intent = Intent(this, InputProfilSecondOneActivity::class.java) | 259 | var intent = Intent(this, InputProfilSecondOneActivity::class.java) |
21 | startActivity(intent) | 260 | startActivity(intent) |
... | @@ -26,9 +265,6 @@ class InputProfilThirdThreeActivity : AppCompatActivity() { | ... | @@ -26,9 +265,6 @@ class InputProfilThirdThreeActivity : AppCompatActivity() { |
26 | startActivity(intent) | 265 | startActivity(intent) |
27 | } | 266 | } |
28 | 267 | ||
29 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
30 | - val editor: SharedPreferences.Editor=prof.edit() | ||
31 | - | ||
32 | nextButton.setOnClickListener { | 268 | nextButton.setOnClickListener { |
33 | if(nothingButton.isChecked){ editor.putInt("c4_11",1); editor.commit()} | 269 | if(nothingButton.isChecked){ editor.putInt("c4_11",1); editor.commit()} |
34 | if(mipilButton.isChecked){ editor.putInt("c4_2",1); editor.commit()} | 270 | if(mipilButton.isChecked){ editor.putInt("c4_2",1); editor.commit()} | ... | ... |
... | @@ -5,19 +5,259 @@ import android.content.Intent | ... | @@ -5,19 +5,259 @@ import android.content.Intent |
5 | import android.content.SharedPreferences | 5 | import android.content.SharedPreferences |
6 | import androidx.appcompat.app.AppCompatActivity | 6 | import androidx.appcompat.app.AppCompatActivity |
7 | import android.os.Bundle | 7 | import android.os.Bundle |
8 | +import android.util.Log | ||
8 | import android.view.View.GONE | 9 | import android.view.View.GONE |
9 | import android.view.View.VISIBLE | 10 | import android.view.View.VISIBLE |
11 | +import android.widget.TextView | ||
12 | +import android.widget.Toast | ||
13 | +import androidx.appcompat.app.AlertDialog | ||
14 | +import com.google.android.gms.tasks.OnCompleteListener | ||
15 | +import com.google.firebase.auth.FirebaseAuth | ||
16 | +import com.google.firebase.database.FirebaseDatabase | ||
17 | +import com.google.firebase.iid.FirebaseInstanceId | ||
18 | +import com.google.firebase.messaging.FirebaseMessaging | ||
10 | import kotlinx.android.synthetic.main.activity_input_profil_third_two.* | 19 | import kotlinx.android.synthetic.main.activity_input_profil_third_two.* |
11 | 20 | ||
12 | class InputProfilThirdTwoActivity : AppCompatActivity() { | 21 | class InputProfilThirdTwoActivity : AppCompatActivity() { |
13 | 22 | ||
23 | + private val firebaseAuth = FirebaseAuth.getInstance() | ||
24 | + val user_db = FirebaseDatabase.getInstance("https://capstone-vip-user.firebaseio.com/").reference | ||
25 | + | ||
26 | + private fun sendToken(){ | ||
27 | + FirebaseInstanceId.getInstance().instanceId | ||
28 | + .addOnCompleteListener(OnCompleteListener { task -> | ||
29 | + if (!task.isSuccessful) { | ||
30 | + //Log.w(TAG, "getInstanceId failed", task.exception) | ||
31 | + return@OnCompleteListener | ||
32 | + } | ||
33 | + | ||
34 | + // Get new Instance ID token | ||
35 | + tkn = task.result!!.token | ||
36 | + | ||
37 | + // Log and toast | ||
38 | + val msg = getString(R.string.msg_token_fmt, tkn) | ||
39 | + //Log.d(TAG, msg) | ||
40 | + Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show() | ||
41 | + }) | ||
42 | + } | ||
43 | + | ||
44 | + private fun writeNewUser(u_id: String, u_token: String, Policy: String?) { | ||
45 | + val user = User(u_token, Policy!!) | ||
46 | + user_db.child(u_id).setValue(user)/// .setValue(user) | ||
47 | + } | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
14 | override fun onCreate(savedInstanceState: Bundle?) { | 53 | override fun onCreate(savedInstanceState: Bundle?) { |
15 | super.onCreate(savedInstanceState) | 54 | super.onCreate(savedInstanceState) |
16 | setContentView(R.layout.activity_input_profil_third_two) | 55 | setContentView(R.layout.activity_input_profil_third_two) |
17 | 56 | ||
57 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
58 | + val editor: SharedPreferences.Editor=prof.edit() | ||
59 | + | ||
18 | // 1. 툴바 사용 설정 | 60 | // 1. 툴바 사용 설정 |
19 | setSupportActionBar(toolbar) | 61 | setSupportActionBar(toolbar) |
20 | 62 | ||
63 | + //pushing code start | ||
64 | + intent.extras?.let { | ||
65 | + for (key in it.keySet()) { | ||
66 | + val value = intent.extras?.get(key) | ||
67 | + //Log.d(TAG, "Key: $key Value: $value") | ||
68 | + } | ||
69 | + } | ||
70 | + //pushing code end | ||
71 | + | ||
72 | + | ||
73 | + skipButton.setOnClickListener { | ||
74 | + sendToken() | ||
75 | + val user=firebaseAuth?.currentUser!!.uid | ||
76 | + Log.d("test:", user.toString()) | ||
77 | + val cat_1=listOf("c1_1","c1_2","c1_3") | ||
78 | + val cat_2=listOf("c2_1","c2_2","c2_3","c2_4","c2_5","c2_6","c2_7") | ||
79 | + val cat_3=listOf("c3_1","c3_2","c3_3") | ||
80 | + 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") | ||
81 | + val cat_5=listOf("c5_1","c5_2","c5_3","c5_4","c5_5","c5_6","c5_7","c5_8","c5_9") | ||
82 | + val cat_6=listOf("c6_1","c6_2","c6_3","c6_4","c6_5","c6_6","c6_7") | ||
83 | + val cat_7=listOf("c7_1","c7_2","c7_3") | ||
84 | + 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") | ||
85 | + 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") | ||
86 | + 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") | ||
87 | + 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") | ||
88 | + 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") | ||
89 | + val cat_13=listOf("c13_1","c13_2","c13_3") | ||
90 | + val cat_14=listOf("c14_1","c14_2","c14_3") | ||
91 | + val cat_15=listOf("c15_1","c15_2","c15_3") | ||
92 | + val cat_16=listOf("c16_1","c16_2","c16_3","c16_4","c16_5","c16_6","c16_7") | ||
93 | + | ||
94 | + //val policy_string_list= listOf("c1_1c2_1c3_1c4_1c5_1c6_1c7_1c8_1c9_1c10_1c11_1c12_1c13_1c14_1c15_1c16_1") | ||
95 | + //var policy_string="" | ||
96 | + | ||
97 | + var user_cat_1 = mutableListOf("c1_1") | ||
98 | + var user_cat_2 = mutableListOf("c2_1") | ||
99 | + var user_cat_3 = mutableListOf("c3_1") | ||
100 | + var user_cat_4 = mutableListOf("c4_1") | ||
101 | + var user_cat_5 = mutableListOf("c5_1") | ||
102 | + var user_cat_6 = mutableListOf("c6_1") | ||
103 | + var user_cat_7 = mutableListOf("c7_1") | ||
104 | + var user_cat_8 = mutableListOf("c8_1") | ||
105 | + var user_cat_9 = mutableListOf("c9_1") | ||
106 | + var user_cat_10 = mutableListOf("c10_1") | ||
107 | + var user_cat_11 = mutableListOf("c11_1") | ||
108 | + var user_cat_12 = mutableListOf("c12_1") | ||
109 | + var user_cat_13 = mutableListOf("c13_1") | ||
110 | + var user_cat_14 = mutableListOf("c14_1") | ||
111 | + var user_cat_15 = mutableListOf("c15_1") | ||
112 | + var user_cat_16 = mutableListOf("c16_1") | ||
113 | + | ||
114 | + for(item in cat_1){if(prof.getInt(item,3)==1){user_cat_1.add(item)}} | ||
115 | + for(item in cat_2){if(prof.getInt(item,3)==1){user_cat_2.add(item)}} | ||
116 | + for(item in cat_3){if(prof.getInt(item,3)==1){user_cat_3.add(item)}} | ||
117 | + for(item in cat_4){if(prof.getInt(item,3)==1){user_cat_4.add(item)}} | ||
118 | + for(item in cat_5){if(prof.getInt(item,3)==1){user_cat_5.add(item)}} | ||
119 | + for(item in cat_6){if(prof.getInt(item,3)==1){user_cat_6.add(item)}} | ||
120 | + for(item in cat_7){if(prof.getInt(item,3)==1){user_cat_7.add(item)}} | ||
121 | + for(item in cat_8){if(prof.getInt(item,3)==1){user_cat_8.add(item)}} | ||
122 | + for(item in cat_9){if(prof.getInt(item,3)==1){user_cat_9.add(item)}} | ||
123 | + for(item in cat_10){if(prof.getInt(item,3)==1){user_cat_10.add(item)}} | ||
124 | + for(item in cat_11){if(prof.getInt(item,3)==1){user_cat_11.add(item)}} | ||
125 | + for(item in cat_12){if(prof.getInt(item,3)==1){user_cat_12.add(item)}} | ||
126 | + for(item in cat_13){if(prof.getInt(item,3)==1){user_cat_13.add(item)}} | ||
127 | + for(item in cat_14){if(prof.getInt(item,3)==1){user_cat_14.add(item)}} | ||
128 | + for(item in cat_15){if(prof.getInt(item,3)==1){user_cat_15.add(item)}} | ||
129 | + for(item in cat_16){if(prof.getInt(item,3)==1){user_cat_16.add(item)}} | ||
130 | + | ||
131 | + var topic = "" | ||
132 | + var user_topic = "" | ||
133 | + | ||
134 | + Log.d("hell gate1 : ", user_cat_1.toString()) | ||
135 | + Log.d("hell gate2 : ", user_cat_2.toString()) | ||
136 | + Log.d("hell gate3 : ", user_cat_3.toString()) | ||
137 | + Log.d("hell gate4 : ", user_cat_4.toString()) | ||
138 | + Log.d("hell gate5 : ", user_cat_5.toString()) | ||
139 | + Log.d("hell gate6 : ", user_cat_6.toString()) | ||
140 | + Log.d("hell gate7 : ", user_cat_7.toString()) | ||
141 | + Log.d("hell gate8 : ", user_cat_8.toString()) | ||
142 | + Log.d("hell gate9 : ", user_cat_9.toString()) | ||
143 | + Log.d("hell gate10 : ", user_cat_10.toString()) | ||
144 | + Log.d("hell gate11 : ", user_cat_11.toString()) | ||
145 | + Log.d("hell gate12 : ", user_cat_12.toString()) | ||
146 | + Log.d("hell gate13 : ", user_cat_13.toString()) | ||
147 | + Log.d("hell gate14 : ", user_cat_14.toString()) | ||
148 | + Log.d("hell gate15 : ", user_cat_15.toString()) | ||
149 | + Log.d("hell gate16 : ", user_cat_16.toString()) | ||
150 | + | ||
151 | + | ||
152 | + for(c1 in user_cat_1) { | ||
153 | + topic += c1 | ||
154 | + for (c2 in user_cat_2) { | ||
155 | + topic += c2 | ||
156 | + for (c3 in user_cat_3) { | ||
157 | + topic += c3 | ||
158 | + for (c4 in user_cat_4) { | ||
159 | + topic += c4 | ||
160 | + for (c5 in user_cat_5) { | ||
161 | + topic += c5 | ||
162 | + for (c6 in user_cat_6) { | ||
163 | + topic += c6 | ||
164 | + for (c7 in user_cat_7) { | ||
165 | + topic += c7 | ||
166 | + for (c8 in user_cat_8) { | ||
167 | + topic += c8 | ||
168 | + for (c9 in user_cat_9) { | ||
169 | + topic += c9 | ||
170 | + for (c10 in user_cat_10) { | ||
171 | + topic += c10 | ||
172 | + for (c11 in user_cat_11) { | ||
173 | + topic += c11 | ||
174 | + for (c12 in user_cat_12) { | ||
175 | + topic += c12 | ||
176 | + for (c13 in user_cat_13) { | ||
177 | + topic += c13 | ||
178 | + for (c14 in user_cat_14) { | ||
179 | + topic += c14 | ||
180 | + for (c15 in user_cat_15) { | ||
181 | + topic += c15 | ||
182 | + for (c16 in user_cat_16) { | ||
183 | + topic += c16 | ||
184 | + user_topic += (topic + "/") | ||
185 | + // debug | ||
186 | + // Log.d("topic : ", topic) | ||
187 | + | ||
188 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
189 | + if (!task.isSuccessful) { } // 성공 | ||
190 | + } | ||
191 | + /* topic 구독 코드 | ||
192 | + FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener { task -> | ||
193 | + if (!task.isSuccessful) { } // 성공 | ||
194 | + } | ||
195 | + */ | ||
196 | + | ||
197 | + topic = topic.substring(0, topic.length - c16.length) | ||
198 | + } | ||
199 | + topic = topic.substring(0, topic.length - c15.length) | ||
200 | + } | ||
201 | + topic = topic.substring(0, topic.length - c14.length) | ||
202 | + } | ||
203 | + topic = topic.substring(0, topic.length - c13.length) | ||
204 | + } | ||
205 | + topic = topic.substring(0, topic.length - c12.length) | ||
206 | + } | ||
207 | + topic = topic.substring(0, topic.length - c11.length) | ||
208 | + } | ||
209 | + topic = topic.substring(0, topic.length - c10.length) | ||
210 | + } | ||
211 | + topic = topic.substring(0, topic.length - c9.length) | ||
212 | + } | ||
213 | + topic = topic.substring(0, topic.length - c8.length) | ||
214 | + } | ||
215 | + topic = topic.substring(0, topic.length - c7.length) | ||
216 | + } | ||
217 | + topic = topic.substring(0, topic.length - c6.length) | ||
218 | + } | ||
219 | + topic = topic.substring(0, topic.length - c5.length) | ||
220 | + } | ||
221 | + topic = topic.substring(0, topic.length - c4.length) | ||
222 | + } | ||
223 | + topic = topic.substring(0, topic.length - c3.length) | ||
224 | + } | ||
225 | + topic = topic.substring(0, topic.length - c2.length) | ||
226 | + } | ||
227 | + topic = topic.substring(0, topic.length-c1.length) | ||
228 | + } | ||
229 | + | ||
230 | + //Log.d("re:", user_topic) | ||
231 | + writeNewUser(user, "null", user_topic) // db에 쓰기 | ||
232 | + | ||
233 | + | ||
234 | + var intent = Intent(this, SignInActivity::class.java) | ||
235 | + startActivity(intent) | ||
236 | + } | ||
237 | + | ||
238 | + questionButton.setOnClickListener { | ||
239 | + val builder = AlertDialog.Builder(this) | ||
240 | + val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | ||
241 | + //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | ||
242 | + //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | ||
243 | + dialogView.findViewById<TextView>(R.id.dialogTitle).text="가족구성원이란?" | ||
244 | + dialogView.findViewById<TextView>(R.id.dialogContent).text="주민등록상 같은 거주지에 사는 사람" | ||
245 | + | ||
246 | + builder.setView(dialogView) | ||
247 | + .setPositiveButton("확인") { dialogInterface, i -> | ||
248 | + //mainTv.text = dialogText.text.toString() | ||
249 | + //mainRb.rating = dialogRatingBar.rating | ||
250 | + /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | ||
251 | + | ||
252 | + } | ||
253 | + /* | ||
254 | + .setNegativeButton("취소") { dialogInterface, i -> | ||
255 | + /* 취소일 때 아무 액션이 없으므로 빈칸 */ | ||
256 | + } | ||
257 | + */ | ||
258 | + .show() | ||
259 | + } | ||
260 | + | ||
21 | skipButton.setOnClickListener { | 261 | skipButton.setOnClickListener { |
22 | var intent = Intent(this, InputProfilSecondOneActivity::class.java) | 262 | var intent = Intent(this, InputProfilSecondOneActivity::class.java) |
23 | startActivity(intent) | 263 | startActivity(intent) |
... | @@ -28,9 +268,6 @@ class InputProfilThirdTwoActivity : AppCompatActivity() { | ... | @@ -28,9 +268,6 @@ class InputProfilThirdTwoActivity : AppCompatActivity() { |
28 | startActivity(intent) | 268 | startActivity(intent) |
29 | } | 269 | } |
30 | 270 | ||
31 | - val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
32 | - val editor: SharedPreferences.Editor=prof.edit() | ||
33 | - | ||
34 | nextButton.setOnClickListener { | 271 | nextButton.setOnClickListener { |
35 | if(companyButton.isChecked){ editor.putInt("c5_6",1); editor.commit()} | 272 | if(companyButton.isChecked){ editor.putInt("c5_6",1); editor.commit()} |
36 | if(workerButton.isChecked){ editor.putInt("c5_7",1); editor.commit()} | 273 | if(workerButton.isChecked){ editor.putInt("c5_7",1); editor.commit()} | ... | ... |
1 | package com.example.vip | 1 | package com.example.vip |
2 | 2 | ||
3 | +import android.content.Context | ||
3 | import android.content.Intent | 4 | import android.content.Intent |
5 | +import android.content.SharedPreferences | ||
4 | import android.os.Bundle | 6 | import android.os.Bundle |
5 | import android.view.Menu | 7 | import android.view.Menu |
6 | import android.view.MenuItem | 8 | import android.view.MenuItem |
... | @@ -29,6 +31,9 @@ class SignInActivity : AppCompatActivity() { | ... | @@ -29,6 +31,9 @@ class SignInActivity : AppCompatActivity() { |
29 | val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) | 31 | val dialogView = layoutInflater.inflate(R.layout.dialog_example, null) |
30 | //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) | 32 | //val dialogText = dialogView.findViewById<EditText>(R.id.dialogEt) |
31 | //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) | 33 | //val dialogRatingBar = dialogView.findViewById<RatingBar>(R.id.dialogRb) |
34 | + val prof: SharedPreferences =getSharedPreferences("profdata", Context.MODE_PRIVATE) | ||
35 | + val editor: SharedPreferences.Editor=prof.edit() | ||
36 | + | ||
32 | dialogView.findViewById<TextView>(R.id.dialogTitle).text="프로필을 입력해주세요!" | 37 | dialogView.findViewById<TextView>(R.id.dialogTitle).text="프로필을 입력해주세요!" |
33 | dialogView.findViewById<TextView>(R.id.dialogContent).text="정확한 정책 추천을 얻으려면 더 많은 프로필 정보가 필요해요!" | 38 | dialogView.findViewById<TextView>(R.id.dialogContent).text="정확한 정책 추천을 얻으려면 더 많은 프로필 정보가 필요해요!" |
34 | 39 | ||
... | @@ -39,7 +44,8 @@ class SignInActivity : AppCompatActivity() { | ... | @@ -39,7 +44,8 @@ class SignInActivity : AppCompatActivity() { |
39 | /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ | 44 | /* 확인일 때 main의 View의 값에 dialog View에 있는 값을 적용 */ |
40 | } | 45 | } |
41 | .setNegativeButton("지금할게요 :)") { dialogInterface, i -> | 46 | .setNegativeButton("지금할게요 :)") { dialogInterface, i -> |
42 | - /* 취소일 때 아무 액션이 없으므로 빈칸 */ | 47 | + editor.clear() |
48 | + | ||
43 | val intent = Intent(this, InputProfilFirstOneActivity::class.java) | 49 | val intent = Intent(this, InputProfilFirstOneActivity::class.java) |
44 | startActivity(intent) | 50 | startActivity(intent) |
45 | } | 51 | } | ... | ... |
... | @@ -4,13 +4,64 @@ | ... | @@ -4,13 +4,64 @@ |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | - tools:context=".InputProfilFirstFiveActivity"> | 7 | + tools:context=".InputProfilFourthFiveActivity"> |
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="match_parent" | 11 | android:layout_height="match_parent" |
12 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
13 | 13 | ||
14 | + <androidx.appcompat.widget.Toolbar | ||
15 | + android:id="@+id/toolbar" | ||
16 | + android:layout_width="fill_parent" | ||
17 | + android:layout_height="wrap_content" | ||
18 | + android:layout_marginBottom="11dp" | ||
19 | + android:background="#FFF" | ||
20 | + android:elevation="5dp" | ||
21 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | ||
22 | + app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | ||
23 | + | ||
24 | + <LinearLayout | ||
25 | + android:layout_width="match_parent" | ||
26 | + android:layout_height="match_parent" | ||
27 | + android:orientation="horizontal"> | ||
28 | + | ||
29 | + <Button | ||
30 | + android:id="@+id/skipButton" | ||
31 | + android:layout_width="10dp" | ||
32 | + android:layout_height="match_parent" | ||
33 | + android:layout_weight="1.5" | ||
34 | + android:background="#FFFFFF" | ||
35 | + android:text="나가기" | ||
36 | + android:textColor="#29ABE2" | ||
37 | + android:textSize="16dp" /> | ||
38 | + <LinearLayout | ||
39 | + android:layout_width="10dp" | ||
40 | + android:layout_height="match_parent" | ||
41 | + android:orientation="horizontal" | ||
42 | + android:layout_weight="1"/> | ||
43 | + <ImageView | ||
44 | + android:layout_width="77dp" | ||
45 | + android:layout_height="44dp" | ||
46 | + android:layout_gravity="center" | ||
47 | + android:layout_weight="1" | ||
48 | + android:src="@drawable/toolbar_logo" /> | ||
49 | + <LinearLayout | ||
50 | + android:layout_width="10dp" | ||
51 | + android:layout_height="match_parent" | ||
52 | + android:orientation="horizontal" | ||
53 | + android:layout_weight="1"/> | ||
54 | + <LinearLayout | ||
55 | + android:layout_width="10dp" | ||
56 | + android:layout_height="match_parent" | ||
57 | + android:orientation="horizontal" | ||
58 | + android:layout_weight="1.5"/> | ||
59 | + | ||
60 | + </LinearLayout> | ||
61 | + | ||
62 | + | ||
63 | + </androidx.appcompat.widget.Toolbar> | ||
64 | + | ||
14 | <LinearLayout | 65 | <LinearLayout |
15 | android:layout_width="match_parent" | 66 | android:layout_width="match_parent" |
16 | android:layout_height="50dp" | 67 | android:layout_height="50dp" |
... | @@ -20,20 +71,52 @@ | ... | @@ -20,20 +71,52 @@ |
20 | <TextView | 71 | <TextView |
21 | android:id="@+id/stageTextView1" | 72 | android:id="@+id/stageTextView1" |
22 | android:layout_width="wrap_content" | 73 | android:layout_width="wrap_content" |
23 | - android:layout_height="wrap_content" | 74 | + android:layout_height="match_parent" |
24 | android:layout_gravity="center" | 75 | android:layout_gravity="center" |
25 | android:layout_weight="1" | 76 | android:layout_weight="1" |
77 | + android:background="#1E90FF" | ||
26 | android:gravity="center" | 78 | android:gravity="center" |
27 | - android:text="1단계" /> | 79 | + android:text="1" /> |
28 | 80 | ||
29 | <TextView | 81 | <TextView |
30 | - android:id="@+id/neccesaryTextView" | 82 | + android:id="@+id/stageTextView2" |
31 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
32 | - android:layout_height="wrap_content" | 84 | + android:layout_height="match_parent" |
85 | + android:layout_gravity="center" | ||
86 | + android:layout_weight="1" | ||
87 | + android:background="#1E90FF" | ||
88 | + android:gravity="center" | ||
89 | + android:text="2" /> | ||
90 | + | ||
91 | + <TextView | ||
92 | + android:id="@+id/stageTextView3" | ||
93 | + android:layout_width="wrap_content" | ||
94 | + android:layout_height="match_parent" | ||
95 | + android:layout_gravity="center" | ||
96 | + android:layout_weight="1" | ||
97 | + android:background="#1E90FF" | ||
98 | + android:gravity="center" | ||
99 | + android:text="3" /> | ||
100 | + | ||
101 | + <TextView | ||
102 | + android:id="@+id/stageTextView4" | ||
103 | + android:layout_width="wrap_content" | ||
104 | + android:layout_height="match_parent" | ||
33 | android:layout_gravity="center" | 105 | android:layout_gravity="center" |
34 | android:layout_weight="1" | 106 | android:layout_weight="1" |
107 | + android:background="#1E90FF" | ||
35 | android:gravity="center" | 108 | android:gravity="center" |
36 | - android:text="필수항목" /> | 109 | + android:text="4" /> |
110 | + | ||
111 | + <TextView | ||
112 | + android:id="@+id/stageTextView5" | ||
113 | + android:layout_width="wrap_content" | ||
114 | + android:layout_height="match_parent" | ||
115 | + android:layout_gravity="center" | ||
116 | + android:layout_weight="1" | ||
117 | + android:gravity="center" | ||
118 | + android:text="5" /> | ||
119 | + | ||
37 | </LinearLayout> | 120 | </LinearLayout> |
38 | 121 | ||
39 | <LinearLayout | 122 | <LinearLayout |
... | @@ -53,47 +136,68 @@ | ... | @@ -53,47 +136,68 @@ |
53 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
54 | android:orientation="vertical"> | 137 | android:orientation="vertical"> |
55 | 138 | ||
56 | - <TextView | 139 | + <RelativeLayout |
57 | - android:id="@+id/explainTextView" | ||
58 | android:layout_width="match_parent" | 140 | android:layout_width="match_parent" |
59 | - android:layout_height="wrap_content" | 141 | + android:layout_height="match_parent"> |
60 | - android:layout_gravity="center" | 142 | + |
61 | - android:gravity="center" | 143 | + <TextView |
62 | - android:text="4. 내/외국인 여부를 선택해주세요." /> | 144 | + android:id="@+id/explainTextView" |
145 | + android:layout_width="match_parent" | ||
146 | + android:layout_height="wrap_content" | ||
147 | + android:layout_gravity="center" | ||
148 | + android:gravity="center" | ||
149 | + android:text="4. 내/외국인 여부를 선택해주세요." /> | ||
150 | + <Button | ||
151 | + android:id="@+id/questionButton" | ||
152 | + android:layout_width="30dp" | ||
153 | + android:layout_height="30dp" | ||
154 | + android:layout_gravity="center" | ||
155 | + android:layout_toRightOf="@id/explainTextView" | ||
156 | + android:backgroundTint="#1E90FF" | ||
157 | + android:gravity="center" | ||
158 | + android:text=" ? " | ||
159 | + android:textSize="8sp" /> | ||
160 | + </RelativeLayout> | ||
63 | </LinearLayout> | 161 | </LinearLayout> |
64 | 162 | ||
65 | <LinearLayout | 163 | <LinearLayout |
66 | android:layout_width="match_parent" | 164 | android:layout_width="match_parent" |
67 | android:layout_height="50dp" | 165 | android:layout_height="50dp" |
68 | android:layout_weight="1" | 166 | android:layout_weight="1" |
69 | - android:orientation="vertical"></LinearLayout> | ||
70 | - | ||
71 | - <LinearLayout | ||
72 | - android:layout_width="wrap_content" | ||
73 | - android:layout_height="wrap_content" | ||
74 | - android:layout_gravity="center" | ||
75 | - android:gravity="center" | ||
76 | android:orientation="vertical"> | 167 | android:orientation="vertical"> |
77 | 168 | ||
78 | - <ToggleButton | 169 | + </LinearLayout> |
79 | - android:id="@+id/inmanButton" | 170 | + |
80 | - android:layout_width="match_parent" | 171 | + <ScrollView |
81 | - android:layout_height="wrap_content" | 172 | + android:layout_width="match_parent" |
82 | - android:background="@drawable/profil_selector" | 173 | + android:layout_height="wrap_content"> |
83 | - android:text="내국인" | ||
84 | - android:textOff="내국인" | ||
85 | - android:textOn="내국인" /> | ||
86 | 174 | ||
87 | - <ToggleButton | 175 | + <LinearLayout |
88 | - android:id="@+id/outmanButton" | ||
89 | android:layout_width="match_parent" | 176 | android:layout_width="match_parent" |
90 | android:layout_height="wrap_content" | 177 | android:layout_height="wrap_content" |
91 | - android:background="@drawable/profil_selector" | 178 | + android:orientation="vertical"> |
92 | - android:text="외국인" | 179 | + <ToggleButton |
93 | - android:textOff="외국인" | 180 | + android:id="@+id/inmanButton" |
94 | - android:textOn="외국인" /> | 181 | + android:layout_width="match_parent" |
95 | - | 182 | + android:layout_height="wrap_content" |
96 | - </LinearLayout> | 183 | + android:background="@drawable/profil_selector" |
184 | + android:text="내국인" | ||
185 | + android:textOff="내국인" | ||
186 | + android:textOn="내국인" /> | ||
187 | + | ||
188 | + <ToggleButton | ||
189 | + android:id="@+id/outmanButton" | ||
190 | + android:layout_width="match_parent" | ||
191 | + android:layout_height="wrap_content" | ||
192 | + android:background="@drawable/profil_selector" | ||
193 | + android:text="외국인" | ||
194 | + android:textOff="외국인" | ||
195 | + android:textOn="외국인" /> | ||
196 | + | ||
197 | + </LinearLayout> | ||
198 | + | ||
199 | + | ||
200 | + </ScrollView> | ||
97 | 201 | ||
98 | <LinearLayout | 202 | <LinearLayout |
99 | android:layout_width="match_parent" | 203 | android:layout_width="match_parent" |
... | @@ -113,12 +217,6 @@ | ... | @@ -113,12 +217,6 @@ |
113 | android:layout_weight="1" | 217 | android:layout_weight="1" |
114 | android:text="이전 단계로" /> | 218 | android:text="이전 단계로" /> |
115 | 219 | ||
116 | - <LinearLayout | ||
117 | - android:layout_width="10dp" | ||
118 | - android:layout_height="match_parent" | ||
119 | - android:layout_weight="1" | ||
120 | - android:orientation="vertical"></LinearLayout> | ||
121 | - | ||
122 | <Button | 220 | <Button |
123 | android:id="@+id/nextButton" | 221 | android:id="@+id/nextButton" |
124 | android:layout_width="10dp" | 222 | android:layout_width="10dp" | ... | ... |
... | @@ -4,13 +4,64 @@ | ... | @@ -4,13 +4,64 @@ |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | - tools:context=".InputProfilFirstFourActivity"> | 7 | + tools:context=".InputProfilFourthFiveActivity"> |
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="match_parent" | 11 | android:layout_height="match_parent" |
12 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
13 | 13 | ||
14 | + <androidx.appcompat.widget.Toolbar | ||
15 | + android:id="@+id/toolbar" | ||
16 | + android:layout_width="fill_parent" | ||
17 | + android:layout_height="wrap_content" | ||
18 | + android:layout_marginBottom="11dp" | ||
19 | + android:background="#FFF" | ||
20 | + android:elevation="5dp" | ||
21 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | ||
22 | + app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | ||
23 | + | ||
24 | + <LinearLayout | ||
25 | + android:layout_width="match_parent" | ||
26 | + android:layout_height="match_parent" | ||
27 | + android:orientation="horizontal"> | ||
28 | + | ||
29 | + <Button | ||
30 | + android:id="@+id/skipButton" | ||
31 | + android:layout_width="10dp" | ||
32 | + android:layout_height="match_parent" | ||
33 | + android:layout_weight="1.5" | ||
34 | + android:background="#FFFFFF" | ||
35 | + android:text="나가기" | ||
36 | + android:textColor="#29ABE2" | ||
37 | + android:textSize="16dp" /> | ||
38 | + <LinearLayout | ||
39 | + android:layout_width="10dp" | ||
40 | + android:layout_height="match_parent" | ||
41 | + android:orientation="horizontal" | ||
42 | + android:layout_weight="1"/> | ||
43 | + <ImageView | ||
44 | + android:layout_width="77dp" | ||
45 | + android:layout_height="44dp" | ||
46 | + android:layout_gravity="center" | ||
47 | + android:layout_weight="1" | ||
48 | + android:src="@drawable/toolbar_logo" /> | ||
49 | + <LinearLayout | ||
50 | + android:layout_width="10dp" | ||
51 | + android:layout_height="match_parent" | ||
52 | + android:orientation="horizontal" | ||
53 | + android:layout_weight="1"/> | ||
54 | + <LinearLayout | ||
55 | + android:layout_width="10dp" | ||
56 | + android:layout_height="match_parent" | ||
57 | + android:orientation="horizontal" | ||
58 | + android:layout_weight="1.5"/> | ||
59 | + | ||
60 | + </LinearLayout> | ||
61 | + | ||
62 | + | ||
63 | + </androidx.appcompat.widget.Toolbar> | ||
64 | + | ||
14 | <LinearLayout | 65 | <LinearLayout |
15 | android:layout_width="match_parent" | 66 | android:layout_width="match_parent" |
16 | android:layout_height="50dp" | 67 | android:layout_height="50dp" |
... | @@ -20,20 +71,52 @@ | ... | @@ -20,20 +71,52 @@ |
20 | <TextView | 71 | <TextView |
21 | android:id="@+id/stageTextView1" | 72 | android:id="@+id/stageTextView1" |
22 | android:layout_width="wrap_content" | 73 | android:layout_width="wrap_content" |
23 | - android:layout_height="wrap_content" | 74 | + android:layout_height="match_parent" |
24 | android:layout_gravity="center" | 75 | android:layout_gravity="center" |
25 | android:layout_weight="1" | 76 | android:layout_weight="1" |
77 | + android:background="#1E90FF" | ||
26 | android:gravity="center" | 78 | android:gravity="center" |
27 | - android:text="1단계" /> | 79 | + android:text="1" /> |
28 | 80 | ||
29 | <TextView | 81 | <TextView |
30 | - android:id="@+id/neccesaryTextView" | 82 | + android:id="@+id/stageTextView2" |
31 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
32 | - android:layout_height="wrap_content" | 84 | + android:layout_height="match_parent" |
33 | android:layout_gravity="center" | 85 | android:layout_gravity="center" |
34 | android:layout_weight="1" | 86 | android:layout_weight="1" |
87 | + android:background="#1E90FF" | ||
35 | android:gravity="center" | 88 | android:gravity="center" |
36 | - android:text="필수항목" /> | 89 | + android:text="2" /> |
90 | + | ||
91 | + <TextView | ||
92 | + android:id="@+id/stageTextView3" | ||
93 | + android:layout_width="wrap_content" | ||
94 | + android:layout_height="match_parent" | ||
95 | + android:layout_gravity="center" | ||
96 | + android:layout_weight="1" | ||
97 | + android:background="#1E90FF" | ||
98 | + android:gravity="center" | ||
99 | + android:text="3" /> | ||
100 | + | ||
101 | + <TextView | ||
102 | + android:id="@+id/stageTextView4" | ||
103 | + android:layout_width="wrap_content" | ||
104 | + android:layout_height="match_parent" | ||
105 | + android:layout_gravity="center" | ||
106 | + android:layout_weight="1" | ||
107 | + android:background="#1E90FF" | ||
108 | + android:gravity="center" | ||
109 | + android:text="4" /> | ||
110 | + | ||
111 | + <TextView | ||
112 | + android:id="@+id/stageTextView5" | ||
113 | + android:layout_width="wrap_content" | ||
114 | + android:layout_height="match_parent" | ||
115 | + android:layout_gravity="center" | ||
116 | + android:layout_weight="1" | ||
117 | + android:gravity="center" | ||
118 | + android:text="5" /> | ||
119 | + | ||
37 | </LinearLayout> | 120 | </LinearLayout> |
38 | 121 | ||
39 | <LinearLayout | 122 | <LinearLayout |
... | @@ -53,28 +136,49 @@ | ... | @@ -53,28 +136,49 @@ |
53 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
54 | android:orientation="vertical"> | 137 | android:orientation="vertical"> |
55 | 138 | ||
56 | - <TextView | 139 | + <RelativeLayout |
57 | - android:id="@+id/explainTextView" | ||
58 | android:layout_width="match_parent" | 140 | android:layout_width="match_parent" |
59 | - android:layout_height="wrap_content" | 141 | + android:layout_height="match_parent"> |
60 | - android:layout_gravity="center" | 142 | + |
61 | - android:gravity="center" | 143 | + <TextView |
62 | - android:text="3. 주민등록상 거주지를 선택해 주세요." /> | 144 | + android:id="@+id/explainTextView" |
145 | + android:layout_width="wrap_content" | ||
146 | + android:layout_height="wrap_content" | ||
147 | + android:layout_centerInParent="true" | ||
148 | + android:layout_gravity="center" | ||
149 | + android:gravity="center" | ||
150 | + android:text="3. 자신의 주민등록상 거주지를 선택해주세요." /> | ||
151 | + | ||
152 | + <Button | ||
153 | + android:id="@+id/questionButton" | ||
154 | + android:layout_width="30dp" | ||
155 | + android:layout_height="30dp" | ||
156 | + android:layout_gravity="center" | ||
157 | + android:layout_toRightOf="@id/explainTextView" | ||
158 | + android:backgroundTint="#1E90FF" | ||
159 | + android:gravity="center" | ||
160 | + android:text=" ? " | ||
161 | + android:textSize="8sp" /> | ||
162 | + </RelativeLayout> | ||
63 | </LinearLayout> | 163 | </LinearLayout> |
64 | 164 | ||
65 | <LinearLayout | 165 | <LinearLayout |
66 | android:layout_width="match_parent" | 166 | android:layout_width="match_parent" |
67 | android:layout_height="50dp" | 167 | android:layout_height="50dp" |
68 | android:layout_weight="1" | 168 | android:layout_weight="1" |
69 | - android:orientation="vertical"></LinearLayout> | ||
70 | - | ||
71 | - <LinearLayout | ||
72 | - android:layout_width="wrap_content" | ||
73 | - android:layout_height="wrap_content" | ||
74 | - android:layout_gravity="center" | ||
75 | - android:gravity="center" | ||
76 | android:orientation="vertical"> | 169 | android:orientation="vertical"> |
77 | 170 | ||
171 | + </LinearLayout> | ||
172 | + | ||
173 | + <ScrollView | ||
174 | + android:layout_width="match_parent" | ||
175 | + android:layout_height="wrap_content"> | ||
176 | + | ||
177 | + <LinearLayout | ||
178 | + android:layout_width="match_parent" | ||
179 | + android:layout_height="wrap_content" | ||
180 | + android:orientation="vertical"> | ||
181 | + | ||
78 | <TextView | 182 | <TextView |
79 | android:id="@+id/doTextView" | 183 | android:id="@+id/doTextView" |
80 | android:layout_width="match_parent" | 184 | android:layout_width="match_parent" |
... | @@ -96,8 +200,8 @@ | ... | @@ -96,8 +200,8 @@ |
96 | android:id="@+id/gooSpinner" | 200 | android:id="@+id/gooSpinner" |
97 | android:layout_width="fill_parent" | 201 | android:layout_width="fill_parent" |
98 | android:layout_height="wrap_content" /> | 202 | android:layout_height="wrap_content" /> |
99 | - | 203 | + </LinearLayout> |
100 | - </LinearLayout> | 204 | + </ScrollView> |
101 | 205 | ||
102 | <LinearLayout | 206 | <LinearLayout |
103 | android:layout_width="match_parent" | 207 | android:layout_width="match_parent" |
... | @@ -117,12 +221,6 @@ | ... | @@ -117,12 +221,6 @@ |
117 | android:layout_weight="1" | 221 | android:layout_weight="1" |
118 | android:text="이전 단계로" /> | 222 | android:text="이전 단계로" /> |
119 | 223 | ||
120 | - <LinearLayout | ||
121 | - android:layout_width="10dp" | ||
122 | - android:layout_height="match_parent" | ||
123 | - android:layout_weight="1" | ||
124 | - android:orientation="vertical"></LinearLayout> | ||
125 | - | ||
126 | <Button | 224 | <Button |
127 | android:id="@+id/nextButton" | 225 | android:id="@+id/nextButton" |
128 | android:layout_width="10dp" | 226 | android:layout_width="10dp" | ... | ... |
... | @@ -4,13 +4,64 @@ | ... | @@ -4,13 +4,64 @@ |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | - tools:context=".InputProfilFirstSixActivity"> | 7 | + tools:context=".InputProfilFourthFiveActivity"> |
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="match_parent" | 11 | android:layout_height="match_parent" |
12 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
13 | 13 | ||
14 | + <androidx.appcompat.widget.Toolbar | ||
15 | + android:id="@+id/toolbar" | ||
16 | + android:layout_width="fill_parent" | ||
17 | + android:layout_height="wrap_content" | ||
18 | + android:layout_marginBottom="11dp" | ||
19 | + android:background="#FFF" | ||
20 | + android:elevation="5dp" | ||
21 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | ||
22 | + app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | ||
23 | + | ||
24 | + <LinearLayout | ||
25 | + android:layout_width="match_parent" | ||
26 | + android:layout_height="match_parent" | ||
27 | + android:orientation="horizontal"> | ||
28 | + | ||
29 | + <Button | ||
30 | + android:id="@+id/skipButton" | ||
31 | + android:layout_width="10dp" | ||
32 | + android:layout_height="match_parent" | ||
33 | + android:layout_weight="1.5" | ||
34 | + android:background="#FFFFFF" | ||
35 | + android:text="나가기" | ||
36 | + android:textColor="#29ABE2" | ||
37 | + android:textSize="16dp" /> | ||
38 | + <LinearLayout | ||
39 | + android:layout_width="10dp" | ||
40 | + android:layout_height="match_parent" | ||
41 | + android:orientation="horizontal" | ||
42 | + android:layout_weight="1"/> | ||
43 | + <ImageView | ||
44 | + android:layout_width="77dp" | ||
45 | + android:layout_height="44dp" | ||
46 | + android:layout_gravity="center" | ||
47 | + android:layout_weight="1" | ||
48 | + android:src="@drawable/toolbar_logo" /> | ||
49 | + <LinearLayout | ||
50 | + android:layout_width="10dp" | ||
51 | + android:layout_height="match_parent" | ||
52 | + android:orientation="horizontal" | ||
53 | + android:layout_weight="1"/> | ||
54 | + <LinearLayout | ||
55 | + android:layout_width="10dp" | ||
56 | + android:layout_height="match_parent" | ||
57 | + android:orientation="horizontal" | ||
58 | + android:layout_weight="1.5"/> | ||
59 | + | ||
60 | + </LinearLayout> | ||
61 | + | ||
62 | + | ||
63 | + </androidx.appcompat.widget.Toolbar> | ||
64 | + | ||
14 | <LinearLayout | 65 | <LinearLayout |
15 | android:layout_width="match_parent" | 66 | android:layout_width="match_parent" |
16 | android:layout_height="50dp" | 67 | android:layout_height="50dp" |
... | @@ -20,20 +71,52 @@ | ... | @@ -20,20 +71,52 @@ |
20 | <TextView | 71 | <TextView |
21 | android:id="@+id/stageTextView1" | 72 | android:id="@+id/stageTextView1" |
22 | android:layout_width="wrap_content" | 73 | android:layout_width="wrap_content" |
23 | - android:layout_height="wrap_content" | 74 | + android:layout_height="match_parent" |
24 | android:layout_gravity="center" | 75 | android:layout_gravity="center" |
25 | android:layout_weight="1" | 76 | android:layout_weight="1" |
77 | + android:background="#1E90FF" | ||
26 | android:gravity="center" | 78 | android:gravity="center" |
27 | - android:text="1단계" /> | 79 | + android:text="1" /> |
28 | 80 | ||
29 | <TextView | 81 | <TextView |
30 | - android:id="@+id/neccesaryTextView" | 82 | + android:id="@+id/stageTextView2" |
31 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
32 | - android:layout_height="wrap_content" | 84 | + android:layout_height="match_parent" |
85 | + android:layout_gravity="center" | ||
86 | + android:layout_weight="1" | ||
87 | + android:background="#1E90FF" | ||
88 | + android:gravity="center" | ||
89 | + android:text="2" /> | ||
90 | + | ||
91 | + <TextView | ||
92 | + android:id="@+id/stageTextView3" | ||
93 | + android:layout_width="wrap_content" | ||
94 | + android:layout_height="match_parent" | ||
95 | + android:layout_gravity="center" | ||
96 | + android:layout_weight="1" | ||
97 | + android:background="#1E90FF" | ||
98 | + android:gravity="center" | ||
99 | + android:text="3" /> | ||
100 | + | ||
101 | + <TextView | ||
102 | + android:id="@+id/stageTextView4" | ||
103 | + android:layout_width="wrap_content" | ||
104 | + android:layout_height="match_parent" | ||
33 | android:layout_gravity="center" | 105 | android:layout_gravity="center" |
34 | android:layout_weight="1" | 106 | android:layout_weight="1" |
107 | + android:background="#1E90FF" | ||
35 | android:gravity="center" | 108 | android:gravity="center" |
36 | - android:text="필수항목" /> | 109 | + android:text="4" /> |
110 | + | ||
111 | + <TextView | ||
112 | + android:id="@+id/stageTextView5" | ||
113 | + android:layout_width="wrap_content" | ||
114 | + android:layout_height="match_parent" | ||
115 | + android:layout_gravity="center" | ||
116 | + android:layout_weight="1" | ||
117 | + android:gravity="center" | ||
118 | + android:text="5" /> | ||
119 | + | ||
37 | </LinearLayout> | 120 | </LinearLayout> |
38 | 121 | ||
39 | <LinearLayout | 122 | <LinearLayout |
... | @@ -53,47 +136,67 @@ | ... | @@ -53,47 +136,67 @@ |
53 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
54 | android:orientation="vertical"> | 137 | android:orientation="vertical"> |
55 | 138 | ||
56 | - <TextView | 139 | + <RelativeLayout |
57 | - android:id="@+id/explainTextView" | ||
58 | android:layout_width="match_parent" | 140 | android:layout_width="match_parent" |
59 | - android:layout_height="wrap_content" | 141 | + android:layout_height="match_parent"> |
60 | - android:layout_gravity="center" | 142 | + |
61 | - android:gravity="center" | 143 | + <TextView |
62 | - android:text="5. 가구주 여부를 선택해 주세요" /> | 144 | + android:id="@+id/explainTextView" |
145 | + android:layout_width="match_parent" | ||
146 | + android:layout_height="wrap_content" | ||
147 | + android:layout_gravity="center" | ||
148 | + android:gravity="center" | ||
149 | + android:text="5. 가구주 여부를 선택해 주세요" /> | ||
150 | + <Button | ||
151 | + android:id="@+id/questionButton" | ||
152 | + android:layout_width="30dp" | ||
153 | + android:layout_height="30dp" | ||
154 | + android:layout_gravity="center" | ||
155 | + android:layout_toRightOf="@id/explainTextView" | ||
156 | + android:backgroundTint="#1E90FF" | ||
157 | + android:gravity="center" | ||
158 | + android:text=" ? " | ||
159 | + android:textSize="8sp" /> | ||
160 | + </RelativeLayout> | ||
63 | </LinearLayout> | 161 | </LinearLayout> |
64 | 162 | ||
65 | <LinearLayout | 163 | <LinearLayout |
66 | android:layout_width="match_parent" | 164 | android:layout_width="match_parent" |
67 | android:layout_height="50dp" | 165 | android:layout_height="50dp" |
68 | android:layout_weight="1" | 166 | android:layout_weight="1" |
69 | - android:orientation="vertical"></LinearLayout> | ||
70 | - | ||
71 | - <LinearLayout | ||
72 | - android:layout_width="wrap_content" | ||
73 | - android:layout_height="wrap_content" | ||
74 | - android:layout_gravity="center" | ||
75 | - android:gravity="center" | ||
76 | android:orientation="vertical"> | 167 | android:orientation="vertical"> |
77 | 168 | ||
78 | - <ToggleButton | 169 | + </LinearLayout> |
79 | - android:id="@+id/gagoojooButton" | 170 | + |
80 | - android:layout_width="match_parent" | 171 | + <ScrollView |
81 | - android:layout_height="wrap_content" | 172 | + android:layout_width="match_parent" |
82 | - android:background="@drawable/profil_selector" | 173 | + android:layout_height="wrap_content"> |
83 | - android:text="가구주" | ||
84 | - android:textOff="가구주" | ||
85 | - android:textOn="가구주" /> | ||
86 | 174 | ||
87 | - <ToggleButton | 175 | + <LinearLayout |
88 | - android:id="@+id/gagoowonButton" | ||
89 | android:layout_width="match_parent" | 176 | android:layout_width="match_parent" |
90 | android:layout_height="wrap_content" | 177 | android:layout_height="wrap_content" |
91 | - android:background="@drawable/profil_selector" | 178 | + android:orientation="vertical"> |
92 | - android:text="가구원" | 179 | + |
93 | - android:textOff="가구원" | 180 | + <ToggleButton |
94 | - android:textOn="외국인" /> | 181 | + android:id="@+id/gagoojooButton" |
95 | - | 182 | + android:layout_width="match_parent" |
96 | - </LinearLayout> | 183 | + android:layout_height="wrap_content" |
184 | + android:background="@drawable/profil_selector" | ||
185 | + android:text="가구주" | ||
186 | + android:textOff="가구주" | ||
187 | + android:textOn="가구주" /> | ||
188 | + | ||
189 | + <ToggleButton | ||
190 | + android:id="@+id/gagoowonButton" | ||
191 | + android:layout_width="match_parent" | ||
192 | + android:layout_height="wrap_content" | ||
193 | + android:background="@drawable/profil_selector" | ||
194 | + android:text="가구원" | ||
195 | + android:textOff="가구원" | ||
196 | + android:textOn="가구원" /> | ||
197 | + | ||
198 | + </LinearLayout> | ||
199 | + </ScrollView> | ||
97 | 200 | ||
98 | <LinearLayout | 201 | <LinearLayout |
99 | android:layout_width="match_parent" | 202 | android:layout_width="match_parent" |
... | @@ -113,12 +216,6 @@ | ... | @@ -113,12 +216,6 @@ |
113 | android:layout_weight="1" | 216 | android:layout_weight="1" |
114 | android:text="이전 단계로" /> | 217 | android:text="이전 단계로" /> |
115 | 218 | ||
116 | - <LinearLayout | ||
117 | - android:layout_width="10dp" | ||
118 | - android:layout_height="match_parent" | ||
119 | - android:layout_weight="1" | ||
120 | - android:orientation="vertical"></LinearLayout> | ||
121 | - | ||
122 | <Button | 219 | <Button |
123 | android:id="@+id/nextButton" | 220 | android:id="@+id/nextButton" |
124 | android:layout_width="10dp" | 221 | android:layout_width="10dp" | ... | ... |
... | @@ -4,13 +4,64 @@ | ... | @@ -4,13 +4,64 @@ |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | - tools:context=".InputProfilFirstThreeActivity"> | 7 | + tools:context=".InputProfilFourthFiveActivity"> |
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="match_parent" | 11 | android:layout_height="match_parent" |
12 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
13 | 13 | ||
14 | + <androidx.appcompat.widget.Toolbar | ||
15 | + android:id="@+id/toolbar" | ||
16 | + android:layout_width="fill_parent" | ||
17 | + android:layout_height="wrap_content" | ||
18 | + android:layout_marginBottom="11dp" | ||
19 | + android:background="#FFF" | ||
20 | + android:elevation="5dp" | ||
21 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | ||
22 | + app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | ||
23 | + | ||
24 | + <LinearLayout | ||
25 | + android:layout_width="match_parent" | ||
26 | + android:layout_height="match_parent" | ||
27 | + android:orientation="horizontal"> | ||
28 | + | ||
29 | + <Button | ||
30 | + android:id="@+id/skipButton" | ||
31 | + android:layout_width="10dp" | ||
32 | + android:layout_height="match_parent" | ||
33 | + android:layout_weight="1.5" | ||
34 | + android:background="#FFFFFF" | ||
35 | + android:text="나가기" | ||
36 | + android:textColor="#29ABE2" | ||
37 | + android:textSize="16dp" /> | ||
38 | + <LinearLayout | ||
39 | + android:layout_width="10dp" | ||
40 | + android:layout_height="match_parent" | ||
41 | + android:orientation="horizontal" | ||
42 | + android:layout_weight="1"/> | ||
43 | + <ImageView | ||
44 | + android:layout_width="77dp" | ||
45 | + android:layout_height="44dp" | ||
46 | + android:layout_gravity="center" | ||
47 | + android:layout_weight="1" | ||
48 | + android:src="@drawable/toolbar_logo" /> | ||
49 | + <LinearLayout | ||
50 | + android:layout_width="10dp" | ||
51 | + android:layout_height="match_parent" | ||
52 | + android:orientation="horizontal" | ||
53 | + android:layout_weight="1"/> | ||
54 | + <LinearLayout | ||
55 | + android:layout_width="10dp" | ||
56 | + android:layout_height="match_parent" | ||
57 | + android:orientation="horizontal" | ||
58 | + android:layout_weight="1.5"/> | ||
59 | + | ||
60 | + </LinearLayout> | ||
61 | + | ||
62 | + | ||
63 | + </androidx.appcompat.widget.Toolbar> | ||
64 | + | ||
14 | <LinearLayout | 65 | <LinearLayout |
15 | android:layout_width="match_parent" | 66 | android:layout_width="match_parent" |
16 | android:layout_height="50dp" | 67 | android:layout_height="50dp" |
... | @@ -20,20 +71,52 @@ | ... | @@ -20,20 +71,52 @@ |
20 | <TextView | 71 | <TextView |
21 | android:id="@+id/stageTextView1" | 72 | android:id="@+id/stageTextView1" |
22 | android:layout_width="wrap_content" | 73 | android:layout_width="wrap_content" |
23 | - android:layout_height="wrap_content" | 74 | + android:layout_height="match_parent" |
24 | android:layout_gravity="center" | 75 | android:layout_gravity="center" |
25 | android:layout_weight="1" | 76 | android:layout_weight="1" |
77 | + android:background="#1E90FF" | ||
26 | android:gravity="center" | 78 | android:gravity="center" |
27 | - android:text="1단계" /> | 79 | + android:text="1" /> |
28 | 80 | ||
29 | <TextView | 81 | <TextView |
30 | - android:id="@+id/neccesaryTextView" | 82 | + android:id="@+id/stageTextView2" |
31 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
32 | - android:layout_height="wrap_content" | 84 | + android:layout_height="match_parent" |
85 | + android:layout_gravity="center" | ||
86 | + android:layout_weight="1" | ||
87 | + android:background="#1E90FF" | ||
88 | + android:gravity="center" | ||
89 | + android:text="2" /> | ||
90 | + | ||
91 | + <TextView | ||
92 | + android:id="@+id/stageTextView3" | ||
93 | + android:layout_width="wrap_content" | ||
94 | + android:layout_height="match_parent" | ||
95 | + android:layout_gravity="center" | ||
96 | + android:layout_weight="1" | ||
97 | + android:background="#1E90FF" | ||
98 | + android:gravity="center" | ||
99 | + android:text="3" /> | ||
100 | + | ||
101 | + <TextView | ||
102 | + android:id="@+id/stageTextView4" | ||
103 | + android:layout_width="wrap_content" | ||
104 | + android:layout_height="match_parent" | ||
33 | android:layout_gravity="center" | 105 | android:layout_gravity="center" |
34 | android:layout_weight="1" | 106 | android:layout_weight="1" |
107 | + android:background="#1E90FF" | ||
35 | android:gravity="center" | 108 | android:gravity="center" |
36 | - android:text="필수항목" /> | 109 | + android:text="4" /> |
110 | + | ||
111 | + <TextView | ||
112 | + android:id="@+id/stageTextView5" | ||
113 | + android:layout_width="wrap_content" | ||
114 | + android:layout_height="match_parent" | ||
115 | + android:layout_gravity="center" | ||
116 | + android:layout_weight="1" | ||
117 | + android:gravity="center" | ||
118 | + android:text="5" /> | ||
119 | + | ||
37 | </LinearLayout> | 120 | </LinearLayout> |
38 | 121 | ||
39 | <LinearLayout | 122 | <LinearLayout |
... | @@ -53,47 +136,92 @@ | ... | @@ -53,47 +136,92 @@ |
53 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
54 | android:orientation="vertical"> | 137 | android:orientation="vertical"> |
55 | 138 | ||
56 | - <TextView | 139 | + <RelativeLayout |
57 | - android:id="@+id/explainTextView" | ||
58 | android:layout_width="match_parent" | 140 | android:layout_width="match_parent" |
59 | - android:layout_height="wrap_content" | 141 | + android:layout_height="match_parent"> |
60 | - android:layout_gravity="center" | 142 | + |
61 | - android:gravity="center" | 143 | + <TextView |
62 | - android:text="2. 성별을 선택해 주세요." /> | 144 | + android:id="@+id/explainTextView" |
145 | + android:layout_width="match_parent" | ||
146 | + android:layout_height="wrap_content" | ||
147 | + android:layout_gravity="center" | ||
148 | + android:gravity="center" | ||
149 | + android:text="2. 성별을 선택해 주세요." /> | ||
150 | + <Button | ||
151 | + android:id="@+id/questionButton" | ||
152 | + android:layout_width="30dp" | ||
153 | + android:layout_height="30dp" | ||
154 | + android:layout_gravity="center" | ||
155 | + android:layout_toRightOf="@id/explainTextView" | ||
156 | + android:backgroundTint="#1E90FF" | ||
157 | + android:gravity="center" | ||
158 | + android:text=" ? " | ||
159 | + android:textSize="8sp" /> | ||
160 | + </RelativeLayout> | ||
63 | </LinearLayout> | 161 | </LinearLayout> |
64 | 162 | ||
65 | <LinearLayout | 163 | <LinearLayout |
66 | android:layout_width="match_parent" | 164 | android:layout_width="match_parent" |
67 | android:layout_height="50dp" | 165 | android:layout_height="50dp" |
68 | android:layout_weight="1" | 166 | android:layout_weight="1" |
69 | - android:orientation="vertical"></LinearLayout> | ||
70 | - | ||
71 | - <LinearLayout | ||
72 | - android:layout_width="wrap_content" | ||
73 | - android:layout_height="wrap_content" | ||
74 | - android:layout_gravity="center" | ||
75 | - android:gravity="center" | ||
76 | android:orientation="vertical"> | 167 | android:orientation="vertical"> |
77 | 168 | ||
78 | - <RadioGroup | 169 | + </LinearLayout> |
79 | - android:id="@+id/radio_group" | ||
80 | - android:layout_width="match_parent" | ||
81 | - android:layout_height="match_parent"> | ||
82 | 170 | ||
83 | - <RadioButton | 171 | + <ScrollView |
84 | - android:id="@+id/manButton" | 172 | + android:layout_width="match_parent" |
85 | - android:layout_width="match_parent" | 173 | + android:layout_height="wrap_content"> |
86 | - android:layout_height="wrap_content" | ||
87 | - android:text="남자" /> | ||
88 | 174 | ||
89 | - <RadioButton | 175 | + <LinearLayout |
90 | - android:id="@+id/womanButton" | 176 | + android:layout_width="match_parent" |
91 | - android:layout_width="match_parent" | 177 | + android:layout_height="wrap_content" |
92 | - android:layout_height="wrap_content" | 178 | + android:orientation="vertical"> |
93 | - android:text="여자" /> | ||
94 | - </RadioGroup> | ||
95 | 179 | ||
96 | - </LinearLayout> | 180 | + <LinearLayout |
181 | + android:layout_width="match_parent" | ||
182 | + android:layout_height="match_parent" | ||
183 | + android:layout_gravity="center" | ||
184 | + android:gravity="center" | ||
185 | + android:orientation="vertical"> | ||
186 | + | ||
187 | + <LinearLayout | ||
188 | + android:layout_width="match_parent" | ||
189 | + android:layout_height="match_parent" | ||
190 | + android:orientation="horizontal"> | ||
191 | + | ||
192 | + <ToggleButton | ||
193 | + android:id="@+id/manButton" | ||
194 | + android:layout_width="300dp" | ||
195 | + android:layout_height="wrap_content" | ||
196 | + android:layout_weight="1" | ||
197 | + android:background="@drawable/profil_selector" | ||
198 | + android:text="남자" | ||
199 | + android:textOff="남자" | ||
200 | + android:textOn="남자" /> | ||
201 | + | ||
202 | + </LinearLayout> | ||
203 | + | ||
204 | + | ||
205 | + <LinearLayout | ||
206 | + android:layout_width="match_parent" | ||
207 | + android:layout_height="match_parent" | ||
208 | + android:orientation="horizontal"> | ||
209 | + | ||
210 | + <ToggleButton | ||
211 | + android:id="@+id/womanButton" | ||
212 | + android:layout_width="300dp" | ||
213 | + android:layout_height="wrap_content" | ||
214 | + android:layout_weight="1" | ||
215 | + android:background="@drawable/profil_selector" | ||
216 | + android:text="여자" | ||
217 | + android:textOff="여자" | ||
218 | + android:textOn="여자" /> | ||
219 | + </LinearLayout> | ||
220 | + | ||
221 | + </LinearLayout> | ||
222 | + </LinearLayout> | ||
223 | + | ||
224 | + </ScrollView> | ||
97 | 225 | ||
98 | <LinearLayout | 226 | <LinearLayout |
99 | android:layout_width="match_parent" | 227 | android:layout_width="match_parent" |
... | @@ -113,12 +241,6 @@ | ... | @@ -113,12 +241,6 @@ |
113 | android:layout_weight="1" | 241 | android:layout_weight="1" |
114 | android:text="이전 단계로" /> | 242 | android:text="이전 단계로" /> |
115 | 243 | ||
116 | - <LinearLayout | ||
117 | - android:layout_width="10dp" | ||
118 | - android:layout_height="match_parent" | ||
119 | - android:layout_weight="1" | ||
120 | - android:orientation="vertical"></LinearLayout> | ||
121 | - | ||
122 | <Button | 244 | <Button |
123 | android:id="@+id/nextButton" | 245 | android:id="@+id/nextButton" |
124 | android:layout_width="10dp" | 246 | android:layout_width="10dp" | ... | ... |
... | @@ -4,13 +4,64 @@ | ... | @@ -4,13 +4,64 @@ |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
7 | - tools:context=".InputProfilFirstTwoActivity"> | 7 | + tools:context=".InputProfilFourthFiveActivity"> |
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="match_parent" | 11 | android:layout_height="match_parent" |
12 | android:orientation="vertical"> | 12 | android:orientation="vertical"> |
13 | 13 | ||
14 | + <androidx.appcompat.widget.Toolbar | ||
15 | + android:id="@+id/toolbar" | ||
16 | + android:layout_width="fill_parent" | ||
17 | + android:layout_height="wrap_content" | ||
18 | + android:layout_marginBottom="11dp" | ||
19 | + android:background="#FFF" | ||
20 | + android:elevation="5dp" | ||
21 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | ||
22 | + app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | ||
23 | + | ||
24 | + <LinearLayout | ||
25 | + android:layout_width="match_parent" | ||
26 | + android:layout_height="match_parent" | ||
27 | + android:orientation="horizontal"> | ||
28 | + | ||
29 | + <Button | ||
30 | + android:id="@+id/skipButton" | ||
31 | + android:layout_width="10dp" | ||
32 | + android:layout_height="match_parent" | ||
33 | + android:layout_weight="1.5" | ||
34 | + android:background="#FFFFFF" | ||
35 | + android:text="나가기" | ||
36 | + android:textColor="#29ABE2" | ||
37 | + android:textSize="16dp" /> | ||
38 | + <LinearLayout | ||
39 | + android:layout_width="10dp" | ||
40 | + android:layout_height="match_parent" | ||
41 | + android:orientation="horizontal" | ||
42 | + android:layout_weight="1"/> | ||
43 | + <ImageView | ||
44 | + android:layout_width="77dp" | ||
45 | + android:layout_height="44dp" | ||
46 | + android:layout_gravity="center" | ||
47 | + android:layout_weight="1" | ||
48 | + android:src="@drawable/toolbar_logo" /> | ||
49 | + <LinearLayout | ||
50 | + android:layout_width="10dp" | ||
51 | + android:layout_height="match_parent" | ||
52 | + android:orientation="horizontal" | ||
53 | + android:layout_weight="1"/> | ||
54 | + <LinearLayout | ||
55 | + android:layout_width="10dp" | ||
56 | + android:layout_height="match_parent" | ||
57 | + android:orientation="horizontal" | ||
58 | + android:layout_weight="1.5"/> | ||
59 | + | ||
60 | + </LinearLayout> | ||
61 | + | ||
62 | + | ||
63 | + </androidx.appcompat.widget.Toolbar> | ||
64 | + | ||
14 | <LinearLayout | 65 | <LinearLayout |
15 | android:layout_width="match_parent" | 66 | android:layout_width="match_parent" |
16 | android:layout_height="50dp" | 67 | android:layout_height="50dp" |
... | @@ -20,20 +71,52 @@ | ... | @@ -20,20 +71,52 @@ |
20 | <TextView | 71 | <TextView |
21 | android:id="@+id/stageTextView1" | 72 | android:id="@+id/stageTextView1" |
22 | android:layout_width="wrap_content" | 73 | android:layout_width="wrap_content" |
23 | - android:layout_height="wrap_content" | 74 | + android:layout_height="match_parent" |
24 | android:layout_gravity="center" | 75 | android:layout_gravity="center" |
25 | android:layout_weight="1" | 76 | android:layout_weight="1" |
77 | + android:background="#1E90FF" | ||
26 | android:gravity="center" | 78 | android:gravity="center" |
27 | - android:text="1단계" /> | 79 | + android:text="1" /> |
28 | 80 | ||
29 | <TextView | 81 | <TextView |
30 | - android:id="@+id/neccesaryTextView" | 82 | + android:id="@+id/stageTextView2" |
31 | android:layout_width="wrap_content" | 83 | android:layout_width="wrap_content" |
32 | - android:layout_height="wrap_content" | 84 | + android:layout_height="match_parent" |
85 | + android:layout_gravity="center" | ||
86 | + android:layout_weight="1" | ||
87 | + android:background="#1E90FF" | ||
88 | + android:gravity="center" | ||
89 | + android:text="2" /> | ||
90 | + | ||
91 | + <TextView | ||
92 | + android:id="@+id/stageTextView3" | ||
93 | + android:layout_width="wrap_content" | ||
94 | + android:layout_height="match_parent" | ||
95 | + android:layout_gravity="center" | ||
96 | + android:layout_weight="1" | ||
97 | + android:background="#1E90FF" | ||
98 | + android:gravity="center" | ||
99 | + android:text="3" /> | ||
100 | + | ||
101 | + <TextView | ||
102 | + android:id="@+id/stageTextView4" | ||
103 | + android:layout_width="wrap_content" | ||
104 | + android:layout_height="match_parent" | ||
33 | android:layout_gravity="center" | 105 | android:layout_gravity="center" |
34 | android:layout_weight="1" | 106 | android:layout_weight="1" |
107 | + android:background="#1E90FF" | ||
35 | android:gravity="center" | 108 | android:gravity="center" |
36 | - android:text="필수항목" /> | 109 | + android:text="4" /> |
110 | + | ||
111 | + <TextView | ||
112 | + android:id="@+id/stageTextView5" | ||
113 | + android:layout_width="wrap_content" | ||
114 | + android:layout_height="match_parent" | ||
115 | + android:layout_gravity="center" | ||
116 | + android:layout_weight="1" | ||
117 | + android:gravity="center" | ||
118 | + android:text="5" /> | ||
119 | + | ||
37 | </LinearLayout> | 120 | </LinearLayout> |
38 | 121 | ||
39 | <LinearLayout | 122 | <LinearLayout |
... | @@ -53,37 +136,60 @@ | ... | @@ -53,37 +136,60 @@ |
53 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
54 | android:orientation="vertical"> | 137 | android:orientation="vertical"> |
55 | 138 | ||
56 | - <TextView | 139 | + <RelativeLayout |
57 | - android:id="@+id/explainTextView" | ||
58 | android:layout_width="match_parent" | 140 | android:layout_width="match_parent" |
59 | - android:layout_height="wrap_content" | 141 | + android:layout_height="match_parent"> |
60 | - android:layout_gravity="center" | 142 | + |
61 | - android:gravity="center" | 143 | + <TextView |
62 | - android:text="1. 생년월일을 입력해 주세요." /> | 144 | + android:id="@+id/explainTextView" |
145 | + android:layout_width="match_parent" | ||
146 | + android:layout_height="wrap_content" | ||
147 | + android:layout_gravity="center" | ||
148 | + android:gravity="center" | ||
149 | + android:text="1. 생년월일을 입력해 주세요." /> | ||
150 | + | ||
151 | + <Button | ||
152 | + android:id="@+id/questionButton" | ||
153 | + android:layout_width="30dp" | ||
154 | + android:layout_height="30dp" | ||
155 | + android:layout_gravity="center" | ||
156 | + android:layout_toRightOf="@id/explainTextView" | ||
157 | + android:backgroundTint="#1E90FF" | ||
158 | + android:gravity="center" | ||
159 | + android:text=" ? " | ||
160 | + android:textSize="8sp" /> | ||
161 | + </RelativeLayout> | ||
63 | </LinearLayout> | 162 | </LinearLayout> |
64 | 163 | ||
65 | <LinearLayout | 164 | <LinearLayout |
66 | android:layout_width="match_parent" | 165 | android:layout_width="match_parent" |
67 | android:layout_height="50dp" | 166 | android:layout_height="50dp" |
68 | android:layout_weight="1" | 167 | android:layout_weight="1" |
69 | - android:orientation="vertical"></LinearLayout> | ||
70 | - | ||
71 | - <LinearLayout | ||
72 | - android:layout_width="wrap_content" | ||
73 | - android:layout_height="wrap_content" | ||
74 | - android:layout_gravity="center" | ||
75 | - android:gravity="center" | ||
76 | android:orientation="vertical"> | 168 | android:orientation="vertical"> |
77 | 169 | ||
78 | - <EditText | 170 | + </LinearLayout> |
79 | - android:id="@+id/editText" | 171 | + |
172 | + <ScrollView | ||
173 | + android:layout_width="match_parent" | ||
174 | + android:layout_height="wrap_content"> | ||
175 | + | ||
176 | + <LinearLayout | ||
80 | android:layout_width="match_parent" | 177 | android:layout_width="match_parent" |
81 | android:layout_height="wrap_content" | 178 | android:layout_height="wrap_content" |
82 | - android:layout_gravity="center" | 179 | + android:orientation="vertical" > |
83 | - android:ems="10" | 180 | + |
84 | - android:gravity="center" | 181 | + <EditText |
85 | - android:inputType="date" /> | 182 | + android:id="@+id/editText" |
86 | - </LinearLayout> | 183 | + android:layout_width="match_parent" |
184 | + android:layout_height="wrap_content" | ||
185 | + android:layout_gravity="center" | ||
186 | + android:ems="10" | ||
187 | + android:gravity="center" | ||
188 | + android:inputType="date" /> | ||
189 | + | ||
190 | + | ||
191 | + </LinearLayout> | ||
192 | + </ScrollView> | ||
87 | 193 | ||
88 | <LinearLayout | 194 | <LinearLayout |
89 | android:layout_width="match_parent" | 195 | android:layout_width="match_parent" |
... | @@ -96,19 +202,12 @@ | ... | @@ -96,19 +202,12 @@ |
96 | android:layout_height="wrap_content" | 202 | android:layout_height="wrap_content" |
97 | android:orientation="horizontal"> | 203 | android:orientation="horizontal"> |
98 | 204 | ||
99 | - <LinearLayout | 205 | + <Button |
100 | - android:layout_width="10dp" | 206 | + android:id="@+id/previousButton" |
101 | - android:layout_height="match_parent" | ||
102 | - android:layout_weight="1" | ||
103 | - android:orientation="vertical"> | ||
104 | - | ||
105 | - </LinearLayout> | ||
106 | - | ||
107 | - <LinearLayout | ||
108 | android:layout_width="10dp" | 207 | android:layout_width="10dp" |
109 | - android:layout_height="match_parent" | 208 | + android:layout_height="wrap_content" |
110 | android:layout_weight="1" | 209 | android:layout_weight="1" |
111 | - android:orientation="vertical"></LinearLayout> | 210 | + android:text="이전 단계로" /> |
112 | 211 | ||
113 | <Button | 212 | <Button |
114 | android:id="@+id/nextButton" | 213 | android:id="@+id/nextButton" | ... | ... |
-
Please register or login to post a comment