soonmyeong2

connect db

#-*- coding: utf-8 -*-
import json
with open('tset.json', 'rt', encoding='utf-8') as json_file:
json_data = json.load(json_file)
for js in json_data:
for key, value in js.items():
if type(value) != str and key != 'View':
js[key] = str(value)
with open('result.json', 'w', encoding='utf-8') as make_file:
make_file.write('[')
for i, js in enumerate(json_data):
#make_file.write(json.dumps(js, indent="\t",ensure_ascii=False))
json.dump(js, make_file, indent="\t", ensure_ascii=False)
if i != len(json_data) - 1:
make_file.write(',')
make_file.write(']')
......@@ -24,10 +24,30 @@ import kotlinx.android.synthetic.main.activity_recommend.toolbar
import kotlinx.android.synthetic.main.activity_signin.*
data class MemoItemFavor(
val Target : String = "",
val Policy : String = "",
val Content : String = "",
val Link : String = ""
val Link : String = "",
val View : Int = 0,
val Keyword : String = "",
val Date : String = "",
val Review : String = "",
val Score : Float = 0.toFloat(),
val Category1 : String = "",
val Category2 : String = "",
val Category3 : String = "",
val Category4 : String = "",
val Category5 : String = "",
val Category6 : String = "",
val Category7 : String = "",
val Category8 : String = "",
val Category9 : String = "",
val Category10 : String = "",
val Category11 : String = "",
val Category12 : String = "",
val Category13 : String = "",
val Category14 : String = "",
val Category15 : String = "",
val Category16 : String = ""
)
class FavoritesActivity : AppCompatActivity() {
......@@ -71,10 +91,29 @@ class FavoritesActivity : AppCompatActivity() {
PolicyItem(
ContextCompat.getDrawable(this@FavoritesActivity, R.drawable.image01)!!,
memo!!.Policy,
memo!!.Policy,
memo!!.Policy,
4.toFloat(),
" "
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
)
)
}
......@@ -85,17 +124,6 @@ class FavoritesActivity : AppCompatActivity() {
})
}
/* if (intent.hasExtra("key")) {
//textView.text = intent.getStringExtra("key") 텍뷰추가하면 인텐트로 값넘기는거 보임
} else {
Toast.makeText(this, "putExtra value not found", Toast.LENGTH_SHORT).show()
}
*/
// 1. 툴바 사용 설정
setSupportActionBar(toolbar)
......
......@@ -45,14 +45,14 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
fun bind(item: PolicyItem) {
view.policyImage.setImageDrawable(item.policyItemImage)
view.policyDday.text = item.policyItemDday
view.policyHost.text = item.policyItemHost
view.policyTitle.text = item.policyItemTitle
view.policyScore.rating= item.policyItemScore
view.policyFavor.text=item.policyItemFavor
if (item.policyItemDate == "") { item.policyItemDate = "상시" }
view.policyDday.text = item.policyItemDate
view.policyHost.text = item.policyItemKeyword
view.policyTitle.text = item.policyItemPolicy
view.policyScore.rating= item.policyScore
if(item.policyItemTitle in sepstrset){
if(item.policyItemPolicy in sepstrset){
view.policyFavor.isChecked=true
}
else{
......@@ -62,8 +62,8 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
val intent=Intent(view.context, DetailActivity::class.java)
//putExtraStart
intent.putExtra("key",item.policyItemTitle)
//putExtraEnd
intent.putExtra("key",item.policyItemPolicy)
//putExtraEnd0
view.context.startActivity(intent)
}
......
......@@ -3,8 +3,28 @@ package com.example.vip
import android.graphics.drawable.Drawable
class PolicyItem(val policyItemImage: Drawable,
val policyItemDday: String,
val policyItemHost: String,
val policyItemTitle: String,
val policyItemScore: Float,
val policyItemFavor: String)
\ No newline at end of file
val policyItemPolicy: String,
val policyItemContents: String,
val policyItemLink: String,
val policyItemView: Int,
val policyItemKeyword: String,
var policyItemDate: String,
val policyReview : String,
val policyScore : Float,
val policyCategory1: String,
val policyCategory2: String,
val policyCategory3: String,
val policyCategory4: String,
val policyCategory5: String,
val policyCategory6: String,
val policyCategory7: String,
val policyCategory8: String,
val policyCategory9: String,
val policyCategory10: String,
val policyCategory11: String,
val policyCategory12: String,
val policyCategory13: String,
val policyCategory14: String,
val policyCategory15: String,
val policyCategory16: String
) {}
\ No newline at end of file
......
......@@ -33,12 +33,31 @@ import androidx.core.content.ContextCompat.getSystemService
import android.icu.lang.UCharacter.GraphemeClusterBreak.T
import androidx.core.view.size
data class MemoItemRecom(
val Target : String = "",
val Policy : String = "",
val Content : String = "",
val Link : String = ""
val Link : String = "",
val View : Int = 0,
val Keyword : String = "",
val Date : String = "",
val Review : String = "",
val Score : Float = 0.toFloat(),
val Category1 : String = "",
val Category2 : String = "",
val Category3 : String = "",
val Category4 : String = "",
val Category5 : String = "",
val Category6 : String = "",
val Category7 : String = "",
val Category8 : String = "",
val Category9 : String = "",
val Category10 : String = "",
val Category11 : String = "",
val Category12 : String = "",
val Category13 : String = "",
val Category14 : String = "",
val Category15 : String = "",
val Category16 : String = ""
)
class RecommendActivity : AppCompatActivity() {
......@@ -74,12 +93,31 @@ class RecommendActivity : AppCompatActivity() {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(this@RecommendActivity, R.drawable.image01)!!,
"상시",
memo!!.Policy,
memo.Policy,
4.toFloat(),
""
)
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
)
)
}
val adapter = PolicyAdapter(policyList)
......@@ -102,14 +140,32 @@ class RecommendActivity : AppCompatActivity() {
policyList.add(
PolicyItem(
ContextCompat.getDrawable(this@RecommendActivity, R.drawable.image01)!!,
"상시",
memo!!.Policy,
memo.Policy,
4.toFloat(),
""
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
)
)
//Toast.makeText(this@RecommendActivity, memo.View.toString(), Toast.LENGTH_SHORT).show()
}
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
......