消息中心改造-UI

This commit is contained in:
chenguilong
2022-11-17 18:58:56 +08:00
committed by fengshuo
parent 48b0178fa8
commit a994594617
23 changed files with 661 additions and 2 deletions

View File

@@ -212,6 +212,7 @@
9B86D8802817F4A300494FCD /* XPNobleSettingNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D87F2817F4A300494FCD /* XPNobleSettingNavView.m */; };
9B86D88328192DC000494FCD /* XPRoomRankEntranceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D88228192DC000494FCD /* XPRoomRankEntranceView.m */; };
9B86D886281942D200494FCD /* SocialMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D885281942D200494FCD /* SocialMicroView.m */; };
9B87B3CD2926473D00085110 /* XPSessionListHeadFriendCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B87B3CC2926473D00085110 /* XPSessionListHeadFriendCell.m */; };
9B88E20C28C5EB8300D26FBA /* MessageContentRedPacketView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B88E20B28C5EB8300D26FBA /* MessageContentRedPacketView.m */; };
9B88E20F28C6305400D26FBA /* XPRoomSearchRecordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B88E20E28C6305400D26FBA /* XPRoomSearchRecordViewController.m */; };
9B88E21228C6365B00D26FBA /* XPHomeSearchRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B88E21128C6365B00D26FBA /* XPHomeSearchRecordCell.m */; };
@@ -294,6 +295,9 @@
9BD63FAE277EE97A006EB744 /* XPReleaseRadioPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD63FAD277EE97A006EB744 /* XPReleaseRadioPresenter.m */; };
9BD63FB4277EF1B3006EB744 /* XPReleaseRadioModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD63FB3277EF1B3006EB744 /* XPReleaseRadioModel.m */; };
9BD6E435289A48E3007DCF42 /* XPNewUserRechargePresentTrasition.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD6E433289A48E3007DCF42 /* XPNewUserRechargePresentTrasition.m */; };
9BD798B129262434003E03E6 /* XPSessionListHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD798B029262434003E03E6 /* XPSessionListHeadView.m */; };
9BD798B4292632FE003E03E6 /* XPSessionListHeadItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD798B3292632FE003E03E6 /* XPSessionListHeadItemView.m */; };
9BD798B72926362F003E03E6 /* XPSessionListHeadItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD798B62926362F003E03E6 /* XPSessionListHeadItem.m */; };
9BD8D4E328911E9900AE03FF /* XPMineCollectRoomListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD8D4E228911E9900AE03FF /* XPMineCollectRoomListViewController.m */; };
9BD8D4E628911F7700AE03FF /* XPMineCollectRoomListPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD8D4E528911F7700AE03FF /* XPMineCollectRoomListPresenter.m */; };
9BD9A17927A0EC57004186FE /* XPMineVisitorPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD9A17827A0EC57004186FE /* XPMineVisitorPresenter.m */; };
@@ -1641,6 +1645,8 @@
9B86D88228192DC000494FCD /* XPRoomRankEntranceView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomRankEntranceView.m; sourceTree = "<group>"; };
9B86D884281942D200494FCD /* SocialMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocialMicroView.h; sourceTree = "<group>"; };
9B86D885281942D200494FCD /* SocialMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SocialMicroView.m; sourceTree = "<group>"; };
9B87B3CB2926473D00085110 /* XPSessionListHeadFriendCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionListHeadFriendCell.h; sourceTree = "<group>"; };
9B87B3CC2926473D00085110 /* XPSessionListHeadFriendCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionListHeadFriendCell.m; sourceTree = "<group>"; };
9B88E20A28C5EB8300D26FBA /* MessageContentRedPacketView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentRedPacketView.h; sourceTree = "<group>"; };
9B88E20B28C5EB8300D26FBA /* MessageContentRedPacketView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentRedPacketView.m; sourceTree = "<group>"; };
9B88E20D28C6305400D26FBA /* XPRoomSearchRecordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomSearchRecordViewController.h; sourceTree = "<group>"; };
@@ -1810,6 +1816,12 @@
9BD63FB3277EF1B3006EB744 /* XPReleaseRadioModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPReleaseRadioModel.m; sourceTree = "<group>"; };
9BD6E433289A48E3007DCF42 /* XPNewUserRechargePresentTrasition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPNewUserRechargePresentTrasition.m; sourceTree = "<group>"; };
9BD6E434289A48E3007DCF42 /* XPNewUserRechargePresentTrasition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPNewUserRechargePresentTrasition.h; sourceTree = "<group>"; };
9BD798AF29262434003E03E6 /* XPSessionListHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionListHeadView.h; sourceTree = "<group>"; };
9BD798B029262434003E03E6 /* XPSessionListHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionListHeadView.m; sourceTree = "<group>"; };
9BD798B2292632FE003E03E6 /* XPSessionListHeadItemView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionListHeadItemView.h; sourceTree = "<group>"; };
9BD798B3292632FE003E03E6 /* XPSessionListHeadItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionListHeadItemView.m; sourceTree = "<group>"; };
9BD798B52926362F003E03E6 /* XPSessionListHeadItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionListHeadItem.h; sourceTree = "<group>"; };
9BD798B62926362F003E03E6 /* XPSessionListHeadItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionListHeadItem.m; sourceTree = "<group>"; };
9BD8D4E128911E9900AE03FF /* XPMineCollectRoomListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineCollectRoomListViewController.h; sourceTree = "<group>"; };
9BD8D4E228911E9900AE03FF /* XPMineCollectRoomListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCollectRoomListViewController.m; sourceTree = "<group>"; };
9BD8D4E428911F7700AE03FF /* XPMineCollectRoomListPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineCollectRoomListPresenter.h; sourceTree = "<group>"; };
@@ -4220,6 +4232,7 @@
18F404BC2760989300A6C548 /* View */ = {
isa = PBXGroup;
children = (
9BD798AE29262306003E03E6 /* SessionListHeadView */,
E8A30BDB28534667003B4873 /* FindNew */,
18EE3FF72754B01D00A452BF /* NIMViews */,
18EE3FF52754AFD900A452BF /* SessionList */,
@@ -5072,6 +5085,21 @@
path = Protocol;
sourceTree = "<group>";
};
9BD798AE29262306003E03E6 /* SessionListHeadView */ = {
isa = PBXGroup;
children = (
9BD798AF29262434003E03E6 /* XPSessionListHeadView.h */,
9BD798B029262434003E03E6 /* XPSessionListHeadView.m */,
9BD798B2292632FE003E03E6 /* XPSessionListHeadItemView.h */,
9BD798B3292632FE003E03E6 /* XPSessionListHeadItemView.m */,
9BD798B52926362F003E03E6 /* XPSessionListHeadItem.h */,
9BD798B62926362F003E03E6 /* XPSessionListHeadItem.m */,
9B87B3CB2926473D00085110 /* XPSessionListHeadFriendCell.h */,
9B87B3CC2926473D00085110 /* XPSessionListHeadFriendCell.m */,
);
path = SessionListHeadView;
sourceTree = "<group>";
};
9BD9A17D27A0EFB1004186FE /* Visitor */ = {
isa = PBXGroup;
children = (
@@ -9472,6 +9500,7 @@
E8F9168B27EC940E00F10D8F /* XPHomeLittleGameTableViewCell.m in Sources */,
E8DEC9A12764A5D20078CB70 /* XPRoomMoreItemModel.m in Sources */,
E80EC81028ACD84000D133C5 /* QExtendBoardView.m in Sources */,
9B87B3CD2926473D00085110 /* XPSessionListHeadFriendCell.m in Sources */,
9B86D88328192DC000494FCD /* XPRoomRankEntranceView.m in Sources */,
18F404B7276095D700A6C548 /* SessionChatLimitView.m in Sources */,
E8788942273A55AD00BF1D57 /* XPGiftUsersView.m in Sources */,
@@ -9949,6 +9978,7 @@
E824544B26F5BBB800BE8163 /* XPMineModifPayPwdViewController.m in Sources */,
E81C1B2227705F950020D1E4 /* Api+ArrangeMic.m in Sources */,
E800805A27FD34DE0055A8AB /* XPMineClanViewController.m in Sources */,
9BD798B4292632FE003E03E6 /* XPSessionListHeadItemView.m in Sources */,
E8ACEFF527C8EF0500F66D1A /* XPHomeHotRoomViewController.m in Sources */,
E8E20BE828169BDC0033B688 /* XPMineLoginPasswordPresenter.m in Sources */,
E81EF6DC279AB5CC00FF3EDE /* XPLittleGameRoomOpenView.m in Sources */,
@@ -9975,6 +10005,7 @@
E880B3AF278BE1D800A83B0D /* Api+AcrossRoomPK.m in Sources */,
E8B9842D28AB77F10022D026 /* XPMonentsPublishTopicView.m in Sources */,
E88C72992828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.m in Sources */,
9BD798B129262434003E03E6 /* XPSessionListHeadView.m in Sources */,
E8D34D4728080295009C4835 /* XPMineUserDataViewController.m in Sources */,
E801275127E3281100BAC3F2 /* XPRoomPKTimeTableViewCell.m in Sources */,
E8EEB90F26FC6AB8007C6EBA /* XPMineUserInfoEditPresenter.m in Sources */,
@@ -10163,6 +10194,7 @@
9BAD41AC28C6EB13005E47B3 /* XPInRoomRecordPresenter.m in Sources */,
E8AC721626F46B06007D6E91 /* XPMineSettingTableViewCell.m in Sources */,
18EE3FDF2750C1F700A452BF /* SessionListCell.m in Sources */,
9BD798B72926362F003E03E6 /* XPSessionListHeadItem.m in Sources */,
9BB549622782EA1D0090CD26 /* NobleInfo.m in Sources */,
E80487652717DDD9008595F2 /* XPRoomMenuItem.m in Sources */,
E895018C282D0701007E459A /* XPMoentsTopicView.m in Sources */,

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "session_list_head_activity@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "session_list_head_activity@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "session_list_head_mengxin@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "session_list_head_mengxin@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "session_list_head_office@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "session_list_head_office@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "session_list_head_subscribe@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "session_list_head_subscribe@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -21,6 +21,7 @@
#import "XPSessionFindNewViewController.h"
#import "TTPopUp.h"
#import "XPTeenagerHomeView.h"
#import "XPSessionListHeadView.h"
NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
@@ -33,6 +34,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *allReadButton;
@property (nonatomic, strong) XPSessionListHeadView *headView;
/**
*
*/
@@ -108,9 +110,9 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
- (void)viewDidLoad {
[super viewDidLoad];
[self getUserInfo];
[self initViews];
[self initLayout];
[self getUserInfo];
}
- (void)getUserInfo {
@@ -120,6 +122,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
UserInfoModel * userInfo = [UserInfoModel modelWithDictionary:data.data];
self.userInfo = userInfo;
[self.sessionListView reloadData];
[self.headView updateToolViewWithUserLevel:self.userInfo.userLevelVo.charmLevelSeq];
}
} uid:uid];
}
@@ -129,6 +132,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
[self.customNavigationBar addSubview:self.titleLabel];
[self.view addSubview:self.customNavigationBar];
[self.customNavigationBar addSubview:self.allReadButton];
[self.view addSubview:self.headView];
}
[self.view addSubview:self.sessionListView];
}
@@ -143,12 +147,16 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
make.width.height.mas_equalTo(30);
make.centerY.mas_equalTo(self.customNavigationBar);
}];
[self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(0);
make.top.mas_equalTo(self.customNavigationBar.mas_bottom).mas_offset(8);
}];
}
[self.sessionListView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.view);
if (self.openType == SessionListOpenTypeDefault) {
make.top.mas_equalTo(self.customNavigationBar.mas_bottom);
make.top.mas_equalTo(self.headView.mas_bottom);
} else {
make.top.mas_equalTo(self.view);
}
@@ -448,4 +456,10 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
return _teenagerView;
}
- (XPSessionListHeadView *)headView {
if (!_headView) {
_headView = [[XPSessionListHeadView alloc] init];
}
return _headView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPSessionListHeadFriendCell.h
// xplan-ios
//
// Created by GreenLand on 2022/11/17.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPSessionListHeadFriendCell : UICollectionViewCell
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,87 @@
//
// XPSessionListHeadFriendCell.m
// xplan-ios
//
// Created by GreenLand on 2022/11/17.
//
#import "XPSessionListHeadFriendCell.h"
#import <Masonry/Masonry.h>
#import "ThemeColor.h"
@interface XPSessionListHeadFriendCell()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UIView *dotView;
@end
@implementation XPSessionListHeadFriendCell
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initView];
[self initContraints];
}
return self;
}
- (void)initView {
[self addSubview:self.imageView];
[self addSubview:self.nameLabel];
[self addSubview:self.dotView];
}
- (void)initContraints {
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerX.mas_equalTo(0);
make.width.height.mas_equalTo(50);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.bottom.mas_equalTo(0);
make.top.mas_equalTo(self.imageView.mas_bottom).mas_offset(8);
make.bottom.mas_equalTo(0);
make.height.mas_equalTo(17);
}];
[self.dotView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.mas_equalTo(self.imageView);
make.width.height.mas_equalTo(8);
}];
}
- (void)setTitle:(NSString *)title {
self.nameLabel.text = title;
}
- (void)setImageName:(NSString *)imageName {
self.imageView.image = [UIImage imageNamed:imageName];
}
- (UILabel *)nameLabel {
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_nameLabel.backgroundColor = [UIColor clearColor];
_nameLabel.font = [UIFont systemFontOfSize:14];
_nameLabel.textColor = ThemeColor.mainTextColor;
}
return _nameLabel;
}
- (UIImageView *)imageView {
if (!_imageView) {
_imageView = [[UIImageView alloc] init];
}
return _imageView;
}
- (UIView *)dotView {
if (!_dotView) {
_dotView = [[UIView alloc] init];
_dotView.layer.cornerRadius = 4;
_dotView.layer.masksToBounds = YES;
}
return _dotView;
}
@end

