Merge MatrixKit develop with commit hash: b85b736313bec0592bd1cabc68035d97f5331137

This commit is contained in:
SBiOSoftWhare
2021-12-03 11:47:24 +01:00
parent af65f71177
commit f57941177e
475 changed files with 87437 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
/*
Copyright 2015 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import <UIKit/UIKit.h>
/**
'MXKCollectionViewCell' class is used to define custom UICollectionViewCell.
Each 'MXKCollectionViewCell-inherited' class has its own 'reuseIdentifier'.
*/
@interface MXKCollectionViewCell : UICollectionViewCell
/**
Returns the `UINib` object initialized for the cell.
@return The initialized `UINib` object or `nil` if there were errors during
initialization or the nib file could not be located.
*/
+ (UINib *)nib;
/**
The default reuseIdentifier of the 'MXKCollectionViewCell-inherited' class.
*/
+ (NSString*)defaultReuseIdentifier;
/**
Customize the rendering of the collection view cell and its subviews (Do nothing by default).
This method is called when the view is initialized or prepared for reuse.
Override this method to customize the collection view cell at the application level.
*/
- (void)customizeCollectionViewCellRendering;
@end

View File

@@ -0,0 +1,76 @@
/*
Copyright 2015 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "MXKCollectionViewCell.h"
@implementation MXKCollectionViewCell
+ (UINib *)nib
{
// Check whether a nib file is available
NSBundle *mainBundle = [NSBundle bundleForClass:self.class];
NSString *path = [mainBundle pathForResource:NSStringFromClass([self class]) ofType:@"nib"];
if (path)
{
return [UINib nibWithNibName:NSStringFromClass([self class]) bundle:mainBundle];
}
return nil;
}
+ (NSString*)defaultReuseIdentifier
{
return NSStringFromClass([self class]);
}
- (void)awakeFromNib
{
[super awakeFromNib];
[self customizeCollectionViewCellRendering];
}
- (void)prepareForReuse
{
[super prepareForReuse];
[self customizeCollectionViewCellRendering];
}
- (instancetype)initWithFrame:(CGRect)frame
{
// Check whether a xib is defined
if ([[self class] nib])
{
self = [[[self class] nib] instantiateWithOwner:nil options:nil].firstObject;
self.frame = frame;
}
else
{
self = [super initWithFrame:frame];
[self customizeCollectionViewCellRendering];
}
return self;
}
- (void)customizeCollectionViewCellRendering
{
// Do nothing by default.
}
@end

View File

@@ -0,0 +1,45 @@
/*
Copyright 2015 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "MXKCollectionViewCell.h"
#import <AVKit/AVKit.h>
#import "MXKImageView.h"
/**
'MXKMediaCollectionViewCell' class is used to display picture or video thumbnail.
*/
@interface MXKMediaCollectionViewCell : MXKCollectionViewCell
@property (weak, nonatomic) IBOutlet UIView *customView;
@property (weak, nonatomic) IBOutlet MXKImageView *mxkImageView;
@property (weak, nonatomic) IBOutlet UIImageView *centerIcon;
@property (weak, nonatomic) IBOutlet UIImageView *bottomLeftIcon;
@property (weak, nonatomic) IBOutlet UIImageView *bottomRightIcon;
@property (weak, nonatomic) IBOutlet UIImageView *topRightIcon;
/**
A potential player used in the cell.
*/
@property (nonatomic) AVPlayerViewController *moviePlayer;
/**
A potential observer used to update cell display.
*/
@property (nonatomic) id notificationObserver;
@end

View File

