Files
peko-ios/YuMi/Modules/YMRoom/View/SendRedPacket/XPRoomSendRedPacketViewController.m
2023-09-01 19:00:59 +08:00

737 lines
28 KiB
Objective-C

//
// YMRoomSendRedPacketViewController.m
// YUMI
//
// Created by YUMI on 2022/8/31.
//
#import "XPRoomSendRedPacketViewController.h"
///tool
#import <YYText/YYText.h>
#import "DJDKMIMOMColor.h"
#import "YUMIMacroUitls.h"
#import "XNDJTDDLoadingTool.h"
#import "TTPopUp.h"
#import "YUMIHtmlUrl.h"
///Third
#import <Masonry/Masonry.h>
#import "UIImage+Utils.h"
///view
#import "XPRoomRedPacketPwdView.h"
#import "XPMinePayPwdViewController.h"
#import "BaseNavigationController.h"
#import "XPMineRechargeViewController.h"
#import "XPRoomHalfWebView.h"
#import "XPWebViewController.h"
///P
#import "XPRoomRedPacketPresenter.h"
#import "XPRoomRedPacketProtocol.h"
///model
#import "WalletInfoModel.h"
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
@interface XPRoomSendRedPacketViewController ()<YYTextViewDelegate, XPRoomRedPacketProtocol, XPRoomRedPacketPwdViewDelegate>
///host代理
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
///上面点击的view
@property (nonatomic,strong) UIView *topTapView;
///下面点击的view
@property (nonatomic,strong) UIView *bottomTapView;
///中间内容的容器
@property (nonatomic,strong) UIImageView *backView;
///厅内红包
@property (nonatomic, strong) UIButton *roomButton;
///全服红包
@property (nonatomic, strong) UIButton *allServerButton;
///选中类型指示器
@property (nonatomic, strong) UIView *typeView;
///红包个数容器
@property (nonatomic, strong) UIView *packetContentView;
///红包数量标题
@property (nonatomic, strong) UILabel *packetTitle;
///红包数量输入框
@property (nonatomic, strong) UITextField *packetTextField;
///红包数量单位
@property (nonatomic, strong) UILabel *packetUnit;
///总钻石数容器
@property (nonatomic, strong) UIView *diamondContentView;
///钻石数量标题
@property (nonatomic, strong) UILabel *diamondTitle;
///钻石数量输入框
@property (nonatomic, strong) UITextField *diamondTextField;
///钻石数量单位
@property (nonatomic, strong) UILabel *diamondUnit;
///红包数量描述
@property (nonatomic,strong) UILabel *countDesc;
///输入框背景
@property (nonatomic, strong) UIView *descContentView;
///广播输入框
@property (nonatomic,strong) UITextView *wishTextView;
///祝福语palceHolder
@property (nonatomic, strong) UILabel *wishPlaceHolderLabel;
///红包数量描述
@property (nonatomic,strong) UILabel *wishCountLabel;
///祝福语描述
@property (nonatomic, strong) UILabel *wishDesc;
///发布按钮
@property (nonatomic, strong) UIButton *releaseButton;
///钻石图标
@property (nonatomic, strong) UIImageView *diamondImage;
///钱包中钻石数量
@property (nonatomic,strong) UILabel *walletDiamondLabel;
///充值按钮
@property (nonatomic, strong) UIButton *rechargeButton;
///规则按钮
@property (nonatomic, strong) UIButton *ruleButton;
///关闭按钮
@property (nonatomic, strong) UIButton *closeButton;
@end
@implementation XPRoomSendRedPacketViewController
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
if (self = [super init]) {
self.hostDelegate = delegate;
}
return self;
}
- (XPRoomRedPacketPresenter *)createPresenter {
return [[XPRoomRedPacketPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor clearColor];
self.navigationController.view.backgroundColor = [UIColor clearColor];
[self.navigationController setNavigationBarHidden:YES];
[self initSubViews];
[self initSubViewConstraints];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onTextViewChange:) name:UITextViewTextDidChangeNotification object:nil];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.presenter getUserWalletInfo];
}
- (BOOL)isHiddenNavBar {
return YES;
}
#pragma mark - Private Method
- (void)initSubViews {
self.view.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.topTapView];
[self.view addSubview:self.backView];
[self.view addSubview:self.bottomTapView];
[self.backView addSubview:self.roomButton];
[self.backView addSubview:self.allServerButton];
[self.backView addSubview:self.typeView];
[self.backView addSubview:self.packetContentView];
[self.packetContentView addSubview:self.packetTitle];
[self.packetContentView addSubview:self.packetTextField];
[self.packetContentView addSubview:self.packetUnit];
[self.backView addSubview:self.diamondContentView];
[self.diamondContentView addSubview:self.diamondTitle];
[self.diamondContentView addSubview:self.diamondTextField];
[self.diamondContentView addSubview:self.diamondUnit];
[self.backView addSubview:self.countDesc];
[self.backView addSubview:self.descContentView];
[self.backView addSubview:self.wishTextView];
[self.backView addSubview:self.wishPlaceHolderLabel];
[self.backView addSubview:self.wishCountLabel];
[self.backView addSubview:self.wishDesc];
[self.backView addSubview:self.releaseButton];
[self.backView addSubview:self.diamondImage];
[self.backView addSubview:self.walletDiamondLabel];
[self.backView addSubview:self.rechargeButton];
[self.backView addSubview:self.ruleButton];
[self.view addSubview:self.closeButton];
}
- (void)initSubViewConstraints {
[self.topTapView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.backView.mas_top);
}];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(310);
make.height.mas_equalTo(450);
make.centerY.centerX.mas_equalTo(self.view);
}];
[self.bottomTapView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.backView.mas_bottom);
make.bottom.mas_equalTo(self.view);
}];
[self.roomButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.backView.mas_centerX).mas_offset(-17);
make.top.mas_equalTo(self.backView).offset(65);
make.height.mas_equalTo(18);
make.width.mas_equalTo(80);
}];
[self.allServerButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.roomButton);
make.height.mas_equalTo(18);
make.width.mas_equalTo(80);
make.left.mas_equalTo(self.backView.mas_centerX).mas_offset(17);
}];
[self.typeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.roomButton);
make.top.mas_equalTo(self.roomButton.mas_bottom).mas_offset(5);
make.width.mas_equalTo(8);
make.height.mas_equalTo(2);
}];
[self.packetContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.roomButton.mas_bottom).mas_offset(32);
make.centerX.mas_equalTo(self.backView);
make.left.mas_equalTo(self.backView).mas_offset(30);
make.height.mas_equalTo(30);
}];
[self.packetTitle mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.packetContentView);
make.left.mas_equalTo(15);
}];
[self.packetTitle setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[self.packetTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.packetContentView);
make.left.mas_equalTo(self.packetTitle.mas_right).mas_offset(4);
make.right.mas_equalTo(self.packetUnit.mas_left).mas_offset(-5);
}];
[self.packetUnit mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.packetContentView);
make.right.mas_equalTo(self.packetContentView).mas_offset(-15);
make.width.mas_equalTo(12);
}];
[self.diamondContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.packetContentView.mas_bottom).mas_offset(20);
make.centerX.mas_equalTo(self.backView);
make.left.mas_equalTo(self.packetContentView);
make.height.mas_equalTo(30);
}];
[self.diamondTitle mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.diamondContentView);
make.left.mas_equalTo(15);
}];
[self.diamondTitle setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[self.diamondTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.diamondContentView);
make.left.mas_equalTo(self.diamondTitle.mas_right).mas_offset(4);
make.right.mas_equalTo(self.diamondUnit.mas_left).mas_offset(-5);
}];
[self.diamondUnit mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerY.mas_equalTo(self.diamondContentView);
make.right.mas_equalTo(self.diamondContentView).mas_offset(-12);
make.width.mas_equalTo(26);
}];
[self.countDesc mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backView);
make.top.mas_equalTo(self.diamondContentView.mas_bottom).mas_offset(5);
make.height.mas_equalTo(11);
}];
[self.descContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView).inset(40);
make.top.mas_equalTo(self.countDesc.mas_bottom).mas_offset(27);
make.height.mas_equalTo(70);
}];
[self.wishTextView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView).inset(60);
make.centerY.mas_equalTo(self.descContentView);
make.height.mas_equalTo(17);
}];
[self.wishPlaceHolderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.mas_equalTo(self.descContentView);
}];
[self.wishCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.mas_equalTo(self.descContentView).inset(5);
make.height.mas_equalTo(10);
}];
[self.wishDesc mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backView);
make.top.mas_equalTo(self.descContentView.mas_bottom).mas_offset(7);
make.height.mas_equalTo(10);
}];
[self.releaseButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.wishDesc.mas_bottom).mas_offset(28);
make.centerX.mas_equalTo(self.backView);
make.width.mas_equalTo(150);
make.height.mas_equalTo(34);
}];
[self.diamondImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.releaseButton.mas_bottom).mas_offset(16);
make.left.mas_equalTo(self.backView).mas_offset(42);;
make.width.height.mas_equalTo(20);
}];
[self.walletDiamondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.diamondImage.mas_right).mas_offset(5);
make.centerY.mas_equalTo(self.diamondImage);
}];
[self.rechargeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.backView).mas_offset(-42);
make.centerY.mas_equalTo(self.diamondImage);
}];
[self.ruleButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.backView).mas_offset(-23);
make.top.mas_equalTo(13);
make.width.height.mas_equalTo(30);
}];
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.backView.mas_bottom).mas_offset(20);
make.width.height.mas_equalTo(35);
}];
}
- (void)onReleaseButtonClick:(UIButton *)button {
//判断红包数量
NSInteger packetCount = [self.packetTextField.text integerValue];
if (packetCount > 100 || packetCount < 1) {
[self showErrorToast:YMLocalizedString(@"XPRoomSendRedPacketViewController17")];
return;
}
//判断钻石数量
NSInteger diamonCount = [self.diamondTextField.text integerValue];
if (diamonCount > 999999 || diamonCount < 100) {
[self showErrorToast:YMLocalizedString(@"XPRoomSendRedPacketViewController18")];
return;
}
if (diamonCount % 10 != 0) {
[self showErrorToast:YMLocalizedString(@"XPRoomSendRedPacketViewController19")];
return;
}
[self.presenter getUserModel];
}
#pragma mark - XPRoomRedPacketProtocol
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:YES];
}
///获取用户钱包信息成功
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
self.walletDiamondLabel.text = balanceInfo.diamonds;
}
///获取用户信息成功
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
if (userInfo.isBindPaymentPwd) {
XPRoomRedPacketPwdView *pwdView = [[XPRoomRedPacketPwdView alloc] init];
pwdView.diamonCount = self.diamondTextField.text;
pwdView.delegate = self;
[TTPopup popupView:pwdView style:TTPopupStyleAlert];
} else {
XPMinePayPwdViewController *vc = [[XPMinePayPwdViewController alloc] init];
vc.userInfo = userInfo;
[self.navigationController pushViewController:vc animated:YES];
}
}
///发送红包成功
- (void)sendRedPacketSuccess {
[self showSuccessToast:YMLocalizedString(@"XPRoomSendRedPacketViewController3")];
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - XPRoomRedPacketPwdViewDelegate
- (void)xPRoomRedPacketPwdViewPwdComplete:(NSString *)pwd {
[TTPopup dismiss];
NSString *roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
NSNumber *type = self.roomButton.isSelected ? @(1) : @(2);
NSString *message = self.wishTextView.text.length ? self.wishTextView.text :YMLocalizedString(@"XPRoomSendRedPacketViewController4");
[self.presenter sendRedPacketWithNum:self.packetTextField.text goldNum:self.diamondTextField.text roomUid:roomUid type:type password:pwd message:message];
}
- (void)xPRoomRedPacketPwdViewPwdForgetBtnClick {
XPMinePayPwdViewController *vc = [[XPMinePayPwdViewController alloc] init];
vc.userInfo = self.hostDelegate.getUserInfo;
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - Event Response
- (void)dismissTapRecognizer:(UITapGestureRecognizer *)tap {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - private
- (void)onRoomButtonClick:(UIButton *)sender {
self.roomButton.selected = YES;
self.allServerButton.selected = NO;
[self.typeView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.roomButton);
make.top.mas_equalTo(self.roomButton.mas_bottom).mas_offset(4);
make.width.mas_equalTo(8);
make.height.mas_equalTo(2);
}];
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"1-100" attributes:@{NSForegroundColorAttributeName: UIColorRGBAlpha(0xffffff, 0.3)}];
self.packetTextField.attributedPlaceholder = attrString;
self.countDesc.text = YMLocalizedString(@"XPRoomSendRedPacketViewController5");
}
- (void)onAllServerButtonClick:(UIButton *)sender {
self.allServerButton.selected = YES;
self.roomButton.selected = NO;
[self.typeView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.allServerButton);
make.top.mas_equalTo(self.roomButton.mas_bottom).mas_offset(4);
make.width.mas_equalTo(8);
make.height.mas_equalTo(2);
}];
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"2-500" attributes:@{NSForegroundColorAttributeName: UIColorRGBAlpha(0xffffff, 0.3)}];
self.packetTextField.attributedPlaceholder = attrString;
self.countDesc.text = YMLocalizedString(@"XPRoomSendRedPacketViewController6");
}
- (void)onRechargeButtonClick:(UIButton *)sender {
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
webVC.isPush = YES;
[self.navigationController pushViewController:webVC animated:YES];
}
- (void)onRuleButtonClick:(UIButton *)sender {
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = URLWithType(kRedPacketRuleURL);
TTPopupService * config = [[TTPopupService alloc] init];
config.contentView = webView;
[TTPopup popupWithConfig:config];
}
- (void)onCloseButtonClick:(UIButton *)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - YYTextViewDelegate
- (void)textViewDidChange:(YYTextView *)textView {
NSInteger maxLength = 20;
if (textView.text.length > maxLength) {
textView.text = [textView.text substringToIndex:maxLength];
}
self.wishCountLabel.text = [NSString stringWithFormat:@"%zd/%ld", textView.text.length, maxLength];
}
- (void)onTextViewChange:(NSNotification *)noti {
NSInteger maxLength = 20;
if (self.wishTextView.text.length > maxLength) {
self.wishTextView.text = [self.wishTextView.text substringToIndex:maxLength];
}
if (self.wishTextView.text.length > 0) {
self.wishPlaceHolderLabel.hidden = YES;
[self.wishTextView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView).inset(60);
make.centerY.mas_equalTo(self.descContentView);
make.height.mas_equalTo(42);
}];
} else {
self.wishPlaceHolderLabel.hidden = NO;
[self.wishTextView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView).inset(60);
make.centerY.mas_equalTo(self.descContentView);
make.height.mas_equalTo(17);
}];
}
self.wishCountLabel.text = [NSString stringWithFormat:@"%zd/%ld", self.wishTextView.text.length, maxLength];
}
#pragma mark - Getters And Setters
- (UIView *)topTapView {
if (!_topTapView) {
_topTapView = [[UIView alloc] init];
_topTapView.backgroundColor = [UIColor clearColor];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissTapRecognizer:)];
[_topTapView addGestureRecognizer:tap];
}
return _topTapView;
}
- (UIView *)bottomTapView {
if (!_bottomTapView) {
_bottomTapView = [[UIView alloc] init];
_bottomTapView.backgroundColor = [UIColor clearColor];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissTapRecognizer:)];
[_bottomTapView addGestureRecognizer:tap];
}
return _bottomTapView;
}
- (UIImageView *)backView {
if (!_backView) {
_backView = [[UIImageView alloc] init];
_backView.userInteractionEnabled = YES;
_backView.image = [UIImage imageNamed:@"send_redpacket_bg"];
}
return _backView;
}
- (UIButton *)roomButton {
if (!_roomButton) {
_roomButton = [[UIButton alloc] init];
[_roomButton setTitle:YMLocalizedString(@"XPRoomSendRedPacketViewController7") forState:UIControlStateNormal];
[_roomButton setTitleColor:UIColorRGBAlpha(0xffffff, 0.5) forState:UIControlStateNormal];
[_roomButton setTitleColor:UIColorRGBAlpha(0xffffff, 1) forState:UIControlStateSelected];
[_roomButton addTarget:self action:@selector(onRoomButtonClick:) forControlEvents:UIControlEventTouchUpInside];
_roomButton.selected = YES;
_roomButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
}
return _roomButton;
}
- (UIButton *)allServerButton {
if (!_allServerButton) {
_allServerButton = [[UIButton alloc] init];
[_allServerButton setTitle:YMLocalizedString(@"XPRoomSendRedPacketViewController8") forState:UIControlStateNormal];
[_allServerButton setTitleColor:UIColorRGBAlpha(0xffffff, 0.5) forState:UIControlStateNormal];
[_allServerButton setTitleColor:UIColorRGBAlpha(0xffffff, 1) forState:UIControlStateSelected];
[_allServerButton addTarget:self action:@selector(onAllServerButtonClick:) forControlEvents:UIControlEventTouchUpInside];
_allServerButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
}
return _allServerButton;
}
- (UIView *)typeView {
if (!_typeView) {
_typeView = [[UIView alloc] init];
_typeView.backgroundColor = [UIColor whiteColor];
_typeView.layer.cornerRadius = 1;
_typeView.layer.masksToBounds = YES;
}
return _typeView;
}
- (UIView *)packetContentView {
if (!_packetContentView) {
_packetContentView = [[UIView alloc] init];
_packetContentView.backgroundColor = UIColorFromRGB(0xCC2247);
_packetContentView.layer.cornerRadius = 15;
_packetContentView.layer.masksToBounds = YES;
}
return _packetContentView;
}
- (UILabel *)packetTitle {
if (!_packetTitle) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomSendRedPacketViewController9");
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_packetTitle = label;
}
return _packetTitle;
}
- (UITextField *)packetTextField {
if (!_packetTextField) {
UITextField *label = [[UITextField alloc] init];
label.keyboardType = UIKeyboardTypeNumberPad;
label.textAlignment = NSTextAlignmentRight;
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"1-100" attributes:@{NSForegroundColorAttributeName: UIColorRGBAlpha(0xffffff, 0.5)}];
label.attributedPlaceholder = attrString;
label.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
_packetTextField = label;
}
return _packetTextField;
}
- (UILabel *)packetUnit {
if (!_packetUnit) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomSendRedPacketViewController10");
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_packetUnit = label;
}
return _packetUnit;
}
- (UIView *)diamondContentView {
if (!_diamondContentView) {
_diamondContentView = [[UIView alloc] init];
_diamondContentView.backgroundColor = UIColorFromRGB(0xCC2247);
_diamondContentView.layer.cornerRadius = 15;
_diamondContentView.layer.masksToBounds = YES;
}
return _diamondContentView;
}
- (UILabel *)diamondTitle {
if (!_diamondTitle) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomSendRedPacketViewController11");
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_diamondTitle = label;
}
return _diamondTitle;
}
- (UITextField *)diamondTextField {
if (!_diamondTextField) {
UITextField *label = [[UITextField alloc] init];
label.keyboardType = UIKeyboardTypeNumberPad;
label.textAlignment = NSTextAlignmentRight;
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"0" attributes:@{NSForegroundColorAttributeName: UIColorRGBAlpha(0xffffff, 0.5)}];
label.attributedPlaceholder = attrString;
label.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
_diamondTextField = label;
}
return _diamondTextField;
}
- (UILabel *)diamondUnit {
if (!_diamondUnit) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomSendRedPacketViewController12");
label.font = [UIFont systemFontOfSize:12];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_diamondUnit = label;
}
return _diamondUnit;
}
- (UILabel *)countDesc {
if (!_countDesc) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomSendRedPacketViewController13");
label.font = [UIFont systemFontOfSize:11];
label.textColor = [UIColor whiteColor];
_countDesc = label;
}
return _countDesc;
}
- (UIView *)descContentView {
if (!_descContentView) {
_descContentView = [[UIView alloc] init];
_descContentView.backgroundColor = UIColorRGBAlpha(0xCC2247, 0.6);
_descContentView.layer.cornerRadius = 8;
_descContentView.layer.masksToBounds = YES;
}
return _descContentView;
}
- (UITextView *)wishTextView {
if (!_wishTextView) {
_wishTextView = [[UITextView alloc] init];
_wishTextView.layer.cornerRadius = 8;
_wishTextView.layer.masksToBounds = YES;
_wishTextView.backgroundColor = [UIColor clearColor];
_wishTextView.showsVerticalScrollIndicator = NO;
_wishTextView.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_wishTextView.textColor = [UIColor whiteColor];
_wishTextView.textAlignment = NSTextAlignmentCenter;
}
return _wishTextView;
}
- (UIButton *)releaseButton {
if (!_releaseButton) {
_releaseButton = [[UIButton alloc] init];
[_releaseButton setTitleColor:[DJDKMIMOMColor confirmButtonTextColor] forState:UIControlStateNormal];
[_releaseButton setBackgroundImage:[UIImage imageNamed:@"send_redPacket_button"] forState:UIControlStateNormal];
[_releaseButton addTarget:self action:@selector(onReleaseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _releaseButton;
}
- (UILabel *)wishDesc {
if (!_wishDesc) {
_wishDesc = [[UILabel alloc] init];
_wishDesc.text = YMLocalizedString(@"XPRoomSendRedPacketViewController14");
_wishDesc.font = [UIFont systemFontOfSize:10];
_wishDesc.textColor = UIColorRGBAlpha(0xffffff, 0.5);
}
return _wishDesc;
}
- (UILabel *)wishCountLabel {
if (!_wishCountLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = @"0/20";
label.font = [UIFont systemFontOfSize:10];
label.textColor = UIColorFromRGB(0xFF8C9D);
_wishCountLabel = label;
}
return _wishCountLabel;
}
- (UIImageView *)diamondImage {
if (!_diamondImage) {
_diamondImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"common_diamond"]];
}
return _diamondImage;
}
- (UILabel *)walletDiamondLabel {
if (!_walletDiamondLabel) {
_walletDiamondLabel = [[UILabel alloc] init];
_walletDiamondLabel.textColor = [UIColor whiteColor];
_walletDiamondLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
}
return _walletDiamondLabel;
}
- (UILabel *)wishPlaceHolderLabel {
if (!_wishPlaceHolderLabel) {
UILabel *label = [[UILabel alloc] init];
label.text = YMLocalizedString(@"XPRoomSendRedPacketViewController4");
label.font = [UIFont systemFontOfSize:16];
label.textColor = UIColorRGBAlpha(0xffffff, 0.5);
_wishPlaceHolderLabel = label;
}
return _wishPlaceHolderLabel;
}
- (UIButton *)rechargeButton {
if (!_rechargeButton) {
_rechargeButton = [[UIButton alloc] init];
[_rechargeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_rechargeButton addTarget:self action:@selector(onRechargeButtonClick:) forControlEvents:UIControlEventTouchUpInside];
NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPRoomSendRedPacketViewController16")];
NSRange titleRange = {0,[title length]};
[title addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:titleRange];
[_rechargeButton setAttributedTitle:title forState:UIControlStateNormal];
_rechargeButton.titleLabel.font = [UIFont systemFontOfSize:13];
}
return _rechargeButton;
}
- (UIButton *)ruleButton {
if (!_ruleButton) {
_ruleButton = [[UIButton alloc] init];
[_ruleButton addTarget:self action:@selector(onRuleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[_ruleButton setImage:[UIImage imageNamed:@"send_redPacket_help"] forState:UIControlStateNormal];
}
return _ruleButton;
}
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [[UIButton alloc] init];
[_closeButton addTarget:self action:@selector(onCloseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[_closeButton setImage:[UIImage imageNamed:@"common_close_white"] forState:UIControlStateNormal];
}
return _closeButton;
}
@end