View File

@@ -0,0 +1,28 @@
//
// XPSessionListHeadItem.h
// xplan-ios
//
// Created by GreenLand on 2022/11/17.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, XPSessionListHeadItemType) {
XPSessionListHeadItemType_Office,//官方公告
XPSessionListHeadItemType_Activity,//活动通知
XPSessionListHeadItemType_Subscribe,//订阅提醒
XPSessionListHeadItemType_MemgXin,//发现萌新
};
@interface XPSessionListHeadItem : NSObject
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *imageName;
@property (nonatomic, assign) BOOL showRedDot;
@property (nonatomic, assign) XPSessionListHeadItemType type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// XPSessionListHeadItem.m
// xplan-ios
//
// Created by GreenLand on 2022/11/17.
//
#import "XPSessionListHeadItem.h"
@implementation XPSessionListHeadItem
@end

View File

@@ -0,0 +1,20 @@
//
// XPSessionListHeadItemView.h
// xplan-ios
//
// Created by GreenLand on 2022/11/17.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPSessionListHeadItemView : UIView
@property (nonatomic, copy) NSString *imageName;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) BOOL showDot;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,87 @@
//
// XPSessionListHeadItemView.m
// xplan-ios
//
// Created by GreenLand on 2022/11/17.
//
#import "XPSessionListHeadItemView.h"
#import <Masonry/Masonry.h>
#import "ThemeColor.h"
@interface XPSessionListHeadItemView()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UIView *dotView;
@end
@implementation XPSessionListHeadItemView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initView];
[self initContraints];
}
return self;
}
- (void)initView {
[self addSubview:self.imageView];
[self addSubview:self.nameLabel];
[self addSubview:self.dotView];
}
- (void)initContraints {
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerX.mas_equalTo(0);
make.width.height.mas_equalTo(50);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.bottom.mas_equalTo(0);
make.top.mas_equalTo(self.imageView.mas_bottom).mas_offset(8);
make.bottom.mas_equalTo(0);
make.height.mas_equalTo(17);
}];
[self.dotView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.mas_equalTo(self.imageView);
make.width.height.mas_equalTo(8);
}];
}
- (void)setTitle:(NSString *)title {
self.nameLabel.text = title;
}
- (void)setImageName:(NSString *)imageName {
self.imageView.image = [UIImage imageNamed:imageName];
}
- (UILabel *)nameLabel {
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_nameLabel.backgroundColor = [UIColor clearColor];
_nameLabel.font = [UIFont systemFontOfSize:14];
_nameLabel.textColor = ThemeColor.mainTextColor;
}
return _nameLabel;
}
- (UIImageView *)imageView {
if (!_imageView) {
_imageView = [[UIImageView alloc] init];
}
return _imageView;
}
- (UIView *)dotView {
if (!_dotView) {
_dotView = [[UIView alloc] init];
_dotView.layer.cornerRadius = 4;
_dotView.layer.masksToBounds = YES;
}
return _dotView;
}
@end

