[Libreoffice-commits] online.git: ios/Mobile

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Dec 6 14:40:06 UTC 2018


 ios/Mobile/Base.lproj/Main.storyboard                     |   22 +++++++-------
 ios/Mobile/Resources/Templates/Blank (A4).ott.png         |binary
 ios/Mobile/Resources/Templates/Blank (widescreen).otp.png |binary
 ios/Mobile/Resources/Templates/Blank.otp.png              |binary
 ios/Mobile/Resources/Templates/Blank.ots.png              |binary
 ios/Mobile/TemplateCollectionViewController.mm            |    7 +++-
 6 files changed, 16 insertions(+), 13 deletions(-)

New commits:
commit 8b106eb3127ed49a5af825826df0aad2af9603b0
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Dec 6 16:33:39 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Dec 6 16:38:50 2018 +0200

    Look for thumbnails of the templates and show them in the template browser
    
    Add such thumbnails. Rename the presentation templates to not have
    colons in their name, as that seems to be problematic for macOS and/or
    iOS, sigh. (Shadows of pre-OS X MacOS, where the coln was the path
    component separator, not the slash.)
    
    Hack on the storyboard scene for the template browser. More work is
    needed there; the thumbnails aren't scaled down for some reason. I
    need to make sure the aspect ratio is maintained, too. Maybe to get it
    to look like I want I need to do some coding and not just tweak the
    storyboard in the Xcode UI designer, sigh.
    
    Change-Id: I959d051352c2f033c8563188155af5281961c7d8

diff --git a/ios/Mobile/Base.lproj/Main.storyboard b/ios/Mobile/Base.lproj/Main.storyboard
index ed8b0784b..64685855d 100644
--- a/ios/Mobile/Base.lproj/Main.storyboard
+++ b/ios/Mobile/Base.lproj/Main.storyboard
@@ -47,7 +47,7 @@
                     <collectionView key="view" clipsSubviews="YES" contentMode="scaleToFill" dataMode="prototypes" id="cHi-RU-96O">
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="w0h-io-kZq">
                             <size key="itemSize" width="50" height="50"/>
                             <size key="headerReferenceSize" width="50" height="50"/>
@@ -56,28 +56,28 @@
                         </collectionViewFlowLayout>
                         <cells>
                             <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="Cell" id="ppW-Sx-T3H">
-                                <rect key="frame" x="50" y="50" width="100" height="100"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <rect key="frame" x="50" y="50" width="150" height="150"/>
+                                <autoresizingMask key="autoresizingMask"/>
                                 <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
-                                    <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="150" height="150"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                     <subviews>
                                         <label opaque="NO" userInteractionEnabled="NO" tag="2" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fjg-QH-lLg">
-                                            <rect key="frame" x="7" y="75" width="93" height="25"/>
+                                            <rect key="frame" x="0.0" y="129.5" width="150" height="20.5"/>
                                             <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                                            <nil key="textColor"/>
+                                            <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                             <nil key="highlightedColor"/>
                                         </label>
                                         <imageView userInteractionEnabled="NO" tag="1" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="79y-w8-uiT">
-                                            <rect key="frame" x="7" y="0.0" width="93" height="75"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="150" height="121.5"/>
                                         </imageView>
                                     </subviews>
                                 </view>
                                 <constraints>
-                                    <constraint firstItem="fjg-QH-lLg" firstAttribute="top" secondItem="79y-w8-uiT" secondAttribute="bottom" constant="8" symbolic="YES" id="FMl-Ul-D9h"/>
-                                    <constraint firstItem="fjg-QH-lLg" firstAttribute="width" secondItem="79y-w8-uiT" secondAttribute="width" id="kOC-Jx-Eho"/>
+                                    <constraint firstAttribute="bottom" secondItem="fjg-QH-lLg" secondAttribute="bottom" id="AT2-XZ-lxx"/>
+                                    <constraint firstItem="79y-w8-uiT" firstAttribute="top" secondItem="ppW-Sx-T3H" secondAttribute="top" id="Qao-Rw-z5w"/>
                                 </constraints>
