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
e8975bec
Commit
e8975bec
authored
Jul 21, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VR的免费专区和精选体验数据库bean类创建
五星展示的功能已完成
parent
76d889c6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
129 additions
and
14 deletions
+129
-14
EnterDestinationAdapter.kt
.../java/com/mints/street/adapter/EnterDestinationAdapter.kt
+3
-3
ItemEnterDestinationAdapter.kt
...a/com/mints/street/adapter/ItemEnterDestinationAdapter.kt
+2
-2
ScenicSpotDao.kt
app/src/main/java/com/mints/street/db/ScenicSpotDao.kt
+2
-0
TableBean.kt
app/src/main/java/com/mints/street/db/TableBean.kt
+22
-6
FeaturedExperienceFragment.kt
...va/com/mints/street/main/vr/FeaturedExperienceFragment.kt
+1
-1
FreeZoneFragment.kt
...rc/main/java/com/mints/street/main/vr/FreeZoneFragment.kt
+1
-1
RatingStar.java
app/src/main/java/com/mints/street/widget/RatingStar.java
+86
-0
item_grid_map_adapter.xml
app/src/main/res/layout/item_grid_map_adapter.xml
+7
-1
attrs.xml
app/src/main/res/values/attrs.xml
+5
-0
No files found.
app/src/main/java/com/mints/street/adapter/EnterDestinationAdapter.kt
View file @
e8975bec
...
@@ -21,8 +21,8 @@ import me.tatarka.bindingcollectionadapter2.ItemBinding
...
@@ -21,8 +21,8 @@ import me.tatarka.bindingcollectionadapter2.ItemBinding
/**
/**
* Created by 冯瑞雨 on 2021/7/9.
* Created by 冯瑞雨 on 2021/7/9.
*/
*/
class
EnterDestinationAdapter
(
val
context
:
Context
,
val
list
:
String
):
class
EnterDestinationAdapter
(
val
context
:
Context
):
AbstractVLayoutBaseAdapter
<
EnterDestinationAdapterBinding
,
String
>(
context
,
list
,
1
)
{
AbstractVLayoutBaseAdapter
<
EnterDestinationAdapterBinding
,
Any
>(
context
,
null
,
1
)
{
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
vLayout
:
VirtualLayoutManager
?
=
null
...
@@ -37,7 +37,7 @@ class EnterDestinationAdapter(val context: Context, val list :String):
...
@@ -37,7 +37,7 @@ class EnterDestinationAdapter(val context: Context, val list :String):
holder
.
binding
.
listView
.
layoutManager
=
vLayout
holder
.
binding
.
listView
.
layoutManager
=
vLayout
holder
.
binding
.
listView
.
adapter
=
mAdapter
holder
.
binding
.
listView
.
adapter
=
mAdapter
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
,
""
,
true
))
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
,
true
))
}
}
...
...
app/src/main/java/com/mints/street/adapter/ItemEnterDestinationAdapter.kt
View file @
e8975bec
...
@@ -17,8 +17,8 @@ import me.goldze.mvvmhabit.utils.KLog
...
@@ -17,8 +17,8 @@ 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
,
string
:
String
,
val
isMultipleLayout
:
Boolean
)
class
ItemEnterDestinationAdapter
(
val
context
:
Context
,
val
isMultipleLayout
:
Boolean
)
:
AbstractVLayoutBaseAdapter
<
ItemEnterDestinationAdapterBinding
,
String
>(
context
,
string
,
1
)
{
:
AbstractVLayoutBaseAdapter
<
ItemEnterDestinationAdapterBinding
,
Any
>(
context
,
null
,
1
)
{
override
fun
onBindViewHolder
(
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemEnterDestinationAdapterBinding
>,
holder
:
BindingViewHolder
<
ItemEnterDestinationAdapterBinding
>,
position
:
Int
position
:
Int
...
...
app/src/main/java/com/mints/street/db/ScenicSpotDao.kt
View file @
e8975bec
...
@@ -10,4 +10,6 @@ import androidx.room.Query
...
@@ -10,4 +10,6 @@ import androidx.room.Query
interface
ScenicSpotDao
{
interface
ScenicSpotDao
{
@Query
(
"SELECT * FROM scenic_spot"
)
@Query
(
"SELECT * FROM scenic_spot"
)
fun
getAll
():
List
<
ScenicSpotBean
>
fun
getAll
():
List
<
ScenicSpotBean
>
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/db/TableBean.kt
View file @
e8975bec
package
com.mints.street.db
package
com.mints.street.db
import
androidx.room.ColumnInfo
import
androidx.room.Entity
import
androidx.room.Entity
import
androidx.room.PrimaryKey
import
androidx.room.PrimaryKey
/**
/**
* Created by 冯瑞雨 on 2021/7/20.
* Created by 冯瑞雨 on 2021/7/20.
* 景区表
*
VR
景区表
*/
*/
@Entity
(
tableName
=
"scenic_spot"
)
@Entity
(
tableName
=
"
vr_
scenic_spot"
)
class
ScenicSpotBean
(
class
ScenicSpotBean
(
//主键 自增
//主键 自增
@PrimaryKey
(
autoGenerate
=
true
)
var
id
:
Int
=
0
,
@PrimaryKey
(
autoGenerate
=
true
)
//景区 类型 1=境内热门景区 2=境内免费专区 3=首页的景区
var
id
:
Int
=
0
,
var
type
:
Int
=
0
,
//景区 经度
//景区 经度
var
longitude
:
Double
?=
null
,
var
longitude
:
Double
?=
null
,
//景区 纬度
//景区 纬度
...
@@ -20,7 +20,23 @@ class ScenicSpotBean(
...
@@ -20,7 +20,23 @@ class ScenicSpotBean(
//景区 名称
//景区 名称
var
name
:
String
?
=
null
,
var
name
:
String
?
=
null
,
//景区 图片
//景区 图片
var
images
:
List
<
String
>
?
=
null
,
var
images
:
String
?
=
null
,
//景区 星级 默认0-5
//景区 星级 默认0-5
@ColumnInfo
(
name
=
"star_rating"
)
var
starRating
:
Int
?
=
null
var
starRating
:
Int
?
=
null
)
@Entity
(
tableName
=
"foreign_scenic_spots"
)
class
ForeignScenicSpots
(
//主键 自增
@PrimaryKey
(
autoGenerate
=
true
)
var
id
:
Int
=
0
,
//景区 经度
var
longitude
:
Double
?=
null
,
//景区 纬度
var
latitude
:
Double
?=
null
,
//景区 名称
var
name
:
String
?
=
null
,
//景区 图片
var
images
:
List
<
String
>?
=
null
)
)
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/FeaturedExperienceFragment.kt
View file @
e8975bec
...
@@ -40,6 +40,6 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
...
@@ -40,6 +40,6 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
adapter
=
mAdapter
binding
.
listView
.
adapter
=
mAdapter
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
!!
,
""
,
false
))
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
!!
,
false
))
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/FreeZoneFragment.kt
View file @
e8975bec
...
@@ -48,7 +48,7 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
...
@@ -48,7 +48,7 @@ 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
!!
,
""
))
mAdapter
?.
addAdapter
(
EnterDestinationAdapter
(
context
!!
))
}
}
...
...
app/src/main/java/com/mints/street/widget/RatingStar.java
0 → 100644
View file @
e8975bec
package
com
.
mints
.
street
.
widget
;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Canvas
;
import
android.util.AttributeSet
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
com.mints.street.R
;
import
androidx.annotation.Nullable
;
/**
* Created by 冯瑞雨 on 2021/7/21.
*/
public
class
RatingStar
extends
View
{
private
int
normalId
;
private
Bitmap
normalImg
;
private
Bitmap
focusImg
;
private
int
number
;
private
int
w1
;
private
int
h1
;
private
int
marginLeft
;
private
int
marginTop
;
private
int
marginBottom
;
private
int
marginRight
;
private
int
height
;
private
int
width
;
private
int
p
;
private
float
w0
;
private
int
i0
;
private
int
mGrade
;
public
RatingStar
(
Context
context
)
{
this
(
context
,
null
);
}
public
RatingStar
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
this
(
context
,
attrs
,
0
);
}
public
RatingStar
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
TypedArray
array
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
RatingStar
);
normalId
=
array
.
getResourceId
(
R
.
styleable
.
RatingStar_starNormal
,
0
);
normalImg
=
BitmapFactory
.
decodeResource
(
getResources
(),
normalId
);
number
=
array
.
getInteger
(
R
.
styleable
.
RatingStar_starNumber
,
5
);
array
.
recycle
();
i0
=
-
1
;
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
w1
=
normalImg
.
getWidth
();
h1
=
normalImg
.
getHeight
();
//中间间隔
p
=
10
;
// marginTop = 20;
// marginBottom = 20;
// marginLeft = 20;
// marginRight = 20;
height
=
h1
+
marginTop
+
marginBottom
;
width
=
w1
*
number
+(
number
-
1
)*
p
+
marginLeft
+
marginRight
;
setMeasuredDimension
(
width
,
height
);
}
@Override
protected
void
onDraw
(
Canvas
canvas
)
{
super
.
onDraw
(
canvas
);
for
(
int
i
=
0
;
i
<
number
;
i
++)
{
if
(
i
<=
i0
){
canvas
.
drawBitmap
(
focusImg
,
i
*
w1
+
marginLeft
+
i
*
p
,
marginTop
,
null
);
mGrade
=
i
+
1
;
}
else
{
canvas
.
drawBitmap
(
normalImg
,
i
*
w1
+
marginLeft
+
i
*
p
,
marginTop
,
null
);
}
}
// Log.e("msg","我被调用了!");
}
}
\ No newline at end of file
app/src/main/res/layout/item_grid_map_adapter.xml
View file @
e8975bec
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<LinearLayout
<LinearLayout
android:layout_margin=
"15dp"
android:layout_margin=
"15dp"
android:id=
"@+id/bg"
android:id=
"@+id/bg"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"230dp"
android:layout_height=
"230dp"
android:background=
"@drawable/shape_bg_vrdata"
android:background=
"@drawable/shape_bg_vrdata"
android:elevation=
"5dp"
android:elevation=
"5dp"
...
@@ -40,6 +40,12 @@
...
@@ -40,6 +40,12 @@
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
</LinearLayout>
</LinearLayout>
<com.mints.street.widget.RatingStar
android:layout_width=
"60dp"
android:layout_height=
"10dp"
app:starNormal=
"@mipmap/star_icon"
app:starNumber=
"5"
/>
</LinearLayout>
</LinearLayout>
</layout>
</layout>
\ No newline at end of file
app/src/main/res/values/attrs.xml
View file @
e8975bec
...
@@ -16,4 +16,9 @@
...
@@ -16,4 +16,9 @@
<attr
name=
"HorizontalselectedViewTextColor"
format=
"color|reference"
></attr>
<attr
name=
"HorizontalselectedViewTextColor"
format=
"color|reference"
></attr>
</declare-styleable>
</declare-styleable>
<declare-styleable
name=
"RatingStar"
>
<attr
name=
"starNormal"
format=
"reference"
/>
<attr
name=
"starFocus"
format=
"reference"
/>
<attr
name=
"starNumber"
format=
"integer"
/>
</declare-styleable>
</resources>
</resources>
\ 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