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
494c548a
Commit
494c548a
authored
Jul 23, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决冲突
parent
9b237c3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
19 deletions
+50
-19
EnterDestinationAdapter.kt
.../java/com/mints/street/adapter/EnterDestinationAdapter.kt
+3
-3
ItemEnterDestinationAdapter.kt
...a/com/mints/street/adapter/ItemEnterDestinationAdapter.kt
+41
-15
FreeZoneFragment.kt
...rc/main/java/com/mints/street/main/vr/FreeZoneFragment.kt
+6
-1
No files found.
app/src/main/java/com/mints/street/adapter/EnterDestinationAdapter.kt
View file @
494c548a
...
...
@@ -23,15 +23,15 @@ import me.tatarka.bindingcollectionadapter2.ItemBinding
* Created by 冯瑞雨 on 2021/7/9.
*/
class
EnterDestinationAdapter
(
val
context
:
Context
,
val
bean
:
List
<
VrmapBean
.
Abroad
>?):
AbstractVLayoutBaseAdapter
<
EnterDestinationAdapterBinding
,
List
<
VrmapBean
.
Abroad
>?>(
context
,
bean
,
1
)
{
AbstractVLayoutBaseAdapter
<
EnterDestinationAdapterBinding
,
List
<
VrmapBean
.
Abroad
>?>(
context
,
bean
,
1
)
{
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
EnterDestinationAdapterBinding
>,
position
:
Int
)
{
holder
:
BindingViewHolder
<
EnterDestinationAdapterBinding
>,
position
:
Int
)
{
vLayout
=
VirtualLayoutManager
(
context
,
VirtualLayoutManager
.
HORIZONTAL
)
mAdapter
=
DelegateAdapter
(
vLayout
,
false
)
...
...
app/src/main/java/com/mints/street/adapter/ItemEnterDestinationAdapter.kt
View file @
494c548a
package
com.mints.street.adapter
import
android.content.Context
import
android.graphics.Point
import
android.util.DisplayMetrics
import
android.view.Display
import
com.alibaba.android.vlayout.layout.LinearLayoutHelper
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.BindingViewHolder
import
com.fry.base.utils.ImageLoader
import
com.mints.street.R
import
com.mints.street.bean.VrmapBean
import
com.mints.street.databinding.ItemEnterDestinationAdapterBinding
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/9.
* @param isMultipleLayout 是否是多布局
*/
class
ItemEnterDestinationAdapter
(
val
context
:
Context
,
val
isMultipleLayout
:
Boolean
)
:
AbstractVLayoutBaseAdapter
<
ItemEnterDestinationAdapterBinding
,
Any
>(
context
,
null
,
1
)
{
class
ItemEnterDestinationAdapter
(
val
context
:
Context
,
private
val
isMultipleLayout
:
Boolean
,
val
list
:
List
<
VrmapBean
.
Abroad
>?
)
:
AbstractVLayoutBaseAdapter
<
ItemEnterDestinationAdapterBinding
,
List
<
VrmapBean
.
Abroad
>?>(
context
,
list
,
1
)
{
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemEnterDestinationAdapterBinding
>,
position
:
Int
holder
:
BindingViewHolder
<
ItemEnterDestinationAdapterBinding
>,
position
:
Int
)
{
var
a
=
context
.
resources
.
displayMetrics
;
var
a
=
context
.
resources
.
displayMetrics
;
val
bgLayoutParams
=
holder
.
binding
.
bg
.
layoutParams
if
(
isMultipleLayout
)
{
bgLayoutParams
.
width
=
(
a
.
widthPixels
*
0.9
).
toInt
()
}
else
{
if
(
isMultipleLayout
)
{
bgLayoutParams
.
width
=
(
a
.
widthPixels
*
0.9
).
toInt
()
}
else
{
bgLayoutParams
.
width
=
a
.
widthPixels
}
list
?.
let
{
it
->
holder
.
binding
.
tvName
.
text
=
it
[
position
].
name
holder
.
binding
.
tvNumberPeople
.
text
=
"人数"
it
[
position
].
img
?.
let
{
url
->
for
(
index
in
it
.
indices
)
{
when
(
index
)
{
0
->
{
ImageLoader
.
ImageBuilder
.
with
(
context
)
.
setUrl
(
url
[
index
]).
setTargetView
(
holder
.
binding
.
image1
).
start
()
}
1
->
{
ImageLoader
.
ImageBuilder
.
with
(
context
)
.
setUrl
(
url
[
index
]).
setTargetView
(
holder
.
binding
.
image2
).
start
()
}
2
->
{
ImageLoader
.
ImageBuilder
.
with
(
context
)
.
setUrl
(
url
[
index
]).
setTargetView
(
holder
.
binding
.
image3
).
start
()
}
}
}
}
}
}
override
fun
getItemCount
()
=
2
override
fun
getItemCount
()
=
list
?.
size
?:
0
override
fun
onCreateLayoutHelper
()
=
LinearLayoutHelper
()
override
fun
getLayoutId
(
viewType
:
Int
)
=
R
.
layout
.
item_enter_destination_adapter
}
app/src/main/java/com/mints/street/main/vr/FreeZoneFragment.kt
View file @
494c548a
...
...
@@ -22,6 +22,7 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
gridMapAdapter
:
GridMapAdapter
?
=
null
private
var
enterDestinationAdapter
:
EnterDestinationAdapter
?
=
null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
...
...
@@ -48,13 +49,17 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
adapter
=
mAdapter
mAdapter
?.
addAdapter
(
EnterDestinationAdapter
(
context
!!
))
}
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
viewModel
.
VrmapBean
.
observe
(
this
,
Observer
<
VrmapBean
>
{
if
(
enterDestinationAdapter
==
null
){
enterDestinationAdapter
=
EnterDestinationAdapter
(
context
!!
,
it
.
abroad
)
mAdapter
?.
addAdapter
(
enterDestinationAdapter
)
}
if
(
gridMapAdapter
==
null
){
gridMapAdapter
=
GridMapAdapter
(
context
!!
,
it
.
internal
)
mAdapter
?.
addAdapter
(
gridMapAdapter
)
...
...
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