2023-03-03 19:31:22 +08:00
|
|
|
//
|
|
|
|
// XPNewHomeViewController.m
|
|
|
|
// xplan-ios
|
|
|
|
//
|
|
|
|
// Created by XY on 2023/3/3.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "XPNewHomeViewController.h"
|
|
|
|
///Third
|
|
|
|
#import <Masonry/Masonry.h>
|
|
|
|
#import <JXCategoryView.h>
|
|
|
|
#import <JXPagerView.h>
|
|
|
|
#import <MJRefresh/MJRefresh.h>
|
|
|
|
#import <ReactiveObjC/ReactiveObjC.h>
|
|
|
|
///Tool
|
|
|
|
#import "ThemeColor+Home.h"
|
|
|
|
#import "XPMacro.h"
|
|
|
|
#import "XPHtmlURL.h"
|
|
|
|
#import "XPConstant.h"
|
|
|
|
#import "Api+Room.h"
|
|
|
|
#import "AccountInfoStorage.h"
|
|
|
|
#import "TTPopup.h"
|
|
|
|
#import "StatisticsServiceHelper.h"
|
|
|
|
#import "XPWeakTimer.h"
|
|
|
|
#import "ClientConfig.h"
|
|
|
|
#import "NSArray+Safe.h"
|
|
|
|
#import "UIImage+Utils.h"
|
2023-03-06 18:41:25 +08:00
|
|
|
#import "XPButton.h"
|
2023-03-09 21:44:59 +08:00
|
|
|
#import "Api+Home.h"
|
|
|
|
#import "XCHUDTool.h"
|
2023-03-03 19:31:22 +08:00
|
|
|
///View
|
|
|
|
#import "XPNewHomeNavView.h"
|
|
|
|
#import "XPHomeRecommendViewController.h"
|
|
|
|
#import "XPRoomSearchContainerViewController.h"
|
|
|
|
#import "XPHomePartyContainerViewController.h"
|
|
|
|
#import "XPHomePartyViewController.h"
|
|
|
|
#import "XPWebViewController.h"
|
|
|
|
#import "XPHomeHotRoomViewController.h"
|
|
|
|
#import "XPRoomViewController.h"
|
|
|
|
#import "XPLittleGameRoomOpenView.h"
|
|
|
|
#import "XPHomeLivesViewController.h"
|
|
|
|
#import "XPTeenagerHomeView.h"
|
|
|
|
#import "XPNewHomeHeaderView.h"
|
|
|
|
#import "XPRoomSearchContainerViewController.h"
|
2023-03-09 21:44:59 +08:00
|
|
|
#import "XPHomeRecommendOtherRoomView.h"
|
2023-03-10 19:24:54 +08:00
|
|
|
#import "XPNewHomeFilterView.h"
|
2023-03-03 19:31:22 +08:00
|
|
|
///P
|
|
|
|
#import "XPHomeRecommendPresenter.h"
|
|
|
|
#import "XPHomeRecommendProtocol.h"
|
|
|
|
///VC
|
|
|
|
#import "XPHomeHappyViewController.h"
|
|
|
|
#import "XPHomeHotRoomViewController.h"
|
2023-03-06 18:41:25 +08:00
|
|
|
#import "XPFindNewFriendViewController.h"
|
2023-03-09 21:44:59 +08:00
|
|
|
///Model
|
|
|
|
#import "HomeMenuInfoModel.h"
|
|
|
|
#import "HomeMenuSourceModel.h"
|
|
|
|
#import "XPHomeMessageScrollModel.h"
|
2023-03-03 19:31:22 +08:00
|
|
|
|
2023-03-09 21:44:59 +08:00
|
|
|
@class HomeBannerInfoModel,HomeRecommendRoomModel, HomePlayRoomModel;
|
2023-03-03 19:31:22 +08:00
|
|
|
|
2023-03-09 21:44:59 +08:00
|
|
|
@interface XPNewHomeViewController ()<JXCategoryViewDelegate,JXPagerViewDelegate, XPHomeRecommendProtocol,JXPagerMainTableViewGestureDelegate, XPNewHomeNavViewDelegate, XPNewHomeHeaderViewDelegate, XPHomeRecommendOtherRoomViewDelegate>
|
2023-03-03 19:31:22 +08:00
|
|
|
{
|
|
|
|
NSTimer * timer;
|
|
|
|
}
|
|
|
|
|
|
|
|
@property (nonatomic, strong) UIImageView *topGradientImageView;
|
|
|
|
///导航栏
|
|
|
|
@property (nonatomic, strong) XPNewHomeNavView *homeNavView;
|
|
|
|
///分页控制器
|
|
|
|
@property (nonatomic, strong) JXCategoryTitleView *titleView;
|
|
|
|
@property (nonatomic, strong) JXPagerView *pagingView;
|
|
|
|
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
2023-03-06 18:41:25 +08:00
|
|
|
@property (nonatomic, strong) UIView *pageHeaderView;
|
2023-03-07 20:14:49 +08:00
|
|
|
@property (nonatomic, strong) UIStackView *stackView;
|
2023-03-06 18:41:25 +08:00
|
|
|
///筛选
|
|
|
|
@property (nonatomic, strong) XPButton *filterBtn;
|
|
|
|
///换一换
|
|
|
|
@property (nonatomic, strong) XPButton *refreshBtn;
|
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
///分页控制器头部
|
|
|
|
@property (nonatomic,strong) XPNewHomeHeaderView *headerView;
|
2023-03-09 21:44:59 +08:00
|
|
|
|
|
|
|
///开黑畅聊
|
2023-03-03 19:31:22 +08:00
|
|
|
@property (nonatomic,strong) XPHomeHappyViewController *personalRoomVC;
|
2023-03-09 21:44:59 +08:00
|
|
|
///热门推荐
|
2023-03-03 19:31:22 +08:00
|
|
|
@property (nonatomic,strong) XPHomeHotRoomViewController *hotRoomVC;
|
2023-03-06 18:41:25 +08:00
|
|
|
///发现新朋友
|
|
|
|
@property (nonatomic,strong) XPFindNewFriendViewController *friendVC;
|
2023-03-03 19:31:22 +08:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation XPNewHomeViewController
|
|
|
|
|
|
|
|
- (XPHomeRecommendPresenter *)createPresenter {
|
|
|
|
return [[XPHomeRecommendPresenter alloc] init];
|
|
|
|
}
|
|
|
|
- (BOOL)isHiddenNavBar {
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
[super viewDidLoad];
|
|
|
|
[self initHeaderAndFooterRrfresh];
|
|
|
|
[self initSubViews];
|
|
|
|
[self addTimer];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLayoutSubviews {
|
|
|
|
[super viewDidLayoutSubviews];
|
|
|
|
CGRect frame = self.view.bounds;
|
|
|
|
frame.origin.y = kNavigationHeight;
|
|
|
|
frame.size.height = frame.size.height - frame.origin.y;
|
|
|
|
self.pagingView.frame = frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
|
|
[super viewWillAppear:animated];
|
|
|
|
if (timer) {
|
2023-03-09 21:44:59 +08:00
|
|
|
[timer setFireDate:[NSDate distantPast]]; //很远的过去
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated {
|
|
|
|
[super viewWillDisappear:animated];
|
|
|
|
if (timer) {
|
|
|
|
//关闭定时器
|
2023-03-09 21:44:59 +08:00
|
|
|
[timer setFireDate:[NSDate distantFuture]]; //很远的将来
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - InitHttp
|
|
|
|
- (void)addTimer {
|
|
|
|
timer = [XPWeakTimer scheduledTimerWithTimeInterval:15 block:^(id userInfo) {
|
|
|
|
[self headerRefresh];
|
|
|
|
} userInfo:nil repeats:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)headerRefresh {
|
|
|
|
[self.presenter getHomeTopBannerList];
|
2023-03-09 21:44:59 +08:00
|
|
|
[_personalRoomVC refreshData];
|
|
|
|
[_hotRoomVC refreshData];
|
|
|
|
[_friendVC refreshData];
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)initHeaderAndFooterRrfresh {
|
|
|
|
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
|
|
|
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
|
|
|
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
|
|
|
header.stateLabel.textColor = [ThemeColor secondTextColor];
|
|
|
|
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
|
|
|
|
self.pagingView.mainTableView.mj_header = header;
|
|
|
|
[self headerRefresh];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Private Method
|
|
|
|
- (void)initSubViews {
|
|
|
|
[self.view addSubview:self.topGradientImageView];
|
|
|
|
[self.view addSubview:self.homeNavView];
|
|
|
|
[self.view addSubview:self.pagingView];
|
2023-03-07 20:14:49 +08:00
|
|
|
[self.pageHeaderView addSubview:self.stackView];
|
|
|
|
[self.stackView addArrangedSubview:self.titleView];
|
|
|
|
[self.stackView addArrangedSubview:self.refreshBtn];
|
|
|
|
[self.stackView addArrangedSubview:self.filterBtn];
|
2023-03-03 19:31:22 +08:00
|
|
|
///首页tab 根据服务端的配置
|
|
|
|
[RACObserve([ClientConfig shareConfig], configInfo) subscribeNext:^(id _Nullable x) {
|
|
|
|
ClientDataModel * model = x;
|
|
|
|
if (model.homeTabList.count > 0) {
|
|
|
|
if ([model.homeTabList containsObject:@"组队开黑"]) {
|
|
|
|
NSMutableArray * temArray = [NSMutableArray arrayWithArray:model.homeTabList];
|
|
|
|
NSInteger index = [temArray indexOfObject:@"组队开黑"];
|
|
|
|
[temArray replaceObjectAtIndex:index withObject:@"开黑畅聊"];
|
2023-03-06 18:41:25 +08:00
|
|
|
[temArray insertObject:@"发现新朋友" atIndex:0];
|
2023-03-03 19:31:22 +08:00
|
|
|
model.homeTabList = temArray.copy;
|
|
|
|
}
|
|
|
|
self.titles = model.homeTabList;
|
|
|
|
self.titleView.titles = self.titles;
|
|
|
|
[self.titleView reloadData];
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
|
|
|
|
[self.topGradientImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.top.right.mas_equalTo(0);
|
2023-03-07 15:13:07 +08:00
|
|
|
make.height.mas_equalTo(125);
|
2023-03-03 19:31:22 +08:00
|
|
|
}];
|
|
|
|
[self.homeNavView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.top.right.mas_equalTo(0);
|
|
|
|
make.height.mas_equalTo(kNavigationHeight);
|
|
|
|
}];
|
2023-03-07 20:14:49 +08:00
|
|
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
make.left.mas_equalTo(15);
|
2023-03-06 18:41:25 +08:00
|
|
|
make.right.mas_equalTo(-15);
|
2023-03-07 20:14:49 +08:00
|
|
|
make.top.bottom.mas_equalTo(0);
|
|
|
|
}];
|
|
|
|
[self.filterBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
2023-03-10 19:24:54 +08:00
|
|
|
make.height.mas_equalTo(24);
|
2023-03-06 18:41:25 +08:00
|
|
|
}];
|
|
|
|
[self.refreshBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
2023-03-10 19:24:54 +08:00
|
|
|
make.height.mas_equalTo(24);
|
2023-03-06 18:41:25 +08:00
|
|
|
}];
|
|
|
|
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2023-03-07 20:14:49 +08:00
|
|
|
make.height.mas_equalTo(50);
|
2023-03-06 18:41:25 +08:00
|
|
|
}];
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
2023-03-09 21:44:59 +08:00
|
|
|
#pragma mark - Action
|
2023-03-03 19:31:22 +08:00
|
|
|
|
2023-03-09 21:44:59 +08:00
|
|
|
/// 点击筛选
|
|
|
|
- (void)filterBtnAction {
|
2023-03-10 19:24:54 +08:00
|
|
|
XPNewHomeFilterView *filterView = [[XPNewHomeFilterView alloc] init];
|
|
|
|
@weakify(self);
|
|
|
|
filterView.selectBlock = ^(NSUInteger index, NSString *title) {
|
|
|
|
@strongify(self);
|
|
|
|
[self.filterBtn setTitle:title forState:UIControlStateNormal];
|
|
|
|
//TODO: 刷新列表
|
|
|
|
|
|
|
|
};
|
|
|
|
[filterView addToVCView:self.view targetView:self.filterBtn];
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
2023-03-09 21:44:59 +08:00
|
|
|
/// 点击换一换
|
|
|
|
- (void)refreshBtnAction {
|
|
|
|
[_friendVC refreshData];
|
2023-03-10 19:24:54 +08:00
|
|
|
self.refreshBtn.userInteractionEnabled = NO;
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
self.refreshBtn.userInteractionEnabled = YES;
|
|
|
|
});
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
2023-03-09 21:44:59 +08:00
|
|
|
#pragma mark - XPHomeRecommendProtocol
|
|
|
|
- (void)getHomeTopBannerListSuccess:(NSArray *)list menuList:(NSArray *)list1{
|
2023-03-03 19:31:22 +08:00
|
|
|
[self.pagingView.mainTableView.mj_header endRefreshing];
|
2023-03-09 21:44:59 +08:00
|
|
|
self.headerView.menuList = list1;
|
|
|
|
|
|
|
|
// 模拟数据
|
|
|
|
XPHomeMessageScrollModel *model1 = [[XPHomeMessageScrollModel alloc] init];
|
|
|
|
model1.senderName = @"小半";
|
|
|
|
model1.receiverName = @"大半";
|
|
|
|
model1.giftName = @"星语星愿";
|
|
|
|
model1.num = @"1";
|
|
|
|
|
|
|
|
XPHomeMessageScrollModel *model2 = [[XPHomeMessageScrollModel alloc] init];
|
|
|
|
model2.senderName = @"小老弟";
|
|
|
|
model2.receiverName = @"大老弟";
|
|
|
|
model2.giftName = @"宇宙飞船";
|
|
|
|
model2.num = @"1";
|
|
|
|
|
|
|
|
XPHomeMessageScrollModel *model3 = [[XPHomeMessageScrollModel alloc] init];
|
|
|
|
model3.senderName = @"心心念念";
|
|
|
|
model3.receiverName = @"乔碧萝";
|
|
|
|
model3.giftName = @"大火箭";
|
|
|
|
model3.num = @"1";
|
|
|
|
NSArray *array = @[model1, model2, model3];
|
|
|
|
self.headerView.messageList = array;
|
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)getHomeRecommendDataFail {
|
2023-03-09 21:44:59 +08:00
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPNewHomeNavViewDelegate
|
|
|
|
|
|
|
|
- (void)xPNewHomeNavView:(XPNewHomeNavView *)view didClickSearch:(UIButton *)sender {
|
|
|
|
XPRoomSearchContainerViewController * searchVC = [[XPRoomSearchContainerViewController alloc] init];
|
|
|
|
searchVC.modalPresentationStyle = UIModalPresentationFullScreen;
|
|
|
|
[self.navigationController presentViewController:searchVC animated:YES completion:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)xPNewHomeNavView:(XPNewHomeNavView *)view didClickRank:(UIButton *)sender {
|
|
|
|
XPWebViewController * webVC =[[XPWebViewController alloc] init];
|
|
|
|
webVC.url = URLWithType(kHomeRankURL);
|
|
|
|
[self.navigationController pushViewController:webVC animated:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - XPNewHomeHeaderViewDelegate
|
2023-03-09 21:44:59 +08:00
|
|
|
/// 点击了某个菜单
|
|
|
|
- (void)homeHeaderViewClickMenu:(HomeMenuInfoModel *)info {
|
|
|
|
if (info.resourceType == HomeMenuResourceType_H5) {
|
|
|
|
XPWebViewController * webVC = [[ XPWebViewController alloc] init];
|
|
|
|
webVC.url = info.resourceContent;
|
|
|
|
[self.navigationController pushViewController:webVC animated:YES];
|
|
|
|
} else {
|
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
if (info.hid.length > 0 && uid.length > 0) {
|
|
|
|
[Api homePickResource:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
if (code == 200) {
|
|
|
|
HomeMenuSourceModel * sourceModel = [HomeMenuSourceModel modelWithDictionary:data.data];
|
|
|
|
if (sourceModel.isPick) {
|
|
|
|
if (sourceModel.uid.integerValue > 0) {
|
|
|
|
[XPRoomViewController openRoom:sourceModel.uid fromNick:nil fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
XPHomeRecommendOtherRoomView * recommendView = [[XPHomeRecommendOtherRoomView alloc] init];
|
|
|
|
recommendView.delegate = self;
|
|
|
|
recommendView.roomInfo = sourceModel;
|
|
|
|
[TTPopup popupView:recommendView style:TTPopupStyleAlert];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
[XCHUDTool showErrorWithMessage:msg];
|
|
|
|
}
|
|
|
|
} uid:uid rid:info.hid];
|
|
|
|
}
|
|
|
|
}
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
2023-03-09 21:44:59 +08:00
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
/// 点击热门
|
2023-03-09 21:44:59 +08:00
|
|
|
- (void)homeHeaderViewClickScrollMessage:(XPHomeMessageScrollModel *)info {
|
2023-03-03 19:31:22 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-03-09 21:44:59 +08:00
|
|
|
#pragma mark - XPHomeRecommendOtherRoomViewDelegate
|
|
|
|
- (void)xPHomeRecommendOtherRoomView:(XPHomeRecommendOtherRoomView *)view didClickEnterRoom:(HomeMenuSourceModel *)model {
|
|
|
|
if (model.uid.integerValue > 0) {
|
|
|
|
[XPRoomViewController openRoom:model.uid fromNick:nil fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
#pragma mark - JXCategoryViewDelegate
|
|
|
|
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
|
|
|
|
return [XPNewHomeHeaderView getHeaderViewHeight];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
|
|
|
|
return self.headerView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
|
|
|
return 50;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
2023-03-06 18:41:25 +08:00
|
|
|
return self.pageHeaderView;
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
|
|
|
return self.titles.count;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
|
|
|
|
UIViewController *viewController;
|
2023-03-06 18:41:25 +08:00
|
|
|
if (index == 0) {
|
|
|
|
viewController = self.friendVC;
|
|
|
|
}else{
|
|
|
|
NSString * title = [self.titles safeObjectAtIndex1:index];
|
|
|
|
if ([title isEqualToString:@"开黑畅聊"]) {
|
|
|
|
viewController = self.personalRoomVC;
|
|
|
|
} else {
|
|
|
|
viewController = self.hotRoomVC;
|
|
|
|
}
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
2023-03-06 18:41:25 +08:00
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
return (id <JXPagerViewListViewDelegate>)viewController;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
2023-03-06 18:41:25 +08:00
|
|
|
if (index == 0) {
|
2023-03-07 20:14:49 +08:00
|
|
|
// 调整标题UI
|
|
|
|
self.refreshBtn.hidden = NO;
|
|
|
|
self.filterBtn.hidden = NO;
|
2023-03-06 18:41:25 +08:00
|
|
|
}else{
|
2023-03-07 20:14:49 +08:00
|
|
|
self.refreshBtn.hidden = YES;
|
|
|
|
self.filterBtn.hidden = YES;
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
2023-03-06 18:41:25 +08:00
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - JXPagerMainTableViewGestureDelegate
|
|
|
|
|
|
|
|
- (BOOL)mainTableViewGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
|
|
|
|
///1000是外部的scrollView 1001是人气主播中的collectionView 9999是 开黑畅聊的轮播图
|
|
|
|
if (otherGestureRecognizer.view.tag == 1000 || otherGestureRecognizer.view == self.headerView || otherGestureRecognizer.view.tag == 1001 || otherGestureRecognizer.view.tag == 9999) {
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
return [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
|
|
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
|
|
|
|
|
|
- (UIImageView *)topGradientImageView {
|
|
|
|
if (!_topGradientImageView) {
|
|
|
|
_topGradientImageView = [[UIImageView alloc] init];
|
|
|
|
_topGradientImageView.image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#DCF6FF"], [ThemeColor colorWithHexString:@"#F8F8FA"]] gradientType:GradientTypeTopToBottom imgSize:CGSizeMake(KScreenWidth, 125)];
|
|
|
|
_topGradientImageView.contentMode = UIViewContentModeScaleToFill;
|
|
|
|
}
|
|
|
|
return _topGradientImageView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPNewHomeNavView *)homeNavView {
|
|
|
|
if (!_homeNavView) {
|
|
|
|
_homeNavView = [[XPNewHomeNavView alloc] init];
|
|
|
|
_homeNavView.delegate = self;
|
|
|
|
}
|
|
|
|
return _homeNavView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (JXCategoryTitleView *)titleView {
|
|
|
|
if (!_titleView) {
|
|
|
|
_titleView = [[JXCategoryTitleView alloc] init];
|
|
|
|
_titleView.delegate = self;
|
|
|
|
_titleView.backgroundColor = [UIColor clearColor];
|
|
|
|
_titleView.titleColor = [ThemeColor textThirdColor];
|
|
|
|
_titleView.titleSelectedColor = [ThemeColor mainTextColor];
|
2023-03-06 18:41:25 +08:00
|
|
|
_titleView.titleFont = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
|
|
|
_titleView.titleSelectedFont = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
2023-03-03 19:31:22 +08:00
|
|
|
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
|
|
|
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
|
|
|
_titleView.defaultSelectedIndex = 0;
|
|
|
|
_titleView.averageCellSpacingEnabled = NO;
|
|
|
|
_titleView.titles = self.titles;
|
|
|
|
_titleView.cellSpacing = 20;
|
|
|
|
_titleView.listContainer = (id<JXCategoryViewListContainer>)self.pagingView.listContainerView;
|
|
|
|
|
|
|
|
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
|
2023-03-06 18:41:25 +08:00
|
|
|
lineView.indicatorImageViewSize = CGSizeMake(13, 4);
|
|
|
|
lineView.verticalMargin = 5;
|
|
|
|
lineView.indicatorImageView.image = [UIImage imageNamed:@"home_segment_indicator"];
|
2023-03-03 19:31:22 +08:00
|
|
|
_titleView.indicators = @[lineView];
|
|
|
|
}
|
|
|
|
return _titleView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (JXPagerView *)pagingView {
|
|
|
|
if (!_pagingView) {
|
|
|
|
_pagingView = [[JXPagerView alloc] initWithDelegate:self];
|
|
|
|
_pagingView.backgroundColor = [UIColor clearColor];
|
|
|
|
_pagingView.listContainerView.backgroundColor = [UIColor clearColor];
|
|
|
|
_pagingView.mainTableView.backgroundColor = [UIColor clearColor];
|
|
|
|
_pagingView.mainTableView.gestureDelegate = self;
|
|
|
|
_pagingView.listContainerView.listCellBackgroundColor = UIColor.clearColor;
|
|
|
|
}
|
|
|
|
return _pagingView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray<NSString *> *)titles {
|
|
|
|
if (!_titles) {
|
2023-03-06 18:41:25 +08:00
|
|
|
_titles = @[@"发现新朋友", @"热门房间", @"开黑畅聊"];
|
2023-03-03 19:31:22 +08:00
|
|
|
}
|
|
|
|
return _titles;
|
|
|
|
}
|
|
|
|
|
2023-03-06 18:41:25 +08:00
|
|
|
- (UIView *)pageHeaderView {
|
|
|
|
if (!_pageHeaderView) {
|
|
|
|
_pageHeaderView = [[UIView alloc] init];
|
|
|
|
}
|
|
|
|
return _pageHeaderView;
|
|
|
|
}
|
|
|
|
|
2023-03-07 20:14:49 +08:00
|
|
|
- (UIStackView *)stackView {
|
|
|
|
if (!_stackView) {
|
|
|
|
_stackView = [[UIStackView alloc] init];
|
|
|
|
_stackView.axis = UILayoutConstraintAxisHorizontal;
|
|
|
|
_stackView.distribution = UIStackViewDistributionFill;
|
|
|
|
_stackView.alignment = UIStackViewAlignmentCenter;
|
|
|
|
_stackView.spacing = 6;
|
|
|
|
}
|
|
|
|
return _stackView;
|
|
|
|
}
|
|
|
|
|
2023-03-06 18:41:25 +08:00
|
|
|
- (XPButton *)filterBtn {
|
|
|
|
if (!_filterBtn) {
|
|
|
|
_filterBtn = [XPButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
[_filterBtn setImage:[UIImage imageNamed:@"home_filter_arrow"] forState:UIControlStateNormal];
|
2023-03-10 19:24:54 +08:00
|
|
|
[_filterBtn setTitle:@"全部" forState:UIControlStateNormal];
|
2023-03-06 18:41:25 +08:00
|
|
|
[_filterBtn setTitleColor:[ThemeColor secondTextColor] forState:UIControlStateNormal];
|
|
|
|
_filterBtn.titleLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
|
|
|
|
_filterBtn.backgroundColor = UIColor.whiteColor;
|
|
|
|
_filterBtn.layer.cornerRadius = 12;
|
|
|
|
_filterBtn.clipsToBounds = YES;
|
2023-03-10 19:24:54 +08:00
|
|
|
_filterBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 10);
|
2023-03-09 21:44:59 +08:00
|
|
|
[_filterBtn addTarget:self action:@selector(filterBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
2023-03-06 18:41:25 +08:00
|
|
|
_filterBtn.imagePosition = XPButtonImagePositionRight;
|
|
|
|
_filterBtn.imageTitleSpace = 4;
|
|
|
|
}
|
|
|
|
return _filterBtn;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPButton *)refreshBtn {
|
|
|
|
if (!_refreshBtn) {
|
|
|
|
_refreshBtn = [XPButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
[_refreshBtn setImage:[UIImage imageNamed:@"home_refresh"] forState:UIControlStateNormal];
|
|
|
|
[_refreshBtn setTitle:@"换一换" forState:UIControlStateNormal];
|
|
|
|
[_refreshBtn setTitleColor:[ThemeColor secondTextColor] forState:UIControlStateNormal];
|
|
|
|
_refreshBtn.titleLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
|
|
|
|
_refreshBtn.backgroundColor = UIColor.whiteColor;
|
|
|
|
_refreshBtn.layer.cornerRadius = 12;
|
|
|
|
_refreshBtn.clipsToBounds = YES;
|
2023-03-10 19:24:54 +08:00
|
|
|
_refreshBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 10);
|
2023-03-09 21:44:59 +08:00
|
|
|
[_refreshBtn addTarget:self action:@selector(refreshBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
2023-03-06 18:41:25 +08:00
|
|
|
_refreshBtn.imagePosition = XPButtonImagePositionRight;
|
|
|
|
_refreshBtn.imageTitleSpace = 4;
|
|
|
|
}
|
|
|
|
return _refreshBtn;
|
|
|
|
}
|
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
- (XPNewHomeHeaderView *)headerView {
|
|
|
|
if (!_headerView) {
|
|
|
|
_headerView = [[XPNewHomeHeaderView alloc] init];
|
|
|
|
_headerView.backgroundColor = [UIColor clearColor];
|
|
|
|
_headerView.delegate = self;
|
|
|
|
}
|
|
|
|
return _headerView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPHomeHotRoomViewController *)hotRoomVC {
|
|
|
|
if (!_hotRoomVC) {
|
|
|
|
_hotRoomVC = [[XPHomeHotRoomViewController alloc] init];
|
|
|
|
}
|
|
|
|
return _hotRoomVC;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (XPHomeHappyViewController *)personalRoomVC {
|
|
|
|
if (!_personalRoomVC) {
|
|
|
|
_personalRoomVC = [[XPHomeHappyViewController alloc] init];
|
|
|
|
}
|
|
|
|
return _personalRoomVC;
|
|
|
|
}
|
2023-03-06 18:41:25 +08:00
|
|
|
|
|
|
|
- (XPFindNewFriendViewController *)friendVC {
|
|
|
|
if (!_friendVC) {
|
|
|
|
_friendVC = [[XPFindNewFriendViewController alloc] init];
|
|
|
|
}
|
|
|
|
return _friendVC;
|
|
|
|
}
|
|
|
|
|
2023-03-03 19:31:22 +08:00
|
|
|
@end
|