View File

@@ -0,0 +1,20 @@
//
// XPSessionListHeadView.h
// xplan-ios
//
// Created by GreenLand on 2022/11/17.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPSessionListHeadView : UIView
- (void)updateToolViewWithUserLevel:(NSInteger)level;
@property (nonatomic, strong) NSArray *friendsArray;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,249 @@
//
// XPSessionListHeadView.m
// xplan-ios
//
// Created by GreenLand on 2022/11/17.
//
#import "XPSessionListHeadView.h"
#import <Masonry/Masonry.h>
#import "UIImage+Utils.h"
#import "ThemeColor.h"
#import "ClientConfig.h"
#import "UserInfoModel.h"
#import "XPSessionListHeadItem.h"
#import "XPSessionListHeadItemView.h"
#import "XPSessionListHeadFriendCell.h"
@interface XPSessionListHeadView()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, strong) UIStackView *mainStackView;
///
@property (nonatomic, strong) UIStackView *toolStackView;
///
@property (nonatomic, strong) UIView *friendContentView;
///view
@property (nonatomic, strong) UIImageView *partyView;
///~
@property (nonatomic, strong) UIButton *partyButton;
///
@property (nonatomic, strong) UICollectionView *collectionView;
///item
@property (nonatomic, strong) NSMutableArray *funtionArray;
@end
@implementation XPSessionListHeadView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initItemData];
[self initView];
[self initContraints];
}
return self;
}
- (void)initItemData {
XPSessionListHeadItem *officeItem = [[XPSessionListHeadItem alloc] init];
officeItem.title = @"官方公告";
officeItem.imageName = @"session_list_head_office";
officeItem.type = XPSessionListHeadItemType_Office;
XPSessionListHeadItem *activityItem = [[XPSessionListHeadItem alloc] init];
activityItem.title = @"活动通知";
activityItem.imageName = @"session_list_head_activity";
activityItem.type = XPSessionListHeadItemType_Activity;
XPSessionListHeadItem *subscribeItem = [[XPSessionListHeadItem alloc] init];
subscribeItem.title = @"订阅提醒";
subscribeItem.imageName = @"session_list_head_subscribe";
subscribeItem.type = XPSessionListHeadItemType_Subscribe;
[self.funtionArray addObject:officeItem];
[self.funtionArray addObject:activityItem];
[self.funtionArray addObject:subscribeItem];
}
- (void)initView {
[self addSubview:self.mainStackView];
[self.mainStackView addArrangedSubview:self.toolStackView];
[self.mainStackView addArrangedSubview:self.friendContentView];
for (XPSessionListHeadItem *item in self.funtionArray) {
XPSessionListHeadItemView *itemView = [[XPSessionListHeadItemView alloc] init];
itemView.imageName = item.imageName;
itemView.title = item.title;
itemView.showDot = item.showRedDot;
itemView.tag = item.type;
[self.toolStackView addArrangedSubview:itemView];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapItem:)];
[itemView addGestureRecognizer:tap];
}
[self.friendContentView addSubview:self.partyView];
[self.partyView addSubview:self.partyButton];
[self.friendContentView addSubview:self.collectionView];
}
- (void)initContraints {
[self.mainStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.partyView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(26);
make.top.mas_equalTo(12);
make.size.mas_equalTo(CGSizeMake(82, 16));
}];
[self.partyButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(-16);
make.height.mas_equalTo(82);
make.top.mas_equalTo(self.partyView.mas_bottom);
make.bottom.mas_equalTo(0);
}];
}
#pragma mark - UICollectionViewDelegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.friendsArray.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPSessionListHeadFriendCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPSessionListHeadFriendCell class]) forIndexPath:indexPath];
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
}
- (void)updateToolViewWithUserLevel:(NSInteger)level {
if( [ClientConfig shareConfig].configInfo.findNewbieCharmLevel <= level) {
XPSessionListHeadItem *mengxinItem = [[XPSessionListHeadItem alloc] init];
mengxinItem.title = @"发现萌新";
mengxinItem.imageName = @"session_list_head_mengxin";
mengxinItem.type = XPSessionListHeadItemType_MemgXin;
[self.funtionArray addObject:mengxinItem];
XPSessionListHeadItemView *itemView = [[XPSessionListHeadItemView alloc] init];
itemView.imageName = mengxinItem.imageName;
itemView.title = mengxinItem.title;
itemView.showDot = mengxinItem.showRedDot;
itemView.tag = mengxinItem.type;
[self.toolStackView addArrangedSubview:itemView];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapItem:)];
[itemView addGestureRecognizer:tap];
}
}
- (void)tapItem:(UITapGestureRecognizer *)ges {
XPSessionListHeadItemView *view = (XPSessionListHeadItemView *)ges.view;
switch (view.tag) {
case XPSessionListHeadItemType_Office:
{
}
break;
case XPSessionListHeadItemType_Activity:
{
}
break;
case XPSessionListHeadItemType_Subscribe:
{
}
break;
case XPSessionListHeadItemType_MemgXin:
{
}
break;
default:
break;
}
}
- (UIStackView *)mainStackView {
if (!_mainStackView) {
_mainStackView = [[UIStackView alloc] init];
_mainStackView.axis = UILayoutConstraintAxisVertical;
_mainStackView.distribution = UIStackViewDistributionFill;
_mainStackView.alignment = UIStackViewAlignmentFill;
}
return _mainStackView;
}
- (UIStackView *)toolStackView {
if (!_toolStackView) {
_toolStackView = [[UIStackView alloc] init];
_toolStackView.axis = UILayoutConstraintAxisHorizontal;
_toolStackView.distribution = UIStackViewDistributionFillEqually;
_toolStackView.alignment = UIStackViewAlignmentCenter;
}
return _toolStackView;
}
- (NSMutableArray *)funtionArray {
if (!_funtionArray) {
_funtionArray = [NSMutableArray array];
}
return _funtionArray;
}
- (UIView *)friendContentView {
if (!_friendContentView) {
_friendContentView = [[UIView alloc] init];
// _friendContentView.hidden = YES;
}
return _friendContentView;
}
- (UICollectionView *)collectionView {
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.minimumLineSpacing = 0;
layout.minimumInteritemSpacing = 18;
layout.itemSize = CGSizeMake(48, 68);
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[_collectionView registerClass:[XPSessionListHeadFriendCell class] forCellWithReuseIdentifier:NSStringFromClass([XPSessionListHeadFriendCell class])];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.backgroundColor = UIColorRGBAlpha(0x5FCCE4, 0.12);
_collectionView.layer.cornerRadius = 8;
_collectionView.layer.masksToBounds = YES;
}
return _collectionView;
}
- (UIImageView *)partyView {
if (!_partyView) {
_partyView = [[UIImageView alloc] init];
_partyView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x70F2F2), UIColorFromRGB(0x4ECDFF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(82, 16)];
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 82, 16) byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(6, 6)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = path.CGPath;
_partyView.layer.mask = maskLayer;
}
return _partyView;
}
- (UIButton *)partyButton {
if (!_partyButton) {
_partyButton = [[UIButton alloc] init];
[_partyButton setTitle:@"好友派对中~" forState:UIControlStateNormal];
[_partyButton setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
_partyButton.titleLabel.font = [UIFont systemFontOfSize:10];
_partyButton.titleLabel.textColor = [ThemeColor mainTextColor];
}
return _partyButton;
}
@end