Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions preferences/Resources/PriorityHub.plist
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ items = (
label = "Icon Location";
validValues = (
0,
1
1,
2,
3
);
validTitles = (
"Top",
"Bottom"
"Bottom",
"Left",
"Right"
);
},
{
Expand Down
33 changes: 23 additions & 10 deletions source/PHContainerView.xm
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,29 @@
}

//Layout all app views
CGFloat totalWidth = [[appViews allKeys] count] * [self appViewSize].width;
self.contentSize = CGSizeMake(totalWidth, [self appViewSize].height);
CGFloat startX = (CGRectGetWidth(self.frame) - totalWidth)/2;
if (startX < 0)
startX = 0;

for (PHAppView *appView in [appViews allValues]) {
appView.frame = CGRectMake(startX, 0, [self appViewSize].width, [self appViewSize].height);
startX += [self appViewSize].width;
}
if ( [defaults integerForKey:@"iconLocation"] < 2) {
CGFloat totalWidth = [[appViews allKeys] count] * [self appViewSize].width;
self.contentSize = CGSizeMake(totalWidth, [self appViewSize].height);
CGFloat startX = (CGRectGetWidth(self.frame) - totalWidth)/2;
if (startX < 0)
startX = 0;

for (PHAppView *appView in [appViews allValues]) {
appView.frame = CGRectMake(startX, 0, [self appViewSize].width, [self appViewSize].height);
startX += [self appViewSize].width;
}
} else {
CGFloat totalHeight = [[appViews allKeys] count] * [self appViewSize].height;
self.contentSize = CGSizeMake([self appViewSize].width, totalHeight);
CGFloat startY = (CGRectGetHeight(self.frame) - totalHeight)/2;
if (startY < 0)
startY = 0;

for (PHAppView *appView in [appViews allValues]) {
appView.frame = CGRectMake(0, startY, [self appViewSize].width, [self appViewSize].height);
startY += [self appViewSize].height;
}
}

//Update selected view location
if (selectedView.alpha == 1 && selectedAppID && [appViews objectForKey:selectedAppID])
Expand Down
9 changes: 7 additions & 2 deletions source/Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,15 @@ void showTestNotification() {
containerView.frame = CGRectMake(containerView.frame.origin.x, containerView.frame.origin.y + verticalAdjustmentTop, containerView.frame.size.width, containerView.frame.size.height - verticalAdjustmentTop + verticalAdjustmentBottom);

//Layout PHContainerView and notifications table view
if ([defaults integerForKey:@"iconLocation"] == 0) //App icons at top
int iconLocation = [defaults integerForKey:@"iconLocation"];
if (iconLocation == 0) //App icons at top
CGRectDivide(containerView.bounds, &phContainerViewFrame, &tableViewFrame, [phContainerView appViewSize].height, CGRectMinYEdge);
else //App icons at bottom
else if (iconLocation == 1)//App icons at bottom
CGRectDivide(containerView.bounds, &phContainerViewFrame, &tableViewFrame, [phContainerView appViewSize].height, CGRectMaxYEdge);
else if (iconLocation == 2)//App icons at left
CGRectDivide(containerView.bounds, &phContainerViewFrame, &tableViewFrame, [phContainerView appViewSize].width, CGRectMinXEdge);
else //App icons at right
CGRectDivide(containerView.bounds, &phContainerViewFrame, &tableViewFrame, [phContainerView appViewSize].width, CGRectMaxXEdge);

phContainerView.frame = phContainerViewFrame;
notificationsTableView.frame = tableViewFrame;
Expand Down