Commit a66c5e3a authored by fengruiyu's avatar fengruiyu

1.首页的底部View的功能已完成

2.免费专区的页面和功能已完成
3.精选体验的页面和功能已完成
parent e1755026
...@@ -18,17 +18,17 @@ ...@@ -18,17 +18,17 @@
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
> >
<activity android:name="com.mints.street.main.MainActivity"> <activity android:name="com.mints.street.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> </activity>
<activity android:name="com.mints.street.login.LoginActivity"> <activity android:name="com.mints.street.login.LoginActivity">
</activity> </activity>
<activity android:name="com.mints.street.splash.SplashActivity"> <activity android:name="com.mints.street.splash.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> </activity>
</application> </application>
......
package com.mints.street.adapter
import android.content.Context
import android.view.View
import androidx.databinding.ObservableArrayList
import androidx.databinding.ObservableList
import androidx.databinding.ViewDataBinding
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.EnterDestinationAdapterBinding
import com.mints.street.main.vr.FreeZoneViewModel
import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter
import me.tatarka.bindingcollectionadapter2.ItemBinding
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
class EnterDestinationAdapter(val context: Context, val list :String):
AbstractVLayoutBaseAdapter<EnterDestinationAdapterBinding, String>(context,list,1) {
private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null
override fun onBindViewHolder(
holder: BindingViewHolder<EnterDestinationAdapterBinding>,
position: Int) {
vLayout = VirtualLayoutManager(context, VirtualLayoutManager.HORIZONTAL)
mAdapter = DelegateAdapter(vLayout,false)
holder.binding.listView.layoutManager = vLayout
holder.binding.listView.adapter = mAdapter
mAdapter?.addAdapter(ItemEnterDestinationAdapter(context,"",true))
}
override fun getItemCount() = 1
override fun onCreateLayoutHelper() = LinearLayoutHelper()
override fun getLayoutId(viewType: Int) = R.layout.enter_destination_adapter
}
\ No newline at end of file
package com.mints.street.adapter
import android.content.Context
import com.alibaba.android.vlayout.LayoutHelper
import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.fry.base.binding.setMargin
import com.mints.street.R
import com.mints.street.databinding.ItemGridMapAdapterBinding
import me.goldze.mvvmhabit.utils.AppUtils
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
class GridMapAdapter(val context: Context,val list :List<String>):AbstractVLayoutBaseAdapter<ItemGridMapAdapterBinding,List<String>>(context,list,2) {
override fun onBindViewHolder(
holder: BindingViewHolder<ItemGridMapAdapterBinding>,
position: Int
) {
var a = holder.binding.bg.layoutParams
if(position%2 == 0){
holder.binding.bg.setMargin(AppUtils.dp2Px(context,10F),AppUtils.dp2Px(context,10F),AppUtils.dp2Px(context,10F),0,null,null,null)
}else{
holder.binding.bg.setMargin(0,AppUtils.dp2Px(context,10F),AppUtils.dp2Px(context,10F),0,null,null,null)
}
}
override fun getItemCount() = list.size
override fun onCreateLayoutHelper()=GridLayoutHelper(2)
override fun getLayoutId(viewType: Int) = R.layout.item_grid_map_adapter
}
\ No newline at end of file
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.mints.street.R
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,string:String,val isMultipleLayout:Boolean)
:AbstractVLayoutBaseAdapter<ItemEnterDestinationAdapterBinding,String>(context,string,1) {
override fun onBindViewHolder(
holder: BindingViewHolder<ItemEnterDestinationAdapterBinding>,
position: Int
) {
var a = context.resources.displayMetrics;
val bgLayoutParams = holder.binding.bg.layoutParams
if(isMultipleLayout){
bgLayoutParams.width = (a.widthPixels*0.9).toInt()
}else{
bgLayoutParams.width = a.widthPixels
}
}
override fun getItemCount() = 2
override fun onCreateLayoutHelper() = LinearLayoutHelper()
override fun getLayoutId(viewType: Int) = R.layout.item_enter_destination_adapter
}
package com.mints.street.main.home
import me.goldze.mvvmhabit.base.ItemViewModel
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
class HomeButtonItemVM (viewModel: HomeViewModel): ItemViewModel<HomeViewModel?>(viewModel) {
}
\ No newline at end of file
...@@ -18,4 +18,9 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>() { ...@@ -18,4 +18,9 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>() {
savedInstanceState: Bundle?)= R.layout.fragment_home savedInstanceState: Bundle?)= R.layout.fragment_home
override fun initVariableId()=BR.viewModel override fun initVariableId()=BR.viewModel
override fun initData() {
super.initData()
viewModel.add()
}
} }
\ No newline at end of file
package com.mints.street.main.home package com.mints.street.main.home
import android.app.Application import android.app.Application
import androidx.databinding.ObservableArrayList
import com.mints.street.BR
import com.mints.street.R
import me.goldze.mvvmhabit.base.BaseViewModel import me.goldze.mvvmhabit.base.BaseViewModel
import me.tatarka.bindingcollectionadapter2.ItemBinding
/** /**
* Created by 冯瑞雨 on 2021/7/2. * Created by 冯瑞雨 on 2021/7/2.
*/ */
class HomeViewModel(application: Application):BaseViewModel(application) { class HomeViewModel(application: Application):BaseViewModel(application) {
var addressList = ObservableArrayList<HomeButtonItemVM?>()
var addressItemBinding = ItemBinding.of<HomeButtonItemVM>(BR.viewModel, R.layout.item_home_button)
fun add(){
for (index in 0..10){
addressList.add(HomeButtonItemVM(this))
}
}
} }
\ No newline at end of file
package com.mints.street.main.vr
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.fry.base.base.BaseFragment
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.adapter.EnterDestinationAdapter
import com.mints.street.adapter.GridMapAdapter
import com.mints.street.adapter.ItemEnterDestinationAdapter
import com.mints.street.databinding.FragmentFeaturedExperienceBinding
/**
* Created by 冯瑞雨 on 2021/7/9.
* 精选体验
*/
class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
,FeaturedExperienceViewModel>() {
private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null
override fun initContentView(
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?
)= R.layout.fragment_featured_experience
override fun initVariableId() = BR.viewModel
override fun initData() {
super.initData()
//初始化布局管理器
if (context ==null)return
vLayout = VirtualLayoutManager(context!!);
mAdapter = DelegateAdapter(vLayout,false)
binding.listView.layoutManager = vLayout
binding.listView.adapter = mAdapter
mAdapter?.addAdapter(ItemEnterDestinationAdapter(context!!, "",false))
}
}
\ No newline at end of file
package com.mints.street.main.vr
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
class FeaturedExperienceViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.street.main.vr
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.fry.base.base.BaseFragment
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.adapter.EnterDestinationAdapter
import com.mints.street.adapter.ItemEnterDestinationAdapter
import com.mints.street.adapter.GridMapAdapter
import com.mints.street.databinding.FragmentFreeZoneBinding
import me.goldze.mvvmhabit.utils.AppUtils
import me.goldze.mvvmhabit.utils.Utils
/**
* Created by 冯瑞雨 on 2021/7/9.
* 免费专区
*/
class FreeZoneFragment:BaseFragment<FragmentFreeZoneBinding,FreeZoneViewModel>() {
private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null
override fun initContentView(
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?
)= R.layout.fragment_free_zone
override fun initVariableId() = BR.viewModel
override fun initData() {
super.initData()
//初始化布局管理器
if (context ==null)return
vLayout = VirtualLayoutManager(context!!);
mAdapter = DelegateAdapter(vLayout,false)
binding.listView.layoutManager = vLayout
binding.listView.adapter = mAdapter
mAdapter?.addAdapter(EnterDestinationAdapter(context!!, ""))
mAdapter?.addAdapter(GridMapAdapter(context!!, listOf("1","2","3","4","5","")))
}
}
\ No newline at end of file
package com.mints.street.main.vr
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
class FreeZoneViewModel(application: Application):BaseViewModel(application) {
}
\ No newline at end of file
...@@ -46,12 +46,12 @@ class VRFragment : BaseFragment<FragmentVrBinding, VRViewModel>() { ...@@ -46,12 +46,12 @@ class VRFragment : BaseFragment<FragmentVrBinding, VRViewModel>() {
private fun initTabFragment() { private fun initTabFragment() {
val tabNames = mutableListOf<String>() val tabNames = mutableListOf<String>()
tabNames.add("热门") tabNames.add("免费专区")
tabNames.add("变老特效") tabNames.add("精选体验")
val fragments = mutableListOf<Fragment>() val fragments = mutableListOf<Fragment>()
fragments.add(MyFragment()) fragments.add(FreeZoneFragment())
fragments.add(MyFragment()) fragments.add(FeaturedExperienceFragment())
//初始化viewpager2 //初始化viewpager2
......
...@@ -5,6 +5,7 @@ import com.fry.base.base.BaseActivity ...@@ -5,6 +5,7 @@ import com.fry.base.base.BaseActivity
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.databinding.ActivitySplashBinding import com.mints.street.databinding.ActivitySplashBinding
import com.mints.street.main.MainActivity
/** /**
* Created by 冯瑞雨 on 2021/7/5. * Created by 冯瑞雨 on 2021/7/5.
...@@ -23,8 +24,9 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() { ...@@ -23,8 +24,9 @@ class SplashActivity:BaseActivity<ActivitySplashBinding,SplashViewModel>() {
finish() finish()
return return
} }
binding.bu.setOnClickListener {
startActivity(MainActivity::class.java)
}
checkAppSign() checkAppSign()
} }
/** /**
......
package com.mints.street.widget
import android.animation.ValueAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.View
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
class HomeBottomView(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : View(context, attrs,defStyleAttr) {
init {
}
val STATUS_DEFAULT = 0
val STATUS_EXTEND = 1
val STATUS_CLOSE = 2
val STATUS_ING = 3 //滑动中
private var touchSlop = 0
private var slideSlop = 0
private var offsetB = 0
private var animator: ValueAnimator? = null
private var width1 = 0
private val height1 = 0
private var offsetY = 0
private var offsetExtend = 0
private var offsetClose //是负数
= 0
private var offsetDefault = 0
private var child_default_height = 0
}
\ No newline at end of file
This diff is collapsed.
package com.mints.street.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.fry.base.ui.widget.CustomRecycleView;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import me.goldze.mvvmhabit.utils.KLog;
/**
* Created by yunzhao.liu on 2018/6/20
*/
public class ScrollRecyclerView extends CustomRecycleView {
public static boolean canScroll = true;
public float lastY;
public ScrollRecyclerView(Context context) {
this(context, null);
}
public ScrollRecyclerView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public ScrollRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onTouchEvent(MotionEvent e) {
float eY = e.getY();
switch (e.getAction()) {
//因为是滚动列表,所以父View的dispatchTouchEvent不会调用Down事件,而是从Move事件开始调用
case MotionEvent.ACTION_DOWN:
KLog.i("liuyzz:recyclerview:", "---down");
lastY = eY;
canScroll = true;
super.onTouchEvent(e);
return true;
case MotionEvent.ACTION_MOVE:
if (!canScroll) {
return false;
}
//下滑负 上滑正
int offset = (int) (lastY - eY);
lastY = eY;
KLog.i("liuyzz:recyclerview:", ""+canScroll+"-isTop:"+isTop()+"-offset:"+offset);
canScroll = !isTop() || offset > 0;
super.onTouchEvent(e);//如果不写,则会不让滑动
return canScroll;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
canScroll = true;
super.onTouchEvent(e);
return true;
}
return super.onTouchEvent(e);
}
private boolean isTop() {
LayoutManager manager = getLayoutManager();
if (manager == null
|| !(manager instanceof LinearLayoutManager)) {
return false;
}
//显示区域最上面一条信息的position
int visibleItemPosition = ((LinearLayoutManager) manager).findFirstVisibleItemPosition();
View childView = getChildAt(0);//getChildAt(0)只能获得当前能看到的item的第一个
KLog.i("liuyzz:recyclerview:", "position:"+visibleItemPosition+"-top:"+childView.getTop());
//坐标系 下正右正
//D/liuyzz:recyclerview:: position:0-top:-3
//D/liuyzz:recyclerview:: position:0-top:-35
//D/liuyzz:recyclerview:: position:3-top:-10
//D/liuyzz:recyclerview:: position:3-top:-34
return childView != null && visibleItemPosition <= 0 && childView.getTop() >= 0;
}
}
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="#ffffffff" /> <solid android:color="#ffffffff" />
<corners android:radius="10dp" /> <corners android:radius="4dp" />
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/color_7EE2FF" />
<corners android:radius="20dp" />
</shape>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"> <layout xmlns:android="http://schemas.android.com/apk/res/android">
<data> <data>
<variable <variable
name="ViewModel" name="viewModel"
type="com.mints.street.login.LoginViewModel" /> type="com.mints.street.login.LoginViewModel" />
</data> </data>
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"> <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<FrameLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/fl_splash"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/white"> >
<Button
<!--这里模拟一张oneshot单的焦点图展示-->
<ImageView
android:id="@+id/oneshot_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="400px" />
<RelativeLayout
android:id="@+id/splash_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<!-- 广点通开屏广告支持“半屏/全屏”展示,开发者可以把Logo区域放在屏幕底部,然后在Logo上方提供一个容器来放置半开屏广告,请注意此容器高度不得小于400dp -->
<!-- 1.Logo区域:展示半开屏广告时使用,如果想展示全开屏广告,可以不需要这个Logo区域 -->
<!-- 注意:如需要这个Logo区域,建议开发者使用自己的Logo资源,而不是联盟的Logo资源@drawable/gdt_splash_logo,资源规格可参照@drawable/gdt_splash_logo -->
<FrameLayout
android:id="@+id/splash_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/app_logo" />
<!-- 2.预设开屏图片区域: -->
<!-- 开发者可以把自家App设计开屏图片摆放在这里,本示例中放置了一张静态图片。!-->
<!-- 注意1:直接将此图放在广告容器的下面即可,始终不要将广告容器splash_container的设为invisible,否则将不会展示广告无法计费,返回错误码600。-->
<!-- 注意2:建议开发者使用自己的开屏图片资源,而不是联盟的@drawable/splash_holder,资源规格可参照@drawable/splash_holder -->
<ImageView
android:id="@+id/splash_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/app_logo"
android:scaleType="fitXY" />
<!-- 3.开屏广告容器区域:-->
<!-- 注意:该区域高度不得小于400dp。在本示例中没有写死splash_container的高度值,是因为第1部分的app_logo区域是一个高度很小的图片。 -->
<ImageView
android:id="@+id/app_logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
/>
<!-- 4.自定义跳过按钮区域:开发者可以根据需要自己实现不同样式的跳过按钮 -->
<!-- 注意1:根据广告法规定,跳过按钮必须在屏幕当中出现。因此广告展示的时候,必须让将SkipView显示出来,即visible,否则将SDK将不展示广告,返回错误码608。。 -->
<!-- 注意2:SDK除了会检查跳过按钮的可见性,还将检测它的尺寸,其尺寸不得小于3dp*3dp,否则将SDK将不展示广告,返回错误码608。 -->
<TextView
android:id="@+id/skip_view"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_bg_circle"
android:gravity="center"
android:text="点击跳过"
android:textColor="@android:color/white"
android:textSize="14sp"
android:visibility="gone" />
<!-- 本示例省略了自定义的倒计时,和跳过按钮放在一起实现了。开发者也可以实现自己的倒计时View,方法是在onADTick回调中获得广告剩余的展示时间,并自由决定倒计时View的样式,SDK对倒计时的View没有要求。 -->
<!-- 自定义wifi预加载按钮,需设置状态为不显示,当素材为视频且视频开始播放时,SDK内部会处理为显示状态-->
<TextView
android:id="@+id/preload_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" app:layout_constraintTop_toTopOf="parent"
android:layout_alignParentTop="true" app:layout_constraintStart_toStartOf="parent"
android:layout_margin="16dp" android:text="butt"
android:background="@drawable/shape_bg_circle" android:id="@+id/bu"
android:gravity="center" />
android:text="已Wi-Fi预加载" </androidx.constraintlayout.widget.ConstraintLayout>
android:textColor="@android:color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
</FrameLayout>
<data> <data>
......
<?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>
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="140dp"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</androidx.recyclerview.widget.RecyclerView>
</FrameLayout>
</layout>
\ No newline at end of file
<?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.main.vr.FeaturedExperienceViewModel" />
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srl_my"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlAccentColor="@color/gray"
app:srlPrimaryColor="@color/white">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</FrameLayout>
</layout>
\ No newline at end of file
<?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.main.vr.FreeZoneViewModel" />
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srl_my"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlAccentColor="@color/gray"
app:srlPrimaryColor="@color/white">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</FrameLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"> <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> <data>
<variable <variable
name="ViewModel" name="viewModel"
type="com.mints.street.main.home.HomeViewModel" /> type="com.mints.street.main.home.HomeViewModel" />
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
<TextView >
android:layout_width="wrap_content"
android:layout_height="wrap_content" <ImageView
android:layout_marginTop="15dp"
android:id="@+id/image_map_change"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" android:layout_width="35dp"
android:text="广场" android:layout_height="35dp"
android:textColor="@color/black" android:src="@mipmap/map_change_icon"
android:textSize="39dp"
/> />
<ImageView
android:layout_marginTop="15dp"
android:id="@+id/image_map_history"
app:layout_constraintTop_toBottomOf="@id/image_map_change"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/map_history_icon"
/>
<ImageView
android:layout_marginTop="15dp"
android:id="@+id/image_location_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="120dp"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/location_icon"
/>
<LinearLayout
android:id="@+id/map_a_d"
android:layout_width="31dp"
android:layout_height="63dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/image_location_icon"
android:orientation="vertical"
android:background="@drawable/shape_gold_card"
android:layout_marginEnd="2dp"
android:layout_marginBottom="10dp"
>
<ImageView
android:padding="10dp"
android:layout_width="31dp"
android:layout_height="31dp"
android:src="@mipmap/scale_add_icon"
/>
<View
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_width="wrap_content"
android:layout_height="0.5dp"
android:background="@color/color_333"
/>
<ImageView
android:padding="10dp"
android:layout_width="31dp"
android:layout_height="31dp"
android:src="@mipmap/scale_shrink_icon"
/>
</LinearLayout>
<com.mints.street.widget.ScrollLayout
android:id="@+id/scroll_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:fillViewport="true"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:src="@mipmap/icon_content_back" />
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="占位置"
android:textColor="@color/color_2B3238" />
</LinearLayout>
<com.mints.street.widget.ScrollRecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBinding="@{viewModel.addressItemBinding}"
app:items="@{viewModel.addressList}"
tools:listitem="@layout/item_home_button">
</com.mints.street.widget.ScrollRecyclerView>
</com.mints.street.widget.ScrollLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<layout xmlns:app="http://schemas.android.com/apk/res-auto"> <layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data> <data>
<variable <variable
name="ViewModel" name="viewModel"
type="com.mints.street.main.my.MyViewModel" /> type="com.mints.street.main.my.MyViewModel" />
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<layout xmlns:app="http://schemas.android.com/apk/res-auto"> <layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data> <data>
<variable <variable
name="ViewModel" name="viewModel"
type="com.mints.street.main.vr.VRViewModel" /> type="com.mints.street.main.vr.VRViewModel" />
</data> </data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
......
<?xml version="1.0" encoding="utf-8"?>
<layout 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.ItemEnterDestinationAdapter" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bg"
android:layout_width="match_parent"
android:layout_height="140dp"
android:background="@mipmap/vip_google_bg"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:padding="10dp"
>
<TextView
android:id="@+id/tv_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="测试"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"
/>
<TextView
android:gravity="center"
android:layout_marginTop="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_name"
android:id="@+id/tv_number_people"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="人数"
android:drawableStart="@mipmap/search_hot_icon"
android:textColor="@color/black"
android:textSize="12sp"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/street_go"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_name"
app:layout_constraintBottom_toBottomOf="@id/tv_number_people"
/>
<ImageView
android:id="@+id/image1"
android:layout_width="0dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/image2"
android:src="@mipmap/bg_fl"
/>
<ImageView
android:layout_marginStart="10dp"
android:id="@+id/image2"
android:layout_width="0dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/image1"
app:layout_constraintEnd_toStartOf="@id/image3"
android:src="@mipmap/bg_fl"
/>
<ImageView
android:layout_marginStart="10dp"
android:id="@+id/image3"
android:layout_width="0dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/image2"
app:layout_constraintEnd_toEndOf="parent"
android:src="@mipmap/bg_fl"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="com.mints.street.adapter.GridMapAdapter" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bg"
android:layout_width="150dp"
android:layout_height="150dp"
android:background="@drawable/shape_gold_card_20"
>
<ImageView
android:id="@+id/image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="90dp"/>
<TextView
android:padding="10dp"
android:id="@+id/tv_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="测试"
android:textColor="@color/black"
android:textSize="12sp"
/>
<LinearLayout
app:layout_constraintTop_toBottomOf="@id/tv_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
>
<ImageView
android:padding="5dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/star_icon"
/><ImageView
android:padding="5dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/star_icon"
/><ImageView
android:padding="5dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/star_icon"
/><ImageView
android:padding="5dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/star_icon"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
>
<data>
<variable
name="viewModel"
type="com.mints.street.main.home.HomeButtonItemVM" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="120dp"
android:background="@mipmap/abc_popup_background_mtrl_mult"
android:padding="15dp"
>
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sdfasd"
android:textSize="16sp"
android:singleLine="true"
android:textStyle="bold"
android:textColor="@color/color_2B3238"
/>
<ImageView
android:id="@+id/image1"
android:layout_width="0dp"
android:layout_height="65dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/image2"
tools:src="@mipmap/bg_fl"
/>
<ImageView
android:layout_marginStart="10dp"
android:id="@+id/image2"
android:layout_width="0dp"
android:layout_height="65dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/image1"
app:layout_constraintEnd_toStartOf="@id/image3"
tools:src="@mipmap/bg_fl"
/>
<ImageView
android:layout_marginStart="10dp"
android:id="@+id/image3"
android:layout_width="0dp"
android:layout_height="65dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/image2"
app:layout_constraintEnd_toEndOf="parent"
tools:src="@mipmap/bg_fl"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
...@@ -68,4 +68,7 @@ dependencies { ...@@ -68,4 +68,7 @@ dependencies {
//底部bottomBar //底部bottomBar
api 'com.github.ittianyu:BottomNavigationViewEx:2.0.4' api 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
//万能布局管理器VirtualLayout
api 'com.alibaba.android:vlayout:1.0.9'
} }
package com.fry.base.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.alibaba.android.vlayout.DelegateAdapter;
import androidx.annotation.NonNull;
import androidx.databinding.ViewDataBinding;
/**
* @author jeme
* @date 2019/9/21
*/
public abstract class AbstractVLayoutBaseAdapter<T extends ViewDataBinding,D> extends DelegateAdapter.Adapter<BindingViewHolder<T>> {
protected Context mContext;
protected D mData;
protected int mViewType;
public AbstractVLayoutBaseAdapter(Context context, D datas, int viewType){
this.mContext = context;
this.mData = datas;
this.mViewType = viewType;
}
protected abstract int getLayoutId(int viewType);
public D getData(){
return mData;
}
@Override
public int getItemViewType(int position) {
return mViewType;
}
@Override
public long getItemId(int position) {
return position;
}
@NonNull
@Override
public BindingViewHolder<T> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new BindingViewHolder<>(LayoutInflater.from(mContext).inflate(getLayoutId(viewType), parent, false));
}
}
#Thu Jul 08 17:51:32 CST 2021 #Fri Jul 09 19:35:56 CST 2021
VERSION_BUILD=2593 VERSION_BUILD=2722
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