1:修改K歌房

2:修改房间展示每日任务
3:修改页面跳转
4:遗留问题在进入首页的时候出现首页刷新
This commit is contained in:
2025-10-27 20:09:12 +08:00
parent 8631fdbdbf
commit a4032c76ad
106 changed files with 6593 additions and 396 deletions

View File

@@ -94,14 +94,21 @@ public class PopularRoomActivity extends BaseMvpActivity<VoiceCategoryPresenter,
}
TopRoom item = mAdapter.getItem(position);
if (item != null ) {
mBinding.coolWaitView.setVisibility(View.VISIBLE);
MessageListenerSingleton.getInstance().joinGroup(item.getRoom_id());
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id(), "");
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id(), "",null);
}
}
});
}
@Override
protected void onPause() {
super.onPause();
mBinding.coolWaitView.setVisibility(View.GONE);
}
@Override
protected void onResume() {
super.onResume();

View File

@@ -31,6 +31,7 @@ public class RankingListActivity extends BaseAppCompatActivity<ActivityRankingLi
@Override
protected void initView() {
mBinding.topBar.setTitle("排行榜");
mBinding.topBar.setColor(getResources().getColor(R.color.white));
SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());
mBinding.viewPager.setAdapter(sectionsPagerAdapter);
mBinding.tabs.setupWithViewPager( mBinding.viewPager);

View File

@@ -154,7 +154,7 @@ public class SearchActivity extends BaseMvpActivity<SearchPresenter, ActivitySea
public void onGnsClick(UserResultResp item) {
if (item.getRoom_id() != null && !item.getRoom_id().isEmpty() && !"0".equals(item.getRoom_id())) {
RoomManager.getInstance().fetchRoomDataAndEnter(SearchActivity.this, item.getRoom_id() + "", "");
RoomManager.getInstance().fetchRoomDataAndEnter(SearchActivity.this, item.getRoom_id() + "", "",null);
} else {
ChatLauncher.getInstance().launchC2CChat(SearchActivity.this, item.getUser_id() + "");
@@ -173,7 +173,7 @@ public class SearchActivity extends BaseMvpActivity<SearchPresenter, ActivitySea
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
RoomSearchResp item = mSearchRoomResultAdapter.getItem(position);
if (item != null) {
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id(), "");
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id(), "",null);
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "搜索界面").withString("roomId", item.getId()).navigation();
}

View File

@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.moduleroom.activity.RoomActivity;
import com.example.modulevoice.R;
import com.example.modulevoice.adapter.HotAdapter;
import com.example.modulevoice.contacts.HotListContacts;
@@ -34,12 +35,16 @@ public class HotListFragment extends BaseMvpFragment<HotListPresenter, FragmentH
private String tag;
private int page;
public static HotListFragment newInstance(String type, String tag) {
private VoiceCategoryFragment voiceCategoryFragment;
public HotListFragment(){}
public HotListFragment(VoiceCategoryFragment voiceCategoryFragment){
this.voiceCategoryFragment = voiceCategoryFragment;
}
public static HotListFragment newInstance(VoiceCategoryFragment voiceCategoryFragment,String type, String tag) {
Bundle args = new Bundle();
args.putString("label_id", type);
args.putString("tag", tag);
HotListFragment fragment = new HotListFragment();
HotListFragment fragment = new HotListFragment(voiceCategoryFragment);
fragment.setArguments(args);
return fragment;
}
@@ -117,7 +122,7 @@ public class HotListFragment extends BaseMvpFragment<HotListPresenter, FragmentH
if ( ClickUtils.isFastDoubleClick()){
return;
}
voiceCategoryFragment.showLoading();
// 添加索引有效性检查
if (position < 0 || position >= mAdapter.getData().size()) {
return;
@@ -134,7 +139,7 @@ public class HotListFragment extends BaseMvpFragment<HotListPresenter, FragmentH
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), item.getRoom_id(), "");
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), item.getRoom_id(), "",null);
// MvpPre.getRoomIn(item.getRoom_id(), "");
}
}