-                                <size key="customSize" width="100" height="100"/>
+                                <size key="customSize" width="150" height="150"/>
                             </collectionViewCell>
                         </cells>
                         <collectionReusableView key="sectionHeaderView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="SectionHeaderView" id="Vbs-oR-qri" customClass="TemplateSectionHeaderView">
@@ -88,7 +88,7 @@
                                     <rect key="frame" x="8" y="0.0" width="359" height="50"/>
                                     <autoresizingMask key="autoresizingMask" flexibleMinY="YES" flexibleMaxY="YES"/>
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                                    <nil key="textColor"/>
+                                    <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                             </subviews>
diff --git a/ios/Mobile/Resources/Templates/Blank A4.ott b/ios/Mobile/Resources/Templates/Blank (A4).ott
similarity index 100%
rename from ios/Mobile/Resources/Templates/Blank A4.ott
rename to ios/Mobile/Resources/Templates/Blank (A4).ott
diff --git a/ios/Mobile/Resources/Templates/Blank (A4).ott.png b/ios/Mobile/Resources/Templates/Blank (A4).ott.png
new file mode 100644
index 000000000..055df5e94
Binary files /dev/null and b/ios/Mobile/Resources/Templates/Blank (A4).ott.png differ
diff --git a/ios/Mobile/Resources/Templates/Blank 16:9.otp b/ios/Mobile/Resources/Templates/Blank (widescreen).otp
similarity index 100%
rename from ios/Mobile/Resources/Templates/Blank 16:9.otp
rename to ios/Mobile/Resources/Templates/Blank (widescreen).otp
diff --git a/ios/Mobile/Resources/Templates/Blank (widescreen).otp.png b/ios/Mobile/Resources/Templates/Blank (widescreen).otp.png
new file mode 100644
index 000000000..e4e7254f2
Binary files /dev/null and b/ios/Mobile/Resources/Templates/Blank (widescreen).otp.png differ
diff --git a/ios/Mobile/Resources/Templates/Blank 4:3.otp b/ios/Mobile/Resources/Templates/Blank.otp
similarity index 100%
rename from ios/Mobile/Resources/Templates/Blank 4:3.otp
rename to ios/Mobile/Resources/Templates/Blank.otp
diff --git a/ios/Mobile/Resources/Templates/Blank.otp.png b/ios/Mobile/Resources/Templates/Blank.otp.png
new file mode 100644
index 000000000..da2dc775c
Binary files /dev/null and b/ios/Mobile/Resources/Templates/Blank.otp.png differ
diff --git a/ios/Mobile/Resources/Templates/Blank.ots.png b/ios/Mobile/Resources/Templates/Blank.ots.png
new file mode 100644
index 000000000..c176b1e22
Binary files /dev/null and b/ios/Mobile/Resources/Templates/Blank.ots.png differ
diff --git a/ios/Mobile/TemplateCollectionViewController.mm b/ios/Mobile/TemplateCollectionViewController.mm
index c6bb67be9..91d5689d0 100644
--- a/ios/Mobile/TemplateCollectionViewController.mm
+++ b/ios/Mobile/TemplateCollectionViewController.mm
@@ -58,8 +58,11 @@ static NSString *mapTemplateExtensionToActual(NSString *templateName)
     UIImageView *image = (UIImageView *)[cell viewWithTag:1];
     UILabel *title = (UILabel *)[cell viewWithTag:2];
 
-    // FIXME: Just use a dummy image for now
-    image.image = [UIImage imageNamed:@"AppIcon"];
+    NSString *templateThumbnail = [[templates[[indexPath indexAtPosition:0]][[indexPath indexAtPosition:1]] path] stringByAppendingString:@".png"];
+    if ([NSFileManager.defaultManager fileExistsAtPath:templateThumbnail])
+          image.image = [UIImage imageWithContentsOfFile:templateThumbnail];
+    else
+          image.image = [UIImage imageNamed:@"AppIcon"];
 
     NSString *fileName = [templates[[indexPath indexAtPosition:0]][[indexPath indexAtPosition:1]] lastPathComponent];
 


More information about the Libreoffice-commits mailing list