신기성

lasting merging

Showing 92 changed files with 684 additions and 440 deletions
wello_firebase_SDKKey.json
__pycache__
vip_key.jks
backend/wello_firebase_SDKKey.json
\ No newline at end of file
backend/wello_firebase_SDKKey.json
backend/result.json
\ No newline at end of file
......
......@@ -71,4 +71,4 @@ for i, categorys in enumerate(pre_topic):
for push in push_index:
send_to_topic('[가정복지부] 기성이를 보유하신 가정에 지원금을 드립니다.', topics[push])
send_to_topic('wello 화이팅~~.', topics[push])
......
......@@ -4,9 +4,9 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/ic_launcher_real2"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher_real2_round"
android:supportsRtl="true"
android:theme="@style/NoActionBar">
<activity android:name=".InputProfilThirdFiveActivity"></activity>
......
......@@ -16,7 +16,6 @@ import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ValueEventListener
import kotlinx.android.synthetic.main.fragment_a.*
class AFragment : Fragment() {
override fun onCreateView(
......@@ -28,6 +27,9 @@ class AFragment : Fragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
val prof: SharedPreferences = view!!.context.getSharedPreferences("profdata", Context.MODE_PRIVATE)
////// DB 긁어오는 곳 /////////
val policyList = ArrayList<PolicyItem>()
var recomdatabase = FirebaseDatabase.getInstance().reference
......@@ -37,46 +39,65 @@ class AFragment : Fragment() {
//Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
//if (policyList0.size == 0) {
for (memoSnapshot in dataSnapshot.children) {
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo!!.Content,
memo!!.Link,
memo!!.View,
memo!!.Keyword,
memo!!.Date,
memo!!.Review,
memo!!.Score,
memo!!.Category1,
memo!!.Category2,
memo!!.Category3,
memo!!.Category4,
memo!!.Category5,
memo!!.Category6,
memo!!.Category7,
memo!!.Category8,
memo!!.Category9,
memo!!.Category10,
memo!!.Category11,
memo!!.Category12,
memo!!.Category13,
memo!!.Category14,
memo!!.Category15,
memo!!.Category16,
memo!!.Value,
memo!!.D_day
var all_flag = arrayListOf<String>()
var check_flag = arrayListOf<String>()
var user_category = arrayListOf<String>()
var user_topic = prof.getString("existing_topic","none")
//Toast.makeText(this@RecommendActivity, user_topic, Toast.LENGTH_SHORT).show()
val regex = "c[0-9]+[_][0-9]+".toRegex()
val matchResult : Sequence<MatchResult> = regex.findAll(user_topic.toString())
for(i in matchResult) {
if (i.value.split("_")[1] != "1") {
user_category.add(i.value)
}
}
for(i in user_category) {
if (i.split("_")[0] == "c1") { all_flag.add("c1"); if ((i.split("_")[1] in memo!!.Category1.split(" ")) || (memo!!.Category1.split(" ")[0] == "1")) { check_flag.add("c1") } }
if (i.split("_")[0] == "c2") { all_flag.add("c2"); if ((i.split("_")[1] in memo!!.Category2.split(" ")) || (memo!!.Category2.split(" ")[0] == "1")) { check_flag.add("c2") } }
if (i.split("_")[0] == "c3") { all_flag.add("c3"); if ((i.split("_")[1] in memo!!.Category3.split(" ")) || (memo!!.Category3.split(" ")[0] == "1")) { check_flag.add("c3") } }
if (i.split("_")[0] == "c4") { all_flag.add("c4"); if ((i.split("_")[1] in memo!!.Category4.split(" ")) || (memo!!.Category4.split(" ")[0] == "1")) { check_flag.add("c4") } }
if (i.split("_")[0] == "c5") { all_flag.add("c5"); if ((i.split("_")[1] in memo!!.Category5.split(" ")) || (memo!!.Category5.split(" ")[0] == "1")) { check_flag.add("c5") } }
if (i.split("_")[0] == "c6") { all_flag.add("c6"); if ((i.split("_")[1] in memo!!.Category6.split(" ")) || (memo!!.Category6.split(" ")[0] == "1")) { check_flag.add("c6") } }
if (i.split("_")[0] == "c7") { all_flag.add("c7"); if ((i.split("_")[1] in memo!!.Category7.split(" ")) || (memo!!.Category7.split(" ")[0] == "1")) { check_flag.add("c7") } }
if (i.split("_")[0] == "c8") { all_flag.add("c8"); if ((i.split("_")[1] in memo!!.Category8.split(" ")) || (memo!!.Category8.split(" ")[0] == "1")) { check_flag.add("c8") } }
if (i.split("_")[0] == "c9") { all_flag.add("c9"); if ((i.split("_")[1] in memo!!.Category9.split(" ")) || (memo!!.Category9.split(" ")[0] == "1")) { check_flag.add("c9") } }
if (i.split("_")[0] == "c10") { all_flag.add("c10"); if ((i.split("_")[1] in memo!!.Category10.split(" ")) || (memo!!.Category10.split(" ")[0] == "1")) { check_flag.add("c10") } }
if (i.split("_")[0] == "c11") { all_flag.add("c11"); if ((i.split("_")[1] in memo!!.Category11.split(" ")) || (memo!!.Category11.split(" ")[0] == "1")) { check_flag.add("c11") } }
if (i.split("_")[0] == "c12") { all_flag.add("c12"); if ((i.split("_")[1] in memo!!.Category12.split(" ")) || (memo!!.Category12.split(" ")[0] == "1")) { check_flag.add("c12") } }
if (i.split("_")[0] == "c13") { all_flag.add("c13"); if ((i.split("_")[1] in memo!!.Category13.split(" ")) || (memo!!.Category13.split(" ")[0] == "1")) { check_flag.add("c13") } }
if (i.split("_")[0] == "c14") { all_flag.add("c14"); if ((i.split("_")[1] in memo!!.Category14.split(" ")) || (memo!!.Category14.split(" ")[0] == "1")) { check_flag.add("c14") } }
if (i.split("_")[0] == "c15") { all_flag.add("c15"); if ((i.split("_")[1] in memo!!.Category15.split(" ")) || (memo!!.Category15.split(" ")[0] == "1")) { check_flag.add("c15") } }
if (i.split("_")[0] == "c16") { all_flag.add("c16"); if ((i.split("_")[1] in memo!!.Category16.split(" ")) || (memo!!.Category16.split(" ")[0] == "1")) { check_flag.add("c16") } }
}
var set_all = all_flag.distinct()
var set_check = check_flag.distinct()
if (set_all.size == set_check.size) {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, memo!!.Policy, memo!!.Content, memo!!.Link, memo!!.View, memo!!.Keyword, memo!!.Date, memo!!.Review, memo!!.Score, memo!!.Category1, memo!!.Category2, memo!!.Category3, memo!!.Category4, memo!!.Category5, memo!!.Category6, memo!!.Category7, memo!!.Category8, memo!!.Category9, memo!!.Category10, memo!!.Category11, memo!!.Category12, memo!!.Category13, memo!!.Category14, memo!!.Category15, memo!!.Category16, memo!!.Value, memo!!.D_day
)
)
)
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
}
}
//val adapter = PolicyAdapter(policyList)
//policyRecyclerView.adapter = adapter
Toast.makeText(context!!.applicationContext, "총 "+policyList.size.toString()+"개의 추천 정책을 찾았습니다.", Toast.LENGTH_SHORT).show()
}
})
}
......
package com.example.vip
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.content.ContextCompat
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
......@@ -25,6 +28,9 @@ class BFragment : Fragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
val prof: SharedPreferences = view!!.context.getSharedPreferences("profdata", Context.MODE_PRIVATE)
////// DB 긁어오는 곳 /////////
val policyList = ArrayList<PolicyItem>()
var recomdatabase = FirebaseDatabase.getInstance().reference
......@@ -34,44 +40,80 @@ class BFragment : Fragment() {
//Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
//if (policyList0.size == 0) {
for (memoSnapshot in dataSnapshot.children) {
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo!!.Content,
memo!!.Link,
memo!!.View,
memo!!.Keyword,
memo!!.Date,
memo!!.Review,
memo!!.Score,
memo!!.Category1,
memo!!.Category2,
memo!!.Category3,
memo!!.Category4,
memo!!.Category5,
memo!!.Category6,
memo!!.Category7,
memo!!.Category8,
memo!!.Category9,
memo!!.Category10,
memo!!.Category11,
memo!!.Category12,
memo!!.Category13,
memo!!.Category14,
memo!!.Category15,
memo!!.Category16,
memo!!.Value,
memo!!.D_day
)
)
var all_flag = arrayListOf<String>()
var check_flag = arrayListOf<String>()
var user_category = arrayListOf<String>()
var user_topic = prof.getString("existing_topic","none")
//Toast.makeText(this@RecommendActivity, user_topic, Toast.LENGTH_SHORT).show()
val regex = "c[0-9]+[_][0-9]+".toRegex()
val matchResult : Sequence<MatchResult> = regex.findAll(user_topic.toString())
for(i in matchResult) {
if (i.value.split("_")[1] != "1") {
user_category.add(i.value)
}
}
for(i in user_category) {
if (i.split("_")[0] == "c1") { all_flag.add("c1"); if ((i.split("_")[1] in memo!!.Category1.split(" ")) || (memo!!.Category1.split(" ")[0] == "1")) { check_flag.add("c1") } }
if (i.split("_")[0] == "c2") { all_flag.add("c2"); if ((i.split("_")[1] in memo!!.Category2.split(" ")) || (memo!!.Category2.split(" ")[0] == "1")) { check_flag.add("c2") } }
if (i.split("_")[0] == "c3") { all_flag.add("c3"); if ((i.split("_")[1] in memo!!.Category3.split(" ")) || (memo!!.Category3.split(" ")[0] == "1")) { check_flag.add("c3") } }
if (i.split("_")[0] == "c4") { all_flag.add("c4"); if ((i.split("_")[1] in memo!!.Category4.split(" ")) || (memo!!.Category4.split(" ")[0] == "1")) { check_flag.add("c4") } }
if (i.split("_")[0] == "c5") { all_flag.add("c5"); if ((i.split("_")[1] in memo!!.Category5.split(" ")) || (memo!!.Category5.split(" ")[0] == "1")) { check_flag.add("c5") } }
if (i.split("_")[0] == "c6") { all_flag.add("c6"); if ((i.split("_")[1] in memo!!.Category6.split(" ")) || (memo!!.Category6.split(" ")[0] == "1")) { check_flag.add("c6") } }
if (i.split("_")[0] == "c7") { all_flag.add("c7"); if ((i.split("_")[1] in memo!!.Category7.split(" ")) || (memo!!.Category7.split(" ")[0] == "1")) { check_flag.add("c7") } }
if (i.split("_")[0] == "c8") { all_flag.add("c8"); if ((i.split("_")[1] in memo!!.Category8.split(" ")) || (memo!!.Category8.split(" ")[0] == "1")) { check_flag.add("c8") } }
if (i.split("_")[0] == "c9") { all_flag.add("c9"); if ((i.split("_")[1] in memo!!.Category9.split(" ")) || (memo!!.Category9.split(" ")[0] == "1")) { check_flag.add("c9") } }
if (i.split("_")[0] == "c10") { all_flag.add("c10"); if ((i.split("_")[1] in memo!!.Category10.split(" ")) || (memo!!.Category10.split(" ")[0] == "1")) { check_flag.add("c10") } }
if (i.split("_")[0] == "c11") { all_flag.add("c11"); if ((i.split("_")[1] in memo!!.Category11.split(" ")) || (memo!!.Category11.split(" ")[0] == "1")) { check_flag.add("c11") } }
if (i.split("_")[0] == "c12") { all_flag.add("c12"); if ((i.split("_")[1] in memo!!.Category12.split(" ")) || (memo!!.Category12.split(" ")[0] == "1")) { check_flag.add("c12") } }
if (i.split("_")[0] == "c13") { all_flag.add("c13"); if ((i.split("_")[1] in memo!!.Category13.split(" ")) || (memo!!.Category13.split(" ")[0] == "1")) { check_flag.add("c13") } }
if (i.split("_")[0] == "c14") { all_flag.add("c14"); if ((i.split("_")[1] in memo!!.Category14.split(" ")) || (memo!!.Category14.split(" ")[0] == "1")) { check_flag.add("c14") } }
if (i.split("_")[0] == "c15") { all_flag.add("c15"); if ((i.split("_")[1] in memo!!.Category15.split(" ")) || (memo!!.Category15.split(" ")[0] == "1")) { check_flag.add("c15") } }
if (i.split("_")[0] == "c16") { all_flag.add("c16"); if ((i.split("_")[1] in memo!!.Category16.split(" ")) || (memo!!.Category16.split(" ")[0] == "1")) { check_flag.add("c16") } }
}
var set_all = all_flag.distinct()
var set_check = check_flag.distinct()
if (set_all.size == set_check.size) {
if ("2" in memo!!.Category5.split(" ") ||
"3" in memo!!.Category5.split(" ") ||
"4" in memo!!.Category5.split(" ") ||
"5" in memo!!.Category5.split(" ") ||
"2" in memo!!.Category6.split(" ") ||
"3" in memo!!.Category6.split(" ") ||
"4" in memo!!.Category6.split(" ") ||
"5" in memo!!.Category6.split(" ") ||
"6" in memo!!.Category6.split(" ") ||
"7" in memo!!.Category6.split(" ") ||
"17" in memo!!.Category8.split(" ")) {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, memo!!.Policy, memo!!.Content, memo!!.Link, memo!!.View, memo!!.Keyword, memo!!.Date, memo!!.Review, memo!!.Score, memo!!.Category1, memo!!.Category2, memo!!.Category3, memo!!.Category4, memo!!.Category5, memo!!.Category6, memo!!.Category7, memo!!.Category8, memo!!.Category9, memo!!.Category10, memo!!.Category11, memo!!.Category12, memo!!.Category13, memo!!.Category14, memo!!.Category15, memo!!.Category16, memo!!.Value, memo!!.D_day
)
)
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
}
}
}
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
//Toast.makeText(context!!.applicationContext, "총 "+policyList.size.toString()+"개의 추천 정책을 찾았습니다.", Toast.LENGTH_SHORT).show()
}
})
}
......
package com.example.vip
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.content.ContextCompat
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
......@@ -27,6 +30,7 @@ class CFragment : Fragment() {
super.onActivityCreated(savedInstanceState)
val policyList = ArrayList<PolicyItem>()
var recomdatabase = FirebaseDatabase.getInstance().reference
val prof: SharedPreferences = view!!.context.getSharedPreferences("profdata", Context.MODE_PRIVATE)
recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object :
ValueEventListener {
......@@ -34,44 +38,84 @@ class CFragment : Fragment() {
//Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
//if (policyList0.size == 0) {
for (memoSnapshot in dataSnapshot.children) {
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo!!.Content,
memo!!.Link,
memo!!.View,
memo!!.Keyword,
memo!!.Date,
memo!!.Review,
memo!!.Score,
memo!!.Category1,
memo!!.Category2,
memo!!.Category3,
memo!!.Category4,
memo!!.Category5,
memo!!.Category6,
memo!!.Category7,
memo!!.Category8,
memo!!.Category9,
memo!!.Category10,
memo!!.Category11,
memo!!.Category12,
memo!!.Category13,
memo!!.Category14,
memo!!.Category15,
memo!!.Category16,
memo!!.Value,
memo!!.D_day
)
)
var all_flag = arrayListOf<String>()
var check_flag = arrayListOf<String>()
var user_category = arrayListOf<String>()
var user_topic = prof.getString("existing_topic","none")
//Toast.makeText(this@RecommendActivity, user_topic, Toast.LENGTH_SHORT).show()
val regex = "c[0-9]+[_][0-9]+".toRegex()
val matchResult : Sequence<MatchResult> = regex.findAll(user_topic.toString())
for(i in matchResult) {
if (i.value.split("_")[1] != "1") {
user_category.add(i.value)
}
}
for(i in user_category) {
if (i.split("_")[0] == "c1") { all_flag.add("c1"); if ((i.split("_")[1] in memo!!.Category1.split(" ")) || (memo!!.Category1.split(" ")[0] == "1")) { check_flag.add("c1") } }
if (i.split("_")[0] == "c2") { all_flag.add("c2"); if ((i.split("_")[1] in memo!!.Category2.split(" ")) || (memo!!.Category2.split(" ")[0] == "1")) { check_flag.add("c2") } }
if (i.split("_")[0] == "c3") { all_flag.add("c3"); if ((i.split("_")[1] in memo!!.Category3.split(" ")) || (memo!!.Category3.split(" ")[0] == "1")) { check_flag.add("c3") } }
if (i.split("_")[0] == "c4") { all_flag.add("c4"); if ((i.split("_")[1] in memo!!.Category4.split(" ")) || (memo!!.Category4.split(" ")[0] == "1")) { check_flag.add("c4") } }
if (i.split("_")[0] == "c5") { all_flag.add("c5"); if ((i.split("_")[1] in memo!!.Category5.split(" ")) || (memo!!.Category5.split(" ")[0] == "1")) { check_flag.add("c5") } }
if (i.split("_")[0] == "c6") { all_flag.add("c6"); if ((i.split("_")[1] in memo!!.Category6.split(" ")) || (memo!!.Category6.split(" ")[0] == "1")) { check_flag.add("c6") } }
if (i.split("_")[0] == "c7") { all_flag.add("c7"); if ((i.split("_")[1] in memo!!.Category7.split(" ")) || (memo!!.Category7.split(" ")[0] == "1")) { check_flag.add("c7") } }
if (i.split("_")[0] == "c8") { all_flag.add("c8"); if ((i.split("_")[1] in memo!!.Category8.split(" ")) || (memo!!.Category8.split(" ")[0] == "1")) { check_flag.add("c8") } }
if (i.split("_")[0] == "c9") { all_flag.add("c9"); if ((i.split("_")[1] in memo!!.Category9.split(" ")) || (memo!!.Category9.split(" ")[0] == "1")) { check_flag.add("c9") } }
if (i.split("_")[0] == "c10") { all_flag.add("c10"); if ((i.split("_")[1] in memo!!.Category10.split(" ")) || (memo!!.Category10.split(" ")[0] == "1")) { check_flag.add("c10") } }
if (i.split("_")[0] == "c11") { all_flag.add("c11"); if ((i.split("_")[1] in memo!!.Category11.split(" ")) || (memo!!.Category11.split(" ")[0] == "1")) { check_flag.add("c11") } }
if (i.split("_")[0] == "c12") { all_flag.add("c12"); if ((i.split("_")[1] in memo!!.Category12.split(" ")) || (memo!!.Category12.split(" ")[0] == "1")) { check_flag.add("c12") } }
if (i.split("_")[0] == "c13") { all_flag.add("c13"); if ((i.split("_")[1] in memo!!.Category13.split(" ")) || (memo!!.Category13.split(" ")[0] == "1")) { check_flag.add("c13") } }
if (i.split("_")[0] == "c14") { all_flag.add("c14"); if ((i.split("_")[1] in memo!!.Category14.split(" ")) || (memo!!.Category14.split(" ")[0] == "1")) { check_flag.add("c14") } }
if (i.split("_")[0] == "c15") { all_flag.add("c15"); if ((i.split("_")[1] in memo!!.Category15.split(" ")) || (memo!!.Category15.split(" ")[0] == "1")) { check_flag.add("c15") } }
if (i.split("_")[0] == "c16") { all_flag.add("c16"); if ((i.split("_")[1] in memo!!.Category16.split(" ")) || (memo!!.Category16.split(" ")[0] == "1")) { check_flag.add("c16") } }
}
var set_all = all_flag.distinct()
var set_check = check_flag.distinct()
if (set_all.size == set_check.size) {
if ("3" in memo!!.Category2.split(" ") ||
"4" in memo!!.Category2.split(" ") ||
"5" in memo!!.Category2.split(" ") ||
"6" in memo!!.Category2.split(" ") ||
"7" in memo!!.Category2.split(" ") ||
"3" in memo!!.Category5.split(" ") ||
"4" in memo!!.Category5.split(" ") ||
"5" in memo!!.Category5.split(" ") ||
"6" in memo!!.Category5.split(" ") ||
"7" in memo!!.Category5.split(" ") ||
"8" in memo!!.Category5.split(" ") ||
"9" in memo!!.Category5.split(" ") ||
"4" in memo!!.Category6.split(" ") ||
"5" in memo!!.Category6.split(" ") ||
"6" in memo!!.Category6.split(" ") ) {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, memo!!.Policy, memo!!.Content, memo!!.Link, memo!!.View, memo!!.Keyword, memo!!.Date, memo!!.Review, memo!!.Score, memo!!.Category1, memo!!.Category2, memo!!.Category3, memo!!.Category4, memo!!.Category5, memo!!.Category6, memo!!.Category7, memo!!.Category8, memo!!.Category9, memo!!.Category10, memo!!.Category11, memo!!.Category12, memo!!.Category13, memo!!.Category14, memo!!.Category15, memo!!.Category16, memo!!.Value, memo!!.D_day
)
)
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
}
}
}
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
//Toast.makeText(context!!.applicationContext, "총 "+policyList.size.toString()+"개의 추천 정책을 찾았습니다.", Toast.LENGTH_SHORT).show()
}
})
}
......
package com.example.vip
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.content.ContextCompat
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
......@@ -27,6 +30,7 @@ class DFragment : Fragment() {
super.onActivityCreated(savedInstanceState)
val policyList = ArrayList<PolicyItem>()
var recomdatabase = FirebaseDatabase.getInstance().reference
val prof: SharedPreferences = view!!.context.getSharedPreferences("profdata", Context.MODE_PRIVATE)
recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object :
ValueEventListener {
......@@ -34,44 +38,81 @@ class DFragment : Fragment() {
//Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
//if (policyList0.size == 0) {
for (memoSnapshot in dataSnapshot.children) {
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo!!.Content,
memo!!.Link,
memo!!.View,
memo!!.Keyword,
memo!!.Date,
memo!!.Review,
memo!!.Score,
memo!!.Category1,
memo!!.Category2,
memo!!.Category3,
memo!!.Category4,
memo!!.Category5,
memo!!.Category6,
memo!!.Category7,
memo!!.Category8,
memo!!.Category9,
memo!!.Category10,
memo!!.Category11,
memo!!.Category12,
memo!!.Category13,
memo!!.Category14,
memo!!.Category15,
memo!!.Category16,
memo!!.Value,
memo!!.D_day
)
)
var all_flag = arrayListOf<String>()
var check_flag = arrayListOf<String>()
var user_category = arrayListOf<String>()
var user_topic = prof.getString("existing_topic","none")
//Toast.makeText(this@RecommendActivity, user_topic, Toast.LENGTH_SHORT).show()
val regex = "c[0-9]+[_][0-9]+".toRegex()
val matchResult : Sequence<MatchResult> = regex.findAll(user_topic.toString())
for(i in matchResult) {
if (i.value.split("_")[1] != "1") {
user_category.add(i.value)
}
}
for(i in user_category) {
if (i.split("_")[0] == "c1") { all_flag.add("c1"); if ((i.split("_")[1] in memo!!.Category1.split(" ")) || (memo!!.Category1.split(" ")[0] == "1")) { check_flag.add("c1") } }
if (i.split("_")[0] == "c2") { all_flag.add("c2"); if ((i.split("_")[1] in memo!!.Category2.split(" ")) || (memo!!.Category2.split(" ")[0] == "1")) { check_flag.add("c2") } }
if (i.split("_")[0] == "c3") { all_flag.add("c3"); if ((i.split("_")[1] in memo!!.Category3.split(" ")) || (memo!!.Category3.split(" ")[0] == "1")) { check_flag.add("c3") } }
if (i.split("_")[0] == "c4") { all_flag.add("c4"); if ((i.split("_")[1] in memo!!.Category4.split(" ")) || (memo!!.Category4.split(" ")[0] == "1")) { check_flag.add("c4") } }
if (i.split("_")[0] == "c5") { all_flag.add("c5"); if ((i.split("_")[1] in memo!!.Category5.split(" ")) || (memo!!.Category5.split(" ")[0] == "1")) { check_flag.add("c5") } }
if (i.split("_")[0] == "c6") { all_flag.add("c6"); if ((i.split("_")[1] in memo!!.Category6.split(" ")) || (memo!!.Category6.split(" ")[0] == "1")) { check_flag.add("c6") } }
if (i.split("_")[0] == "c7") { all_flag.add("c7"); if ((i.split("_")[1] in memo!!.Category7.split(" ")) || (memo!!.Category7.split(" ")[0] == "1")) { check_flag.add("c7") } }
if (i.split("_")[0] == "c8") { all_flag.add("c8"); if ((i.split("_")[1] in memo!!.Category8.split(" ")) || (memo!!.Category8.split(" ")[0] == "1")) { check_flag.add("c8") } }
if (i.split("_")[0] == "c9") { all_flag.add("c9"); if ((i.split("_")[1] in memo!!.Category9.split(" ")) || (memo!!.Category9.split(" ")[0] == "1")) { check_flag.add("c9") } }
if (i.split("_")[0] == "c10") { all_flag.add("c10"); if ((i.split("_")[1] in memo!!.Category10.split(" ")) || (memo!!.Category10.split(" ")[0] == "1")) { check_flag.add("c10") } }
if (i.split("_")[0] == "c11") { all_flag.add("c11"); if ((i.split("_")[1] in memo!!.Category11.split(" ")) || (memo!!.Category11.split(" ")[0] == "1")) { check_flag.add("c11") } }
if (i.split("_")[0] == "c12") { all_flag.add("c12"); if ((i.split("_")[1] in memo!!.Category12.split(" ")) || (memo!!.Category12.split(" ")[0] == "1")) { check_flag.add("c12") } }
if (i.split("_")[0] == "c13") { all_flag.add("c13"); if ((i.split("_")[1] in memo!!.Category13.split(" ")) || (memo!!.Category13.split(" ")[0] == "1")) { check_flag.add("c13") } }
if (i.split("_")[0] == "c14") { all_flag.add("c14"); if ((i.split("_")[1] in memo!!.Category14.split(" ")) || (memo!!.Category14.split(" ")[0] == "1")) { check_flag.add("c14") } }
if (i.split("_")[0] == "c15") { all_flag.add("c15"); if ((i.split("_")[1] in memo!!.Category15.split(" ")) || (memo!!.Category15.split(" ")[0] == "1")) { check_flag.add("c15") } }
if (i.split("_")[0] == "c16") { all_flag.add("c16"); if ((i.split("_")[1] in memo!!.Category16.split(" ")) || (memo!!.Category16.split(" ")[0] == "1")) { check_flag.add("c16") } }
}
var set_all = all_flag.distinct()
var set_check = check_flag.distinct()
if (set_all.size == set_check.size) {
if ("2" in memo!!.Category13.split(" ") ||
"3" in memo!!.Category13.split(" ") ||
"2" in memo!!.Category14.split(" ") ||
"3" in memo!!.Category14.split(" ") ||
"2" in memo!!.Category15.split(" ") ||
"3" in memo!!.Category15.split(" ") ||
"2" in memo!!.Category16.split(" ") ||
"3" in memo!!.Category16.split(" ") ||
"4" in memo!!.Category16.split(" ") ||
"5" in memo!!.Category16.split(" ") ||
"6" in memo!!.Category16.split(" ") ||
"7" in memo!!.Category16.split(" ")) {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, memo!!.Policy, memo!!.Content, memo!!.Link, memo!!.View, memo!!.Keyword, memo!!.Date, memo!!.Review, memo!!.Score, memo!!.Category1, memo!!.Category2, memo!!.Category3, memo!!.Category4, memo!!.Category5, memo!!.Category6, memo!!.Category7, memo!!.Category8, memo!!.Category9, memo!!.Category10, memo!!.Category11, memo!!.Category12, memo!!.Category13, memo!!.Category14, memo!!.Category15, memo!!.Category16, memo!!.Value, memo!!.D_day
)
)
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
}
}
}
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
//Toast.makeText(context!!.applicationContext, "총 "+policyList.size.toString()+"개의 추천 정책을 찾았습니다.", Toast.LENGTH_SHORT).show()
}
})
}
......
......@@ -66,7 +66,7 @@ class DetailActivity : AppCompatActivity() {
detaildatabase.orderByChild("Policy").startAt(intent.getStringExtra("key")).endAt(intent.getStringExtra("key")+"\uf8ff").addListenerForSingleValueEvent(object :
ValueEventListener {
override fun onCancelled(p0: DatabaseError) {
Toast.makeText(this@DetailActivity, "실패부분", Toast.LENGTH_SHORT).show()
//Toast.makeText(this@DetailActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
......@@ -82,7 +82,7 @@ class DetailActivity : AppCompatActivity() {
detailDday.text=memo!!.D_day
detailTitle.text=memo!!.Policy
detailScore.rating=4.toFloat()
detailFavor.text= memo!!.Keyword
detailFavor.text= "[" + memo!!.Keyword + "]"
val web : WebView = findViewById(R.id.policy_context)
val summary : String = memo!!.Content
......@@ -183,7 +183,7 @@ class DetailActivity : AppCompatActivity() {
} else {
Toast.makeText(this, "putExtra value not found", Toast.LENGTH_SHORT).show()
//Toast.makeText(this, "putExtra value not found", Toast.LENGTH_SHORT).show()
}
......
package com.example.vip
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.content.ContextCompat
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
......@@ -35,44 +38,95 @@ class EFragment : Fragment() {
//Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
//if (policyList0.size == 0) {
val prof: SharedPreferences = view!!.context.getSharedPreferences("profdata", Context.MODE_PRIVATE)
for (memoSnapshot in dataSnapshot.children) {
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo!!.Content,
memo!!.Link,
memo!!.View,
memo!!.Keyword,
memo!!.Date,
memo!!.Review,
memo!!.Score,
memo!!.Category1,
memo!!.Category2,
memo!!.Category3,
memo!!.Category4,
memo!!.Category5,
memo!!.Category6,
memo!!.Category7,
memo!!.Category8,
memo!!.Category9,
memo!!.Category10,
memo!!.Category11,
memo!!.Category12,
memo!!.Category13,
memo!!.Category14,
memo!!.Category15,
memo!!.Category16,
memo!!.Value,
memo!!.D_day
)
)
var all_flag = arrayListOf<String>()
var check_flag = arrayListOf<String>()
var user_category = arrayListOf<String>()
var user_topic = prof.getString("existing_topic","none")
//Toast.makeText(this@RecommendActivity, user_topic, Toast.LENGTH_SHORT).show()
val regex = "c[0-9]+[_][0-9]+".toRegex()
val matchResult : Sequence<MatchResult> = regex.findAll(user_topic.toString())
for(i in matchResult) {
if (i.value.split("_")[1] != "1") {
user_category.add(i.value)
}
}
for(i in user_category) {
if (i.split("_")[0] == "c1") { all_flag.add("c1"); if ((i.split("_")[1] in memo!!.Category1.split(" ")) || (memo!!.Category1.split(" ")[0] == "1")) { check_flag.add("c1") } }
if (i.split("_")[0] == "c2") { all_flag.add("c2"); if ((i.split("_")[1] in memo!!.Category2.split(" ")) || (memo!!.Category2.split(" ")[0] == "1")) { check_flag.add("c2") } }
if (i.split("_")[0] == "c3") { all_flag.add("c3"); if ((i.split("_")[1] in memo!!.Category3.split(" ")) || (memo!!.Category3.split(" ")[0] == "1")) { check_flag.add("c3") } }
if (i.split("_")[0] == "c4") { all_flag.add("c4"); if ((i.split("_")[1] in memo!!.Category4.split(" ")) || (memo!!.Category4.split(" ")[0] == "1")) { check_flag.add("c4") } }
if (i.split("_")[0] == "c5") { all_flag.add("c5"); if ((i.split("_")[1] in memo!!.Category5.split(" ")) || (memo!!.Category5.split(" ")[0] == "1")) { check_flag.add("c5") } }
if (i.split("_")[0] == "c6") { all_flag.add("c6"); if ((i.split("_")[1] in memo!!.Category6.split(" ")) || (memo!!.Category6.split(" ")[0] == "1")) { check_flag.add("c6") } }
if (i.split("_")[0] == "c7") { all_flag.add("c7"); if ((i.split("_")[1] in memo!!.Category7.split(" ")) || (memo!!.Category7.split(" ")[0] == "1")) { check_flag.add("c7") } }
if (i.split("_")[0] == "c8") { all_flag.add("c8"); if ((i.split("_")[1] in memo!!.Category8.split(" ")) || (memo!!.Category8.split(" ")[0] == "1")) { check_flag.add("c8") } }
if (i.split("_")[0] == "c9") { all_flag.add("c9"); if ((i.split("_")[1] in memo!!.Category9.split(" ")) || (memo!!.Category9.split(" ")[0] == "1")) { check_flag.add("c9") } }
if (i.split("_")[0] == "c10") { all_flag.add("c10"); if ((i.split("_")[1] in memo!!.Category10.split(" ")) || (memo!!.Category10.split(" ")[0] == "1")) { check_flag.add("c10") } }
if (i.split("_")[0] == "c11") { all_flag.add("c11"); if ((i.split("_")[1] in memo!!.Category11.split(" ")) || (memo!!.Category11.split(" ")[0] == "1")) { check_flag.add("c11") } }
if (i.split("_")[0] == "c12") { all_flag.add("c12"); if ((i.split("_")[1] in memo!!.Category12.split(" ")) || (memo!!.Category12.split(" ")[0] == "1")) { check_flag.add("c12") } }
if (i.split("_")[0] == "c13") { all_flag.add("c13"); if ((i.split("_")[1] in memo!!.Category13.split(" ")) || (memo!!.Category13.split(" ")[0] == "1")) { check_flag.add("c13") } }
if (i.split("_")[0] == "c14") { all_flag.add("c14"); if ((i.split("_")[1] in memo!!.Category14.split(" ")) || (memo!!.Category14.split(" ")[0] == "1")) { check_flag.add("c14") } }
if (i.split("_")[0] == "c15") { all_flag.add("c15"); if ((i.split("_")[1] in memo!!.Category15.split(" ")) || (memo!!.Category15.split(" ")[0] == "1")) { check_flag.add("c15") } }
if (i.split("_")[0] == "c16") { all_flag.add("c16"); if ((i.split("_")[1] in memo!!.Category16.split(" ")) || (memo!!.Category16.split(" ")[0] == "1")) { check_flag.add("c16") } }
}
var set_all = all_flag.distinct()
var set_check = check_flag.distinct()
if (set_all.size == set_check.size) {
if ("2" in memo!!.Category8.split(" ") ||
"8" in memo!!.Category8.split(" ") ||
"9" in memo!!.Category8.split(" ") ||
"12" in memo!!.Category8.split(" ") ||
"13" in memo!!.Category8.split(" ") ||
"14" in memo!!.Category8.split(" ") ||
"17" in memo!!.Category8.split(" ") ||
"2" in memo!!.Category9.split(" ") ||
"3" in memo!!.Category9.split(" ") ||
"4" in memo!!.Category9.split(" ") ||
"5" in memo!!.Category9.split(" ") ||
"6" in memo!!.Category9.split(" ") ||
"7" in memo!!.Category9.split(" ") ||
"8" in memo!!.Category9.split(" ") ||
"9" in memo!!.Category9.split(" ") ||
"10" in memo!!.Category9.split(" ") ||
"11" in memo!!.Category9.split(" ") ||
"12" in memo!!.Category9.split(" ") ||
"13" in memo!!.Category9.split(" ") ||
"14" in memo!!.Category9.split(" ") ||
"15" in memo!!.Category9.split(" ") ||
"16" in memo!!.Category9.split(" ") ||
"17" in memo!!.Category9.split(" ") ||
"18" in memo!!.Category9.split(" ") ||
"19" in memo!!.Category9.split(" ")) {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, memo!!.Policy, memo!!.Content, memo!!.Link, memo!!.View, memo!!.Keyword, memo!!.Date, memo!!.Review, memo!!.Score, memo!!.Category1, memo!!.Category2, memo!!.Category3, memo!!.Category4, memo!!.Category5, memo!!.Category6, memo!!.Category7, memo!!.Category8, memo!!.Category9, memo!!.Category10, memo!!.Category11, memo!!.Category12, memo!!.Category13, memo!!.Category14, memo!!.Category15, memo!!.Category16, memo!!.Value, memo!!.D_day
)
)
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
}
}
}
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
//Toast.makeText(context!!.applicationContext, "총 "+policyList.size.toString()+"개의 추천 정책을 찾았습니다.", Toast.LENGTH_SHORT).show()
}
})
}
......
......@@ -37,43 +37,77 @@ class FFragment : Fragment() {
//Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
//if (policyList0.size == 0) {
val prof: SharedPreferences = view!!.context.getSharedPreferences("profdata", Context.MODE_PRIVATE)
for (memoSnapshot in dataSnapshot.children) {
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo!!.Content,
memo!!.Link,
memo!!.View,
memo!!.Keyword,
memo!!.Date,
memo!!.Review,
memo!!.Score,
memo!!.Category1,
memo!!.Category2,
memo!!.Category3,
memo!!.Category4,
memo!!.Category5,
memo!!.Category6,
memo!!.Category7,
memo!!.Category8,
memo!!.Category9,
memo!!.Category10,
memo!!.Category11,
memo!!.Category12,
memo!!.Category13,
memo!!.Category14,
memo!!.Category15,
memo!!.Category16,
memo!!.Value,
memo!!.D_day
)
)
var all_flag = arrayListOf<String>()
var check_flag = arrayListOf<String>()
var user_category = arrayListOf<String>()
var user_topic = prof.getString("existing_topic","none")
//Toast.makeText(this@RecommendActivity, user_topic, Toast.LENGTH_SHORT).show()
val regex = "c[0-9]+[_][0-9]+".toRegex()
val matchResult : Sequence<MatchResult> = regex.findAll(user_topic.toString())
for(i in matchResult) {
if (i.value.split("_")[1] != "1") {
user_category.add(i.value)
}
}
for(i in user_category) {
if (i.split("_")[0] == "c1") { all_flag.add("c1"); if ((i.split("_")[1] in memo!!.Category1.split(" ")) || (memo!!.Category1.split(" ")[0] == "1")) { check_flag.add("c1") } }
if (i.split("_")[0] == "c2") { all_flag.add("c2"); if ((i.split("_")[1] in memo!!.Category2.split(" ")) || (memo!!.Category2.split(" ")[0] == "1")) { check_flag.add("c2") } }
if (i.split("_")[0] == "c3") { all_flag.add("c3"); if ((i.split("_")[1] in memo!!.Category3.split(" ")) || (memo!!.Category3.split(" ")[0] == "1")) { check_flag.add("c3") } }
if (i.split("_")[0] == "c4") { all_flag.add("c4"); if ((i.split("_")[1] in memo!!.Category4.split(" ")) || (memo!!.Category4.split(" ")[0] == "1")) { check_flag.add("c4") } }
if (i.split("_")[0] == "c5") { all_flag.add("c5"); if ((i.split("_")[1] in memo!!.Category5.split(" ")) || (memo!!.Category5.split(" ")[0] == "1")) { check_flag.add("c5") } }
if (i.split("_")[0] == "c6") { all_flag.add("c6"); if ((i.split("_")[1] in memo!!.Category6.split(" ")) || (memo!!.Category6.split(" ")[0] == "1")) { check_flag.add("c6") } }
if (i.split("_")[0] == "c7") { all_flag.add("c7"); if ((i.split("_")[1] in memo!!.Category7.split(" ")) || (memo!!.Category7.split(" ")[0] == "1")) { check_flag.add("c7") } }
if (i.split("_")[0] == "c8") { all_flag.add("c8"); if ((i.split("_")[1] in memo!!.Category8.split(" ")) || (memo!!.Category8.split(" ")[0] == "1")) { check_flag.add("c8") } }
if (i.split("_")[0] == "c9") { all_flag.add("c9"); if ((i.split("_")[1] in memo!!.Category9.split(" ")) || (memo!!.Category9.split(" ")[0] == "1")) { check_flag.add("c9") } }
if (i.split("_")[0] == "c10") { all_flag.add("c10"); if ((i.split("_")[1] in memo!!.Category10.split(" ")) || (memo!!.Category10.split(" ")[0] == "1")) { check_flag.add("c10") } }
if (i.split("_")[0] == "c11") { all_flag.add("c11"); if ((i.split("_")[1] in memo!!.Category11.split(" ")) || (memo!!.Category11.split(" ")[0] == "1")) { check_flag.add("c11") } }
if (i.split("_")[0] == "c12") { all_flag.add("c12"); if ((i.split("_")[1] in memo!!.Category12.split(" ")) || (memo!!.Category12.split(" ")[0] == "1")) { check_flag.add("c12") } }
if (i.split("_")[0] == "c13") { all_flag.add("c13"); if ((i.split("_")[1] in memo!!.Category13.split(" ")) || (memo!!.Category13.split(" ")[0] == "1")) { check_flag.add("c13") } }
if (i.split("_")[0] == "c14") { all_flag.add("c14"); if ((i.split("_")[1] in memo!!.Category14.split(" ")) || (memo!!.Category14.split(" ")[0] == "1")) { check_flag.add("c14") } }
if (i.split("_")[0] == "c15") { all_flag.add("c15"); if ((i.split("_")[1] in memo!!.Category15.split(" ")) || (memo!!.Category15.split(" ")[0] == "1")) { check_flag.add("c15") } }
if (i.split("_")[0] == "c16") { all_flag.add("c16"); if ((i.split("_")[1] in memo!!.Category16.split(" ")) || (memo!!.Category16.split(" ")[0] == "1")) { check_flag.add("c16") } }
}
var set_all = all_flag.distinct()
var set_check = check_flag.distinct()
if (set_all.size == set_check.size) {
if ("2" in memo!!.Category2.split(" ") ||
"3" in memo!!.Category2.split(" ") ||
"4" in memo!!.Category2.split(" ") ||
"5" in memo!!.Category2.split(" ") ||
"6" in memo!!.Category2.split(" ") ||
"7" in memo!!.Category2.split(" ") ||
"8" in memo!!.Category8.split(" ")) {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, memo!!.Policy, memo!!.Content, memo!!.Link, memo!!.View, memo!!.Keyword, memo!!.Date, memo!!.Review, memo!!.Score, memo!!.Category1, memo!!.Category2, memo!!.Category3, memo!!.Category4, memo!!.Category5, memo!!.Category6, memo!!.Category7, memo!!.Category8, memo!!.Category9, memo!!.Category10, memo!!.Category11, memo!!.Category12, memo!!.Category13, memo!!.Category14, memo!!.Category15, memo!!.Category16, memo!!.Value, memo!!.D_day
)
)
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
}
}
}
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
//Toast.makeText(context!!.applicationContext, "총 "+policyList.size.toString()+"개의 추천 정책을 찾았습니다.", Toast.LENGTH_SHORT).show()
}
})
}
......
......@@ -7,6 +7,7 @@ import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.ActionBar
import androidx.core.content.ContextCompat
......@@ -22,6 +23,7 @@ import kotlinx.android.synthetic.main.activity_recommend.*
//import kotlinx.android.synthetic.main.activity_recommend.policyRecyclerView
import kotlinx.android.synthetic.main.activity_recommend.toolbar
import kotlinx.android.synthetic.main.activity_signin.*
import kotlinx.android.synthetic.main.search.*
data class MemoItemFavor(
val Policy : String = "",
......@@ -84,7 +86,7 @@ class FavoritesActivity : AppCompatActivity() {
favordatabase.orderByChild("Policy").startAt(favor).endAt(favor).addListenerForSingleValueEvent(object :
ValueEventListener {
override fun onCancelled(p0: DatabaseError) {
Toast.makeText(this@FavoritesActivity, "실패부분", Toast.LENGTH_SHORT).show()
//Toast.makeText(this@FavoritesActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
......@@ -125,6 +127,16 @@ class FavoritesActivity : AppCompatActivity() {
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
if (policyList.size == 0) {
policyRecyclerView.setVisibility(View.GONE)
no_favor.setVisibility(View.VISIBLE)
}
else {
no_favor.setVisibility(View.GONE)
policyRecyclerView.setVisibility(View.VISIBLE)
}
}
})
}
......
......@@ -37,43 +37,74 @@ class GFragment : Fragment() {
//Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
//if (policyList0.size == 0) {
val prof: SharedPreferences = view!!.context.getSharedPreferences("profdata", Context.MODE_PRIVATE)
for (memoSnapshot in dataSnapshot.children) {
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo!!.Content,
memo!!.Link,
memo!!.View,
memo!!.Keyword,
memo!!.Date,
memo!!.Review,
memo!!.Score,
memo!!.Category1,
memo!!.Category2,
memo!!.Category3,
memo!!.Category4,
memo!!.Category5,
memo!!.Category6,
memo!!.Category7,
memo!!.Category8,
memo!!.Category9,
memo!!.Category10,
memo!!.Category11,
memo!!.Category12,
memo!!.Category13,
memo!!.Category14,
memo!!.Category15,
memo!!.Category16,
memo!!.Value,
memo!!.D_day
)
)
var all_flag = arrayListOf<String>()
var check_flag = arrayListOf<String>()
var user_category = arrayListOf<String>()
var user_topic = prof.getString("existing_topic","none")
//Toast.makeText(this@RecommendActivity, user_topic, Toast.LENGTH_SHORT).show()
val regex = "c[0-9]+[_][0-9]+".toRegex()
val matchResult : Sequence<MatchResult> = regex.findAll(user_topic.toString())
for(i in matchResult) {
if (i.value.split("_")[1] != "1") {
user_category.add(i.value)
}
}
for(i in user_category) {
if (i.split("_")[0] == "c1") { all_flag.add("c1"); if ((i.split("_")[1] in memo!!.Category1.split(" ")) || (memo!!.Category1.split(" ")[0] == "1")) { check_flag.add("c1") } }
if (i.split("_")[0] == "c2") { all_flag.add("c2"); if ((i.split("_")[1] in memo!!.Category2.split(" ")) || (memo!!.Category2.split(" ")[0] == "1")) { check_flag.add("c2") } }
if (i.split("_")[0] == "c3") { all_flag.add("c3"); if ((i.split("_")[1] in memo!!.Category3.split(" ")) || (memo!!.Category3.split(" ")[0] == "1")) { check_flag.add("c3") } }
if (i.split("_")[0] == "c4") { all_flag.add("c4"); if ((i.split("_")[1] in memo!!.Category4.split(" ")) || (memo!!.Category4.split(" ")[0] == "1")) { check_flag.add("c4") } }
if (i.split("_")[0] == "c5") { all_flag.add("c5"); if ((i.split("_")[1] in memo!!.Category5.split(" ")) || (memo!!.Category5.split(" ")[0] == "1")) { check_flag.add("c5") } }
if (i.split("_")[0] == "c6") { all_flag.add("c6"); if ((i.split("_")[1] in memo!!.Category6.split(" ")) || (memo!!.Category6.split(" ")[0] == "1")) { check_flag.add("c6") } }
if (i.split("_")[0] == "c7") { all_flag.add("c7"); if ((i.split("_")[1] in memo!!.Category7.split(" ")) || (memo!!.Category7.split(" ")[0] == "1")) { check_flag.add("c7") } }
if (i.split("_")[0] == "c8") { all_flag.add("c8"); if ((i.split("_")[1] in memo!!.Category8.split(" ")) || (memo!!.Category8.split(" ")[0] == "1")) { check_flag.add("c8") } }
if (i.split("_")[0] == "c9") { all_flag.add("c9"); if ((i.split("_")[1] in memo!!.Category9.split(" ")) || (memo!!.Category9.split(" ")[0] == "1")) { check_flag.add("c9") } }
if (i.split("_")[0] == "c10") { all_flag.add("c10"); if ((i.split("_")[1] in memo!!.Category10.split(" ")) || (memo!!.Category10.split(" ")[0] == "1")) { check_flag.add("c10") } }
if (i.split("_")[0] == "c11") { all_flag.add("c11"); if ((i.split("_")[1] in memo!!.Category11.split(" ")) || (memo!!.Category11.split(" ")[0] == "1")) { check_flag.add("c11") } }
if (i.split("_")[0] == "c12") { all_flag.add("c12"); if ((i.split("_")[1] in memo!!.Category12.split(" ")) || (memo!!.Category12.split(" ")[0] == "1")) { check_flag.add("c12") } }
if (i.split("_")[0] == "c13") { all_flag.add("c13"); if ((i.split("_")[1] in memo!!.Category13.split(" ")) || (memo!!.Category13.split(" ")[0] == "1")) { check_flag.add("c13") } }
if (i.split("_")[0] == "c14") { all_flag.add("c14"); if ((i.split("_")[1] in memo!!.Category14.split(" ")) || (memo!!.Category14.split(" ")[0] == "1")) { check_flag.add("c14") } }
if (i.split("_")[0] == "c15") { all_flag.add("c15"); if ((i.split("_")[1] in memo!!.Category15.split(" ")) || (memo!!.Category15.split(" ")[0] == "1")) { check_flag.add("c15") } }
if (i.split("_")[0] == "c16") { all_flag.add("c16"); if ((i.split("_")[1] in memo!!.Category16.split(" ")) || (memo!!.Category16.split(" ")[0] == "1")) { check_flag.add("c16") } }
}
var set_all = all_flag.distinct()
var set_check = check_flag.distinct()
if (set_all.size == set_check.size) {
if ("4" in memo!!.Category8.split(" ") ||
"5" in memo!!.Category8.split(" ") ||
"6" in memo!!.Category8.split(" ") ||
"7" in memo!!.Category8.split(" ")) {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, memo!!.Policy, memo!!.Content, memo!!.Link, memo!!.View, memo!!.Keyword, memo!!.Date, memo!!.Review, memo!!.Score, memo!!.Category1, memo!!.Category2, memo!!.Category3, memo!!.Category4, memo!!.Category5, memo!!.Category6, memo!!.Category7, memo!!.Category8, memo!!.Category9, memo!!.Category10, memo!!.Category11, memo!!.Category12, memo!!.Category13, memo!!.Category14, memo!!.Category15, memo!!.Category16, memo!!.Value, memo!!.D_day
)
)
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
policyRecyclerView.setItemViewCacheSize((200000000))
}
}
}
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
//Toast.makeText(context!!.applicationContext, "총 "+policyList.size.toString()+"개의 추천 정책을 찾았습니다.", Toast.LENGTH_SHORT).show()
}
})
}
......
......@@ -32,9 +32,9 @@ class InputProfilFifthFourActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//11Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -33,9 +33,9 @@ class InputProfilFifthOneActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -32,9 +32,9 @@ class InputProfilFifthThreeActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -34,9 +34,9 @@ class InputProfilFifthTwoActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -40,7 +40,8 @@ class InputProfilFirstFiveActivity : AppCompatActivity() {
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//
// Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -35,9 +35,9 @@ class InputProfilFirstFourActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
// val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -46,9 +46,9 @@ class InputProfilFirstOneActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -32,9 +32,9 @@ class InputProfilFirstSixActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -34,9 +34,9 @@ class InputProfilFirstThreeActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -34,9 +34,9 @@ class InputProfilFirstTwoActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......@@ -188,6 +188,7 @@ class InputProfilFirstTwoActivity : AppCompatActivity() {
editor.commit()
editor.putString("first_two","done");editor.commit()
}
else if((2019-birthdateint)<59){
editor.putInt("c1_6",1)
......
......@@ -33,9 +33,9 @@ class InputProfilFourthFiveActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -33,9 +33,9 @@ class InputProfilFourthFourActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -34,9 +34,9 @@ class InputProfilFourthOneActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -33,9 +33,9 @@ class InputProfilFourthThreeActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -34,9 +34,9 @@ class InputProfilFourthTwoActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -32,9 +32,9 @@ class InputProfilSecondOneActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -37,9 +37,9 @@ class InputProfilSecondThreeActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -39,7 +39,7 @@ class InputProfilSecondTwoActivity : AppCompatActivity() {
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -39,9 +39,9 @@ class InputProfilThirdFiveActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -34,9 +34,9 @@ class InputProfilThirdFourActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -33,9 +33,9 @@ class InputProfilThirdOneActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -32,9 +32,9 @@ class InputProfilThirdThreeActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -34,9 +34,9 @@ class InputProfilThirdTwoActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
......
......@@ -32,6 +32,7 @@ import androidx.core.app.ComponentActivity.ExtraData
import androidx.core.content.ContextCompat.getSystemService
import android.icu.lang.UCharacter.GraphemeClusterBreak.T
import androidx.core.view.size
import kotlinx.android.synthetic.main.fragment_a.*
data class MemoItemRecom(
val Policy : String = "",
......@@ -62,7 +63,6 @@ data class MemoItemRecom(
val D_day : String = ""
)
class RecommendActivity : AppCompatActivity() {
private val adapter by lazy { MainAdapter(supportFragmentManager) }
......@@ -87,108 +87,7 @@ class RecommendActivity : AppCompatActivity() {
bottomNavigationView.selectedItemId = R.id.bottomRecommend
bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
/*
val policyList = ArrayList<PolicyItem>()
if (intent.hasExtra("key")) {
//textView.text = intent.getStringExtra("key") 텍뷰추가하면 인텐트로 값넘기는거 보임
// startAt(intent.getStringExtra("key")).endAt(intent.getStringExtra("key")+"\uf8ff")
recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object : ValueEventListener {
override fun onCancelled(p0: DatabaseError) {
Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(this@RecommendActivity, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo.Content,
memo.Link,
memo.View,
memo.Keyword,
memo.Date,
memo.Review,
memo.Score,
memo.Category1,
memo.Category2,
memo.Category3,
memo.Category4,
memo.Category5,
memo.Category6,
memo.Category7,
memo.Category8,
memo.Category9,
memo.Category10,
memo.Category11,
memo.Category12,
memo.Category13,
memo.Category14,
memo.Category15,
memo.Category16,
memo.Value,
memo.D_day
)
)
}
//val adapter = PolicyAdapter(policyList)
//policyRecyclerView.adapter = adapter
}
})
} else {
//Toast.makeText(this, "putExtra value not found", Toast.LENGTH_SHORT).show()
recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object :
ValueEventListener {
override fun onCancelled(p0: DatabaseError) {
Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
val memo = memoSnapshot.getValue(MemoItemRecom::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(this@RecommendActivity, R.drawable.recommend_default_blue)!!,
memo!!.Policy,
memo!!.Content,
memo!!.Link,
memo!!.View,
memo!!.Keyword,
memo!!.Date,
memo!!.Review,
memo!!.Score,
memo!!.Category1,
memo!!.Category2,
memo!!.Category3,
memo!!.Category4,
memo!!.Category5,
memo!!.Category6,
memo!!.Category7,
memo!!.Category8,
memo!!.Category9,
memo!!.Category10,
memo!!.Category11,
memo!!.Category12,
memo!!.Category13,
memo!!.Category14,
memo!!.Category15,
memo!!.Category16,
memo!!.Value,
memo!!.D_day
)
)
}
//val adapter = PolicyAdapter(policyList)
//policyRecyclerView.adapter = adapter
}
})
}
*/
vpMainActivity.setCurrentItem(intent.getIntExtra("key", 0))
// 1. 툴바 사용 설정
setSupportActionBar(toolbar)
......@@ -201,6 +100,7 @@ class RecommendActivity : AppCompatActivity() {
//val bottomNavigation: BottomNavigationView =findViewById(R.id.bottomNavigation)
//bottomNavigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
////bottom navigation view operation end 2
}
// 3.툴바 메뉴 버튼을 설정
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
......
......@@ -26,8 +26,6 @@ import androidx.core.content.ContextCompat.getSystemService
import android.icu.lang.UCharacter.GraphemeClusterBreak.T
data class MemoItem(
val Target : String = "",
val Policy : String = "",
......@@ -106,10 +104,13 @@ class SearchActivity : AppCompatActivity() {
}
}
//중복 제거
var set_key =key.distinct()
no_search.setVisibility(View.GONE)
policy_scroll_view.setVisibility(View.VISIBLE)
for (i in key) {
for (i in set_key) {
val key_query = database.orderByChild("Policy").equalTo("$i")
key_query.addListenerForSingleValueEvent(object : ValueEventListener {
override fun onDataChange(dataSnapshot: DataSnapshot) {
......@@ -120,7 +121,7 @@ class SearchActivity : AppCompatActivity() {
searchList.add(
SearchItem(
ContextCompat.getDrawable(this@SearchActivity, R.drawable.image01)!!, memo!!.Policy
ContextCompat.getDrawable(this@SearchActivity, R.drawable._wello_2)!!, memo!!.Policy
)
)
}
......
......@@ -18,15 +18,15 @@ class SettingActivity : AppCompatActivity() {
var editTextHello = findViewById(R.id.editText2) as EditText
Log.d(TAG, "Subscribing to weather topic")
// [START subscribe_topics]
Toast.makeText(this, editTextHello.text.toString(), Toast.LENGTH_SHORT).show()
//Toast.makeText(this, editTextHello.text.toString(), Toast.LENGTH_SHORT).show()
FirebaseMessaging.getInstance().subscribeToTopic(editTextHello.text.toString())
.addOnCompleteListener { task ->
var msg = getString(R.string.msg_subscribed)
if (!task.isSuccessful) {
msg = getString(R.string.msg_subscribe_failed)
}
Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//Log.d(TAG, msg)
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
}
// [END subscribe_topics]
}
......
......@@ -40,32 +40,32 @@ class SignInActivity : AppCompatActivity() {
kyoyookButton.setOnClickListener {
val intent = Intent(this, RecommendActivity::class.java)
intent.putExtra("key","kyoyook")
intent.putExtra("key",1)
startActivity(intent)
}
koyongButton.setOnClickListener {
val intent = Intent(this, RecommendActivity::class.java)
intent.putExtra("key","koyong")
intent.putExtra("key",2)
startActivity(intent)
}
joogeoButton.setOnClickListener {
val intent = Intent(this, RecommendActivity::class.java)
intent.putExtra("key","joogeo")
intent.putExtra("key",3)
startActivity(intent)
}
geongangButton.setOnClickListener {
val intent = Intent(this, RecommendActivity::class.java)
intent.putExtra("key","geongang")
intent.putExtra("key",4)
startActivity(intent)
}
seominButton.setOnClickListener {
val intent = Intent(this, RecommendActivity::class.java)
intent.putExtra("key","seomin")
intent.putExtra("key",5)
startActivity(intent)
}
moonhwaButton.setOnClickListener {
val intent = Intent(this, RecommendActivity::class.java)
intent.putExtra("key","moonhwa")
intent.putExtra("key",6)
startActivity(intent)
}
// 네비게이션 뷰 포커스 맞추는 코드
......
......@@ -58,9 +58,9 @@ class SignUpActivity : AppCompatActivity() {
tkn = task.result!!.token
// Log and toast
val msg = getString(R.string.msg_token_fmt, tkn)
Log.d(TAG, msg)
Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
//val msg = getString(R.string.msg_token_fmt, tkn)
//Log.d(TAG, msg)
//Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}
//pushing code end 2
......

14.5 KB | W: | H:

29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

14.5 KB | W: | H:

29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

14.5 KB | W: | H:

29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

14.5 KB | W: | H:

29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

14.5 KB | W: | H:

29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

14.5 KB | W: | H:

29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

14.5 KB | W: | H:

29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

14.5 KB | W: | H:

29 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
......@@ -81,7 +81,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginRight="3dp"
android:ellipsize="end"
android:textSize="14dp" />
......
......@@ -39,8 +39,21 @@
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_weight="1"
android:visibility="visible"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_policy" />
tools:listitem="@layout/item_policy">
</androidx.recyclerview.widget.RecyclerView>
<ImageView
android:id="@+id/no_favor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_weight="1"
android:contentDescription="img"
android:visibility="gone"
app:srcCompat="@drawable/no_favorlist" />
<FrameLayout
android:layout_width="match_parent"
......
......@@ -74,13 +74,13 @@
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="2dp"
android:orientation="vertical">
<TextView
android:id="@+id/textView10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="14dp"
android:text="분야별 복지정책"
android:textSize="18dp"
android:textStyle="bold" />
......@@ -107,6 +107,7 @@
android:orientation="horizontal">
<LinearLayout
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
......@@ -138,6 +139,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
......@@ -169,6 +171,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
......@@ -207,6 +210,7 @@
android:orientation="horizontal"></LinearLayout>
<LinearLayout
android:id="@+id/btn4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
......@@ -245,6 +249,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
......@@ -276,6 +281,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/btn6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
......
......@@ -10,8 +10,8 @@
<ImageView
android:id="@+id/searchIcon"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:layout_weight="0"
android:adjustViewBounds="true"
......@@ -26,7 +26,7 @@
android:ellipsize="end"
android:gravity="center_horizontal|left|center_vertical"
android:maxLines="1"
android:paddingLeft="4dp"
android:paddingLeft="10dp"
android:paddingRight="7dp"
android:text="dfefef"
android:textSize="20sp" />
......
......@@ -80,10 +80,11 @@
android:layout_width="278dp"
android:layout_height="278dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="200dp"
android:layout_weight="1"
android:contentDescription="img"
android:visibility="gone"
app:srcCompat="@drawable/not_matching" />
android:src="@drawable/not_matching"
android:visibility="gone" />
<LinearLayout
android:id="@+id/hashtag_linear"
......@@ -129,14 +130,14 @@
<com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginBottom="20dp">
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 장애인"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -147,8 +148,7 @@
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 한부모"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -160,7 +160,7 @@
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 다문화"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -168,15 +168,22 @@
app:chipBackgroundColor="#FFFFFF" />
</com.google.android.material.chip.ChipGroup>
<TextView
android:id="@+id/textView13"
android:layout_width="wrap_content"
android:layout_height="2dp" />
<com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp">
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 저소득층"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -188,6 +195,7 @@
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 임신/출산"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -214,14 +222,14 @@
<com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginBottom="20dp">
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 아동"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -232,8 +240,7 @@
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 청소년"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -245,7 +252,7 @@
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 청년"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -253,15 +260,21 @@
app:chipBackgroundColor="#FFFFFF" />
</com.google.android.material.chip.ChipGroup>
<TextView
android:id="@+id/textView14"
android:layout_width="wrap_content"
android:layout_height="2dp" />
<com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginLeft="10dp">
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 중장년"
android:textAppearance="@style/TextAppearance.AppCompat"
......@@ -273,6 +286,7 @@
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="7dp"
android:checkable="false"
android:text="# 노년"
android:textAppearance="@style/TextAppearance.AppCompat"
......
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_real_background"/>
<foreground android:drawable="@mipmap/ic_launcher_real_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_real2_background"/>
<foreground android:drawable="@mipmap/ic_launcher_real2_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_real2_background"/>
<foreground android:drawable="@mipmap/ic_launcher_real2_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_real_background"/>
<foreground android:drawable="@mipmap/ic_launcher_real_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_real2_background">#FFFFFF</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_real_background">#FFFFFF</color>
</resources>
\ No newline at end of file