mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
Add support for hiding apps
This commit is contained in:
+15
-1
@@ -9,7 +9,7 @@
|
||||
#import "UIAppView.h"
|
||||
#import "AppAssetManager.h"
|
||||
|
||||
static const float REFRESH_CYCLE = 2.0f;
|
||||
static const float REFRESH_CYCLE = 1.0f;
|
||||
|
||||
@implementation UIAppView {
|
||||
TemporaryApp* _app;
|
||||
@@ -40,10 +40,15 @@ static UIImage* noImage;
|
||||
self.frame = CGRectMake(0, 0, 150, 200);
|
||||
#endif
|
||||
|
||||
[self setAlpha:app.hidden ? 0.4 : 1.0];
|
||||
|
||||
_appImage = [[UIImageView alloc] initWithFrame:self.frame];
|
||||
[_appImage setImage:noImage];
|
||||
[self addSubview:_appImage];
|
||||
|
||||
UILongPressGestureRecognizer* longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(appLongClicked:)];
|
||||
[self addGestureRecognizer:longPressRecognizer];
|
||||
|
||||
if (@available(iOS 9.0, tvOS 9.0, *)) {
|
||||
[self addTarget:self action:@selector(appClicked) forControlEvents:UIControlEventPrimaryActionTriggered];
|
||||
}
|
||||
@@ -78,6 +83,12 @@ static UIImage* noImage;
|
||||
[_callback appClicked:_app];
|
||||
}
|
||||
|
||||
- (void) appLongClicked:(UILongPressGestureRecognizer*)gesture {
|
||||
if (gesture.state == UIGestureRecognizerStateBegan) {
|
||||
[_callback appLongClicked:_app];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) updateAppImage {
|
||||
if (_appOverlay != nil) {
|
||||
[_appOverlay removeFromSuperview];
|
||||
@@ -185,6 +196,9 @@ static UIImage* noImage;
|
||||
[self updateAppImage];
|
||||
}
|
||||
|
||||
// Update opacity if neccessary
|
||||
[self setAlpha:_app.hidden ? 0.4 : 1.0];
|
||||
|
||||
// Stop updating when we detach from our parent view
|
||||
if (self.superview != nil) {
|
||||
[self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE];
|
||||
|
||||
Reference in New Issue
Block a user