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-10-31 18:34:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
357149b06a7ace02ae5efb13b76f5b82737aa838
357149b0
1 parent
36d23d1a
recommend page list done
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
28 deletions
vip/.idea/vcs.xml
vip/app/src/main/java/com/example/vip/RecommendActivity.kt
vip/app/src/main/res/layout/activity_recommend.xml
vip/app/src/main/res/layout/item_policy.xml
vip/.idea/vcs.xml
View file @
357149b
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$/../.."
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$/.."
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
...
...
vip/app/src/main/java/com/example/vip/RecommendActivity.kt
View file @
357149b
...
...
@@ -6,15 +6,28 @@ import android.os.Bundle
import
android.util.Half.toFloat
import
android.view.Menu
import
android.view.MenuItem
import
android.widget.Toast
import
androidx.appcompat.app.ActionBar
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.content.ContextCompat
import
androidx.viewpager.widget.ViewPager
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
com.google.android.material.snackbar.Snackbar
import
com.google.firebase.database.DataSnapshot
import
com.google.firebase.database.DatabaseError
import
com.google.firebase.database.FirebaseDatabase
import
com.google.firebase.database.ValueEventListener
import
kotlinx.android.synthetic.main.activity_recommend.*
import
kotlinx.android.synthetic.main.activity_signin.*
import
kotlinx.android.synthetic.main.activity_signin.toolbar
import
kotlinx.android.synthetic.main.search.*
data class
MemoItemRecom
(
val
Target
:
String
=
""
,
val
Policy
:
String
=
""
,
val
Content
:
String
=
""
,
val
Link
:
String
=
""
)
class
RecommendActivity
:
AppCompatActivity
()
{
...
...
@@ -26,21 +39,45 @@ class RecommendActivity : AppCompatActivity() {
setContentView
(
R
.
layout
.
activity_recommend
)
val
policyList
=
ArrayList
<
PolicyItem
>()
var
recomdatabase
=
FirebaseDatabase
.
getInstance
().
reference
if
(
intent
.
hasExtra
(
"key"
))
{
//textView.text = intent.getStringExtra("key") 텍뷰추가하면 인텐트로 값넘기는거 보임
recomdatabase
.
orderByChild
(
"Policy"
).
startAt
(
intent
.
getStringExtra
(
"key"
)).
endAt
(
intent
.
getStringExtra
(
"key"
)+
"\uf8ff"
).
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
(
MemoItem
::
class
.
java
)
policyList
.
add
(
PolicyItem
(
ContextCompat
.
getDrawable
(
this
@RecommendActivity
,
R
.
drawable
.
image01
)
!!
,
memo
!!
.
Policy
,
memo
!!
.
Policy
,
memo
!!
.
Policy
,
4
.
toFloat
(),
"0"
)
)
}
policyList
.
add
(
PolicyItem
(
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
image01
)
!!
,
getString
(
R
.
string
.
title01
),
getString
(
R
.
string
.
title01
),
getString
(
R
.
string
.
title01
),
4
.
toFloat
(),
"0"
val
adapter
=
PolicyAdapter
(
policyList
)
policyRecyclerView
.
adapter
=
adapter
)
)
}
})
}
else
{
Toast
.
makeText
(
this
,
"putExtra value not found"
,
Toast
.
LENGTH_SHORT
).
show
()
}
val
adapter
=
PolicyAdapter
(
policyList
)
policyRecyclerView
.
adapter
=
adapter
// 1. 툴바 사용 설정
...
...
vip/app/src/main/res/layout/activity_recommend.xml
View file @
357149b
...
...
@@ -38,28 +38,28 @@
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/policyRecyclerView"
android:layout_width=
"match_parent"
android:layout_height=
"
1
00dp"
android:layout_height=
"
5
00dp"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf=
"@id/bottomNavigation"
tools:listitem=
"@layout/item_policy"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:id=
"@+id/fragmentContainer"
/>
app:layout_constraintBottom_toBottomOf=
"parent"
>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id=
"@+id/bottomNavigation"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom"
android:background=
"#FFF"
app:itemIconTint=
"#29ABE2"
app:itemTextColor=
"#29ABE2"
app:labelVisibilityMode=
"labeled"
app:menu=
"@menu/bottom_nav_menu"
/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id=
"@+id/bottomNavigation"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom"
android:background=
"#FFF"
app:itemIconTint=
"#29ABE2"
app:itemTextColor=
"#29ABE2"
app:labelVisibilityMode=
"labeled"
app:menu=
"@menu/bottom_nav_menu"
/>
</FrameLayout>
</LinearLayout>
...
...
vip/app/src/main/res/layout/item_policy.xml
View file @
357149b
...
...
@@ -3,7 +3,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"
match_parent
"
android:layout_height=
"
100dp
"
android:orientation=
"horizontal"
>
...
...
Please
register
or
login
to post a comment