@@ -0,0 +1,73 @@
/*
Copyright 2015 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd
Copyright 2018 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "MXKMediaCollectionViewCell.h"
@implementation MXKMediaCollectionViewCell
- (void)prepareForReuse
{
[super prepareForReuse];
[self.moviePlayer.player pause];
self.moviePlayer.player = nil;
self.moviePlayer = nil;
// Restore the cell in reusable state
self.mxkImageView.hidden = NO;
self.mxkImageView.stretchable = NO;
// Cancel potential image download
self.mxkImageView.enableInMemoryCache = NO;
[self.mxkImageView setImageURI:nil
withType:nil
andImageOrientation:UIImageOrientationUp
previewImage:nil
mediaManager:nil];
self.customView.hidden = YES;
self.centerIcon.hidden = YES;
// Remove added view in custon view
NSArray *subViews = self.customView.subviews;
for (UIView *view in subViews)
{
[view removeFromSuperview];
}
// Remove potential media download observer
if (self.notificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:self.notificationObserver];
self.notificationObserver = nil;
}
// Remove all gesture recognizers
while (self.gestureRecognizers.count)
{
[self removeGestureRecognizer:self.gestureRecognizers[0]];
}
self.tag = -1;
}
- (void)dealloc
{
[self.moviePlayer.player pause];
self.moviePlayer.player = nil;
}
@end

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="eCk-zY-LXq" customClass="MXKMediaCollectionViewCell">
<rect key="frame" x="0.0" y="0.0" width="80" height="80"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="80" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TP2-Sr-1hA" userLabel="CustomView">
<rect key="frame" x="0.0" y="0.0" width="80" height="80"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="T1Q-RS-8o6" customClass="MXKImageView">
<rect key="frame" x="0.0" y="0.0" width="80" height="80"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="l9u-PV-2Kx" userLabel="centerIcon">
<rect key="frame" x="28" y="28" width="25" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="fdh-Aa-NDo"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="25" id="pCq-on-PJR"/>
<constraint firstAttribute="width" constant="25" id="toX-JA-StF"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="25" id="usE-Mq-K8k"/>
</constraints>
</imageView>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YB6-Jv-WMr" userLabel="bottomLeftIcon">
<rect key="frame" x="8" y="53" width="20" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="fDo-LF-4CI"/>
<constraint firstAttribute="height" constant="20" id="yQL-WA-w9j"/>
</constraints>
</imageView>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="S1K-Sj-lhV" userLabel="topRightIcon">
<rect key="frame" x="52" y="7" width="20" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="YJM-RC-2sA"/>
<constraint firstAttribute="height" constant="20" id="ozP-cX-0lT"/>
</constraints>
</imageView>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="5Yd-df-HbB" userLabel="bottomRightIcon">
<rect key="frame" x="52" y="53" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="UEZ-5S-KMf"/>
<constraint firstAttribute="width" constant="20" id="bbS-D2-SZi"/>
</constraints>
</imageView>
</subviews>
</view>
<constraints>
<constraint firstAttribute="trailing" secondItem="5Yd-df-HbB" secondAttribute="trailing" priority="750" constant="8" id="2bi-ya-uC0"/>
<constraint firstAttribute="trailing" secondItem="T1Q-RS-8o6" secondAttribute="trailing" id="2mi-ZG-4dV"/>
<constraint firstItem="YB6-Jv-WMr" firstAttribute="leading" secondItem="eCk-zY-LXq" secondAttribute="leading" priority="750" constant="8" id="43S-Eh-tnF"/>
<constraint firstItem="l9u-PV-2Kx" firstAttribute="centerY" secondItem="eCk-zY-LXq" secondAttribute="centerY" id="7oz-CQ-w1O"/>
<constraint firstAttribute="bottom" secondItem="T1Q-RS-8o6" secondAttribute="bottom" id="8rM-p9-Vwc"/>
<constraint firstItem="T1Q-RS-8o6" firstAttribute="leading" secondItem="eCk-zY-LXq" secondAttribute="leading" id="AET-tr-Wti"/>
<constraint firstItem="T1Q-RS-8o6" firstAttribute="top" secondItem="eCk-zY-LXq" secondAttribute="top" id="Fzk-Dy-HI1"/>
<constraint firstAttribute="trailing" secondItem="TP2-Sr-1hA" secondAttribute="trailing" id="NWc-zx-iym"/>
<constraint firstAttribute="bottom" secondItem="TP2-Sr-1hA" secondAttribute="bottom" id="Psv-4k-pFA"/>
<constraint firstAttribute="bottom" secondItem="YB6-Jv-WMr" secondAttribute="bottom" priority="750" constant="7" id="RTC-59-huH"/>
<constraint firstAttribute="bottom" secondItem="5Yd-df-HbB" secondAttribute="bottom" priority="750" constant="7" id="S8E-Zu-cIr"/>
<constraint firstAttribute="trailing" secondItem="S1K-Sj-lhV" secondAttribute="trailing" priority="750" constant="8" id="XfO-xa-DlO"/>
<constraint firstItem="l9u-PV-2Kx" firstAttribute="centerX" secondItem="eCk-zY-LXq" secondAttribute="centerX" id="d32-f1-U3Q"/>
<constraint firstItem="TP2-Sr-1hA" firstAttribute="top" secondItem="eCk-zY-LXq" secondAttribute="top" id="eBE-6d-RBK"/>
<constraint firstItem="TP2-Sr-1hA" firstAttribute="leading" secondItem="eCk-zY-LXq" secondAttribute="leading" id="lR0-ej-w9L"/>
<constraint firstItem="S1K-Sj-lhV" firstAttribute="top" secondItem="eCk-zY-LXq" secondAttribute="top" priority="750" constant="7" id="neN-7y-A6j"/>
</constraints>
<connections>
<outlet property="bottomLeftIcon" destination="YB6-Jv-WMr" id="EAI-25-P6H"/>
<outlet property="bottomRightIcon" destination="5Yd-df-HbB" id="X1R-n5-kOH"/>
<outlet property="centerIcon" destination="l9u-PV-2Kx" id="5E4-tR-DBr"/>
<outlet property="customView" destination="TP2-Sr-1hA" id="eOK-uE-mrx"/>
<outlet property="mxkImageView" destination="T1Q-RS-8o6" id="kPS-Hx-zbu"/>
<outlet property="topRightIcon" destination="S1K-Sj-lhV" id="yc9-aM-Rjc"/>
</connections>
</collectionViewCell>
</objects>
</document>