]> git.saurik.com Git - cydget.git/commitdiff
Use separate layers to correct for notifications.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Jan 2014 17:53:52 +0000 (09:53 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Jan 2014 17:53:52 +0000 (09:53 -0800)
LockScreen.mm
PhotoExamplePlus.cydget/background.html
PhotoExamplePlus.cydget/foreground.html

index 90da329a140886b396f75db98346e65f3a6d8714..750ff7ac74deb7ece4b0e1a32d1a30de655e5dd7 100644 (file)
@@ -127,7 +127,12 @@ typedef uint16_t UChar;
 - (void) _setZoomScale:(float)scale duration:(double)duration;
 @end
 
+@interface SBLockScreenView : UIView
+- (BOOL) mediaControlsHidden;
+@end
+
 @interface SBLockScreenViewController : UIViewController
+- (SBLockScreenView *) lockScreenView;
 - (BOOL) isShowingMediaControls;
 - (void) _setMediaControlsVisible:(BOOL)visible;
 @end
@@ -485,6 +490,7 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) {
 @interface WebCycriptLockScreenController : SBAwayViewPluginController {
     NSDictionary *configuration_;
     WebCydgetLockScreenView *background_;
+    WebCydgetLockScreenView *foreground_;
 }
 
 @end
@@ -1152,9 +1158,10 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     if (NSString *background = [configuration_ objectForKey:@"Background"])
         background_ = [[WebCydgetLockScreenView alloc] initWithURL:[NSURL URLWithString:background relativeToURL:base]];
 
-    if (NSString *homepage = [configuration_ objectForKey:@"Homepage"])
-        [self setView:[[[WebCydgetLockScreenView alloc] initWithURL:[NSURL URLWithString:homepage relativeToURL:base]] autorelease]];
-    else if (kCFCoreFoundationVersionNumber < 800 && background_ != nil) {
+    if (NSString *homepage = [configuration_ objectForKey:@"Homepage"]) {
+        foreground_ = [[WebCydgetLockScreenView alloc] initWithURL:[NSURL URLWithString:homepage relativeToURL:base]];
+        [self setView:foreground_];
+    } else if (kCFCoreFoundationVersionNumber < 800 && background_ != nil) {
         [self setView:[background_ autorelease]];
         background_ = nil;
     }
@@ -1164,6 +1171,9 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     [background_ removeFromSuperview];
     [background_ release];
     background_ = nil;
+    [foreground_ removeFromSuperview];
+    [foreground_ release];
+    foreground_ = nil;
     [super purgeView];
 }
 
@@ -1175,24 +1185,55 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     return YES;
 }
 
+- (BOOL) updateHidden {
+    if (foreground_ == nil)
+        return true;
+    SBLockScreenViewController *controller([[$SBLockScreenManager sharedInstance] lockScreenViewController]);
+    SBLockScreenView *view([controller lockScreenView]);
+    bool media(view != nil && ![view mediaControlsHidden]);
+    [foreground_ setHidden:media];
+    return media;
+}
+
 - (BOOL) showDateView {
-    return [configuration_ objectForKey:@"Homepage"] == nil;
+    bool homepage([configuration_ objectForKey:@"Homepage"] != nil);
+    if (kCFCoreFoundationVersionNumber < 800)
+        return !homepage;
+    else if (!homepage)
+        return true;
+    return [self updateHidden];
+}
+
+- (BOOL) allowsLockScreenMediaControls {
+    if (kCFCoreFoundationVersionNumber < 800)
+        return true;
+    if (background_ == nil)
+        return false;
+    [self updateHidden];
+    return true;
 }
 
 /*- (BOOL) showHeaderView {
     return YES;
 }*/
 
+// 1-3
 - (NSUInteger) presentationStyle {
     return 1;
 }
 
+// 1-5
 - (NSUInteger) overlayStyle {
     if ([configuration_ objectForKey:@"Background"] == nil)
         return 1;
     return 4;
 }
 
+// 1-[2/3?]
+- (NSUInteger) notificationBehavior {
+    return 1;
+}
+
 - (BOOL) viewWantsFullscreenLayout {
     return kCFCoreFoundationVersionNumber >= 800;
 }
@@ -1218,10 +1259,13 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     return YES;
 }*/
 
+// - (void) lockScreenMediaControlsShown:(BOOL)shown;
+
 - (BOOL) handleMenuButtonDoubleTap {
     if (kCFCoreFoundationVersionNumber >= 800) {
         SBLockScreenViewController *controller([[$SBLockScreenManager sharedInstance] lockScreenViewController]);
         [controller _setMediaControlsVisible:![controller isShowingMediaControls]];
+        [self updateHidden];
     }
 
     return [super handleMenuButtonDoubleTap];
index 9af50a9aca079909e8b0697f2480bdb09097d7b1..a4c61804d3164dfbe122c5ed74cdf810114a4900 100644 (file)
         height: 100%;
         width: 100%;
         background: none;
+        background-color: black;
     }
 
     #content {
         height: 100%;
         width: 100%;
-        display: table-cell;
-        text-align: center;
+    }
+
+    #content td {
         vertical-align: middle;
     }
 
     #content img {
         max-width: 100%;
         max-height: 100%;
-        vertical-align: middle;
+    }
+
+    #shadow {
+        position: absolute;
+        width: 100%;
+        height: 164px;
+        top: 0px;
+        left: 0px;
+        background-color: rgba(87, 87, 87, 0.5);
     }
 </style></head><body>
-    <div id="content"><script type="text/javascript">
+    <table id="content" cellspacing="0" cellpadding="0"><tr><td><script type="text/javascript">
         var album = PLPhotoLibrary.sharedPhotoLibrary.albums[0].userEditableAssets.array;
         var length = album.length;
         if (length != 0) {
@@ -54,5 +64,7 @@
             var path = album[index].pathForLargeDisplayableImageFile;
             document.write('<img src="' + path + '"/>');
         }
-    </script></div>
+    </script></td></tr></table>
+
+    <div id="shadow"></div>
 </body></html>
index 4d2a6e605eb77a75c5397e195700aa8befaf40ae..0933d7240df622616e1ee636d525ec446176c785 100644 (file)
@@ -33,7 +33,6 @@
 
     #lcd {
         margin-top: 50px;
-        background-color: rgba(87, 87, 87, 0.5);
     }
 
     #lcd h1 {