View File

@@ -74,8 +74,21 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
private List<String> info;
CarouselBannerAdapter carouselBannerAdapter;
public static VoiceCategoryFragment newInstance() {
return new VoiceCategoryFragment();
private VoiceFragment voiceFragment;
private VoiceCategoryFragment (){}
private VoiceCategoryFragment (VoiceFragment voiceFragment){
this.voiceFragment = voiceFragment;
}
public static VoiceCategoryFragment newInstance(VoiceFragment voiceFragment) {
return new VoiceCategoryFragment(voiceFragment);
}
public void showLoading(){
voiceFragment.isShowLoading(true);
}
@Nullable
@@ -156,7 +169,8 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
carouselBannerAdapter.setOnItemClickListener((view, data, position) -> {
// 示例:跳转到房间 详情页
if (data != null) {
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), data.getRoom_id() ,"");
showLoading();
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), data.getRoom_id() ,"",null);
}
});
@@ -178,7 +192,8 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
if (item != null) { // 再次检查 item 是否为 null
String roomId = item.getRoom_id(); // 或者 item.getRoomId(); 确保方法名正确
if (roomId != null && !roomId.isEmpty()) { // 检查 roomId 是否有效
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), roomId,"");
showLoading();
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), roomId,"",null);
// ARouter.getInstance()
// .build(ARouteConstants.ROOM_DETAILS)
@@ -327,7 +342,7 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
RoomTypeModel roomTypeModel = list.get(position);
String categoryId = roomTypeModel.getId();
HotListFragment.newInstance(categoryId, TYPE_INDEX);
HotListFragment.newInstance(VoiceCategoryFragment.this,categoryId, TYPE_INDEX);
}
}
@@ -389,7 +404,7 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
super.onDestroy();
}
private static class MyFragmentPagerAdapter extends FragmentStateAdapter {
private class MyFragmentPagerAdapter extends FragmentStateAdapter {
private List<RoomTypeModel> list;
@@ -408,7 +423,7 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
public Fragment createFragment(int position) {
RoomTypeModel roomTypeModel = list.get(position);
String categoryId = roomTypeModel.getId();
return HotListFragment.newInstance(categoryId, TYPE_INDEX);
return HotListFragment.newInstance(VoiceCategoryFragment.this,categoryId, TYPE_INDEX);
}
@Override

View File

@@ -3,6 +3,7 @@ package com.example.modulevoice.fragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ToastUtils;
@@ -45,6 +46,16 @@ public class VoiceFragment extends BaseMvpFragment<VoicePresenter, FragmentVoice
}
@Override
public void onPause() {
super.onPause();
isShowLoading(false);
}
public void isShowLoading(boolean isShowLoading){
mBinding.coolWaitView.setVisibility(isShowLoading? View.VISIBLE:View.GONE);
}
@Override
protected void initView () {
@@ -186,7 +197,7 @@ public class VoiceFragment extends BaseMvpFragment<VoicePresenter, FragmentVoice
@Override
public void hideRecommend ( boolean hideRecommend, boolean hideGame){
List<Fragment> fragments = new ArrayList<>();
fragments.add(VoiceCategoryFragment.newInstance());
fragments.add(VoiceCategoryFragment.newInstance(VoiceFragment.this));
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(fragments, getChildFragmentManager()));
}

View File

@@ -42,5 +42,18 @@
android:paddingBottom="@dimen/dp_80"
tools:listitem="@layout/item_popular_room"/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
<app.dinus.com.loadingdrawable.LoadingView
android:id="@+id/cool_wait_view"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_centerInParent="true"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@drawable/ps_ic_shadow_bg"
app:loading_renderer="CoolWaitLoadingRenderer"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -29,6 +29,7 @@
android:layout_marginRight="@dimen/dp_10"
app:tabIndicatorHeight="10dp"
app:tabIndicator="@mipmap/tab_x"
app:tabIndicatorGravity="bottom"
app:tabTextColor="@color/white"
app:tabSelectedTextColor="@color/white"
app:tabTextAppearance="@style/CustomTabTextAppearance"

View File

@@ -7,104 +7,119 @@
</data>
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@mipmap/home_bj">
android:layout_height="match_parent">
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_45"
android:orientation="horizontal"
android:gravity="center_vertical">
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@mipmap/home_bj">
<TextView
android:layout_width="wrap_content"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/app_name_bg"
android:textSize="@dimen/sp_25"
android:textStyle="normal"
android:layout_marginLeft="@dimen/dp_15"/>
<LinearLayout
android:id="@+id/ll_search"
android:layout_width="@dimen/dp_0"
android:layout_height="38dp"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:background="@drawable/shape_search_in"
android:gravity="center_vertical"
android:layout_marginTop="@dimen/dp_45"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/iv_close"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_16"
android:src="@drawable/index_level_search"/>
android:gravity="center_vertical">
<TextView
android:id="@+id/edit_query"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/app_name_bg"
android:textSize="@dimen/sp_25"
android:textStyle="normal"
android:layout_marginLeft="@dimen/dp_15"/>
<LinearLayout
android:id="@+id/ll_search"
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:layout_height="38dp"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:background="@drawable/shape_search_in"
android:gravity="center_vertical"
android:text="请输入ID/房间名称"
android:maxLength="10"
android:paddingLeft="@dimen/dp_12"
android:paddingRight="@dimen/dp_12"
android:textColor="#999999"
android:textSize="@dimen/sp_14"/>
</LinearLayout>
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/iv_room3"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:src="@mipmap/index_level_search_o"
android:layout_toStartOf="@+id/iv_ranking_list"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_11"/>
<ImageView
android:id="@+id/iv_close"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_16"
android:src="@drawable/index_level_search"/>
<ImageView
android:id="@+id/iv_ranking_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@+id/iv_room"
android:layout_marginEnd="@dimen/dp_11"
android:layout_centerInParent="true"
android:scaleType="fitCenter"
android:src="@mipmap/ic_home_rank"
android:visibility="gone"/>
<TextView
android:id="@+id/edit_query"
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="请输入ID/房间名称"
android:maxLength="10"
android:paddingLeft="@dimen/dp_12"
android:paddingRight="@dimen/dp_12"
android:textColor="#999999"
android:textSize="@dimen/sp_14"/>
</LinearLayout>
<ImageView
android:id="@+id/iv_room"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_26"
android:src="@mipmap/ic_paidui_home"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:scaleType="fitCenter"
android:layout_marginEnd="@dimen/dp_11"
android:visibility="gone"/>
<ImageView
android:id="@+id/iv_room3"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:src="@mipmap/index_level_search_o"
android:layout_toStartOf="@+id/iv_ranking_list"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_11"/>
<ImageView
android:id="@+id/iv_ranking_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@+id/iv_room"
android:layout_marginEnd="@dimen/dp_11"
android:layout_centerInParent="true"
android:scaleType="fitCenter"
android:src="@mipmap/ic_home_rank"
android:visibility="gone"/>
<ImageView
android:id="@+id/iv_room"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_26"
android:src="@mipmap/ic_paidui_home"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:scaleType="fitCenter"
android:layout_marginEnd="@dimen/dp_11"
android:visibility="gone"/>
</RelativeLayout>
</RelativeLayout>
<com.xscm.moduleutil.widget.ScrollViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.xscm.moduleutil.widget.ScrollViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_60"
android:background="@color/color_transparent"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_60"
android:background="@color/color_transparent"/>
</LinearLayout>
</LinearLayout>
<app.dinus.com.loadingdrawable.LoadingView
android:id="@+id/cool_wait_view"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_centerInParent="true"
android:visibility="gone"
android:background="@drawable/ps_ic_shadow_bg"
app:loading_renderer="CoolWaitLoadingRenderer"/>
</RelativeLayout>
</layout>