soonmyeong2

connect db

1 +#-*- coding: utf-8 -*-
2 +import json
3 +
4 +
5 +with open('tset.json', 'rt', encoding='utf-8') as json_file:
6 + json_data = json.load(json_file)
7 +
8 +
9 +for js in json_data:
10 + for key, value in js.items():
11 + if type(value) != str and key != 'View':
12 + js[key] = str(value)
13 +
14 +with open('result.json', 'w', encoding='utf-8') as make_file:
15 + make_file.write('[')
16 + for i, js in enumerate(json_data):
17 + #make_file.write(json.dumps(js, indent="\t",ensure_ascii=False))
18 + json.dump(js, make_file, indent="\t", ensure_ascii=False)
19 + if i != len(json_data) - 1:
20 + make_file.write(',')
21 + make_file.write(']')
22 +
...@@ -24,10 +24,30 @@ import kotlinx.android.synthetic.main.activity_recommend.toolbar ...@@ -24,10 +24,30 @@ import kotlinx.android.synthetic.main.activity_recommend.toolbar
24 import kotlinx.android.synthetic.main.activity_signin.* 24 import kotlinx.android.synthetic.main.activity_signin.*
25 25
26 data class MemoItemFavor( 26 data class MemoItemFavor(
27 - val Target : String = "",
28 val Policy : String = "", 27 val Policy : String = "",
29 val Content : String = "", 28 val Content : String = "",
30 - val Link : String = "" 29 + val Link : String = "",
30 + val View : Int = 0,
31 + val Keyword : String = "",
32 + val Date : String = "",
33 + val Review : String = "",
34 + val Score : Float = 0.toFloat(),
35 + val Category1 : String = "",
36 + val Category2 : String = "",
37 + val Category3 : String = "",
38 + val Category4 : String = "",
39 + val Category5 : String = "",
40 + val Category6 : String = "",
41 + val Category7 : String = "",
42 + val Category8 : String = "",
43 + val Category9 : String = "",
44 + val Category10 : String = "",
45 + val Category11 : String = "",
46 + val Category12 : String = "",
47 + val Category13 : String = "",
48 + val Category14 : String = "",
49 + val Category15 : String = "",
50 + val Category16 : String = ""
31 ) 51 )
32 52
33 class FavoritesActivity : AppCompatActivity() { 53 class FavoritesActivity : AppCompatActivity() {
...@@ -71,10 +91,29 @@ class FavoritesActivity : AppCompatActivity() { ...@@ -71,10 +91,29 @@ class FavoritesActivity : AppCompatActivity() {
71 PolicyItem( 91 PolicyItem(
72 ContextCompat.getDrawable(this@FavoritesActivity, R.drawable.image01)!!, 92 ContextCompat.getDrawable(this@FavoritesActivity, R.drawable.image01)!!,
73 memo!!.Policy, 93 memo!!.Policy,
74 - memo!!.Policy, 94 + memo.Content,
75 - memo!!.Policy, 95 + memo.Link,
76 - 4.toFloat(), 96 + memo.View,
77 - " " 97 + memo.Keyword,
98 + memo.Date,
99 + memo.Review,
100 + memo.Score,
101 + memo.Category1,
102 + memo.Category2,
103 + memo.Category3,
104 + memo.Category4,
105 + memo.Category5,
106 + memo.Category6,
107 + memo.Category7,
108 + memo.Category8,
109 + memo.Category9,
110 + memo.Category10,
111 + memo.Category11,
112 + memo.Category12,
113 + memo.Category13,
114 + memo.Category14,
115 + memo.Category15,
116 + memo.Category16
78 ) 117 )
79 ) 118 )
80 } 119 }
...@@ -85,17 +124,6 @@ class FavoritesActivity : AppCompatActivity() { ...@@ -85,17 +124,6 @@ class FavoritesActivity : AppCompatActivity() {
85 }) 124 })
86 } 125 }
87 126
88 - /* if (intent.hasExtra("key")) {
89 - //textView.text = intent.getStringExtra("key") 텍뷰추가하면 인텐트로 값넘기는거 보임
90 -
91 - } else {
92 - Toast.makeText(this, "putExtra value not found", Toast.LENGTH_SHORT).show()
93 - }
94 -
95 - */
96 -
97 -
98 -
99 // 1. 툴바 사용 설정 127 // 1. 툴바 사용 설정
100 setSupportActionBar(toolbar) 128 setSupportActionBar(toolbar)
101 129
......
...@@ -45,14 +45,14 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) : ...@@ -45,14 +45,14 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
45 45
46 fun bind(item: PolicyItem) { 46 fun bind(item: PolicyItem) {
47 view.policyImage.setImageDrawable(item.policyItemImage) 47 view.policyImage.setImageDrawable(item.policyItemImage)
48 - view.policyDday.text = item.policyItemDday 48 + if (item.policyItemDate == "") { item.policyItemDate = "상시" }
49 - view.policyHost.text = item.policyItemHost 49 + view.policyDday.text = item.policyItemDate
50 - view.policyTitle.text = item.policyItemTitle 50 + view.policyHost.text = item.policyItemKeyword
51 - view.policyScore.rating= item.policyItemScore 51 + view.policyTitle.text = item.policyItemPolicy
52 - view.policyFavor.text=item.policyItemFavor 52 + view.policyScore.rating= item.policyScore
53 53
54 54
55 - if(item.policyItemTitle in sepstrset){ 55 + if(item.policyItemPolicy in sepstrset){
56 view.policyFavor.isChecked=true 56 view.policyFavor.isChecked=true
57 } 57 }
58 else{ 58 else{
...@@ -62,8 +62,8 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) : ...@@ -62,8 +62,8 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
62 62
63 val intent=Intent(view.context, DetailActivity::class.java) 63 val intent=Intent(view.context, DetailActivity::class.java)
64 //putExtraStart 64 //putExtraStart
65 - intent.putExtra("key",item.policyItemTitle) 65 + intent.putExtra("key",item.policyItemPolicy)
66 - //putExtraEnd 66 + //putExtraEnd0
67 view.context.startActivity(intent) 67 view.context.startActivity(intent)
68 } 68 }
69 69
......
...@@ -3,8 +3,28 @@ package com.example.vip ...@@ -3,8 +3,28 @@ package com.example.vip
3 import android.graphics.drawable.Drawable 3 import android.graphics.drawable.Drawable
4 4
5 class PolicyItem(val policyItemImage: Drawable, 5 class PolicyItem(val policyItemImage: Drawable,
6 - val policyItemDday: String,
7 - val policyItemHost: String,
8 - val policyItemTitle: String,
9 - val policyItemScore: Float,
10 - val policyItemFavor: String)
...\ No newline at end of file ...\ No newline at end of file
6 + val policyItemPolicy: String,
7 + val policyItemContents: String,
8 + val policyItemLink: String,
9 + val policyItemView: Int,
10 + val policyItemKeyword: String,
11 + var policyItemDate: String,
12 + val policyReview : String,
13 + val policyScore : Float,
14 + val policyCategory1: String,
15 + val policyCategory2: String,
16 + val policyCategory3: String,
17 + val policyCategory4: String,
18 + val policyCategory5: String,
19 + val policyCategory6: String,
20 + val policyCategory7: String,
21 + val policyCategory8: String,
22 + val policyCategory9: String,
23 + val policyCategory10: String,
24 + val policyCategory11: String,
25 + val policyCategory12: String,
26 + val policyCategory13: String,
27 + val policyCategory14: String,
28 + val policyCategory15: String,
29 + val policyCategory16: String
30 +) {}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -33,12 +33,31 @@ import androidx.core.content.ContextCompat.getSystemService ...@@ -33,12 +33,31 @@ import androidx.core.content.ContextCompat.getSystemService
33 import android.icu.lang.UCharacter.GraphemeClusterBreak.T 33 import android.icu.lang.UCharacter.GraphemeClusterBreak.T
34 import androidx.core.view.size 34 import androidx.core.view.size
35 35
36 -
37 data class MemoItemRecom( 36 data class MemoItemRecom(
38 - val Target : String = "",
39 val Policy : String = "", 37 val Policy : String = "",
40 val Content : String = "", 38 val Content : String = "",
41 - val Link : String = "" 39 + val Link : String = "",
40 + val View : Int = 0,
41 + val Keyword : String = "",
42 + val Date : String = "",
43 + val Review : String = "",
44 + val Score : Float = 0.toFloat(),
45 + val Category1 : String = "",
46 + val Category2 : String = "",
47 + val Category3 : String = "",
48 + val Category4 : String = "",
49 + val Category5 : String = "",
50 + val Category6 : String = "",
51 + val Category7 : String = "",
52 + val Category8 : String = "",
53 + val Category9 : String = "",
54 + val Category10 : String = "",
55 + val Category11 : String = "",
56 + val Category12 : String = "",
57 + val Category13 : String = "",
58 + val Category14 : String = "",
59 + val Category15 : String = "",
60 + val Category16 : String = ""
42 ) 61 )
43 62
44 class RecommendActivity : AppCompatActivity() { 63 class RecommendActivity : AppCompatActivity() {
...@@ -74,12 +93,31 @@ class RecommendActivity : AppCompatActivity() { ...@@ -74,12 +93,31 @@ class RecommendActivity : AppCompatActivity() {
74 policyList.add( 93 policyList.add(
75 PolicyItem( 94 PolicyItem(
76 ContextCompat.getDrawable(this@RecommendActivity, R.drawable.image01)!!, 95 ContextCompat.getDrawable(this@RecommendActivity, R.drawable.image01)!!,
77 - "상시",
78 memo!!.Policy, 96 memo!!.Policy,
79 - memo.Policy, 97 + memo.Content,
80 - 4.toFloat(), 98 + memo.Link,
81 - "" 99 + memo.View,
82 - ) 100 + memo.Keyword,
101 + memo.Date,
102 + memo.Review,
103 + memo.Score,
104 + memo.Category1,
105 + memo.Category2,
106 + memo.Category3,
107 + memo.Category4,
108 + memo.Category5,
109 + memo.Category6,
110 + memo.Category7,
111 + memo.Category8,
112 + memo.Category9,
113 + memo.Category10,
114 + memo.Category11,
115 + memo.Category12,
116 + memo.Category13,
117 + memo.Category14,
118 + memo.Category15,
119 + memo.Category16
120 + )
83 ) 121 )
84 } 122 }
85 val adapter = PolicyAdapter(policyList) 123 val adapter = PolicyAdapter(policyList)
...@@ -102,14 +140,32 @@ class RecommendActivity : AppCompatActivity() { ...@@ -102,14 +140,32 @@ class RecommendActivity : AppCompatActivity() {
102 policyList.add( 140 policyList.add(
103 PolicyItem( 141 PolicyItem(
104 ContextCompat.getDrawable(this@RecommendActivity, R.drawable.image01)!!, 142 ContextCompat.getDrawable(this@RecommendActivity, R.drawable.image01)!!,
105 - "상시",
106 memo!!.Policy, 143 memo!!.Policy,
107 - memo.Policy, 144 + memo!!.Content,
108 - 4.toFloat(), 145 + memo!!.Link,
109 - "" 146 + memo!!.View,
147 + memo!!.Keyword,
148 + memo!!.Date,
149 + memo!!.Review,
150 + memo!!.Score,
151 + memo!!.Category1,
152 + memo!!.Category2,
153 + memo!!.Category3,
154 + memo!!.Category4,
155 + memo!!.Category5,
156 + memo!!.Category6,
157 + memo!!.Category7,
158 + memo!!.Category8,
159 + memo!!.Category9,
160 + memo!!.Category10,
161 + memo!!.Category11,
162 + memo!!.Category12,
163 + memo!!.Category13,
164 + memo!!.Category14,
165 + memo!!.Category15,
166 + memo!!.Category16
110 ) 167 )
111 ) 168 )
112 - //Toast.makeText(this@RecommendActivity, memo.View.toString(), Toast.LENGTH_SHORT).show()
113 } 169 }
114 val adapter = PolicyAdapter(policyList) 170 val adapter = PolicyAdapter(policyList)
115 policyRecyclerView.adapter = adapter 171 policyRecyclerView.adapter = adapter
......