首页修改
This commit is contained in:
@@ -410,11 +410,6 @@
|
||||
android:targetActivity="com.mango.core.pay.PaymentActivity" />
|
||||
<!-- 支付相关配置 -->
|
||||
|
||||
<!-- 为了兼容小程序返回的问题,声明WXEntryActivity,并把之前的 WechatHandlerActivity注释 -->
|
||||
<activity
|
||||
android:name="com.yinyou.yinyou.wxapi.WXEntryActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:exported="true" />
|
||||
|
||||
<!-- shareSDK配置 end ####################################################### -->
|
||||
<service
|
||||
|
@@ -25,6 +25,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.mango.moshen.home.fragment.TempRoomHotFragment;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||
@@ -173,7 +174,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
private Runnable touchRunnable;
|
||||
|
||||
{
|
||||
fragmentArray.put(MainTabType.TAB_TYPE_HOME, new HomeFragment());
|
||||
fragmentArray.put(MainTabType.TAB_TYPE_HOME, new TempRoomHotFragment());
|
||||
fragmentArray.put(MainTabType.TAB_TYPE_MSG, new ContactsListFragment());
|
||||
fragmentArray.put(MainTabType.TAB_TYPE_SQUARE, new SquareFragment());
|
||||
fragmentArray.put(MainTabType.TAB_TYPE_ME, new MeFragment());
|
||||
|
@@ -17,8 +17,8 @@ import com.mango.core.utils.TextUtils
|
||||
class RoomHotAdapter : BaseMultiItemQuickAdapter<HomeRoomInfo, BaseViewHolder>(null) {
|
||||
|
||||
init {
|
||||
addItemType(HomeRoomInfo.TYPE_ROOM, R.layout.item_room_hot)
|
||||
addItemType(HomeRoomInfo.TYPE_BROADCAST, R.layout.item_room_hot)
|
||||
addItemType(HomeRoomInfo.TYPE_ROOM, R.layout.item_room_hot_temp)
|
||||
addItemType(HomeRoomInfo.TYPE_BROADCAST, R.layout.item_room_hot_temp)
|
||||
addItemType(HomeRoomInfo.TYPE_BANNER, R.layout.item_room_banner)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class RoomHotAdapter : BaseMultiItemQuickAdapter<HomeRoomInfo, BaseViewHolder>(n
|
||||
.onEvent(StatisticsProtocol.EVENT_RM_ROOM_SUCCESS, "热门进入房间")
|
||||
}
|
||||
|
||||
helper.getView<ImageView>(R.id.iv_room_image).load(item.avatar)
|
||||
helper.getView<ImageView>(R.id.iv_room_image).load(item.avatar,round = 8f)
|
||||
helper.setText(R.id.tv_online_number, "${item.onlineNum}")
|
||||
helper.setText(R.id.tv_room_title, item.title)
|
||||
helper.setText(R.id.tv_id, "ID:${item.erbanNo}")
|
||||
@@ -41,7 +41,7 @@ class RoomHotAdapter : BaseMultiItemQuickAdapter<HomeRoomInfo, BaseViewHolder>(n
|
||||
helper.setVisible(R.id.iv_room_tag, !TextUtils.isEmptyText(item.tagPict))
|
||||
helper.getView<ImageView>(R.id.iv_room_tag).load(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_1),
|
||||
helper.getView(R.id.iv_avatar_2),
|
||||
@@ -52,7 +52,7 @@ class RoomHotAdapter : BaseMultiItemQuickAdapter<HomeRoomInfo, BaseViewHolder>(n
|
||||
val avatarUrl = item.micUsers?.getOrNull(i)?.avatar
|
||||
avatars[i].isGone = avatarUrl.isNullOrBlank()
|
||||
avatars[i].load(avatarUrl)
|
||||
}
|
||||
}*/
|
||||
} else {
|
||||
BannerHelper.setBanner(helper.getView(R.id.roll_view), item.bannerVoList)
|
||||
}
|
||||
|
@@ -0,0 +1,93 @@
|
||||
package com.mango.moshen.home.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mango.core.DemoCache
|
||||
import com.mango.moshen.base.BaseViewBindingFragment
|
||||
import com.mango.moshen.common.EmptyViewHelper
|
||||
import com.mango.moshen.databinding.FragmentRoomHotBinding
|
||||
import com.mango.moshen.home.HomeViewModel
|
||||
import com.mango.moshen.home.adapter.RoomHotAdapter
|
||||
import com.mango.moshen.ui.utils.RVDelegate
|
||||
import com.mango.core.home.bean.HomeRoomInfo
|
||||
import com.mango.core.home.event.RefreshHomeDataEvent
|
||||
import com.mango.core.statistic.StatisticManager
|
||||
import com.mango.core.statistic.protocol.StatisticsProtocol
|
||||
import com.mango.moshen.ui.search.SearchActivity
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
|
||||
class TempRoomHotFragment : BaseViewBindingFragment<FragmentRoomHotBinding>() {
|
||||
|
||||
companion object {
|
||||
fun newInstance(): TempRoomHotFragment {
|
||||
val args = Bundle()
|
||||
val fragment = TempRoomHotFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var roomHotAdapter : RoomHotAdapter
|
||||
private lateinit var rvDelegate: RVDelegate<HomeRoomInfo>
|
||||
|
||||
private var page = 1
|
||||
private val pageSize = Int.MAX_VALUE
|
||||
private val homeViewModel: HomeViewModel by activityViewModels()
|
||||
|
||||
override fun init() {
|
||||
|
||||
roomHotAdapter = RoomHotAdapter()
|
||||
rvDelegate = RVDelegate.Builder<HomeRoomInfo>()
|
||||
.setAdapter(roomHotAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyView(context, "暂无房间"))
|
||||
.setLayoutManager(LinearLayoutManager(mContext))
|
||||
.setRefreshLayout(binding.swipeRefresh)
|
||||
.setPageSize(pageSize)
|
||||
.build()
|
||||
|
||||
binding.swipeRefresh.isRefreshing = true
|
||||
binding.swipeRefresh.setOnRefreshListener {
|
||||
loadData(true)
|
||||
}
|
||||
homeViewModel.hotRoomLiveData.observe(this) {
|
||||
rvDelegate.loadData(it)
|
||||
}
|
||||
binding.tvSearch.setOnClickListener {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_SEARCH, "进入搜索页")
|
||||
SearchActivity.start(activity)
|
||||
//为啥触发条件这么恶心
|
||||
if (DemoCache.readAnchorCardView() == 0) {
|
||||
DemoCache.saveAnchorCardView(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loadData(true)
|
||||
}
|
||||
|
||||
private fun loadData(isRefresh: Boolean) {
|
||||
homeViewModel.getHotRoom(page, pageSize)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
EventBus.getDefault().register(this)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onRefreshHomeDataEvent(event: RefreshHomeDataEvent?) {
|
||||
if (isResumed) loadData(true)
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 38 KiB |
13
app/src/main/res/drawable/shape_room_temp.xml
Normal file
13
app/src/main/res/drawable/shape_room_temp.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1px"
|
||||
android:color="#5FCCE4" />
|
||||
<solid android:color="#99ffffff" />
|
||||
<corners
|
||||
android:bottomLeftRadius="16dp"
|
||||
android:bottomRightRadius="16dp"
|
||||
android:topLeftRadius="16dp"
|
||||
android:topRightRadius="16dp" />
|
||||
</shape>
|
@@ -1,7 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@mipmap/ic_logo_main" />
|
||||
|
||||
<com.mango.xchat_android_library.widget.DrawableCenterTextView
|
||||
android:id="@+id/tv_search"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/shape_room_temp"
|
||||
android:drawableStart="@mipmap/ic_search_main"
|
||||
android:gravity="center"
|
||||
android:text="搜索房间/昵称/ID"
|
||||
android:textColor="#BABBCD"
|
||||
android:textSize="14sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="15dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false" />
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
7
app/src/main/res/layout/fragment_temp_room_hot.xml
Normal file
7
app/src/main/res/layout/fragment_temp_room_hot.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false" />
|
||||
|
105
app/src/main/res/layout/item_room_hot_temp.xml
Normal file
105
app/src/main/res/layout/item_room_hot_temp.xml
Normal file
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="10dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:background="@drawable/bg_home_hot_item"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_room_image"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintVertical_bias="0.3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_in_pk"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="16dp"
|
||||
android:background="@drawable/bg_shape_play_pk"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="PK中"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="12dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_room_image"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_room_image"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_room_image"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_id"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_room_image"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_room_image"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="余生点唱歌曲交友房间" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_room_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginTop="3dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_room_image"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_room_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_id"
|
||||
tools:src="@drawable/tag_101"
|
||||
tools:text="聊天" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#66333333"
|
||||
android:textSize="12sp"
|
||||
android:layout_marginTop="3dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/iv_room_tag"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_room_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_room_title"
|
||||
tools:text="ID:1234" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_online_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:drawableStart="@drawable/ic_home_hot_hot"
|
||||
android:drawablePadding="2dp"
|
||||
android:gravity="bottom"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:text="266" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
app/src/main/res/mipmap-xhdpi/ic_logo_main.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/ic_logo_main.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -560,7 +560,7 @@
|
||||
<!-- 页面背景色 -->
|
||||
<color name="bg_normal_1c1b22">#FFF4F4FA</color>
|
||||
<!-- 页面次级背景 列表item背景色-->
|
||||
<color name="bg_secondary_2a2a39">#F3F5FA</color>
|
||||
<color name="bg_secondary_2a2a39">#FFFFFF</color>
|
||||
<!-- 页面三级背景色,一般用于输入框-->
|
||||
<color name="bg_thirdly_f1f1fa">#FFF1F1FA</color>
|
||||
<!-- 按钮不可点击背景颜色 -->
|
||||
|
Reference in New Issue
Block a user