Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_freeworld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_freeworld
Commits
d3618d3f
Commit
d3618d3f
authored
Aug 06, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成热门景点功能1
parent
f6e839cc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
204 additions
and
0 deletions
+204
-0
ItemHotViewAdapter.kt
.../main/java/com/mints/street/adapter/ItemHotViewAdapter.kt
+28
-0
HotViewBean.kt
app/src/main/java/com/mints/street/bean/HotViewBean.kt
+4
-0
HotViewDialog.kt
...main/java/com/mints/street/widget/dialog/HotViewDialog.kt
+84
-0
item_hot_view_adapter.xml
app/src/main/res/layout/item_hot_view_adapter.xml
+88
-0
No files found.
app/src/main/java/com/mints/street/adapter/ItemHotViewAdapter.kt
0 → 100644
View file @
d3618d3f
package
com.mints.street.adapter
import
android.content.Context
import
com.alibaba.android.vlayout.layout.LinearLayoutHelper
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.BindingViewHolder
import
com.mints.street.R
import
com.mints.street.databinding.ItemHotViewAdapterBinding
class
ItemHotViewAdapter
(
val
context
:
Context
,
var
list
:
List
<
String
>?)
:
AbstractVLayoutBaseAdapter
<
ItemHotViewAdapterBinding
,
List
<
String
>?>(
context
,
list
,
1
)
{
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemHotViewAdapterBinding
>,
position
:
Int
)
{
var
a
=
context
.
resources
.
displayMetrics
;
val
bgLayoutParams
=
holder
.
binding
.
bg
.
layoutParams
bgLayoutParams
.
width
=
a
.
widthPixels
holder
.
itemView
.
setOnClickListener
{
}
}
override
fun
getItemCount
()
=
list
?.
size
?:
0
override
fun
onCreateLayoutHelper
()
=
LinearLayoutHelper
()
override
fun
getLayoutId
(
viewType
:
Int
)
=
R
.
layout
.
item_hot_view_adapter
}
\ No newline at end of file
app/src/main/java/com/mints/street/bean/HotViewBean.kt
0 → 100644
View file @
d3618d3f
package
com.mints.street.bean
class
HotViewBean
{
}
\ No newline at end of file
app/src/main/java/com/mints/street/widget/dialog/HotViewDialog.kt
0 → 100644
View file @
d3618d3f
package
com.mints.street.widget.dialog
import
android.graphics.Color
import
android.view.LayoutInflater
import
android.view.View
import
android.widget.ImageView
import
androidx.fragment.app.FragmentActivity
import
androidx.recyclerview.widget.RecyclerView
import
com.alibaba.android.vlayout.DelegateAdapter
import
com.alibaba.android.vlayout.VirtualLayoutManager
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.mints.street.R
import
com.mints.street.adapter.ItemEnterDestinationAdapter
import
com.mints.street.adapter.ItemHotViewAdapter
import
com.mints.street.bean.VreperienceBean
import
com.mints.street.main.home.HomeFragment
import
com.mints.street.main.home.HomeViewModel
class
HotViewDialog
(
context
:
FragmentActivity
,
viewModel
:
HomeViewModel
,
homeFragment
:
HomeFragment
)
{
private
var
mBottomSheetDialog
:
BottomSheetDialog
?=
null
private
var
context
:
FragmentActivity
private
var
viewModel
:
HomeViewModel
?=
null
private
var
homeFragment
:
HomeFragment
?=
null
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
itemHotViewAdapter
:
ItemHotViewAdapter
?=
null
// private var itemHotViewAdapter: ItemEnterDestinationAdapter?=null
init
{
this
.
context
=
context
this
.
viewModel
=
viewModel
this
.
homeFragment
=
homeFragment
}
//
fun
init
():
HotViewDialog
{
//创建弹窗
if
(
mBottomSheetDialog
!=
null
)
return
this
mBottomSheetDialog
=
BottomSheetDialog
(
context
)
val
view1
:
View
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
layout_hotview
,
null
)
mBottomSheetDialog
!!
.
setContentView
(
view1
)
mBottomSheetDialog
!!
.
window
!!
.
findViewById
<
View
>(
R
.
id
.
design_bottom_sheet
).
setBackgroundColor
(
Color
.
TRANSPARENT
)
val
iv_close
:
ImageView
=
view1
.
findViewById
(
R
.
id
.
iv_close
)
val
recycler_view
:
RecyclerView
=
view1
.
findViewById
(
R
.
id
.
recycler_view
)
vLayout
=
VirtualLayoutManager
(
context
!!
);
mAdapter
=
DelegateAdapter
(
vLayout
,
false
)
recycler_view
.
layoutManager
=
vLayout
recycler_view
.
adapter
=
mAdapter
if
(
itemHotViewAdapter
==
null
){
itemHotViewAdapter
=
ItemHotViewAdapter
(
context
!!
,
listOf
(
"1"
,
"3"
,
"1"
,
"3"
,
"1"
,
"3"
,
"1"
,
"3"
))
mAdapter
?.
addAdapter
(
itemHotViewAdapter
)
}
itemHotViewAdapter
!!
.
list
=
listOf
(
"1"
,
"3"
,
"1"
,
"3"
,
"1"
,
"3"
,
"1"
,
"3"
)
// viewModel?.getChooseExperienceHeadData()
// viewModel?.VreperienceBean?.observe(homeFragment!!, androidx.lifecycle.Observer {
// if (itemHotViewAdapter == null){
// itemHotViewAdapter = ItemEnterDestinationAdapter(context!!, false,it?.data)
// mAdapter?.addAdapter(itemHotViewAdapter)
// }
// itemHotViewAdapter?.list = it?.data!!
// mAdapter?.notifyDataSetChanged()
// })
iv_close
.
setOnClickListener
{
mBottomSheetDialog
!!
.
dismiss
()
}
return
this
}
/**
* 展示
*/
fun
show
()
{
mBottomSheetDialog
?.
show
()
}
fun
onDestroy
()
{
mBottomSheetDialog
=
null
}
}
app/src/main/res/layout/item_hot_view_adapter.xml
0 → 100644
View file @
d3618d3f
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.adapter.ItemHotViewAdapter"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/bg"
android:background=
"@color/white"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"5dp"
android:layout_marginBottom=
"5dp"
android:layout_marginStart=
"5dp"
android:layout_marginEnd=
"5dp"
android:padding=
"10dp"
>
<com.mints.street.widget.XCRoundRectImageView
android:id=
"@+id/image1"
android:layout_width=
"100dp"
android:layout_height=
"70dp"
android:src=
"@mipmap/icon_card6"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
tools:src=
"@mipmap/icon_card6"
/>
<TextView
android:id=
"@+id/textView2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"景点名称"
android:textColor=
"@color/black"
android:textSize=
"18dp"
app:layout_constraintStart_toEndOf=
"@+id/image1"
app:layout_constraintTop_toTopOf=
"@+id/image1"
/>
<View
android:id=
"@+id/view"
android:layout_width=
"1dp"
android:layout_height=
"14dp"
android:background=
"@color/black"
app:layout_constraintBottom_toBottomOf=
"@+id/textView3"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/textView2"
app:layout_constraintTop_toTopOf=
"@+id/textView3"
tools:ignore=
"MissingConstraints"
/>
<TextView
android:id=
"@+id/textView3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"距离"
android:layout_marginLeft=
"2dp"
android:textSize=
"14dp"
tools:text=
"距离"
android:textColor=
"#99000000"
app:layout_constraintStart_toEndOf=
"@+id/view"
app:layout_constraintTop_toTopOf=
"@+id/textView2"
/>
<TextView
android:id=
"@+id/textView4"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"景点介绍。。。"
tools:text=
"景点介绍。。。"
android:textColor=
"#99000000"
app:layout_constraintStart_toEndOf=
"@+id/image1"
app:layout_constraintTop_toBottomOf=
"@+id/textView2"
/>
<TextView
android:background=
"@drawable/shape_btn_friends_unenabled"
tools:text=
"看街景"
android:id=
"@+id/textView5"
android:layout_width=
"70dp"
d
android:gravity=
"center"
android:layout_height=
"20dp"
android:textSize=
"12sp"
android:textColor=
"@color/black"
android:text=
"看街景"
app:layout_constraintBottom_toBottomOf=
"@+id/image1"
app:layout_constraintStart_toEndOf=
"@+id/image1"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment