CCIntro.m 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // CCIntro.m
  3. // Crypto Cloud Technology Nextcloud
  4. //
  5. // Created by Marino Faggiana on 05/11/15.
  6. // Copyright (c) 2014 TWS. All rights reserved.
  7. //
  8. // Author Marino Faggiana <m.faggiana@twsweb.it>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. #import "CCIntro.h"
  24. @interface CCIntro ()
  25. {
  26. int titlePositionY;
  27. int descPositionY;
  28. int titleIconPositionY;
  29. }
  30. @end
  31. @implementation CCIntro
  32. - (id)initWithDelegate:(id <CCIntroDelegate>)delegate delegateView:(UIView *)delegateView
  33. {
  34. self = [super init];
  35. if (self) {
  36. self.delegate = delegate;
  37. self.rootView = delegateView;
  38. }
  39. return self;
  40. }
  41. - (void)introDidFinish:(EAIntroView *)introView wasSkipped:(BOOL)wasSkipped
  42. {
  43. if (self.delegate && [self.delegate respondsToSelector:@selector(introDidFinish:wasSkipped:)])
  44. [self.delegate introDidFinish:introView wasSkipped:wasSkipped];
  45. }
  46. - (void)showIntroCryptoCloud:(CGFloat)duration
  47. {
  48. CGFloat height = self.rootView.bounds.size.height;
  49. if (height <= 480) { titleIconPositionY = 20; titlePositionY = 260; descPositionY = 230; }
  50. if (height >= 500 && height <= 800) { titleIconPositionY = 50; titlePositionY = height / 2; descPositionY = height / 2 - 40 ; }
  51. if (height >= 1024) { titleIconPositionY = 100; titlePositionY = 290; descPositionY = 250; }
  52. EAIntroPage *page1 = [EAIntroPage page];
  53. page1.title = [CCUtility localizableBrand:@"_intro_1_title_" table:@"Intro"];
  54. page1.titlePositionY = titlePositionY;
  55. page1.titleColor = COLOR_TEXT_ANTHRACITE;
  56. page1.titleFont = [UIFont systemFontOfSize:20];
  57. page1.desc = [CCUtility localizableBrand:@"_intro_1_text_" table:@"Intro"];
  58. page1.descPositionY = descPositionY;
  59. page1.descColor = COLOR_TEXT_ANTHRACITE;
  60. page1.descFont = [UIFont systemFontOfSize:14];
  61. page1.titleIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"intro1"]];
  62. page1.bgImage = [UIImage imageNamed:@"bgbianco"];
  63. page1.titleIconPositionY = titleIconPositionY;
  64. page1.showTitleView = NO;
  65. EAIntroPage *page2 = [EAIntroPage page];
  66. page2.title = [CCUtility localizableBrand:@"_intro_2_title_" table:@"Intro"];
  67. page2.titlePositionY = titlePositionY;
  68. page2.titleColor = COLOR_TEXT_ANTHRACITE;
  69. page2.titleFont = [UIFont systemFontOfSize:20];
  70. page2.desc = [CCUtility localizableBrand:@"_intro_2_text_" table:@"Intro"];
  71. page2.descPositionY = descPositionY;
  72. page2.descColor = COLOR_TEXT_ANTHRACITE;
  73. page2.descFont = [UIFont systemFontOfSize:14];
  74. page2.titleIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"intro2"]];
  75. page2.bgImage = [UIImage imageNamed:@"bgbianco"];
  76. page2.titleIconPositionY = titleIconPositionY;
  77. page2.showTitleView = NO;
  78. EAIntroPage *page3 = [EAIntroPage page];
  79. page3.title = [CCUtility localizableBrand:@"_intro_3_title_" table:@"Intro"];
  80. page3.titlePositionY = titlePositionY;
  81. page3.titleColor = COLOR_TEXT_ANTHRACITE;
  82. page3.titleFont = [UIFont systemFontOfSize:20];
  83. page3.desc = [CCUtility localizableBrand:@"_intro_3_text_" table:@"Intro"];
  84. page3.descPositionY = descPositionY;
  85. page3.descColor = COLOR_TEXT_ANTHRACITE;
  86. page3.descFont = [UIFont systemFontOfSize:14];
  87. page3.titleIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"intro3"]];
  88. page3.bgImage = [UIImage imageNamed:@"bgbianco"];
  89. page3.titleIconPositionY = titleIconPositionY;
  90. page3.showTitleView = NO;
  91. EAIntroPage *page4 = [EAIntroPage page];
  92. page4.title = [CCUtility localizableBrand:@"_intro_4_title_" table:@"Intro"];
  93. page4.titlePositionY = titlePositionY;
  94. page4.titleColor = COLOR_TEXT_ANTHRACITE;
  95. page4.titleFont = [UIFont systemFontOfSize:20];
  96. page4.desc = [CCUtility localizableBrand:@"_intro_4_text_" table:@"Intro"];
  97. page4.descPositionY = descPositionY;
  98. page4.descColor = COLOR_TEXT_ANTHRACITE;
  99. page4.descFont = [UIFont systemFontOfSize:14];
  100. page4.titleIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"intro4"]];
  101. page4.bgImage = [UIImage imageNamed:@"bgbianco"];
  102. page4.titleIconPositionY = titleIconPositionY;
  103. page4.showTitleView = NO;
  104. EAIntroView *intro = [[EAIntroView alloc] initWithFrame:self.rootView.bounds andPages:@[page1, page2, page3, page4]];
  105. //intro.backgroundColor = [UIColor whiteColor];
  106. intro.tapToNext = YES;
  107. intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
  108. intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
  109. intro.pageControl.backgroundColor = [UIColor clearColor];
  110. [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  111. [intro setDelegate:self];
  112. [intro showInView:self.rootView animateDuration:duration];
  113. }
  114. @end