Skip to content

Commit

Permalink
Add widget UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Hammer committed Oct 28, 2015
1 parent ba4be28 commit 824b486
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 21 deletions.
149 changes: 128 additions & 21 deletions GammaWidget/Base.lproj/MainInterface.storyboard
Original file line number Diff line number Diff line change
@@ -1,50 +1,157 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="M4Y-Lb-cyx">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="M4Y-Lb-cyx">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
</dependencies>
<scenes>
<!--Today View Controller-->
<scene sceneID="cwh-vc-ff4">
<objects>
<viewController id="M4Y-Lb-cyx" customClass="TodayViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="M4Y-Lb-cyx" customClass="TodayViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ft6-oW-KC0"/>
<viewControllerLayoutGuide type="bottom" id="FKl-LY-JtV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" simulatedAppContext="notificationCenter" id="S3S-Oj-5AN">
<rect key="frame" x="0.0" y="0.0" width="320" height="37"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="33"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="top" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hello World" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="GcN-lo-r42">
<rect key="frame" x="20" y="8" width="280" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="lightTextColor"/>
<nil key="highlightedColor"/>
</label>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q7A-B4-r2n">
<rect key="frame" x="0.0" y="0.0" width="75" height="33"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="li5-16-9nm">
<rect key="frame" x="0.0" y="0.0" width="75" height="33"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pAf-D8-wNw">
<rect key="frame" x="0.0" y="0.0" width="75" height="33"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<state key="normal" title="Enable">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="selected" title="Disable"/>
<connections>
<action selector="toggle:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="KMH-6j-piA"/>
</connections>
</button>
</subviews>
<animations/>
</view>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="75" id="Mq5-A2-UA5"/>
<constraint firstAttribute="height" constant="33" id="PUS-GL-lpK"/>
</constraints>
<blurEffect style="light"/>
</visualEffectView>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aYe-bf-vgU">
<rect key="frame" x="83" y="0.0" width="80" height="33"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="vb1-GN-3hE">
<rect key="frame" x="0.0" y="0.0" width="80" height="33"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HCP-KX-ahw">
<rect key="frame" x="0.0" y="0.0" width="80" height="33"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<state key="normal" title="Increase">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled">
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="increase:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="Yv5-cg-EzA"/>
</connections>
</button>
</subviews>
<animations/>
</view>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="80" id="4KA-B3-Bv9"/>
<constraint firstAttribute="height" constant="33" id="MnH-rf-abr"/>
</constraints>
<blurEffect style="light"/>
</visualEffectView>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uv8-3M-ZUU">
<rect key="frame" x="171" y="0.0" width="80" height="33"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="yEs-OP-T42">
<rect key="frame" x="0.0" y="0.0" width="80" height="33"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7FR-va-tED">
<rect key="frame" x="0.0" y="0.0" width="80" height="33"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<state key="normal" title="Decrease">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled">
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="decrease:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="8LL-UC-eVc"/>
</connections>
</button>
</subviews>
<animations/>
</view>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="80" id="Cn1-gu-j4b"/>
<constraint firstAttribute="height" constant="33" id="P8b-Sz-4F3"/>
</constraints>
<blurEffect style="light"/>
</visualEffectView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="S3b-od-4gF">
<rect key="frame" x="270" y="0.0" width="30" height="33"/>
<animations/>
<constraints>
<constraint firstAttribute="height" constant="33" id="Df3-pX-T51"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<state key="normal" title="">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="openApp:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="UG8-Rv-M3N"/>
</connections>
</button>
</subviews>
<animations/>
<constraints>
<constraint firstItem="FKl-LY-JtV" firstAttribute="top" secondItem="GcN-lo-r42" secondAttribute="bottom" constant="20" symbolic="YES" id="0Q0-KW-PJ6"/>
<constraint firstItem="GcN-lo-r42" firstAttribute="leading" secondItem="S3S-Oj-5AN" secondAttribute="leading" constant="20" symbolic="YES" id="6Vq-gs-PHe"/>
<constraint firstAttribute="trailing" secondItem="GcN-lo-r42" secondAttribute="trailing" constant="20" symbolic="YES" id="L8K-9R-egU"/>
<constraint firstItem="GcN-lo-r42" firstAttribute="top" secondItem="Ft6-oW-KC0" secondAttribute="bottom" constant="20" symbolic="YES" id="mYS-Cv-VNx"/>
<constraint firstItem="S3b-od-4gF" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="uv8-3M-ZUU" secondAttribute="trailing" id="D7Z-fX-Qol"/>
<constraint firstAttribute="trailing" secondItem="S3b-od-4gF" secondAttribute="trailing" priority="750" constant="20" symbolic="YES" id="Uax-gt-b4v"/>
<constraint firstItem="S3b-od-4gF" firstAttribute="top" secondItem="Ft6-oW-KC0" secondAttribute="bottom" id="XLd-x4-m9T"/>
<constraint firstItem="Q7A-B4-r2n" firstAttribute="leading" secondItem="S3S-Oj-5AN" secondAttribute="leading" id="edb-cH-0pq"/>
<constraint firstItem="aYe-bf-vgU" firstAttribute="leading" secondItem="Q7A-B4-r2n" secondAttribute="trailing" constant="8" id="gDA-e7-4Cd"/>
<constraint firstItem="uv8-3M-ZUU" firstAttribute="leading" secondItem="aYe-bf-vgU" secondAttribute="trailing" constant="8" id="gV3-yA-ymg"/>
<constraint firstItem="uv8-3M-ZUU" firstAttribute="top" secondItem="Ft6-oW-KC0" secondAttribute="bottom" id="ggv-Fm-BvA"/>
<constraint firstItem="aYe-bf-vgU" firstAttribute="top" secondItem="Ft6-oW-KC0" secondAttribute="bottom" id="htC-oW-TbL"/>
<constraint firstItem="Q7A-B4-r2n" firstAttribute="top" secondItem="Ft6-oW-KC0" secondAttribute="bottom" id="ngw-hF-vlk"/>
</constraints>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="37"/>
<size key="freeformSize" width="320" height="33"/>
<connections>
<outlet property="decreaseButton" destination="7FR-va-tED" id="7Zg-xC-wqj"/>
<outlet property="decreaseView" destination="uv8-3M-ZUU" id="yPW-r5-xeC"/>
<outlet property="increaseButton" destination="HCP-KX-ahw" id="ywc-dv-sKf"/>
<outlet property="increaseView" destination="aYe-bf-vgU" id="j6y-07-lLE"/>
<outlet property="toggleButton" destination="pAf-D8-wNw" id="MLe-pi-uoX"/>
<outlet property="toggleView" destination="Q7A-B4-r2n" id="gt7-cJ-qsy"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vXp-U4-Rya" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="516" y="285"/>
<point key="canvasLocation" x="-282" y="-200.5"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
17 changes: 17 additions & 0 deletions GammaWidget/TodayViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ @interface TodayViewController () <NCWidgetProviding>
@property IBOutlet UIButton *toggleButton;
@property IBOutlet UIButton *increaseButton;
@property IBOutlet UIButton *decreaseButton;

