feat:完成首页UI改版
@@ -22,13 +22,6 @@ class HomeHotAdapter :
|
|||||||
setText(R.id.tv_room_title, item.title)
|
setText(R.id.tv_room_title, item.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.tagPict.isNullOrEmpty()) {
|
|
||||||
helper.setGone(R.id.iv_room_tag, false)
|
|
||||||
} else {
|
|
||||||
helper.setGone(R.id.iv_room_tag, true)
|
|
||||||
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_room_tag), item.tagPict)
|
|
||||||
}
|
|
||||||
|
|
||||||
val avatars: Array<ImageView> = arrayOf(
|
val avatars: Array<ImageView> = arrayOf(
|
||||||
helper.getView(R.id.iv_avatar_0),
|
helper.getView(R.id.iv_avatar_0),
|
||||||
helper.getView(R.id.iv_avatar_1),
|
helper.getView(R.id.iv_avatar_1),
|
||||||
|
@@ -1,125 +1,30 @@
|
|||||||
package com.chwl.app.home.fragment
|
package com.chwl.app.home.fragment
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.fragment.app.activityViewModels
|
|
||||||
import com.chwl.app.R
|
import com.chwl.app.R
|
||||||
import com.chwl.app.application.IReportConstants
|
import com.chwl.app.application.IReportConstants
|
||||||
import com.chwl.app.application.ReportManager
|
import com.chwl.app.application.ReportManager
|
||||||
import com.chwl.app.base.BaseViewBindingFragment
|
import com.chwl.app.base.BaseViewBindingFragment
|
||||||
import com.chwl.app.databinding.FragmentHomeBinding
|
import com.chwl.app.databinding.FragmentHomeBinding
|
||||||
import com.chwl.app.home.HomeViewModel
|
|
||||||
import com.chwl.app.home.adapter.HomeBannerAdapter
|
|
||||||
import com.chwl.app.home.helper.OpenRoomHelper
|
|
||||||
import com.chwl.app.ui.search.SearchActivity
|
import com.chwl.app.ui.search.SearchActivity
|
||||||
import com.chwl.app.ui.webview.CommonWebViewActivity
|
import com.chwl.app.ui.webview.CommonWebViewActivity
|
||||||
import com.chwl.app.ui.widget.magicindicator.buildins.UIUtil
|
|
||||||
import com.chwl.app.utils.CommonJumpHelper
|
|
||||||
import com.chwl.core.DemoCache
|
import com.chwl.core.DemoCache
|
||||||
import com.chwl.core.UriProvider
|
import com.chwl.core.UriProvider
|
||||||
import com.chwl.core.home.bean.BannerInfo
|
|
||||||
import com.chwl.library.utils.ListUtils
|
|
||||||
import com.zhpan.bannerview.BannerViewPager
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
首页
|
首页
|
||||||
*/
|
*/
|
||||||
class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClickListener {
|
class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClickListener {
|
||||||
|
|
||||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
|
||||||
|
|
||||||
private var mBanner: BannerViewPager<BannerInfo>? = null
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
mBanner = view?.findViewById(R.id.banner)
|
|
||||||
// initTitleTab()
|
|
||||||
initListener()
|
initListener()
|
||||||
childFragmentManager.beginTransaction()
|
childFragmentManager.beginTransaction()
|
||||||
.replace(R.id.frameLayout, RecommendFragment(), "RECOMMEND").commitAllowingStateLoss()
|
.replace(R.id.frameLayout, RecommendFragment(), "RECOMMEND").commitAllowingStateLoss()
|
||||||
homeViewModel.bannerLiveData.observe(this) {
|
|
||||||
it?.let {
|
|
||||||
if (ListUtils.isListEmpty(it)) {
|
|
||||||
mBanner?.visibility = View.GONE
|
|
||||||
return@let
|
|
||||||
}
|
|
||||||
mBanner?.visibility = View.VISIBLE
|
|
||||||
mBanner?.adapter = HomeBannerAdapter()
|
|
||||||
mBanner?.post {
|
|
||||||
mBanner?.apply {
|
|
||||||
this.setPageMargin(UIUtil.dip2px(mContext, 8.0))
|
|
||||||
.setScrollDuration(800)
|
|
||||||
.setOnPageClickListener { _: View?, position: Int ->
|
|
||||||
//首页_banner
|
|
||||||
ReportManager.get().reportEvent(
|
|
||||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
|
||||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
|
|
||||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
CommonJumpHelper.bannerJump(context, it[position])
|
|
||||||
}
|
|
||||||
.create(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// homeViewModel.currentResourceLiveData.observe(this) {
|
|
||||||
// it?.let {
|
|
||||||
// if(it.size != 2){
|
|
||||||
// binding.csResource.visibility = View.GONE
|
|
||||||
// return@observe
|
|
||||||
// }
|
|
||||||
// binding.csResource.visibility = View.VISIBLE
|
|
||||||
// val resourceViews = arrayOf(
|
|
||||||
// binding.ivResource0,
|
|
||||||
// binding.ivResource1
|
|
||||||
// )
|
|
||||||
// for (i in resourceViews.indices) {
|
|
||||||
// resourceViews[i].load(it[i].icon)
|
|
||||||
// resourceViews[i].setOnClickListener { _ ->
|
|
||||||
// when {
|
|
||||||
// it[i].resourceType == 5 -> {
|
|
||||||
// CommonWebViewActivity.start(context, it[i].resourceContent)
|
|
||||||
// }
|
|
||||||
// i == 3 -> {
|
|
||||||
// dialogManager.showProgressDialog(mContext)
|
|
||||||
// homeViewModel.getHomeChatPick()
|
|
||||||
// }
|
|
||||||
// else -> {
|
|
||||||
// dialogManager.showProgressDialog(mContext)
|
|
||||||
// homeViewModel.getResourceJumpInfo(it[i].id)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// homeViewModel.resourceJumpLiveData.observe(this) {
|
|
||||||
// dialogManager.dismissDialog()
|
|
||||||
// it?.let {
|
|
||||||
// if (it.isPick) {
|
|
||||||
// AVRoomActivity.start(context, it.uid)
|
|
||||||
// } else {
|
|
||||||
// RecommendRoomDialog.newInstance(it).show(context)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// homeViewModel.homeChatPickLiveData.observe(viewLifecycleOwner) {
|
|
||||||
// dialogManager.dismissDialog()
|
|
||||||
// it?.let {
|
|
||||||
// if (it.isNotEmpty()) {
|
|
||||||
// NimP2PMessageActivity.start(context, it)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
homeViewModel.getBannerInfo()
|
|
||||||
// homeViewModel.getCurrentResourceInfo()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initListener() {
|
private fun initListener() {
|
||||||
binding.ivSearch.setOnClickListener(this)
|
binding.ivSearch.setOnClickListener(this)
|
||||||
binding.ivRanking.setOnClickListener(this)
|
binding.ivRanking.setOnClickListener(this)
|
||||||
binding.ivMyRoom.setOnClickListener(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(v: View) {
|
override fun onClick(v: View) {
|
||||||
@@ -148,76 +53,6 @@ class HomeFragment : BaseViewBindingFragment<FragmentHomeBinding>(), View.OnClic
|
|||||||
)
|
)
|
||||||
CommonWebViewActivity.start(mContext, UriProvider.getRanking())
|
CommonWebViewActivity.start(mContext, UriProvider.getRanking())
|
||||||
}
|
}
|
||||||
R.id.iv_my_room -> {
|
|
||||||
//首页_创建房间
|
|
||||||
ReportManager.get().reportEvent(
|
|
||||||
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
|
|
||||||
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.TWO),
|
|
||||||
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
OpenRoomHelper.openRoom(baseActivity)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 初始化推荐
|
|
||||||
// */
|
|
||||||
// private fun initTitleTab() {
|
|
||||||
// mTabInfoList.add(
|
|
||||||
// HomeTagInfo(
|
|
||||||
// 6,
|
|
||||||
// ResUtil.getString(R.string.home_fragment_homefragment_04),
|
|
||||||
// 0
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// mTabInfoList.add(
|
|
||||||
// HomeTagInfo(
|
|
||||||
// 7,
|
|
||||||
// ResUtil.getString(R.string.home_fragment_homefragment_07),
|
|
||||||
// 0
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// mFragments.add(RecommendFragment::class.java)
|
|
||||||
// mFragments.add(AccompanyFragment::class.java)
|
|
||||||
//
|
|
||||||
// val commonNavigator = CommonNavigator(context)
|
|
||||||
// commonNavigator.setTitleWrapContent(false)
|
|
||||||
// commonNavigator.titleMargin = ScreenUtil.dip2px(2.0F)
|
|
||||||
// commonNavigator.setTitleGravity(Gravity.CENTER_VERTICAL)
|
|
||||||
// val magicIndicatorAdapter = MainIndicatorAdapter(context, mTabInfoList.map { it.name })
|
|
||||||
// magicIndicatorAdapter.setOnItemSelectListener(this)
|
|
||||||
// commonNavigator.adapter = magicIndicatorAdapter
|
|
||||||
// binding.magicIndicator.navigator = commonNavigator
|
|
||||||
// binding.viewPager.adapter =
|
|
||||||
// object : FragmentStateAdapter(childFragmentManager, lifecycle) {
|
|
||||||
// override fun createFragment(position: Int): Fragment {
|
|
||||||
// return mFragments[position].newInstance()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun getItemCount(): Int {
|
|
||||||
// return mFragments.size
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
|
|
||||||
// binding.viewPager.offscreenPageLimit = 1
|
|
||||||
// }
|
|
||||||
|
|
||||||
// override fun onItemSelect(position: Int, view: TextView?) {
|
|
||||||
// binding.viewPager.currentItem = position
|
|
||||||
// //点击顶部tab上报
|
|
||||||
// val map = HashMap<String, Any>(3)
|
|
||||||
// map[IReportConstants.HOMEPAGE_TAB] = mTabInfoList[position].id
|
|
||||||
// map[IReportConstants.MODULE] = IReportConstants.PEKO_HOMEPAGE
|
|
||||||
// ReportManager.get().reportEvent(IReportConstants.TAB_HOMEPAGE_CLICK, map)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// override fun onDestroyView() {
|
|
||||||
// super.onDestroyView()
|
|
||||||
// mTabInfoList.clear()
|
|
||||||
// mFragments.clear()
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_ic_hot.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/home_ic_rank.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 5.8 KiB |
18
app/src/main/res/drawable/home_ic_search.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="30dp"
|
||||||
|
android:height="30dp"
|
||||||
|
android:viewportWidth="30"
|
||||||
|
android:viewportHeight="30">
|
||||||
|
<path
|
||||||
|
android:pathData="M15,15m-15,0a15,15 0,1 1,30 0a15,15 0,1 1,-30 0"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M20.356,19.508C21.52,18.144 22.181,16.413 22.181,14.591C22.181,10.398 18.783,7 14.591,7C10.398,7 7,10.398 7,14.59C7,18.783 10.398,22.181 14.59,22.181C15.342,22.182 16.089,22.071 16.807,21.852C17.122,21.754 17.299,21.42 17.203,21.104C17.106,20.789 16.773,20.61 16.457,20.704C15.852,20.888 15.223,20.982 14.59,20.981C11.061,20.981 8.2,18.12 8.2,14.59C8.2,11.061 11.061,8.2 14.59,8.2C18.12,8.2 20.981,11.061 20.981,14.59C20.981,16.265 20.317,17.848 19.159,19.041C18.895,19.313 18.898,19.747 19.166,20.015L21.979,22.828C22.214,23.059 22.591,23.057 22.824,22.824C23.057,22.591 23.059,22.214 22.828,21.979L20.356,19.508Z"
|
||||||
|
android:strokeWidth="0.6"
|
||||||
|
android:fillColor="#333333"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:strokeColor="#333333"/>
|
||||||
|
</vector>
|
@@ -1,12 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="30dp"
|
|
||||||
android:height="30dp"
|
|
||||||
android:viewportWidth="30"
|
|
||||||
android:viewportHeight="30">
|
|
||||||
<path
|
|
||||||
android:pathData="M21.026,20.071C22.336,18.537 23.078,16.59 23.078,14.539C23.079,9.823 19.256,6 14.539,6C9.823,6 6,9.823 6,14.539C6,19.256 9.823,23.079 14.539,23.079C15.384,23.08 16.225,22.955 17.033,22.709C17.388,22.598 17.586,22.222 17.478,21.867C17.37,21.512 16.995,21.311 16.639,21.417C15.959,21.624 15.251,21.729 14.539,21.729C10.569,21.728 7.35,18.51 7.35,14.539C7.35,10.569 10.569,7.35 14.539,7.35C18.51,7.35 21.729,10.569 21.729,14.539C21.729,16.423 20.982,18.204 19.679,19.546C19.382,19.852 19.386,20.34 19.687,20.642L22.851,23.806C23.116,24.066 23.54,24.064 23.802,23.802C24.064,23.54 24.066,23.116 23.806,22.851L21.026,20.071Z"
|
|
||||||
android:strokeWidth="0.5"
|
|
||||||
android:fillColor="#B4B7BD"
|
|
||||||
android:fillType="nonZero"
|
|
||||||
android:strokeColor="#B4B7BD"/>
|
|
||||||
</vector>
|
|
@@ -30,15 +30,15 @@
|
|||||||
android:layout_marginEnd="@dimen/dp_10"
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_home_search" />
|
android:src="@drawable/home_ic_search" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_my_room"
|
android:id="@+id/iv_ranking"
|
||||||
android:layout_width="@dimen/dp_30"
|
android:layout_width="@dimen/dp_30"
|
||||||
android:layout_height="@dimen/dp_30"
|
android:layout_height="@dimen/dp_30"
|
||||||
android:layout_marginEnd="@dimen/dp_20"
|
android:layout_marginEnd="@dimen/dp_21"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_home_my_room" />
|
android:src="@drawable/home_ic_rank" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -56,85 +56,20 @@
|
|||||||
app:layout_constraintTop_toTopOf="@id/layout_menu" />
|
app:layout_constraintTop_toTopOf="@id/layout_menu" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/iv_indicator"
|
||||||
android:layout_width="@dimen/dp_24"
|
android:layout_width="@dimen/dp_24"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/dp_2"
|
android:layout_marginTop="@dimen/dp_3"
|
||||||
android:src="@drawable/base_ic_indicator"
|
android:src="@drawable/base_ic_indicator"
|
||||||
app:layout_constraintEnd_toEndOf="@id/tv_title"
|
app:layout_constraintEnd_toEndOf="@id/tv_title"
|
||||||
app:layout_constraintStart_toStartOf="@id/tv_title"
|
app:layout_constraintStart_toStartOf="@id/tv_title"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/iv_ranking"
|
android:id="@+id/frameLayout"
|
||||||
android:layout_width="@dimen/dp_30"
|
|
||||||
android:layout_height="@dimen/dp_30"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:scaleType="centerInside"
|
|
||||||
android:src="@drawable/ic_home_rank"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/tv_title"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/tv_title"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/tv_title" />
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
||||||
android:id="@+id/coordinator_layout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="@dimen/dp_14"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title">
|
app:layout_constraintTop_toBottomOf="@id/iv_indicator" />
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
|
||||||
android:id="@+id/app_bar_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
app:elevation="0dp"
|
|
||||||
app:layout_behavior="com.chwl.app.ui.widget.AppBarLayoutBehavior">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/cs_resource"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="@dimen/dp_14"
|
|
||||||
android:paddingEnd="@dimen/dp_14">
|
|
||||||
|
|
||||||
<com.zhpan.bannerview.BannerViewPager
|
|
||||||
android:id="@+id/banner"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dp_80"
|
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:bvp_auto_play="true"
|
|
||||||
app:bvp_can_loop="true"
|
|
||||||
app:bvp_indicator_checked_color="@color/color_9168FA"
|
|
||||||
app:bvp_indicator_normal_color="@color/color_B3B3C3"
|
|
||||||
app:bvp_indicator_radius="@dimen/dp_4"
|
|
||||||
app:bvp_indicator_visibility="visible"
|
|
||||||
app:bvp_page_style="multi_page_scale"
|
|
||||||
app:layout_constraintDimensionRatio="345:80"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/frameLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<com.chwl.library.common.widget.VpRecyclerView
|
<com.chwl.library.common.widget.VpRecyclerView
|
||||||
android:id="@+id/mRecyclerRoom"
|
android:id="@+id/mRecyclerRoom"
|
||||||
android:layout_marginTop="@dimen/dp_6"
|
android:layout_marginTop="@dimen/dp_12"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
|
@@ -11,61 +11,69 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dp_84"
|
android:layout_height="@dimen/dp_84"
|
||||||
android:layout_marginHorizontal="@dimen/dp_12"
|
android:layout_marginHorizontal="@dimen/dp_12"
|
||||||
android:background="@drawable/shape_white_8dp_round"
|
android:background="@drawable/shape_white_10dp_round"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<com.google.android.material.imageview.ShapeableImageView
|
<com.google.android.material.imageview.ShapeableImageView
|
||||||
android:id="@+id/iv_room_image"
|
android:id="@+id/iv_room_image"
|
||||||
android:layout_width="@dimen/dp_88"
|
android:layout_width="@dimen/dp_90"
|
||||||
android:layout_height="@dimen/dp_88"
|
android:layout_height="@dimen/dp_90"
|
||||||
|
android:layout_marginStart="@dimen/dp_12"
|
||||||
|
android:padding="@dimen/dp_1"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:src="@drawable/default_cover"
|
android:src="@drawable/default_cover"
|
||||||
app:borderRadius="@dimen/dp_8"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/v_bg"
|
app:layout_constraintStart_toStartOf="@id/v_bg"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:shapeAppearance="@style/shape_home_recommend_item" />
|
app:shapeAppearance="@style/shape_home_recommend_item"
|
||||||
|
app:strokeColor="#FE87FF"
|
||||||
<ImageView
|
app:strokeWidth="@dimen/dp_2" />
|
||||||
android:id="@+id/iv_room_tag"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/dp_20"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:layout_marginStart="@dimen/dp_12"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/tv_room_title"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/iv_room_image"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/v_bg"
|
|
||||||
app:layout_constraintVertical_chainStyle="packed"
|
|
||||||
tools:src="@drawable/tag_101" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/tv_room_title"
|
android:id="@+id/tv_room_title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/dp_12"
|
android:layout_marginStart="@dimen/dp_12"
|
||||||
|
android:layout_marginTop="@dimen/dp_12"
|
||||||
android:layout_marginEnd="@dimen/dp_10"
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="@color/color_1E1E1F"
|
android:textColor="@color/color_1E1E1F"
|
||||||
android:textSize="@dimen/dp_16"
|
android:textSize="@dimen/dp_16"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toTopOf="@id/fl_avatar"
|
app:layout_constraintBottom_toTopOf="@id/tv_online_number"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/tv_online_number"
|
app:layout_constraintEnd_toEndOf="@id/v_bg"
|
||||||
app:layout_constraintStart_toEndOf="@id/iv_room_image"
|
app:layout_constraintStart_toEndOf="@id/iv_room_image"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_room_tag"
|
app:layout_constraintTop_toTopOf="@id/v_bg"
|
||||||
|
app:layout_constraintVertical_chainStyle="spread_inside"
|
||||||
tools:text="@string/layout_item_room_common_02" />
|
tools:text="@string/layout_item_room_common_02" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_online_number"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/dp_12"
|
||||||
|
android:drawableStart="@drawable/home_ic_hot"
|
||||||
|
android:drawablePadding="@dimen/dp_3"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="#84868A"
|
||||||
|
android:textSize="@dimen/dp_12"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/v_bg"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/tv_room_title"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_room_title"
|
||||||
|
tools:text="266" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/fl_avatar"
|
android:id="@+id/fl_avatar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="@id/tv_online_number"
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_room_title"
|
app:layout_constraintEnd_toEndOf="@id/v_bg"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_room_title">
|
app:layout_constraintTop_toTopOf="@id/tv_online_number">
|
||||||
|
|
||||||
<com.chwl.app.common.widget.CircleImageView
|
<com.chwl.app.common.widget.CircleImageView
|
||||||
android:id="@+id/iv_avatar_0"
|
android:id="@+id/iv_avatar_0"
|
||||||
@@ -79,7 +87,7 @@
|
|||||||
android:id="@+id/iv_avatar_1"
|
android:id="@+id/iv_avatar_1"
|
||||||
android:layout_width="@dimen/dp_20"
|
android:layout_width="@dimen/dp_20"
|
||||||
android:layout_height="@dimen/dp_20"
|
android:layout_height="@dimen/dp_20"
|
||||||
android:layout_marginStart="@dimen/dp_14"
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
android:src="@drawable/default_avatar"
|
android:src="@drawable/default_avatar"
|
||||||
app:cborder_color="@color/white"
|
app:cborder_color="@color/white"
|
||||||
app:cborder_width="1px" />
|
app:cborder_width="1px" />
|
||||||
@@ -88,7 +96,7 @@
|
|||||||
android:id="@+id/iv_avatar_2"
|
android:id="@+id/iv_avatar_2"
|
||||||
android:layout_width="@dimen/dp_20"
|
android:layout_width="@dimen/dp_20"
|
||||||
android:layout_height="@dimen/dp_20"
|
android:layout_height="@dimen/dp_20"
|
||||||
android:layout_marginStart="@dimen/dp_28"
|
android:layout_marginStart="@dimen/dp_32"
|
||||||
android:src="@drawable/default_avatar"
|
android:src="@drawable/default_avatar"
|
||||||
app:cborder_color="@color/white"
|
app:cborder_color="@color/white"
|
||||||
app:cborder_width="1px" />
|
app:cborder_width="1px" />
|
||||||
@@ -97,7 +105,7 @@
|
|||||||
android:id="@+id/iv_avatar_3"
|
android:id="@+id/iv_avatar_3"
|
||||||
android:layout_width="@dimen/dp_20"
|
android:layout_width="@dimen/dp_20"
|
||||||
android:layout_height="@dimen/dp_20"
|
android:layout_height="@dimen/dp_20"
|
||||||
android:layout_marginStart="@dimen/dp_42"
|
android:layout_marginStart="@dimen/dp_48"
|
||||||
android:src="@drawable/default_avatar"
|
android:src="@drawable/default_avatar"
|
||||||
app:cborder_color="@color/white"
|
app:cborder_color="@color/white"
|
||||||
app:cborder_width="1px" />
|
app:cborder_width="1px" />
|
||||||
@@ -106,27 +114,11 @@
|
|||||||
android:id="@+id/iv_avatar_4"
|
android:id="@+id/iv_avatar_4"
|
||||||
android:layout_width="@dimen/dp_20"
|
android:layout_width="@dimen/dp_20"
|
||||||
android:layout_height="@dimen/dp_20"
|
android:layout_height="@dimen/dp_20"
|
||||||
android:layout_marginStart="@dimen/dp_56"
|
android:layout_marginStart="@dimen/dp_64"
|
||||||
android:src="@drawable/default_avatar"
|
android:src="@drawable/default_avatar"
|
||||||
app:cborder_color="@color/white"
|
app:cborder_color="@color/white"
|
||||||
app:cborder_width="1px" />
|
app:cborder_width="1px" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:id="@+id/tv_online_number"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="@dimen/dp_16"
|
|
||||||
android:drawableTop="@drawable/home_ic_hot"
|
|
||||||
android:drawablePadding="@dimen/dp_3"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:textColor="#84868A"
|
|
||||||
android:textSize="@dimen/dp_12"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/v_bg"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/v_bg"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/v_bg"
|
|
||||||
tools:text="266" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -590,10 +590,7 @@
|
|||||||
|
|
||||||
<style name="shape_home_recommend_item">
|
<style name="shape_home_recommend_item">
|
||||||
<item name="cornerFamily">rounded</item>
|
<item name="cornerFamily">rounded</item>
|
||||||
<item name="cornerSizeTopLeft">@dimen/dp_8</item>
|
<item name="cornerSize">50%</item>
|
||||||
<item name="cornerSizeTopRight">@dimen/dp_20</item>
|
|
||||||
<item name="cornerSizeBottomLeft">@dimen/dp_8</item>
|
|
||||||
<item name="cornerSizeBottomRight">@dimen/dp_20</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,91 +0,0 @@
|
|||||||
package com.chwl.app.treasure_box.widget.dialog;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.Window;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatDialog;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
import androidx.databinding.ViewDataBinding;
|
|
||||||
|
|
||||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
|
||||||
import com.chwl.library.annatation.ActLayoutRes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by huangmeng1 on 2018/4/12.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public abstract class BaseBindingDialog<T extends ViewDataBinding> extends AppCompatDialog {
|
|
||||||
|
|
||||||
|
|
||||||
protected int width, height;
|
|
||||||
protected Context context;
|
|
||||||
protected int gravity;
|
|
||||||
|
|
||||||
public BaseBindingDialog(Context context) {
|
|
||||||
this(context, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseBindingDialog(Context context, int theme) {
|
|
||||||
super(context, theme);
|
|
||||||
this.context = context;
|
|
||||||
width = ScreenUtil.getDialogWidth();
|
|
||||||
height = WindowManager.LayoutParams.WRAP_CONTENT;
|
|
||||||
gravity = Gravity.CENTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected T binding;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
Window window = getWindow();
|
|
||||||
if (window != null) {
|
|
||||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
WindowManager.LayoutParams windowParams = window.getAttributes();
|
|
||||||
windowParams.width = width;
|
|
||||||
windowParams.height = height;
|
|
||||||
windowParams.dimAmount = 0.5f;
|
|
||||||
windowParams.gravity = gravity;
|
|
||||||
windowParams.x = 0;
|
|
||||||
windowParams.y = 0;
|
|
||||||
// window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
|
|
||||||
window.setAttributes(windowParams);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
View inflate = LayoutInflater.from(getContext()).inflate(getClass().getAnnotation(ActLayoutRes.class).value(), null);
|
|
||||||
setContentView(inflate.getRootView());
|
|
||||||
setCancelable(true);
|
|
||||||
setCanceledOnTouchOutside(true);
|
|
||||||
binding = DataBindingUtil.bind(inflate);
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void init();
|
|
||||||
|
|
||||||
public void openDialog() {
|
|
||||||
try {
|
|
||||||
show();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeDialog() {
|
|
||||||
try {
|
|
||||||
dismiss();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1022 B |
Before Width: | Height: | Size: 836 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 992 B |
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 876 B |
Before Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 510 B |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 958 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 946 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 434 B |
Before Width: | Height: | Size: 368 B |
Before Width: | Height: | Size: 147 KiB |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 149 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 396 B |
Before Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.5 KiB |