iOSthemem0d

ViewCard

Feb 7th, 2020
171
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <Cephei/HBPreferences.h>
  2. #import <UIKit/UIKit.h>
  3.  
  4.  
  5. static BOOL enableHideLabel; // Enable/Disable Hide Label
  6.  
  7. //Cool Button
  8. @interface coolButton : UIButton
  9. @property (nonatomic, assign) CGFloat highlightAlpha;
  10. @end
  11.  
  12. @implementation coolButton
  13. - (void)setHighlighted:(BOOL)highlighted {
  14.   [super setHighlighted:highlighted];
  15.  
  16.   if (highlighted) {
  17.     self.alpha = 0.8;
  18.   }
  19.   else {
  20.     self.alpha = 1.0;
  21.   }
  22. }
  23. @end
  24.  
  25.  
  26. @interface UIStatusBarWindow : UIWindow
  27. @property (nonatomic, retain) UIView *blurView;
  28. @property (nonatomic, retain) UIView *overlayView;
  29. @property (nonatomic, retain) UISwitch *labelSwitch;
  30. @end
  31.  
  32.  
  33.  
  34. %hook UIStatusBarWindow
  35.  
  36. %property (nonatomic, retain) UIView *blurView;
  37. %property (nonatomic, retain) UIView *overlayView;
  38. %property (nonatomic, retain) UISwitch *labelSwitch;
  39.  
  40. -(instancetype)initWithFrame:(CGRect)frame {
  41.   self = %orig;
  42.   [self addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(showMenu)]];
  43.   return self;
  44. }
  45.  
  46.  
  47. %new
  48. -(void)showMenu
  49. {
  50.   if (self.overlayView)
  51.   [self performSelector:@selector(cancelPressed)];
  52.  
  53.   CGRect screen = UIScreen.mainScreen.bounds;
  54.   UIView *view = UIApplication.sharedApplication.keyWindow;
  55.  
  56.   self.blurView = [[UIView alloc] initWithFrame:screen];
  57.   self.blurView.backgroundColor = UIColor.whiteColor;
  58.   self.blurView.alpha = 0.4f;
  59.   [view addSubview:self.blurView];
  60.  
  61.   self.overlayView = [[UIView alloc] initWithFrame:CGRectMake(0, screen.size.height / 2, screen.size.width, screen.size.height * 2 / 4)];
  62.   self.overlayView.backgroundColor = UIColor.whiteColor;
  63.   self.overlayView.layer.cornerRadius = 25;
  64.   [view addSubview:self.overlayView];
  65.  
  66.  
  67.   //Bold Title at the Top
  68.   UILabel *bigTitle = [[UILabel alloc] initWithFrame:CGRectMake(screen.size.width*0.1, 5, screen.size.width*0.8, 100)];
  69.   bigTitle.text = @"Enable/Disable Icon Labels";
  70.   bigTitle.textAlignment = NSTextAlignmentCenter;
  71.   bigTitle.font = [UIFont systemFontOfSize:20];
  72.   bigTitle.textColor = [UIColor blackColor];
  73.   bigTitle.lineBreakMode = NSLineBreakByWordWrapping;
  74.   bigTitle.numberOfLines = 0;
  75.   [self.overlayView addSubview:bigTitle];
  76.  
  77.  
  78.   // Cancel button
  79.   coolButton *cancelButton = [[coolButton alloc] initWithFrame:CGRectMake(0, 0, 150, 50)];
  80.   [cancelButton setTitle:@"Cancel" forState:UIControlStateNormal];
  81.   [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  82.   cancelButton.titleLabel.textAlignment = NSTextAlignmentCenter;
  83.   cancelButton.center = CGPointMake(screen.size.width / 2 - 80, screen.size.height/ 2 - 60);
  84.   cancelButton.titleLabel.textColor = [UIColor whiteColor];
  85.   cancelButton.titleLabel.font = [UIFont systemFontOfSize:18];
  86.   [cancelButton addTarget:self action:@selector(cancelPressed) forControlEvents:UIControlEventTouchUpInside];
  87.   cancelButton.highlightAlpha = 0.5;
  88.   [self.overlayView addSubview:cancelButton];
  89.  
  90.   //Gradient for cancelButton
  91.   CAGradientLayer *gradientCancel = [CAGradientLayer layer];
  92.   gradientCancel.frame = cancelButton.bounds;
  93.   gradientCancel.colors = [NSArray arrayWithObjects:(id)([UIColor colorWithRed:0.337 green:0.596 blue:1.000 alpha:1.000].CGColor),(id)([UIColor colorWithRed:0.757 green:0.459 blue:1.000 alpha:1.000].CGColor),(id)([UIColor colorWithRed:0.310 green:0.835 blue:1.000 alpha:1.000].CGColor),nil];
  94.   gradientCancel.startPoint = CGPointMake(0.2,0.0);
  95.   gradientCancel.endPoint = CGPointMake(0.9,1.0);
  96.   [cancelButton.layer insertSublayer:gradientCancel atIndex:0];
  97.   gradientCancel.cornerRadius = 20;
  98.  
  99.  
  100.   UISwitch *labelSwitch = [[UISwitch alloc] initWithFrame: CGRectZero];
  101.   [labelSwitch addTarget:self action:@selector(setBool:) forControlEvents:UIControlEventValueChanged];
  102.   labelSwitch.center = CGPointMake(screen.size.width / 2 + 80, screen.size.height/ 2 - 60);
  103.   [labelSwitch setTintColor:[UIColor redColor]];
  104.   [labelSwitch setOnTintColor:[UIColor greenColor]];
  105.   [self.overlayView addSubview:labelSwitch];
  106. }
  107.  
  108. %new
  109. -(void)cancelPressed
  110. {
  111.   [self.overlayView removeFromSuperview];
  112.   [self.blurView removeFromSuperview];
  113. }
  114.  
  115. %new
  116. - (void)setBool:(BOOL)value forKey:(NSString *)enableHideLabel {
  117.  
  118. }
  119. %end
  120.  
  121.  
  122.  
  123. %hook SBIconLegibilityLabelView
  124.  
  125. -(void)setHidden:(BOOL)arg1 {
  126.   if (enableHideLabel) %orig(YES);
  127.   else %orig;
  128. }
  129.  
  130. %end
  131.  
  132. // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  133. //
  134. //  Preferences
  135. //
  136. // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  137.  
  138. %ctor {
  139.  
  140.   HBPreferences *preferences = [[HBPreferences alloc] initWithIdentifier:@"com.iOSthemem0d.ViewCardPrefs"];
  141.  
  142.     [preferences registerBool:&enableHideLabel default:NO forKey:@"enableHideLabel"];
  143.  
  144. }
RAW Paste Data