Commit 1d39ed0e authored by 张释方's avatar 张释方

Merge branch 'dev_1.0.0' of http://gitlab.mints-id.com/android/android_street into branche_zsf

 Conflicts:
	app/src/main/res/layout/item_grid_map_adapter.xml
parents 49f5f762 bf04b134
...@@ -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))
} }
......
...@@ -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
......
...@@ -10,7 +10,7 @@ import me.goldze.mvvmhabit.utils.Utils ...@@ -10,7 +10,7 @@ import me.goldze.mvvmhabit.utils.Utils
*/ */
@Database(entities = [ScenicSpotBean::class], version = 1) @Database(entities = [ScenicSpotBean::class], version = 1)
abstract class AppDatabase : RoomDatabase() { abstract class AppDatabase : RoomDatabase() {
abstract fun userDao(): ScenicSpotDao abstract fun scenicSpotDao(): ScenicSpotDao
companion object { companion object {
private var _instance: AppDatabase? = null private var _instance: AppDatabase? = null
......
package com.mints.street.db package com.mints.street.db
import androidx.room.Dao import androidx.room.*
import androidx.room.Query
/** /**
* Created by 冯瑞雨 on 2021/7/20. * Created by 冯瑞雨 on 2021/7/20.
*/ */
@Dao @Dao
interface ScenicSpotDao { interface ScenicSpotDao {
@Query("SELECT * FROM scenic_spot") /**
fun getAll(): List<ScenicSpotBean> * 添加 VR 免费专区
* OnConflictStrategy.REPLACE表如已有数据,就覆盖掉。
*/
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun addVRFreeZoneAll(list:List<ScenicSpotBean>)
/**
* 获取 VR 免费专区
*/
@Query("SELECT * FROM vr_scenic_spot")
fun getVRFreeZoneAll(): List<ScenicSpotBean>
/**
* 删除 VR 免费专区
*/
@Delete
fun deleteVRFreeZoneAll(list:List<ScenicSpotBean>)
/**
* 获取 国外的 免费专区
*/
@Query("SELECT * FROM foreign_scenic_spots WHERE is_free = 1")
fun getForeignFreeAll(list:List<ForeignScenicSpots>)
/**
* 获取 国外的 收费(精选体验)
*/
@Query("SELECT * FROM foreign_scenic_spots WHERE is_free = 2")
fun getForeignTollAll(list:List<ForeignScenicSpots>)
/**
* 添加 VR 国外
*/
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun addForeignAll(list:List<ForeignScenicSpots>)
/**
* 删除 VR 国外免费
*/
@Query("DELETE FROM foreign_scenic_spots WHERE is_free =1")
fun deleteForeignFreeAll()
/**
* 删除 VR 国外收费
*/
@Query("DELETE FROM foreign_scenic_spots WHERE is_free =2")
fun deleteForeignTollAll()
} }
\ No newline at end of file
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,33 @@ class ScenicSpotBean( ...@@ -20,7 +20,33 @@ class ScenicSpotBean(
//景区 名称 //景区 名称
var name :String? = null, var name :String? = null,
//景区 图片 //景区 图片
var images : List<String>? = null, var images : String? = null,
//景区 url地址
var url : String? = null,
//景区 星级 默认0-5 //景区 星级 默认0-5
var starRating : Int? = null @ColumnInfo(name="star_rating")
var starRating : String? = null
)
@Entity(tableName = "foreign_scenic_spots")
class ForeignScenicSpots(
//主键 自增
@PrimaryKey(autoGenerate = true)
var id: Int = 0,
//景区 免费还是收费的 1=免费 2=收费
@ColumnInfo(name="is_free")
var isFree:Int,
//景区 经度
var longitude :Double?=null,
//景区 纬度
var latitude :Double?=null,
//景区 目的地的ID
var did :Int?=null,
//景区 名称
var name :String? = null,
//景区 人数
@ColumnInfo(name = "number_people")
var numberPeople :Int? = null,
//景区 图片
var images : List<String>? = null
) )
\ No newline at end of file
...@@ -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
...@@ -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!! ))
} }
......
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
...@@ -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="100dp" android:layout_width="wrap_content"
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"
......
...@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment