Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장연우
/
WELLO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
신기성
2019-11-17 23:54:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0edfb5cf50a5a46943c88b4a95784573135c59f4
0edfb5cf
1 parent
ffb9d6b2
favor func done
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
vip/app/src/main/java/com/example/vip/PolicyAdapter.kt
vip/app/src/main/java/com/example/vip/PolicyAdapter.kt
View file @
0edfb5c
...
...
@@ -3,6 +3,7 @@ package com.example.vip
import
android.content.Context
import
android.content.Intent
import
android.content.SharedPreferences
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -39,9 +40,6 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
val
prof
:
SharedPreferences
=
view
.
context
.
getSharedPreferences
(
"profdata"
,
Context
.
MODE_PRIVATE
)
val
editor
:
SharedPreferences
.
Editor
=
prof
.
edit
()
var
tempstring
=
prof
.
getString
(
"favorstringlist"
,
""
)
var
sepstr
=
tempstring
!!
.
split
(
"@"
)
var
sepstrset
=
sepstr
.
toMutableSet
()
fun
bind
(
item
:
PolicyItem
)
{
view
.
policyImage
.
setImageDrawable
(
item
.
policyItemImage
)
...
...
@@ -52,11 +50,10 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
view
.
policyFavor
.
text
=
item
.
policyItemFavor
if
(
item
.
policyItemTitle
in
sepstrset
){
if
(
item
.
policyItemTitle
in
prof
.
getString
(
"favorstringlist"
,
""
)
!!
.
split
(
"@"
).
toMutableSet
()
){
view
.
policyFavor
.
isChecked
=
true
}
else
{
}
else
{
view
.
policyFavor
.
isChecked
=
false
}
view
.
setOnClickListener
{
...
...
@@ -68,6 +65,10 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
}
view
.
policyFavor
.
setOnClickListener
{
var
tempstring
=
prof
.
getString
(
"favorstringlist"
,
""
)
var
sepstr
=
tempstring
!!
.
split
(
"@"
)
var
sepstrset
=
sepstr
.
toMutableSet
()
if
(
view
.
policyFavor
.
isChecked
)
{
tempstring
=
tempstring
+
view
.
policyTitle
.
text
.
toString
()
+
"@"
editor
.
putString
(
"favorstringlist"
,
tempstring
)
...
...
@@ -77,6 +78,7 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
"찜목록 추가 완료! : "
+
view
.
policyTitle
.
text
.
toString
(),
Toast
.
LENGTH_SHORT
).
show
()
Log
.
d
(
"asdf1"
,
prof
.
getString
(
"favorstringlist"
,
"none"
))
}
else
{
sepstrset
.
remove
(
view
.
policyTitle
.
text
.
toString
())
editor
.
putString
(
"favorstringlist"
,
sepstrset
.
joinToString
(
"@"
))
...
...
@@ -86,6 +88,7 @@ class PolicyAdapter(private val items: ArrayList<PolicyItem>) :
"찜목록 제거 완료! : "
+
view
.
policyTitle
.
text
.
toString
(),
Toast
.
LENGTH_SHORT
).
show
()
Log
.
d
(
"asdf2"
,
prof
.
getString
(
"favorstringlist"
,
"none"
))
}
}
}
...
...
Please
register
or
login
to post a comment