Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
před 5 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. #define kScreenWidth [[UIScreen mainScreen] bounds].size.width
  2. @interface SBTodayTableHeaderView : UIView
  3. -(NSString *)lunarDateHeaderString;
  4. @end
  5. @interface SBAnimationSettings
  6. @end
  7. @interface SBFadeAnimationSettings
  8. @property(retain, nonatomic) SBAnimationSettings *dateInSettings;
  9. @end
  10. @interface SBFLockScreenDateView : UIView
  11. @property (nonatomic, assign) UILabel *duplexCalendarLabel;
  12. @property (nonatomic, assign) NSString *todayHeaderViewText;
  13. @property bool dateHidden;
  14. -(id)_dateFont;
  15. -(id)_dateColor;
  16. -(BOOL)isDateHidden;
  17. -(void)layoutDuplexCalendarLabel;
  18. @end
  19. @interface _UILegibilityView : UIView
  20. @end
  21. @interface _UILegibilityLabel : _UILegibilityView
  22. @end
  23. extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void);
  24. static NSString *myObserver=@"duplexcalendarObserver";
  25. static NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7.duplexcalendarprefs.plist";
  26. static NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
  27. static void savePressed(){
  28. prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
  29. }
  30. static void savePressed(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo){
  31. prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
  32. }
  33. static SBTodayTableHeaderView *stattodayHeaderView;
  34. static float originx = 0.0;
  35. static float originy = 0.0;
  36. static float sizewidth = 0.0;
  37. static float sizeheight = 0.0;
  38. %hook SBTodayTableHeaderView
  39. -(SBTodayTableHeaderView *)initWithFrame:(CGRect)arg1{
  40. stattodayHeaderView = %orig();
  41. return stattodayHeaderView;
  42. }
  43. %end
  44. %hook SBFLockScreenDateView
  45. %property (nonatomic, assign) UILabel *duplexCalendarLabel;
  46. %property (nonatomic, assign) NSString *todayHeaderViewText;
  47. -(SBFLockScreenDateView *)initWithFrame:(id)arg1{
  48. SBFLockScreenDateView *origself = %orig(arg1);
  49. if(!self.duplexCalendarLabel){
  50. self.duplexCalendarLabel = [[UILabel alloc] initWithFrame:CGRectMake(originx-50, originy + 19, sizewidth+100, sizeheight)];
  51. self.duplexCalendarLabel.font = [[self _dateFont] fontWithSize:16];
  52. [self addSubview:self.duplexCalendarLabel];
  53. self.duplexCalendarLabel.textColor = [self _dateColor];
  54. self.duplexCalendarLabel.textAlignment = 1;
  55. }
  56. return origself;
  57. }
  58. %new
  59. -(void)layoutDuplexCalendarLabel{
  60. NSString *offsetXTextField = [prefs objectForKey:@"offsetXTextField"];
  61. NSString *offsetYTextField = [prefs objectForKey:@"offsetYTextField"];
  62. NSString *FontSizeTextField = [prefs objectForKey:@"FontSizeTextField"];
  63. //if(originx <= 0.0)
  64. //{
  65. UILabel *originalLabel = MSHookIvar<UILabel *>(self, "_dateLabel");
  66. originx = originalLabel.frame.origin.x;
  67. originy = originalLabel.frame.origin.y;
  68. sizewidth = originalLabel.frame.size.width;
  69. sizeheight = originalLabel.frame.size.height;
  70. //}
  71. [self.duplexCalendarLabel setFrame:CGRectMake(originx-50+ [offsetXTextField floatValue], originy + 19 + [offsetYTextField floatValue], sizewidth+100, sizeheight)];
  72. UIFont *font = self.duplexCalendarLabel.font;
  73. if([FontSizeTextField floatValue] == 0){
  74. self.duplexCalendarLabel.font = [font fontWithSize:16.0];
  75. }else{
  76. self.duplexCalendarLabel.font = [font fontWithSize:[FontSizeTextField floatValue]];
  77. }
  78. if(self.duplexCalendarLabel){
  79. if([self isDateHidden]){
  80. self.duplexCalendarLabel.hidden = true;
  81. }else{
  82. self.duplexCalendarLabel.hidden = false;
  83. }
  84. }
  85. }
  86. -(void)_updateLabels{
  87. %orig;
  88. [self layoutDuplexCalendarLabel];
  89. //if(!self.todayHeaderViewText){
  90. self.todayHeaderViewText = [stattodayHeaderView lunarDateHeaderString];
  91. //}
  92. self.duplexCalendarLabel.text = self.todayHeaderViewText;
  93. }
  94. -(void)_layoutDateLabel {
  95. %orig;
  96. [self layoutDuplexCalendarLabel];
  97. _UILegibilityLabel *originalLegibilityLabel = MSHookIvar<_UILegibilityLabel *>(self, "_legibilityDateLabel");
  98. [originalLegibilityLabel setFrame:CGRectMake(originx, originy - 3, sizewidth, sizeheight)];
  99. }
  100. -(void)updateFormat{
  101. %orig;
  102. [self layoutDuplexCalendarLabel];
  103. }
  104. -(void)layoutSubviews {
  105. %orig;
  106. [self layoutDuplexCalendarLabel];
  107. }
  108. -(void)setDateHidden:(bool)arg1{
  109. %orig(arg1);
  110. if(self.duplexCalendarLabel){
  111. self.duplexCalendarLabel.hidden = arg1;
  112. }
  113. }
  114. %end
  115. %hook SBFadeAnimationSettings
  116. - (void)setDefaultValues {
  117. %orig;
  118. self.dateInSettings = nil;
  119. }
  120. %end
  121. %ctor{
  122. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
  123. (void*)myObserver,
  124. savePressed,
  125. CFSTR("duplexcalendar.savepressed"),
  126. NULL,
  127. CFNotificationSuspensionBehaviorDeliverImmediately);
  128. savePressed();
  129. }