@property IBOutlet UIVisualEffectView *toggleView;
@property IBOutlet UIVisualEffectView *increaseView;
@property IBOutlet UIVisualEffectView *decreaseView;
@end

@implementation TodayViewController
Expand All @@ -23,6 +27,15 @@ @implementation TodayViewController

- (void)viewDidLoad {
[super viewDidLoad];
self.preferredContentSize = CGSizeMake(0, 33);

self.toggleView.layer.cornerRadius = 5;
self.increaseView.layer.cornerRadius = 5;
self.decreaseView.layer.cornerRadius = 5;

self.toggleView.clipsToBounds = YES;
self.increaseView.clipsToBounds = YES;
self.decreaseView.clipsToBounds = YES;
}

- (void)viewWillAppear:(BOOL)animated {
Expand All @@ -37,6 +50,10 @@ - (void)updateUI {
self.decreaseButton.enabled = enabled;
}

- (UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMarginInsets {
return UIEdgeInsetsMake(10, defaultMarginInsets.left, 10, defaultMarginInsets.right);
}

- (IBAction)toggle:(id)sender {
if ([[NSUserDefaults groupDefaults] boolForKey:@"enabled"]) {
[GammaController disableOrangeness];
Expand Down

0 comments on commit 824b486

Please sign in to comment.