Browse Source

Stuff.

pull/101/head
Abhishek 3 years ago
parent
commit
a830c161de
  1. 40
      Clocker/Clocker/en.lproj/Panel.xib
  2. 5
      Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

40
Clocker/Clocker/en.lproj/Panel.xib

@ -32,7 +32,6 @@
<outlet property="stackView" destination="OZA-6o-SbE" id="lIT-4b-8WZ"/> <outlet property="stackView" destination="OZA-6o-SbE" id="lIT-4b-8WZ"/>
<outlet property="upcomingEventCollectionView" destination="Tp2-pl-yIm" id="gLE-03-1cZ"/> <outlet property="upcomingEventCollectionView" destination="Tp2-pl-yIm" id="gLE-03-1cZ"/>
<outlet property="upcomingEventContainerView" destination="Akn-cR-W4G" id="1cy-z6-392"/> <outlet property="upcomingEventContainerView" destination="Akn-cR-W4G" id="1cy-z6-392"/>
<outlet property="upcomingEventView" destination="Akn-cR-W4G" id="SKK-Ai-Vas"/>
<outlet property="window" destination="5" id="7"/> <outlet property="window" destination="5" id="7"/>
</connections> </connections>
</customObject> </customObject>
@ -43,16 +42,16 @@
<windowCollectionBehavior key="collectionBehavior" moveToActiveSpace="YES" ignoresCycle="YES"/> <windowCollectionBehavior key="collectionBehavior" moveToActiveSpace="YES" ignoresCycle="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="1000" y="379" width="350" height="460"/> <rect key="contentRect" x="1000" y="379" width="350" height="460"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/> <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1025"/>
<view key="contentView" focusRingType="none" id="6" customClass="BackgroundPanelView" customModule="Clocker" customModuleProvider="target"> <view key="contentView" focusRingType="none" id="6" customClass="BackgroundPanelView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="350" height="440"/> <rect key="frame" x="0.0" y="0.0" width="370" height="440"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<stackView focusRingType="none" distribution="fill" orientation="vertical" alignment="leading" spacing="0.0" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OZA-6o-SbE"> <stackView focusRingType="none" distribution="fill" orientation="vertical" alignment="leading" spacing="0.0" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OZA-6o-SbE">
<rect key="frame" x="0.0" y="0.0" width="350" height="440"/> <rect key="frame" x="0.0" y="0.0" width="370" height="440"/>
<subviews> <subviews>
<scrollView focusRingType="none" borderType="none" autohidesScrollers="YES" horizontalLineScroll="96" horizontalPageScroll="1" verticalLineScroll="96" verticalPageScroll="1" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" scrollerKnobStyle="light" translatesAutoresizingMaskIntoConstraints="NO" id="4Gd-Nv-fXr"> <scrollView focusRingType="none" borderType="none" autohidesScrollers="YES" horizontalLineScroll="96" horizontalPageScroll="1" verticalLineScroll="96" verticalPageScroll="1" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" scrollerKnobStyle="light" translatesAutoresizingMaskIntoConstraints="NO" id="4Gd-Nv-fXr">
<rect key="frame" x="-20" y="175" width="370" height="265"/> <rect key="frame" x="0.0" y="175" width="370" height="265"/>
<clipView key="contentView" focusRingType="none" drawsBackground="NO" copiesOnScroll="NO" id="4MZ-Di-yNR"> <clipView key="contentView" focusRingType="none" drawsBackground="NO" copiesOnScroll="NO" id="4MZ-Di-yNR">
<rect key="frame" x="0.0" y="0.0" width="370" height="265"/> <rect key="frame" x="0.0" y="0.0" width="370" height="265"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -326,7 +325,7 @@
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" id="mgM-vQ-fB7"> <collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" id="mgM-vQ-fB7">
<size key="itemSize" width="10" height="50"/> <size key="itemSize" width="10" height="50"/>
</collectionViewFlowLayout> </collectionViewFlowLayout>
<color key="primaryBackgroundColor" red="0.071000002324581146" green="0.9580000638961792" blue="0.10900000482797623" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="primaryBackgroundColor" red="0.070588235294117646" green="0.95686274509803915" blue="0.10980392156862745" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<connections> <connections>
<outlet property="dataSource" destination="-2" id="Exd-5i-4cB"/> <outlet property="dataSource" destination="-2" id="Exd-5i-4cB"/>
<outlet property="delegate" destination="-2" id="r49-5r-Rx5"/> <outlet property="delegate" destination="-2" id="r49-5r-Rx5"/>
@ -410,10 +409,10 @@
<accessibility identifier="Modern Slider Container"/> <accessibility identifier="Modern Slider Container"/>
</customView> </customView>
<customView identifier="Review Cell" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="TDn-Kk-KkV" userLabel="Review View"> <customView identifier="Review Cell" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="TDn-Kk-KkV" userLabel="Review View">
<rect key="frame" x="0.0" y="115" width="350" height="50"/> <rect key="frame" x="0.0" y="115" width="370" height="50"/>
<subviews> <subviews>
<stackView focusRingType="none" distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uys-ww-duA"> <stackView focusRingType="none" distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uys-ww-duA">
<rect key="frame" x="25" y="25" width="300" height="20"/> <rect key="frame" x="35" y="25" width="300" height="20"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsExpansionToolTips="YES" preferredMaxLayoutWidth="185" translatesAutoresizingMaskIntoConstraints="NO" id="8Qj-Y9-Okf"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsExpansionToolTips="YES" preferredMaxLayoutWidth="185" translatesAutoresizingMaskIntoConstraints="NO" id="8Qj-Y9-Okf">
<rect key="frame" x="-2" y="0.0" width="304" height="20"/> <rect key="frame" x="-2" y="0.0" width="304" height="20"/>
@ -437,7 +436,7 @@
<accessibility identifier="ReviewLabel"/> <accessibility identifier="ReviewLabel"/>
</stackView> </stackView>
<stackView focusRingType="none" distribution="fillEqually" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1AK-MW-qsc"> <stackView focusRingType="none" distribution="fillEqually" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1AK-MW-qsc">
<rect key="frame" x="75" y="2" width="200" height="21"/> <rect key="frame" x="85" y="2" width="200" height="21"/>
<subviews> <subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WVY-D9-AAX"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WVY-D9-AAX">
<rect key="frame" x="-7" y="-7" width="110" height="33"/> <rect key="frame" x="-7" y="-7" width="110" height="33"/>
@ -484,28 +483,28 @@
<accessibility description="ReviewCell" identifier="ReviewCell"/> <accessibility description="ReviewCell" identifier="ReviewCell"/>
</customView> </customView>
<customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="Akn-cR-W4G" userLabel="Upcoming Event View" customClass="UpcomingEventView" customModule="Clocker" customModuleProvider="target"> <customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="Akn-cR-W4G" userLabel="Upcoming Event View" customClass="UpcomingEventView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="0.0" y="40" width="350" height="75"/> <rect key="frame" x="0.0" y="40" width="370" height="75"/>
<subviews> <subviews>
<scrollView wantsLayer="YES" focusRingType="none" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5BT-DM-xru"> <scrollView wantsLayer="YES" focusRingType="none" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5BT-DM-xru">
<rect key="frame" x="0.0" y="0.0" width="350" height="75"/> <rect key="frame" x="0.0" y="0.0" width="370" height="75"/>
<clipView key="contentView" id="QHw-sR-BYe"> <clipView key="contentView" drawsBackground="NO" id="QHw-sR-BYe">
<rect key="frame" x="0.0" y="0.0" width="350" height="75"/> <rect key="frame" x="0.0" y="0.0" width="370" height="75"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<collectionView id="Tp2-pl-yIm"> <collectionView id="Tp2-pl-yIm">
<rect key="frame" x="0.0" y="0.0" width="350" height="75"/> <rect key="frame" x="0.0" y="0.0" width="370" height="75"/>
<autoresizingMask key="autoresizingMask" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" heightSizable="YES"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" scrollDirection="horizontal" id="g4p-GT-v9Y"> <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" scrollDirection="horizontal" id="g4p-GT-v9Y">
<size key="itemSize" width="50" height="50"/> <size key="itemSize" width="50" height="50"/>
<edgeInsets key="sectionInset" left="10" right="0.0" top="0.0" bottom="0.0"/> <edgeInsets key="sectionInset" left="10" right="0.0" top="0.0" bottom="0.0"/>
</collectionViewFlowLayout> </collectionViewFlowLayout>
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="primaryBackgroundColor" red="0.070588235294117646" green="0.95686274509803915" blue="0.10980392156862745" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</collectionView> </collectionView>
</subviews> </subviews>
<color key="backgroundColor" name="Accent Color"/> <color key="backgroundColor" name="Accent Color"/>
</clipView> </clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Akw-Iw-iVY"> <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Akw-Iw-iVY">
<rect key="frame" x="-100" y="-100" width="345" height="16"/> <rect key="frame" x="-100" y="-100" width="370" height="16"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</scroller> </scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="MXo-gV-Bdf"> <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="MXo-gV-Bdf">
@ -518,17 +517,16 @@
<constraint firstAttribute="height" constant="75" id="JUg-Of-bAv"/> <constraint firstAttribute="height" constant="75" id="JUg-Of-bAv"/>
<constraint firstAttribute="bottom" secondItem="5BT-DM-xru" secondAttribute="bottom" id="Kq0-6J-4rc"/> <constraint firstAttribute="bottom" secondItem="5BT-DM-xru" secondAttribute="bottom" id="Kq0-6J-4rc"/>
<constraint firstItem="5BT-DM-xru" firstAttribute="leading" secondItem="Akn-cR-W4G" secondAttribute="leading" id="jCJ-jE-SF5"/> <constraint firstItem="5BT-DM-xru" firstAttribute="leading" secondItem="Akn-cR-W4G" secondAttribute="leading" id="jCJ-jE-SF5"/>
<constraint firstAttribute="width" constant="350" id="oPv-7I-Y3n"/>
<constraint firstAttribute="trailing" secondItem="5BT-DM-xru" secondAttribute="trailing" id="rIv-zJ-6DJ"/> <constraint firstAttribute="trailing" secondItem="5BT-DM-xru" secondAttribute="trailing" id="rIv-zJ-6DJ"/>
<constraint firstItem="5BT-DM-xru" firstAttribute="top" secondItem="Akn-cR-W4G" secondAttribute="top" id="zo2-i3-2uS"/> <constraint firstItem="5BT-DM-xru" firstAttribute="top" secondItem="Akn-cR-W4G" secondAttribute="top" id="zo2-i3-2uS"/>
</constraints> </constraints>
<accessibility identifier="UpcomingEventView"/> <accessibility identifier="UpcomingEventView"/>
</customView> </customView>
<customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="B8X-sx-cjT"> <customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="B8X-sx-cjT">
<rect key="frame" x="0.0" y="0.0" width="350" height="40"/> <rect key="frame" x="0.0" y="0.0" width="370" height="40"/>
<subviews> <subviews>
<button toolTip="Close Clocker" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1cR-pI-osG"> <button toolTip="Close Clocker" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1cR-pI-osG">
<rect key="frame" x="309" y="7" width="30" height="26"/> <rect key="frame" x="329" y="7" width="30" height="26"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="25" id="WSi-Xj-Kfl"/> <constraint firstAttribute="height" constant="25" id="WSi-Xj-Kfl"/>
<constraint firstAttribute="width" constant="30" id="j2s-C4-pK5"/> <constraint firstAttribute="width" constant="30" id="j2s-C4-pK5"/>
@ -543,7 +541,7 @@
</connections> </connections>
</button> </button>
<button toolTip="Switch between Menubar/Floating mode." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YXE-4J-5cn"> <button toolTip="Switch between Menubar/Floating mode." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YXE-4J-5cn">
<rect key="frame" x="275" y="10" width="29" height="19"/> <rect key="frame" x="295" y="10" width="29" height="19"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="29" id="fWo-31-i3M"/> <constraint firstAttribute="width" constant="29" id="fWo-31-i3M"/>
<constraint firstAttribute="height" constant="18" id="v7I-PR-eTK"/> <constraint firstAttribute="height" constant="18" id="v7I-PR-eTK"/>
@ -558,7 +556,7 @@
</connections> </connections>
</button> </button>
<button toolTip="Share Clocker!" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hc7-fH-V7i"> <button toolTip="Share Clocker!" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hc7-fH-V7i">
<rect key="frame" x="240" y="10" width="30" height="21"/> <rect key="frame" x="260" y="10" width="30" height="21"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="20" id="Bnf-E1-uaE"/> <constraint firstAttribute="height" constant="20" id="Bnf-E1-uaE"/>
<constraint firstAttribute="width" constant="30" id="pke-4M-ob5"/> <constraint firstAttribute="width" constant="30" id="pke-4M-ob5"/>

5
Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

@ -45,11 +45,12 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
func collectionView(_ collectionView: NSCollectionView, layout _: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize { func collectionView(_ collectionView: NSCollectionView, layout _: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
if upcomingEvents.isEmpty || eventCenter.calendarAccessNotDetermined() { if upcomingEvents.isEmpty || eventCenter.calendarAccessNotDetermined() {
return NSSize(width: collectionView.frame.width - 20, height: 50) return NSSize(width: collectionView.frame.width - 40, height: 50)
} }
let currentEventInfo = upcomingEvents[indexPath.item] let currentEventInfo = upcomingEvents[indexPath.item]
let attributedString = NSAttributedString(string: currentEventInfo.event.title, attributes: [NSAttributedString.Key.font : avenirLightFont]) let attributedString = NSAttributedString(string: currentEventInfo.event.title, attributes: [NSAttributedString.Key.font : avenirLightFont])
return NSSize(width: attributedString.size().width + 60, height: 50) let maxWidth = max(attributedString.size().width + 60.0, collectionView.frame.width / 2)
return NSSize(width: maxWidth, height: 50)
} }
} }

Loading…
Cancel
Save