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 19:30:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d9e7ae35bbb13754d566ea5e8d2e634e2347a777
d9e7ae35
1 parent
357149b0
detail page proto done
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
246 additions
and
5 deletions
vip/app/src/main/java/com/example/vip/DetailActivity.kt
vip/app/src/main/java/com/example/vip/RecommendActivity.kt
vip/app/src/main/res/layout/activity_detail.xml
vip/app/src/main/res/values/strings.xml
vip/app/src/main/java/com/example/vip/DetailActivity.kt
View file @
d9e7ae3
package
com.example.vip
import
androidx.appcompat.app.AppCompatActivity
import
android.app.Activity
import
android.content.Intent
import
android.os.Bundle
import
android.util.Half.toFloat
import
android.view.Menu
import
android.view.MenuItem
import
android.view.View
import
android.widget.ImageView
import
android.widget.RatingBar
import
android.widget.TextView
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_detail.*
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
MemoItemDetail
(
val
Target
:
String
=
""
,
val
Policy
:
String
=
""
,
val
Content
:
String
=
""
,
val
Link
:
String
=
""
)
class
DetailActivity
:
AppCompatActivity
()
{
////bottom navigation view operation start 1
lateinit
var
bottomBar
:
ActionBar
////bottom navigation view operation end 1
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_detail
)
var
detaildatabase
=
FirebaseDatabase
.
getInstance
().
reference
if
(
intent
.
hasExtra
(
"key"
))
{
//textView.text = intent.getStringExtra("key") 텍뷰추가하면 인텐트로 값넘기는거 보임
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
()
}
override
fun
onDataChange
(
dataSnapshot
:
DataSnapshot
)
{
for
(
memoSnapshot
in
dataSnapshot
.
children
){
val
memo
=
memoSnapshot
.
getValue
(
MemoItemDetail
::
class
.
java
)
var
detailImage
:
ImageView
=
findViewById
(
R
.
id
.
policyImageDetail
)
var
detailDday
:
TextView
=
findViewById
(
R
.
id
.
policyDdayDetail
)
var
detailHost
:
TextView
=
findViewById
(
R
.
id
.
policyHostDetail
)
var
detailTitle
:
TextView
=
findViewById
(
R
.
id
.
policyTitleDetail
)
var
detailScore
:
RatingBar
=
findViewById
(
R
.
id
.
policyScoreDetail
)
var
detailFavor
:
TextView
=
findViewById
(
R
.
id
.
policyFavorDetail
)
detailImage
.
setImageResource
(
R
.
drawable
.
image01
)
detailDday
.
text
=
memo
!!
.
Policy
detailHost
.
text
=
memo
!!
.
Policy
detailTitle
.
text
=
memo
!!
.
Policy
detailScore
.
rating
=
4
.
toFloat
()
detailFavor
.
text
=
"0"
}
}
})
}
else
{
Toast
.
makeText
(
this
,
"putExtra value not found"
,
Toast
.
LENGTH_SHORT
).
show
()
}
// 1. 툴바 사용 설정
setSupportActionBar
(
toolbar
)
// 2. 툴바 왼쪽 버튼 설정
supportActionBar
!!
.
setDisplayHomeAsUpEnabled
(
true
)
// 왼쪽 버튼 사용 여부 true
supportActionBar
!!
.
setHomeAsUpIndicator
(
R
.
drawable
.
return_page
)
// 왼쪽 버튼 아이콘 설정
supportActionBar
!!
.
setDisplayShowTitleEnabled
(
false
)
// 타이틀 안보이게 하기
////bottom navigation view operation start 2
bottomBar
=
supportActionBar
!!
val
bottomNavigation
:
BottomNavigationView
=
findViewById
(
R
.
id
.
bottomNavigation
)
bottomNavigation
.
setOnNavigationItemSelectedListener
(
mOnNavigationItemSelectedListener
)
////bottom navigation view operation end 2
}
// 3.툴바 메뉴 버튼을 설정
override
fun
onCreateOptionsMenu
(
menu
:
Menu
?):
Boolean
{
menuInflater
.
inflate
(
R
.
menu
.
main_menu
,
menu
)
// main_menu 메뉴를 toolbar 메뉴 버튼으로 설정
return
true
}
// 4.툴바 메뉴 버튼이 클릭 됐을 때 콜백
override
fun
onOptionsItemSelected
(
item
:
MenuItem
?):
Boolean
{
// 클릭된 메뉴 아이템의 아이디 마다 when 구절로 클릭시 동작을 설정한다.
when
(
item
!!
.
itemId
){
android
.
R
.
id
.
home
->{
// 메뉴 버튼
Snackbar
.
make
(
toolbar
,
"Menu pressed"
,
Snackbar
.
LENGTH_SHORT
).
show
()
}
R
.
id
.
menu_search
->{
// 검색 버튼
val
search_Intent
=
Intent
(
this
,
SearchActivity
::
class
.
java
)
startActivity
(
search_Intent
)
//Snackbar.make(toolbar,"Search menu pressed",Snackbar.LENGTH_SHORT).show()
}
}
return
super
.
onOptionsItemSelected
(
item
)
}
//bottom navigation view operation start 3
private
val
mOnNavigationItemSelectedListener
=
BottomNavigationView
.
OnNavigationItemSelectedListener
{
item
->
when
(
item
.
itemId
){
R
.
id
.
bottomHome
->{
val
intent
=
Intent
(
this
,
SignInActivity
::
class
.
java
)
startActivity
(
intent
)
return
@OnNavigationItemSelectedListener
true
}
R
.
id
.
bottomRecommend
->{
val
intent
=
Intent
(
this
,
RecommendActivity
::
class
.
java
)
startActivity
(
intent
)
return
@OnNavigationItemSelectedListener
true
}
R
.
id
.
bottomFavorites
->{
val
intent
=
Intent
(
this
,
FavoritesActivity
::
class
.
java
)
startActivity
(
intent
)
return
@OnNavigationItemSelectedListener
true
}
R
.
id
.
bottomInfo
->{
val
intent
=
Intent
(
this
,
InfoActivity
::
class
.
java
)
startActivity
(
intent
)
return
@OnNavigationItemSelectedListener
true
}
}
false
}
//bottom navigation view operation end 3
}
...
...
vip/app/src/main/java/com/example/vip/RecommendActivity.kt
View file @
d9e7ae3
...
...
@@ -51,7 +51,7 @@ class RecommendActivity : AppCompatActivity() {
}
override
fun
onDataChange
(
dataSnapshot
:
DataSnapshot
)
{
for
(
memoSnapshot
in
dataSnapshot
.
children
){
val
memo
=
memoSnapshot
.
getValue
(
MemoItem
::
class
.
java
)
val
memo
=
memoSnapshot
.
getValue
(
MemoItem
Recom
::
class
.
java
)
policyList
.
add
(
PolicyItem
(
...
...
vip/app/src/main/res/layout/activity_detail.xml
View file @
d9e7ae3
...
...
@@ -4,6 +4,106 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".DetailActivity"
>
tools:context=
".RecommendActivity"
>
<LinearLayout
android:id=
"@+id/linearLayout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"11dp"
android:background=
"#FFF"
android:elevation=
"5dp"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<ImageView
android:layout_width=
"77dp"
android:layout_height=
"44dp"
android:layout_gravity=
"center"
android:src=
"@drawable/toolbar_logo"
/>
</androidx.appcompat.widget.Toolbar>
<ImageView
android:id=
"@+id/policyImageDetail"
android:layout_width=
"match_parent"
android:layout_height=
"200dp"
tools:srcCompat=
"@tools:sample/avatars"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"450dp"
android:orientation=
"horizontal"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/policyDdayDetail"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"TextView"
/>
<TextView
android:id=
"@+id/policyHostDetail"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"TextView"
/>
<TextView
android:id=
"@+id/policyTitleDetail"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"TextView"
/>
<RatingBar
android:id=
"@+id/policyScoreDetail"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
<TextView
android:id=
"@+id/policyFavorDetail"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:text=
"TextView"
/>
</LinearLayout>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
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"
/>
</FrameLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...
...
vip/app/src/main/res/values/strings.xml
View file @
d9e7ae3
<resources>
<string
name=
"app_name"
>
WELLO
</string>
<string
name=
"title01"
>
교육
</string>
<string
name=
"title01"
>
시간
</string>
<string
name=
"title02"
>
고용
</string>
<string
name=
"title03"
>
주거
</string>
<string
name=
"title04"
>
건강
</string>
...
...
Please
register
or
login
to post a comment