Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_street
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_street
Commits
494c548a
Commit
494c548a
authored
Jul 23, 2021
by
张释方
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决冲突
parent
9b237c3a
Changes
3
Show 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
app/src/main/java/com/mints/street/adapter/ItemEnterDestinationAdapter.kt
View file @
494c548a
package
com.mints.street.adapter
package
com.mints.street.adapter
import
android.content.Context
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.alibaba.android.vlayout.layout.LinearLayoutHelper
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.BindingViewHolder
import
com.fry.base.adapter.BindingViewHolder
import
com.fry.base.utils.ImageLoader
import
com.mints.street.R
import
com.mints.street.R
import
com.mints.street.bean.VrmapBean
import
com.mints.street.databinding.ItemEnterDestinationAdapterBinding
import
com.mints.street.databinding.ItemEnterDestinationAdapterBinding
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.KLog
/**
/**
* Created by 冯瑞雨 on 2021/7/9.
* Created by 冯瑞雨 on 2021/7/9.
* @param isMultipleLayout 是否是多布局
* @param isMultipleLayout 是否是多布局
*/
*/
class
ItemEnterDestinationAdapter
(
val
context
:
Context
,
val
isMultipleLayout
:
Boolean
)
class
ItemEnterDestinationAdapter
(
:
AbstractVLayoutBaseAdapter
<
ItemEnterDestinationAdapterBinding
,
Any
>(
context
,
null
,
1
)
{
val
context
:
Context
,
private
val
isMultipleLayout
:
Boolean
,
val
list
:
List
<
VrmapBean
.
Abroad
>?
)
:
AbstractVLayoutBaseAdapter
<
ItemEnterDestinationAdapterBinding
,
List
<
VrmapBean
.
Abroad
>?>(
context
,
list
,
1
)
{
override
fun
onBindViewHolder
(
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemEnterDestinationAdapterBinding
>,
holder
:
BindingViewHolder
<
ItemEnterDestinationAdapterBinding
>,
position
:
Int
position
:
Int
)
{
)
{
var
a
=
context
.
resources
.
displayMetrics
;
var
a
=
context
.
resources
.
displayMetrics
;
val
bgLayoutParams
=
holder
.
binding
.
bg
.
layoutParams
val
bgLayoutParams
=
holder
.
binding
.
bg
.
layoutParams
if
(
isMultipleLayout
)
{
if
(
isMultipleLayout
)
{
bgLayoutParams
.
width
=
(
a
.
widthPixels
*
0.9
).
toInt
()
bgLayoutParams
.
width
=
(
a
.
widthPixels
*
0.9
).
toInt
()
}
else
{
}
else
{
bgLayoutParams
.
width
=
a
.
widthPixels
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
onCreateLayoutHelper
()
=
LinearLayoutHelper
()
override
fun
getLayoutId
(
viewType
:
Int
)
=
R
.
layout
.
item_enter_destination_adapter
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
...
@@ -22,6 +22,7 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
gridMapAdapter
:
GridMapAdapter
?
=
null
private
var
gridMapAdapter
:
GridMapAdapter
?
=
null
private
var
enterDestinationAdapter
:
EnterDestinationAdapter
?
=
null
override
fun
initContentView
(
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
container
:
ViewGroup
?,
...
@@ -48,13 +49,17 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
...
@@ -48,13 +49,17 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
adapter
=
mAdapter
binding
.
listView
.
adapter
=
mAdapter
mAdapter
?.
addAdapter
(
EnterDestinationAdapter
(
context
!!
))
}
}
override
fun
initViewObservable
()
{
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
super
.
initViewObservable
()
viewModel
.
VrmapBean
.
observe
(
this
,
Observer
<
VrmapBean
>
{
viewModel
.
VrmapBean
.
observe
(
this
,
Observer
<
VrmapBean
>
{
if
(
enterDestinationAdapter
==
null
){
enterDestinationAdapter
=
EnterDestinationAdapter
(
context
!!
,
it
.
abroad
)
mAdapter
?.
addAdapter
(
enterDestinationAdapter
)
}
if
(
gridMapAdapter
==
null
){
if
(
gridMapAdapter
==
null
){
gridMapAdapter
=
GridMapAdapter
(
context
!!
,
it
.
internal
)
gridMapAdapter
=
GridMapAdapter
(
context
!!
,
it
.
internal
)
mAdapter
?.
addAdapter
(
gridMapAdapter
)
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