├── .gitattributes
├── .gitignore
├── AndroidDemo
└── banner.zip
├── MDShockBannerViewAndroid
└── banner
│ ├── banner-banner.iml
│ ├── banner.iml
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── youth
│ │ └── banner
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── youth
│ │ └── banner
│ │ ├── Banner.java
│ │ ├── BannerConfig.java
│ │ ├── BannerEntity.java
│ │ ├── BannerScroller.java
│ │ ├── Transformer.java
│ │ ├── WeakHandler.java
│ │ ├── listener
│ │ ├── OnBannerClickListener.java
│ │ └── OnBannerListener.java
│ │ ├── loader
│ │ ├── ImageLoader.java
│ │ └── ImageLoaderInterface.java
│ │ ├── transformer
│ │ ├── ABaseTransformer.java
│ │ ├── AccordionTransformer.java
│ │ ├── BackgroundToForegroundTransformer.java
│ │ ├── CubeInTransformer.java
│ │ ├── CubeOutTransformer.java
│ │ ├── DefaultTransformer.java
│ │ ├── DepthPageTransformer.java
│ │ ├── FlipHorizontalTransformer.java
│ │ ├── FlipVerticalTransformer.java
│ │ ├── ForegroundToBackgroundTransformer.java
│ │ ├── RotateDownTransformer.java
│ │ ├── RotateUpTransformer.java
│ │ ├── ScaleInOutTransformer.java
│ │ ├── StackTransformer.java
│ │ ├── TabletTransformer.java
│ │ ├── ZoomInTransformer.java
│ │ ├── ZoomOutSlideTransformer.java
│ │ └── ZoomOutTranformer.java
│ │ └── view
│ │ ├── BannerViewPager.java
│ │ ├── RoundAngleImageView.java
│ │ └── RoundImageView.java
│ └── res
│ ├── animator
│ └── scale_with_alpha.xml
│ ├── drawable
│ ├── banner_select.png
│ ├── banner_unselect.png
│ ├── black.xml
│ ├── black_background.xml
│ ├── blue.xml
│ ├── gray_radius.xml
│ ├── no_banner.png
│ └── white_radius.xml
│ ├── layout
│ └── banner.xml
│ └── values
│ ├── attr.xml
│ └── ids.xml
├── MDShockBannerViewOC
├── MDShockBannerViewOCDemo.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ └── contents.xcworkspacedata
├── MDShockBannerViewOCDemo.xcworkspace
│ └── contents.xcworkspacedata
├── MDShockBannerViewOCDemo
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── home_banner_select.imageset
│ │ │ ├── 0banner-轮播-选@2x.png
│ │ │ ├── 0banner-轮播-选@3x.png
│ │ │ └── Contents.json
│ │ └── home_banner_unselect.imageset
│ │ │ ├── 0banner-轮播-未选@2x.png
│ │ │ ├── 0banner-轮播-未选@3x.png
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── MDShockBanner
│ │ ├── MDBannerCollectionViewCell.h
│ │ ├── MDBannerCollectionViewCell.m
│ │ ├── MDBannerCollectionViewCell.xib
│ │ ├── MDBannerModel.h
│ │ ├── MDBannerModel.m
│ │ ├── MDMaskView.h
│ │ ├── MDMaskView.m
│ │ ├── MDShockBannerView.h
│ │ ├── MDShockBannerView.m
│ │ ├── UIView+MD.h
│ │ └── UIView+MD.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── MDShockBannerViewOCDemoUITests
│ ├── Info.plist
│ └── MDShockBannerViewOCDemoUITests.m
├── Podfile
├── Podfile.lock
└── Pods
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ └── project.pbxproj
│ ├── SDWebImage
│ ├── LICENSE
│ ├── README.md
│ └── SDWebImage
│ │ ├── NSButton+WebCache.h
│ │ ├── NSButton+WebCache.m
│ │ ├── NSData+ImageContentType.h
│ │ ├── NSData+ImageContentType.m
│ │ ├── NSImage+WebCache.h
│ │ ├── NSImage+WebCache.m
│ │ ├── SDAnimatedImageRep.h
│ │ ├── SDAnimatedImageRep.m
│ │ ├── SDImageCache.h
│ │ ├── SDImageCache.m
│ │ ├── SDImageCacheConfig.h
│ │ ├── SDImageCacheConfig.m
│ │ ├── SDWebImageCoder.h
│ │ ├── SDWebImageCoder.m
│ │ ├── SDWebImageCoderHelper.h
│ │ ├── SDWebImageCoderHelper.m
│ │ ├── SDWebImageCodersManager.h
│ │ ├── SDWebImageCodersManager.m
│ │ ├── SDWebImageCompat.h
│ │ ├── SDWebImageCompat.m
│ │ ├── SDWebImageDownloader.h
│ │ ├── SDWebImageDownloader.m
│ │ ├── SDWebImageDownloaderOperation.h
│ │ ├── SDWebImageDownloaderOperation.m
│ │ ├── SDWebImageFrame.h
│ │ ├── SDWebImageFrame.m
│ │ ├── SDWebImageGIFCoder.h
│ │ ├── SDWebImageGIFCoder.m
│ │ ├── SDWebImageImageIOCoder.h
│ │ ├── SDWebImageImageIOCoder.m
│ │ ├── SDWebImageManager.h
│ │ ├── SDWebImageManager.m
│ │ ├── SDWebImageOperation.h
│ │ ├── SDWebImagePrefetcher.h
│ │ ├── SDWebImagePrefetcher.m
│ │ ├── SDWebImageTransition.h
│ │ ├── SDWebImageTransition.m
│ │ ├── UIButton+WebCache.h
│ │ ├── UIButton+WebCache.m
│ │ ├── UIImage+ForceDecode.h
│ │ ├── UIImage+ForceDecode.m
│ │ ├── UIImage+GIF.h
│ │ ├── UIImage+GIF.m
│ │ ├── UIImage+MultiFormat.h
│ │ ├── UIImage+MultiFormat.m
│ │ ├── UIImageView+HighlightedWebCache.h
│ │ ├── UIImageView+HighlightedWebCache.m
│ │ ├── UIImageView+WebCache.h
│ │ ├── UIImageView+WebCache.m
│ │ ├── UIView+WebCache.h
│ │ ├── UIView+WebCache.m
│ │ ├── UIView+WebCacheOperation.h
│ │ └── UIView+WebCacheOperation.m
│ └── Target Support Files
│ ├── Pods-MDShockBannerViewOCDemo
│ ├── Info.plist
│ ├── Pods-MDShockBannerViewOCDemo-acknowledgements.markdown
│ ├── Pods-MDShockBannerViewOCDemo-acknowledgements.plist
│ ├── Pods-MDShockBannerViewOCDemo-dummy.m
│ ├── Pods-MDShockBannerViewOCDemo-frameworks.sh
│ ├── Pods-MDShockBannerViewOCDemo-resources.sh
│ ├── Pods-MDShockBannerViewOCDemo-umbrella.h
│ ├── Pods-MDShockBannerViewOCDemo.debug.xcconfig
│ ├── Pods-MDShockBannerViewOCDemo.modulemap
│ └── Pods-MDShockBannerViewOCDemo.release.xcconfig
│ └── SDWebImage
│ ├── Info.plist
│ ├── SDWebImage-dummy.m
│ ├── SDWebImage-prefix.pch
│ ├── SDWebImage-umbrella.h
│ ├── SDWebImage.modulemap
│ └── SDWebImage.xcconfig
├── MDShockBannerViewSwift
├── MDShockBannerView.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ └── contents.xcworkspacedata
├── MDShockBannerView.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── MDShockBannerView
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── banner1-bg.imageset
│ │ │ ├── 0banner1-bg@2x.png
│ │ │ ├── 0banner1-bg@3x.png
│ │ │ └── Contents.json
│ │ ├── banner1.imageset
│ │ │ ├── 0banner1-前@2x.png
│ │ │ ├── 0banner1-前@3x.png
│ │ │ └── Contents.json
│ │ ├── banner2-bg.imageset
│ │ │ ├── 0banner2-bg@2x.png
│ │ │ ├── 0banner2-bg@3x.png
│ │ │ └── Contents.json
│ │ ├── banner2.imageset
│ │ │ ├── 0banner2-前@2x.png
│ │ │ ├── 0banner2-前@3x.png
│ │ │ └── Contents.json
│ │ ├── banner_select.imageset
│ │ │ ├── 0banner-轮播-选@2x.png
│ │ │ ├── 0banner-轮播-选@3x.png
│ │ │ └── Contents.json
│ │ ├── banner_unselect.imageset
│ │ │ ├── 0banner-轮播-未选@2x.png
│ │ │ ├── 0banner-轮播-未选@3x.png
│ │ │ └── Contents.json
│ │ ├── home_banner_select.imageset
│ │ │ ├── Contents.json
│ │ │ ├── 轮播-选中@2x.png
│ │ │ └── 轮播-选中@3x.png
│ │ └── home_banner_unselect.imageset
│ │ │ ├── Contents.json
│ │ │ ├── 轮播-点@2x.png
│ │ │ └── 轮播-点@3x.png
│ ├── Base.lproj
│ │ └── LaunchScreen.storyboard
│ ├── Info.plist
│ ├── MDShockBanner
│ │ ├── MDBannerCollectionViewCell.swift
│ │ ├── MDBannerCollectionViewCell.xib
│ │ ├── MDBannerModel.swift
│ │ ├── MDMaskView.swift
│ │ ├── MDShockBannerView.swift
│ │ └── UIView+MDExtension.swift
│ ├── Main.storyboard
│ └── ViewController.swift
├── MDShockBannerViewTests
│ ├── Info.plist
│ └── MDShockBannerViewTests.swift
├── MDShockBannerViewUITests
│ ├── Info.plist
│ └── MDShockBannerViewUITests.swift
├── Podfile
├── Podfile.lock
└── Pods
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ └── project.pbxproj
│ ├── SDWebImage
│ ├── LICENSE
│ ├── README.md
│ └── SDWebImage
│ │ ├── NSButton+WebCache.h
│ │ ├── NSButton+WebCache.m
│ │ ├── NSData+ImageContentType.h
│ │ ├── NSData+ImageContentType.m
│ │ ├── NSImage+WebCache.h
│ │ ├── NSImage+WebCache.m
│ │ ├── SDAnimatedImageRep.h
│ │ ├── SDAnimatedImageRep.m
│ │ ├── SDImageCache.h
│ │ ├── SDImageCache.m
│ │ ├── SDImageCacheConfig.h
│ │ ├── SDImageCacheConfig.m
│ │ ├── SDWebImageCoder.h
│ │ ├── SDWebImageCoder.m
│ │ ├── SDWebImageCoderHelper.h
│ │ ├── SDWebImageCoderHelper.m
│ │ ├── SDWebImageCodersManager.h
│ │ ├── SDWebImageCodersManager.m
│ │ ├── SDWebImageCompat.h
│ │ ├── SDWebImageCompat.m
│ │ ├── SDWebImageDownloader.h
│ │ ├── SDWebImageDownloader.m
│ │ ├── SDWebImageDownloaderOperation.h
│ │ ├── SDWebImageDownloaderOperation.m
│ │ ├── SDWebImageFrame.h
│ │ ├── SDWebImageFrame.m
│ │ ├── SDWebImageGIFCoder.h
│ │ ├── SDWebImageGIFCoder.m
│ │ ├── SDWebImageImageIOCoder.h
│ │ ├── SDWebImageImageIOCoder.m
│ │ ├── SDWebImageManager.h
│ │ ├── SDWebImageManager.m
│ │ ├── SDWebImageOperation.h
│ │ ├── SDWebImagePrefetcher.h
│ │ ├── SDWebImagePrefetcher.m
│ │ ├── SDWebImageTransition.h
│ │ ├── SDWebImageTransition.m
│ │ ├── UIButton+WebCache.h
│ │ ├── UIButton+WebCache.m
│ │ ├── UIImage+ForceDecode.h
│ │ ├── UIImage+ForceDecode.m
│ │ ├── UIImage+GIF.h
│ │ ├── UIImage+GIF.m
│ │ ├── UIImage+MultiFormat.h
│ │ ├── UIImage+MultiFormat.m
│ │ ├── UIImageView+HighlightedWebCache.h
│ │ ├── UIImageView+HighlightedWebCache.m
│ │ ├── UIImageView+WebCache.h
│ │ ├── UIImageView+WebCache.m
│ │ ├── UIView+WebCache.h
│ │ ├── UIView+WebCache.m
│ │ ├── UIView+WebCacheOperation.h
│ │ └── UIView+WebCacheOperation.m
│ └── Target Support Files
│ ├── Pods-MDShockBannerView
│ ├── Info.plist
│ ├── Pods-MDShockBannerView-acknowledgements.markdown
│ ├── Pods-MDShockBannerView-acknowledgements.plist
│ ├── Pods-MDShockBannerView-dummy.m
│ ├── Pods-MDShockBannerView-frameworks.sh
│ ├── Pods-MDShockBannerView-resources.sh
│ ├── Pods-MDShockBannerView-umbrella.h
│ ├── Pods-MDShockBannerView.debug.xcconfig
│ ├── Pods-MDShockBannerView.modulemap
│ └── Pods-MDShockBannerView.release.xcconfig
│ └── SDWebImage
│ ├── Info.plist
│ ├── SDWebImage-dummy.m
│ ├── SDWebImage-prefix.pch
│ ├── SDWebImage-umbrella.h
│ ├── SDWebImage.modulemap
│ └── SDWebImage.xcconfig
├── README.md
└── demo.gif
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.html linguist-language=swift
2 | *.java linguist-language=swift
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 | libs/
9 |
10 | ## Various settings
11 | *.pbxuser
12 | !default.pbxuser
13 | *.mode1v3
14 | !default.mode1v3
15 | *.mode2v3
16 | !default.mode2v3
17 | *.perspectivev3
18 | !default.perspectivev3
19 | xcuserdata/
20 |
21 | ## Other
22 | *.moved-aside
23 | *.xcuserstate
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 |
29 | ## Playgrounds
30 | timeline.xctimeline
31 | playground.xcworkspace
32 |
33 | # Swift Package Manager
34 | #
35 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
36 | # Packages/
37 | .build/
38 |
39 | # CocoaPods
40 | #
41 | # We recommend against adding the Pods directory to your .gitignore. However
42 | # you should judge for yourself, the pros and cons are mentioned at:
43 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
44 | #
45 | # Pods/
46 |
47 | # Carthage
48 | #
49 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
50 | # Carthage/Checkouts
51 |
52 | Carthage/Build
53 |
54 | # fastlane
55 | #
56 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
57 | # screenshots whenever they are needed.
58 | # For more information about the recommended setup visit:
59 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
60 |
61 | fastlane/report.xml
62 | fastlane/Preview.html
63 | fastlane/screenshots
64 | fastlane/test_output
65 |
--------------------------------------------------------------------------------
/AndroidDemo/banner.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/AndroidDemo/banner.zip
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/androidTest/java/com/youth/banner/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/BannerConfig.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner;
2 |
3 |
4 | public class BannerConfig {
5 | /**
6 | * indicator style
7 | */
8 | public static final int NOT_INDICATOR = 0;
9 | public static final int CIRCLE_INDICATOR = 1;
10 | public static final int NUM_INDICATOR = 2;
11 | public static final int NUM_INDICATOR_TITLE = 3;
12 | public static final int CIRCLE_INDICATOR_TITLE = 4;
13 | public static final int CIRCLE_INDICATOR_TITLE_INSIDE = 5;
14 | /**
15 | * indicator gravity
16 | */
17 | public static final int LEFT = 5;
18 | public static final int CENTER = 6;
19 | public static final int RIGHT = 7;
20 |
21 | /**
22 | * banner
23 | */
24 | public static final int PADDING_SIZE = 5;
25 | public static final int TIME = 2000;
26 | public static final int DURATION = 800;
27 | public static final boolean IS_AUTO_PLAY = true;
28 | public static final boolean IS_SCROLL = true;
29 |
30 | /**
31 | * title style
32 | */
33 | public static final int TITLE_BACKGROUND = -1;
34 | public static final int TITLE_HEIGHT = -1;
35 | public static final int TITLE_TEXT_COLOR = -1;
36 | public static final int TITLE_TEXT_SIZE = -1;
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/BannerEntity.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner;
2 |
3 | /**
4 | * 作者:HQY on 18/4/24 10:39
5 | * 邮箱:hqy_xz@126.com
6 | */
7 |
8 | public class BannerEntity {
9 |
10 | private String bg;
11 | private String img;
12 |
13 |
14 | public String getBg() {
15 | return bg == null ? "" : bg;
16 | }
17 |
18 | public void setBg(String bg) {
19 | this.bg = bg;
20 | }
21 |
22 | public String getImg() {
23 | return img == null ? "" : img;
24 | }
25 |
26 | public void setImg(String img) {
27 | this.img = img;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/BannerScroller.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner;
2 |
3 | import android.content.Context;
4 | import android.view.animation.Interpolator;
5 | import android.widget.Scroller;
6 |
7 | public class BannerScroller extends Scroller {
8 | private int mDuration = BannerConfig.DURATION;
9 |
10 | public BannerScroller(Context context) {
11 | super(context);
12 | }
13 |
14 | public BannerScroller(Context context, Interpolator interpolator) {
15 | super(context, interpolator);
16 | }
17 |
18 | public BannerScroller(Context context, Interpolator interpolator, boolean flywheel) {
19 | super(context, interpolator, flywheel);
20 | }
21 |
22 | @Override
23 | public void startScroll(int startX, int startY, int dx, int dy, int duration) {
24 | super.startScroll(startX, startY, dx, dy, mDuration);
25 | }
26 |
27 | @Override
28 | public void startScroll(int startX, int startY, int dx, int dy) {
29 | super.startScroll(startX, startY, dx, dy, mDuration);
30 | }
31 |
32 | public void setDuration(int time) {
33 | mDuration = time;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/Transformer.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner;
2 |
3 | import android.support.v4.view.ViewPager.PageTransformer;
4 |
5 | import com.youth.banner.transformer.AccordionTransformer;
6 | import com.youth.banner.transformer.BackgroundToForegroundTransformer;
7 | import com.youth.banner.transformer.CubeInTransformer;
8 | import com.youth.banner.transformer.CubeOutTransformer;
9 | import com.youth.banner.transformer.DefaultTransformer;
10 | import com.youth.banner.transformer.DepthPageTransformer;
11 | import com.youth.banner.transformer.FlipHorizontalTransformer;
12 | import com.youth.banner.transformer.FlipVerticalTransformer;
13 | import com.youth.banner.transformer.ForegroundToBackgroundTransformer;
14 | import com.youth.banner.transformer.RotateDownTransformer;
15 | import com.youth.banner.transformer.RotateUpTransformer;
16 | import com.youth.banner.transformer.ScaleInOutTransformer;
17 | import com.youth.banner.transformer.StackTransformer;
18 | import com.youth.banner.transformer.TabletTransformer;
19 | import com.youth.banner.transformer.ZoomInTransformer;
20 | import com.youth.banner.transformer.ZoomOutSlideTransformer;
21 | import com.youth.banner.transformer.ZoomOutTranformer;
22 |
23 | public class Transformer {
24 | public static Class extends PageTransformer> Default = DefaultTransformer.class;
25 | public static Class extends PageTransformer> Accordion = AccordionTransformer.class;
26 | public static Class extends PageTransformer> BackgroundToForeground = BackgroundToForegroundTransformer.class;
27 | public static Class extends PageTransformer> ForegroundToBackground = ForegroundToBackgroundTransformer.class;
28 | public static Class extends PageTransformer> CubeIn = CubeInTransformer.class;
29 | public static Class extends PageTransformer> CubeOut = CubeOutTransformer.class;
30 | public static Class extends PageTransformer> DepthPage = DepthPageTransformer.class;
31 | public static Class extends PageTransformer> FlipHorizontal = FlipHorizontalTransformer.class;
32 | public static Class extends PageTransformer> FlipVertical = FlipVerticalTransformer.class;
33 | public static Class extends PageTransformer> RotateDown = RotateDownTransformer.class;
34 | public static Class extends PageTransformer> RotateUp = RotateUpTransformer.class;
35 | public static Class extends PageTransformer> ScaleInOut = ScaleInOutTransformer.class;
36 | public static Class extends PageTransformer> Stack = StackTransformer.class;
37 | public static Class extends PageTransformer> Tablet = TabletTransformer.class;
38 | public static Class extends PageTransformer> ZoomIn = ZoomInTransformer.class;
39 | public static Class extends PageTransformer> ZoomOut = ZoomOutTranformer.class;
40 | public static Class extends PageTransformer> ZoomOutSlide = ZoomOutSlideTransformer.class;
41 | }
42 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/listener/OnBannerClickListener.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner.listener;
2 |
3 |
4 | /**
5 | * 旧版接口,由于返回的下标是从1开始,下标越界而废弃(因为有人使用所以不能直接删除)
6 | */
7 | @Deprecated
8 | public interface OnBannerClickListener {
9 | public void OnBannerClick(int position);
10 | }
11 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/listener/OnBannerListener.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner.listener;
2 |
3 | public interface OnBannerListener {
4 | public void OnBannerClick(int position);
5 | }
6 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/loader/ImageLoader.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner.loader;
2 |
3 | import android.content.Context;
4 | import android.widget.ImageView;
5 |
6 |
7 | public abstract class ImageLoader implements ImageLoaderInterface {
8 |
9 | @Override
10 | public ImageView createImageView(Context context) {
11 | ImageView imageView = new ImageView(context);
12 | return imageView;
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/loader/ImageLoaderInterface.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner.loader;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import java.io.Serializable;
7 |
8 |
9 | public interface ImageLoaderInterface extends Serializable {
10 |
11 | void displayImage(Context context, Object path, T imageView);
12 |
13 | T createImageView(Context context);
14 | }
15 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/AccordionTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class AccordionTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | view.setPivotX(position < 0 ? 0 : view.getWidth());
26 | view.setScaleX(position < 0 ? 1f + position : 1f - position);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/BackgroundToForegroundTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class BackgroundToForegroundTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | final float height = view.getHeight();
26 | final float width = view.getWidth();
27 | final float scale = min(position < 0 ? 1f : Math.abs(1f - position), 0.5f);
28 |
29 | view.setScaleX(scale);
30 | view.setScaleY(scale);
31 | view.setPivotX(width * 0.5f);
32 | view.setPivotY(height * 0.5f);
33 | view.setTranslationX(position < 0 ? width * position : -width * position * 0.25f);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/CubeInTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class CubeInTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | // Rotate the fragment on the left or right edge
26 | view.setPivotX(position > 0 ? 0 : view.getWidth());
27 | view.setPivotY(0);
28 | view.setRotationY(-90f * position);
29 | }
30 |
31 | @Override
32 | public boolean isPagingEnabled() {
33 | return true;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/CubeOutTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class CubeOutTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | view.setPivotX(position < 0f ? view.getWidth() : 0f);
26 | view.setPivotY(view.getHeight() * 0.5f);
27 | view.setRotationY(90f * position);
28 | }
29 |
30 | @Override
31 | public boolean isPagingEnabled() {
32 | return true;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/DefaultTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class DefaultTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 |
26 | }
27 |
28 | @Override
29 | public boolean isPagingEnabled() {
30 | return true;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/DepthPageTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class DepthPageTransformer extends ABaseTransformer {
22 |
23 | private static final float MIN_SCALE = 0.75f;
24 |
25 | @Override
26 | protected void onTransform(View view, float position) {
27 | if (position <= 0f) {
28 | view.setTranslationX(0f);
29 | view.setScaleX(1f);
30 | view.setScaleY(1f);
31 | } else if (position <= 1f) {
32 | final float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
33 | view.setAlpha(1 - position);
34 | view.setPivotY(0.5f * view.getHeight());
35 | view.setTranslationX(view.getWidth() * -position);
36 | view.setScaleX(scaleFactor);
37 | view.setScaleY(scaleFactor);
38 | }
39 | }
40 |
41 | @Override
42 | protected boolean isPagingEnabled() {
43 | return true;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/FlipHorizontalTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class FlipHorizontalTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | final float rotation = 180f * position;
26 |
27 | view.setAlpha(rotation > 90f || rotation < -90f ? 0 : 1);
28 | view.setPivotX(view.getWidth() * 0.5f);
29 | view.setPivotY(view.getHeight() * 0.5f);
30 | view.setRotationY(rotation);
31 | }
32 |
33 | @Override
34 | protected void onPostTransform(View page, float position) {
35 | super.onPostTransform(page, position);
36 |
37 | //resolve problem: new page can't handle click event!
38 | if (position > -0.5f && position < 0.5f) {
39 | page.setVisibility(View.VISIBLE);
40 | } else {
41 | page.setVisibility(View.INVISIBLE);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/FlipVerticalTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class FlipVerticalTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | final float rotation = -180f * position;
26 |
27 | view.setAlpha(rotation > 90f || rotation < -90f ? 0f : 1f);
28 | view.setPivotX(view.getWidth() * 0.5f);
29 | view.setPivotY(view.getHeight() * 0.5f);
30 | view.setRotationX(rotation);
31 | }
32 |
33 | @Override
34 | protected void onPostTransform(View page, float position) {
35 | super.onPostTransform(page, position);
36 |
37 | if (position > -0.5f && position < 0.5f) {
38 | page.setVisibility(View.VISIBLE);
39 | } else {
40 | page.setVisibility(View.INVISIBLE);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/ForegroundToBackgroundTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class ForegroundToBackgroundTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | final float height = view.getHeight();
26 | final float width = view.getWidth();
27 | final float scale = min(position > 0 ? 1f : Math.abs(1f + position), 0.5f);
28 |
29 | view.setScaleX(scale);
30 | view.setScaleY(scale);
31 | view.setPivotX(width * 0.5f);
32 | view.setPivotY(height * 0.5f);
33 | view.setTranslationX(position > 0 ? width * position : -width * position * 0.25f);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/RotateDownTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class RotateDownTransformer extends ABaseTransformer {
22 |
23 | private static final float ROT_MOD = -15f;
24 |
25 | @Override
26 | protected void onTransform(View view, float position) {
27 | final float width = view.getWidth();
28 | final float height = view.getHeight();
29 | final float rotation = ROT_MOD * position * -1.25f;
30 |
31 | view.setPivotX(width * 0.5f);
32 | view.setPivotY(height);
33 | view.setRotation(rotation);
34 | }
35 |
36 | @Override
37 | protected boolean isPagingEnabled() {
38 | return true;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/RotateUpTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class RotateUpTransformer extends ABaseTransformer {
22 |
23 | private static final float ROT_MOD = -15f;
24 |
25 | @Override
26 | protected void onTransform(View view, float position) {
27 | final float width = view.getWidth();
28 | final float rotation = ROT_MOD * position;
29 |
30 | view.setPivotX(width * 0.5f);
31 | view.setPivotY(0f);
32 | view.setTranslationX(0f);
33 | view.setRotation(rotation);
34 | }
35 |
36 | @Override
37 | protected boolean isPagingEnabled() {
38 | return true;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/ScaleInOutTransformer.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner.transformer;
2 |
3 | import android.view.View;
4 |
5 | public class ScaleInOutTransformer extends ABaseTransformer {
6 |
7 | @Override
8 | protected void onTransform(View view, float position) {
9 | view.setPivotX(position < 0 ? 0 : view.getWidth());
10 | view.setPivotY(view.getHeight() / 2f);
11 | float scale = position < 0 ? 1f + position : 1f - position;
12 | view.setScaleX(scale);
13 | view.setScaleY(scale);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/StackTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class StackTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | view.setTranslationX(position < 0 ? 0f : -view.getWidth() * position);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/TabletTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.graphics.Camera;
20 | import android.graphics.Matrix;
21 | import android.view.View;
22 |
23 | public class TabletTransformer extends ABaseTransformer {
24 |
25 | private static final Matrix OFFSET_MATRIX = new Matrix();
26 | private static final Camera OFFSET_CAMERA = new Camera();
27 | private static final float[] OFFSET_TEMP_FLOAT = new float[2];
28 |
29 | @Override
30 | protected void onTransform(View view, float position) {
31 | final float rotation = (position < 0 ? 30f : -30f) * Math.abs(position);
32 |
33 | view.setTranslationX(getOffsetXForRotation(rotation, view.getWidth(), view.getHeight()));
34 | view.setPivotX(view.getWidth() * 0.5f);
35 | view.setPivotY(0);
36 | view.setRotationY(rotation);
37 | }
38 |
39 | protected static final float getOffsetXForRotation(float degrees, int width, int height) {
40 | OFFSET_MATRIX.reset();
41 | OFFSET_CAMERA.save();
42 | OFFSET_CAMERA.rotateY(Math.abs(degrees));
43 | OFFSET_CAMERA.getMatrix(OFFSET_MATRIX);
44 | OFFSET_CAMERA.restore();
45 |
46 | OFFSET_MATRIX.preTranslate(-width * 0.5f, -height * 0.5f);
47 | OFFSET_MATRIX.postTranslate(width * 0.5f, height * 0.5f);
48 | OFFSET_TEMP_FLOAT[0] = width;
49 | OFFSET_TEMP_FLOAT[1] = height;
50 | OFFSET_MATRIX.mapPoints(OFFSET_TEMP_FLOAT);
51 | return (width - OFFSET_TEMP_FLOAT[0]) * (degrees > 0.0f ? 1.0f : -1.0f);
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/ZoomInTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class ZoomInTransformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | final float scale = position < 0 ? position + 1f : Math.abs(1f - position);
26 | view.setScaleX(scale);
27 | view.setScaleY(scale);
28 | view.setPivotX(view.getWidth() * 0.5f);
29 | view.setPivotY(view.getHeight() * 0.5f);
30 | view.setAlpha(position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/ZoomOutSlideTransformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class ZoomOutSlideTransformer extends ABaseTransformer {
22 |
23 | private static final float MIN_SCALE = 0.85f;
24 | private static final float MIN_ALPHA = 0.5f;
25 |
26 | @Override
27 | protected void onTransform(View view, float position) {
28 | if (position >= -1 || position <= 1) {
29 | // Modify the default slide transition to shrink the page as well
30 | final float height = view.getHeight();
31 | final float width = view.getWidth();
32 | final float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
33 | final float vertMargin = height * (1 - scaleFactor) / 2;
34 | final float horzMargin = width * (1 - scaleFactor) / 2;
35 |
36 | // Center vertically
37 | view.setPivotY(0.5f * height);
38 | view.setPivotX(0.5f * width);
39 |
40 | if (position < 0) {
41 | view.setTranslationX(horzMargin - vertMargin / 2);
42 | } else {
43 | view.setTranslationX(-horzMargin + vertMargin / 2);
44 | }
45 |
46 | // Scale the page down (between MIN_SCALE and 1)
47 | view.setScaleX(scaleFactor);
48 | view.setScaleY(scaleFactor);
49 |
50 | // Fade the page relative to its size.
51 | view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));
52 | }
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/transformer/ZoomOutTranformer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Toxic Bakery
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.youth.banner.transformer;
18 |
19 | import android.view.View;
20 |
21 | public class ZoomOutTranformer extends ABaseTransformer {
22 |
23 | @Override
24 | protected void onTransform(View view, float position) {
25 | final float scale = 1f + Math.abs(position);
26 | view.setScaleX(scale);
27 | view.setScaleY(scale);
28 | view.setPivotX(view.getWidth() * 0.5f);
29 | view.setPivotY(view.getHeight() * 0.5f);
30 | view.setAlpha(position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
31 | if(position == -1){
32 | view.setTranslationX(view.getWidth() * -1);
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/java/com/youth/banner/view/BannerViewPager.java:
--------------------------------------------------------------------------------
1 | package com.youth.banner.view;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.ViewPager;
5 | import android.util.AttributeSet;
6 | import android.view.MotionEvent;
7 |
8 |
9 | public class BannerViewPager extends ViewPager {
10 | private boolean scrollable = true;
11 |
12 | public BannerViewPager(Context context) {
13 | super(context);
14 | }
15 |
16 | public BannerViewPager(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | @Override
21 | public boolean onTouchEvent(MotionEvent ev) {
22 | if(this.scrollable) {
23 | if (getCurrentItem() == 0 && getChildCount() == 0) {
24 | return false;
25 | }
26 | return super.onTouchEvent(ev);
27 | } else {
28 | return false;
29 | }
30 | }
31 |
32 | @Override
33 | public boolean onInterceptTouchEvent(MotionEvent ev) {
34 | if(this.scrollable) {
35 | if (getCurrentItem() == 0 && getChildCount() == 0) {
36 | return false;
37 | }
38 | return super.onInterceptTouchEvent(ev);
39 | } else {
40 | return false;
41 | }
42 | }
43 |
44 | public void setScrollable(boolean scrollable) {
45 | this.scrollable = scrollable;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/animator/scale_with_alpha.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
16 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/drawable/banner_select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewAndroid/banner/src/main/res/drawable/banner_select.png
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/drawable/banner_unselect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewAndroid/banner/src/main/res/drawable/banner_unselect.png
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/drawable/black.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/drawable/black_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/drawable/blue.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/drawable/gray_radius.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/drawable/no_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewAndroid/banner/src/main/res/drawable/no_banner.png
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/drawable/white_radius.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/values/attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/MDShockBannerViewAndroid/banner/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 |
24 | - (void)applicationWillResignActive:(UIApplication *)application {
25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
27 | }
28 |
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
38 | }
39 |
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
43 | }
44 |
45 |
46 | - (void)applicationWillTerminate:(UIApplication *)application {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_select.imageset/0banner-轮播-选@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_select.imageset/0banner-轮播-选@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_select.imageset/0banner-轮播-选@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_select.imageset/0banner-轮播-选@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_select.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "0banner-轮播-选@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "0banner-轮播-选@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_unselect.imageset/0banner-轮播-未选@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_unselect.imageset/0banner-轮播-未选@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_unselect.imageset/0banner-轮播-未选@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_unselect.imageset/0banner-轮播-未选@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Assets.xcassets/home_banner_unselect.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "0banner-轮播-未选@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "0banner-轮播-未选@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSAppTransportSecurity
6 |
7 | NSAllowsArbitraryLoads
8 |
9 |
10 | CFBundleDevelopmentRegion
11 | $(DEVELOPMENT_LANGUAGE)
12 | CFBundleExecutable
13 | $(EXECUTABLE_NAME)
14 | CFBundleIdentifier
15 | $(PRODUCT_BUNDLE_IDENTIFIER)
16 | CFBundleInfoDictionaryVersion
17 | 6.0
18 | CFBundleName
19 | $(PRODUCT_NAME)
20 | CFBundlePackageType
21 | APPL
22 | CFBundleShortVersionString
23 | 1.0
24 | CFBundleVersion
25 | 1
26 | LSRequiresIPhoneOS
27 |
28 | UILaunchStoryboardName
29 | LaunchScreen
30 | UIMainStoryboardFile
31 | Main
32 | UIRequiredDeviceCapabilities
33 |
34 | armv7
35 |
36 | UISupportedInterfaceOrientations
37 |
38 | UIInterfaceOrientationPortrait
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UISupportedInterfaceOrientations~ipad
43 |
44 | UIInterfaceOrientationPortrait
45 | UIInterfaceOrientationPortraitUpsideDown
46 | UIInterfaceOrientationLandscapeLeft
47 | UIInterfaceOrientationLandscapeRight
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/MDBannerCollectionViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // MDBannerCollectionViewCell.h
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MDBannerCollectionViewCell : UICollectionViewCell
12 | @property (weak, nonatomic) IBOutlet UIImageView *i_img;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/MDBannerCollectionViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // MDBannerCollectionViewCell.m
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import "MDBannerCollectionViewCell.h"
10 |
11 | @implementation MDBannerCollectionViewCell
12 |
13 | - (void)awakeFromNib {
14 | [super awakeFromNib];
15 | // Initialization code
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/MDBannerCollectionViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/MDBannerModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // MDBannerModel.h
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MDBannerModel : NSObject
12 | @property(nonatomic,strong)NSString *url;
13 | @property(nonatomic,strong)NSString *img;
14 | @property(nonatomic,strong)NSString *bgImg;
15 | @end
16 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/MDBannerModel.m:
--------------------------------------------------------------------------------
1 |
2 | //
3 | // MDBannerModel.m
4 | // MDShockBannerViewOCDemo
5 | //
6 | // Created by Alan on 2018/4/27.
7 | // Copyright © 2018年 MD. All rights reserved.
8 | //
9 |
10 | #import "MDBannerModel.h"
11 |
12 | @implementation MDBannerModel
13 |
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/MDMaskView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MDMaskView.h
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef enum : NSUInteger {
12 | MDBannerSrollDirectionUnknow,
13 | MDBannerSrollDirectionLeft,
14 | MDBannerSrollDirectionRight,
15 | } MDBannerSrollDirection;
16 |
17 | @interface MDMaskView : UIView
18 |
19 | -(void)setRadius:(CGFloat)radius direction:(MDBannerSrollDirection)dir;
20 | @end
21 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/MDMaskView.m:
--------------------------------------------------------------------------------
1 | //
2 | // MDMaskView.m
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import "MDMaskView.h"
10 |
11 |
12 | @interface MDMaskView()
13 |
14 | @property (assign, readonly, nonatomic) CGFloat maskRadius;
15 |
16 | @property (assign, readonly, nonatomic) MDBannerSrollDirection direction;
17 |
18 | @end
19 |
20 | @implementation MDMaskView
21 |
22 | -(void)setRadius:(CGFloat)radius direction:(MDBannerSrollDirection)dir{
23 | _maskRadius = radius;
24 | _direction = dir;
25 |
26 | if (_direction != MDBannerSrollDirectionUnknow) {
27 | [self setNeedsDisplay];
28 | }
29 |
30 | }
31 |
32 |
33 | // Only override drawRect: if you perform custom drawing.
34 | // An empty implementation adversely affects performance during animation.
35 | - (void)drawRect:(CGRect)rect {
36 | self.backgroundColor = [UIColor clearColor];
37 | if (_direction != MDBannerSrollDirectionUnknow) {
38 | CGContextRef ctx = UIGraphicsGetCurrentContext();
39 | if (_direction == MDBannerSrollDirectionLeft){
40 | CGContextAddArc(ctx, self.center.x + rect.size.width/2, self.center.y, _maskRadius, 0, M_PI * 2, NO);
41 | }else{
42 | CGContextAddArc(ctx, self.center.x - rect.size.width/2, self.center.y, _maskRadius, 0, M_PI * 2, NO);
43 | }
44 | CGContextSetFillColorWithColor(ctx, [[UIColor whiteColor] CGColor]);
45 | CGContextFillPath(ctx);
46 | // CGContextRelease(ctx);
47 | }
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/MDShockBannerView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MDShockBannerView.h
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @protocol MDShockBannerViewDelegate
13 |
14 | - (void)clickBanner:(NSInteger)index;
15 |
16 |
17 | @end
18 |
19 | @interface MDShockBannerView : UIView
20 |
21 | @property(nonatomic, assign) BOOL infiniteLoop;
22 |
23 | @property(nonatomic, assign) BOOL autoScroll;
24 |
25 | @property(nonatomic, assign) double scrollInterval;
26 |
27 | @property(nonatomic, strong) UIImage *pageSelectImage;
28 |
29 | @property(nonatomic, strong) UIImage *pageUnselectImage;
30 |
31 |
32 | @property(nonatomic, strong) NSArray *banners;
33 |
34 |
35 |
36 |
37 |
38 | @property(nonatomic, weak) id delegate;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/MDShockBanner/UIView+MD.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+MD.h
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIView (MD)
12 | /**
13 | * 1.间隔X值
14 | */
15 | @property (nonatomic, assign) CGFloat x;
16 |
17 | /**
18 | * 2.间隔Y值
19 | */
20 | @property (nonatomic, assign) CGFloat y;
21 |
22 | /**
23 | * 3.宽度
24 | */
25 | @property (nonatomic, assign) CGFloat width;
26 |
27 | /**
28 | * 4.高度
29 | */
30 | @property (nonatomic, assign) CGFloat height;
31 |
32 | /**
33 | * 5.中心点X值
34 | */
35 | @property (nonatomic, assign) CGFloat centerX;
36 |
37 | /**
38 | * 6.中心点Y值
39 | */
40 | @property (nonatomic, assign) CGFloat centerY;
41 |
42 | /**
43 | * 7.尺寸大小
44 | */
45 | @property (nonatomic, assign) CGSize size;
46 |
47 | /**
48 | * 8.起始点
49 | */
50 | @property (nonatomic, assign) CGPoint origin;
51 |
52 | /**
53 | * 9.上 < Shortcut for frame.origin.y
54 | */
55 | @property (nonatomic) CGFloat top;
56 |
57 | /**
58 | * 10.下 < Shortcut for frame.origin.y + frame.size.height
59 | */
60 | @property (nonatomic) CGFloat bottom;
61 |
62 | /**
63 | * 11.左 < Shortcut for frame.origin.x.
64 | */
65 | @property (nonatomic) CGFloat left;
66 |
67 | /**
68 | * 12.右 < Shortcut for frame.origin.x + frame.size.width
69 | */
70 | @property (nonatomic) CGFloat right;
71 |
72 |
73 | /**
74 | * 1.添加边框
75 | *
76 | * @param color <#color description#>
77 | */
78 | - (void)addBorderColor:(UIColor *)color;
79 |
80 | /**
81 | * 2.UIView 的点击事件
82 | *
83 | * @param target 目标
84 | * @param action 事件
85 | */
86 |
87 | - (void)addTarget:(id)target
88 | action:(SEL)action;
89 | @end
90 |
91 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | #import "MDShockBannerView.h"
12 | #import "MDBannerModel.h"
13 |
14 | @interface ViewController ()
15 |
16 | @end
17 |
18 | @implementation ViewController
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 |
23 | MDShockBannerView *banner = [[MDShockBannerView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.width * 47 / 75)];
24 | banner.delegate = self;
25 | banner.pageSelectImage = [UIImage imageNamed:@"home_banner_select"];
26 | banner.pageUnselectImage = [UIImage imageNamed:@"home_banner_unselect"];
27 | MDBannerModel *model1 = [[MDBannerModel alloc] init];
28 | model1.img = @"http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180417/6265b5b9bf8686f009cf44c366cfa4abd26b1a79.png";
29 | model1.bgImg = @"http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180417/9bc42ce40490c854eab2e9969ac8e328caab0a17.png";
30 |
31 | MDBannerModel *model2 = [[MDBannerModel alloc] init];
32 | model2.img = @"http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180417/16f7ab6124ae4688f0adef43ff3ab3b1f09ccc67.png";
33 | model2.bgImg = @"http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180417/81e9ad49cba8dc479a09d146a1fabf4b9ef3504d.png";
34 |
35 |
36 | banner.banners = @[model1,model2];
37 |
38 | [self.view addSubview:banner];
39 | // Do any additional setup after loading the view, typically from a nib.
40 | }
41 |
42 | -(void)clickBanner:(NSInteger)index{
43 | NSLog(@"点击了第%ld个banner",index);
44 | }
45 |
46 | - (void)didReceiveMemoryWarning {
47 | [super didReceiveMemoryWarning];
48 | // Dispose of any resources that can be recreated.
49 | }
50 |
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // MDShockBannerViewOCDemo
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemoUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/MDShockBannerViewOCDemoUITests/MDShockBannerViewOCDemoUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // MDShockBannerViewOCDemoUITests.m
3 | // MDShockBannerViewOCDemoUITests
4 | //
5 | // Created by Alan on 2018/4/27.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MDShockBannerViewOCDemoUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation MDShockBannerViewOCDemoUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | platform :ios, ‘8.0’
3 |
4 | target 'MDShockBannerViewOCDemo' do
5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
6 | use_frameworks!
7 |
8 | pod 'SDWebImage’
9 |
10 |
11 |
12 | end
13 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SDWebImage (4.3.3):
3 | - SDWebImage/Core (= 4.3.3)
4 | - SDWebImage/Core (4.3.3)
5 |
6 | DEPENDENCIES:
7 | - SDWebImage
8 |
9 | SPEC CHECKSUMS:
10 | SDWebImage: de4d90b5bff3571eae7bd16202b1f43135409fa5
11 |
12 | PODFILE CHECKSUM: ed856319e9cbab487cf10d002e2bb5cba821b772
13 |
14 | COCOAPODS: 1.3.1
15 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SDWebImage (4.3.3):
3 | - SDWebImage/Core (= 4.3.3)
4 | - SDWebImage/Core (4.3.3)
5 |
6 | DEPENDENCIES:
7 | - SDWebImage
8 |
9 | SPEC CHECKSUMS:
10 | SDWebImage: de4d90b5bff3571eae7bd16202b1f43135409fa5
11 |
12 | PODFILE CHECKSUM: ed856319e9cbab487cf10d002e2bb5cba821b772
13 |
14 | COCOAPODS: 1.3.1
15 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Fabrice Aneche
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import
11 | #import "SDWebImageCompat.h"
12 |
13 | typedef NS_ENUM(NSInteger, SDImageFormat) {
14 | SDImageFormatUndefined = -1,
15 | SDImageFormatJPEG = 0,
16 | SDImageFormatPNG,
17 | SDImageFormatGIF,
18 | SDImageFormatTIFF,
19 | SDImageFormatWebP,
20 | SDImageFormatHEIC
21 | };
22 |
23 | @interface NSData (ImageContentType)
24 |
25 | /**
26 | * Return image format
27 | *
28 | * @param data the input image data
29 | *
30 | * @return the image format as `SDImageFormat` (enum)
31 | */
32 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data;
33 |
34 | /**
35 | Convert SDImageFormat to UTType
36 |
37 | @param format Format as SDImageFormat
38 | @return The UTType as CFStringRef
39 | */
40 | + (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/NSImage+WebCache.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if SD_MAC
12 |
13 | #import
14 |
15 | @interface NSImage (WebCache)
16 |
17 | - (CGImageRef)CGImage;
18 | - (NSArray *)images;
19 | - (BOOL)isGIF;
20 |
21 | @end
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/NSImage+WebCache.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "NSImage+WebCache.h"
10 |
11 | #if SD_MAC
12 |
13 | @implementation NSImage (WebCache)
14 |
15 | - (CGImageRef)CGImage {
16 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
17 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil];
18 | return cgImage;
19 | }
20 |
21 | - (NSArray *)images {
22 | return nil;
23 | }
24 |
25 | - (BOOL)isGIF {
26 | BOOL isGIF = NO;
27 | for (NSImageRep *rep in self.representations) {
28 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
29 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
30 | NSUInteger frameCount = [[bitmapRep valueForProperty:NSImageFrameCount] unsignedIntegerValue];
31 | isGIF = frameCount > 1 ? YES : NO;
32 | break;
33 | }
34 | }
35 | return isGIF;
36 | }
37 |
38 | @end
39 |
40 | #endif
41 |
42 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDAnimatedImageRep.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if SD_MAC
12 |
13 | // A subclass of `NSBitmapImageRep` to fix that GIF loop count issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`.
14 | // Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDWebImageImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image.
15 |
16 | @interface SDAnimatedImageRep : NSBitmapImageRep
17 |
18 | @end
19 |
20 | #endif
21 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDAnimatedImageRep.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDAnimatedImageRep.h"
10 |
11 | #if SD_MAC
12 |
13 | #import "SDWebImageGIFCoder.h"
14 |
15 | @interface SDWebImageGIFCoder ()
16 |
17 | - (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source;
18 |
19 | @end
20 |
21 | @interface SDAnimatedImageRep ()
22 |
23 | @property (nonatomic, assign, readonly, nullable) CGImageSourceRef imageSource;
24 |
25 | @end
26 |
27 | @implementation SDAnimatedImageRep
28 |
29 | // `NSBitmapImageRep` will use `kCGImagePropertyGIFDelayTime` whenever you call `setProperty:withValue:` with `NSImageCurrentFrame` to change the current frame. We override it and use the actual `kCGImagePropertyGIFUnclampedDelayTime` if need.
30 | - (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value {
31 | [super setProperty:property withValue:value];
32 | if ([property isEqualToString:NSImageCurrentFrame]) {
33 | // Access the image source
34 | CGImageSourceRef imageSource = self.imageSource;
35 | if (!imageSource) {
36 | return;
37 | }
38 | // Check format type
39 | CFStringRef type = CGImageSourceGetType(imageSource);
40 | if (!type) {
41 | return;
42 | }
43 | NSUInteger index = [value unsignedIntegerValue];
44 | float frameDuration = 0;
45 | // Through we currently process GIF only, in the 5.x we support APNG so we keep the extensibility
46 | if (CFStringCompare(type, kUTTypeGIF, 0) == kCFCompareEqualTo) {
47 | frameDuration = [[SDWebImageGIFCoder sharedCoder] sd_frameDurationAtIndex:index source:imageSource];
48 | }
49 | if (!frameDuration) {
50 | return;
51 | }
52 | // Reset super frame duration with the actual frame duration
53 | [super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)];
54 | }
55 | }
56 |
57 | - (CGImageSourceRef)imageSource {
58 | if (_tiffData) {
59 | return (__bridge CGImageSourceRef)(_tiffData);
60 | }
61 | return NULL;
62 | }
63 |
64 | @end
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | @interface SDImageCacheConfig : NSObject
13 |
14 | /**
15 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory.
16 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption.
17 | */
18 | @property (assign, nonatomic) BOOL shouldDecompressImages;
19 |
20 | /**
21 | * disable iCloud backup [defaults to YES]
22 | */
23 | @property (assign, nonatomic) BOOL shouldDisableiCloud;
24 |
25 | /**
26 | * use memory cache [defaults to YES]
27 | */
28 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory;
29 |
30 | /**
31 | * The reading options while reading cache from disk.
32 | * Defaults to 0. You can set this to `NSDataReadingMappedIfSafe` to improve performance.
33 | */
34 | @property (assign, nonatomic) NSDataReadingOptions diskCacheReadingOptions;
35 |
36 | /**
37 | * The writing options while writing cache to disk.
38 | * Defaults to `NSDataWritingAtomic`. You can set this to `NSDataWritingWithoutOverwriting` to prevent overwriting an existing file.
39 | */
40 | @property (assign, nonatomic) NSDataWritingOptions diskCacheWritingOptions;
41 |
42 | /**
43 | * The maximum length of time to keep an image in the cache, in seconds.
44 | */
45 | @property (assign, nonatomic) NSInteger maxCacheAge;
46 |
47 | /**
48 | * The maximum size of the cache, in bytes.
49 | */
50 | @property (assign, nonatomic) NSUInteger maxCacheSize;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDImageCacheConfig.h"
10 |
11 | static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week
12 |
13 | @implementation SDImageCacheConfig
14 |
15 | - (instancetype)init {
16 | if (self = [super init]) {
17 | _shouldDecompressImages = YES;
18 | _shouldDisableiCloud = YES;
19 | _shouldCacheImagesInMemory = YES;
20 | _diskCacheReadingOptions = 0;
21 | _diskCacheWritingOptions = NSDataWritingAtomic;
22 | _maxCacheAge = kDefaultCacheMaxCacheAge;
23 | _maxCacheSize = 0;
24 | }
25 | return self;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageCoder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCoder.h"
10 |
11 | NSString * const SDWebImageCoderScaleDownLargeImagesKey = @"scaleDownLargeImages";
12 |
13 | CGColorSpaceRef SDCGColorSpaceGetDeviceRGB(void) {
14 | static CGColorSpaceRef colorSpace;
15 | static dispatch_once_t onceToken;
16 | dispatch_once(&onceToken, ^{
17 | colorSpace = CGColorSpaceCreateDeviceRGB();
18 | });
19 | return colorSpace;
20 | }
21 |
22 | BOOL SDCGImageRefContainsAlpha(CGImageRef imageRef) {
23 | if (!imageRef) {
24 | return NO;
25 | }
26 | CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef);
27 | BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone ||
28 | alphaInfo == kCGImageAlphaNoneSkipFirst ||
29 | alphaInfo == kCGImageAlphaNoneSkipLast);
30 | return hasAlpha;
31 | }
32 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageCoderHelper.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 | #import "SDWebImageFrame.h"
12 |
13 | @interface SDWebImageCoderHelper : NSObject
14 |
15 | /**
16 | Return an animated image with frames array.
17 | For UIKit, this will apply the patch and then create animated UIImage. The patch is because that `+[UIImage animatedImageWithImages:duration:]` just use the average of duration for each image. So it will not work if different frame has different duration. Therefore we repeat the specify frame for specify times to let it work.
18 | For AppKit, NSImage does not support animates other than GIF. This will try to encode the frames to GIF format and then create an animated NSImage for rendering. Attention the animated image may loss some detail if the input frames contain full alpha channel because GIF only supports 1 bit alpha channel. (For 1 pixel, either transparent or not)
19 |
20 | @param frames The frames array. If no frames or frames is empty, return nil
21 | @return A animated image for rendering on UIImageView(UIKit) or NSImageView(AppKit)
22 | */
23 | + (UIImage * _Nullable)animatedImageWithFrames:(NSArray * _Nullable)frames;
24 |
25 | /**
26 | Return frames array from an animated image.
27 | For UIKit, this will unapply the patch for the description above and then create frames array. This will also work for normal animated UIImage.
28 | For AppKit, NSImage does not support animates other than GIF. This will try to decode the GIF imageRep and then create frames array.
29 |
30 | @param animatedImage A animated image. If it's not animated, return nil
31 | @return The frames array
32 | */
33 | + (NSArray * _Nullable)framesFromAnimatedImage:(UIImage * _Nullable)animatedImage;
34 |
35 | #if SD_UIKIT || SD_WATCH
36 | /**
37 | Convert an EXIF image orientation to an iOS one.
38 |
39 | @param exifOrientation EXIF orientation
40 | @return iOS orientation
41 | */
42 | + (UIImageOrientation)imageOrientationFromEXIFOrientation:(NSInteger)exifOrientation;
43 | /**
44 | Convert an iOS orientation to an EXIF image orientation.
45 |
46 | @param imageOrientation iOS orientation
47 | @return EXIF orientation
48 | */
49 | + (NSInteger)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation;
50 | #endif
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageCodersManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCoder.h"
11 |
12 | /**
13 | Global object holding the array of coders, so that we avoid passing them from object to object.
14 | Uses a priority queue behind scenes, which means the latest added coders have the highest priority.
15 | This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data.
16 | That way, users can add their custom coders while preserving our existing prebuilt ones
17 |
18 | Note: the `coders` getter will return the coders in their reversed order
19 | Example:
20 | - by default we internally set coders = `IOCoder`, `WebPCoder`. (`GIFCoder` is not recommended to add only if you want to get GIF support without `FLAnimatedImage`)
21 | - calling `coders` will return `@[WebPCoder, IOCoder]`
22 | - call `[addCoder:[MyCrazyCoder new]]`
23 | - calling `coders` now returns `@[MyCrazyCoder, WebPCoder, IOCoder]`
24 |
25 | Coders
26 | ------
27 | A coder must conform to the `SDWebImageCoder` protocol or even to `SDWebImageProgressiveCoder` if it supports progressive decoding
28 | Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat`
29 | Those methods are called on each coder in the array (using the priority order) until one of them returns YES.
30 | That means that coder can decode that data / encode to that format
31 | */
32 | @interface SDWebImageCodersManager : NSObject
33 |
34 | /**
35 | Shared reusable instance
36 | */
37 | + (nonnull instancetype)sharedInstance;
38 |
39 | /**
40 | All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority
41 | */
42 | @property (nonatomic, strong, readwrite, nullable) NSArray* coders;
43 |
44 | /**
45 | Add a new coder to the end of coders array. Which has the highest priority.
46 |
47 | @param coder coder
48 | */
49 | - (void)addCoder:(nonnull id)coder;
50 |
51 | /**
52 | Remove a coder in the coders array.
53 |
54 | @param coder coder
55 | */
56 | - (void)removeCoder:(nonnull id)coder;
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageCompat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Jamie Pinkham
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import
11 |
12 | #ifdef __OBJC_GC__
13 | #error SDWebImage does not support Objective-C Garbage Collection
14 | #endif
15 |
16 | // Apple's defines from TargetConditionals.h are a bit weird.
17 | // Seems like TARGET_OS_MAC is always defined (on all platforms).
18 | // To determine if we are running on OSX, we can only rely on TARGET_OS_IPHONE=0 and all the other platforms
19 | #if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH
20 | #define SD_MAC 1
21 | #else
22 | #define SD_MAC 0
23 | #endif
24 |
25 | // iOS and tvOS are very similar, UIKit exists on both platforms
26 | // Note: watchOS also has UIKit, but it's very limited
27 | #if TARGET_OS_IOS || TARGET_OS_TV
28 | #define SD_UIKIT 1
29 | #else
30 | #define SD_UIKIT 0
31 | #endif
32 |
33 | #if TARGET_OS_IOS
34 | #define SD_IOS 1
35 | #else
36 | #define SD_IOS 0
37 | #endif
38 |
39 | #if TARGET_OS_TV
40 | #define SD_TV 1
41 | #else
42 | #define SD_TV 0
43 | #endif
44 |
45 | #if TARGET_OS_WATCH
46 | #define SD_WATCH 1
47 | #else
48 | #define SD_WATCH 0
49 | #endif
50 |
51 |
52 | #if SD_MAC
53 | #import
54 | #ifndef UIImage
55 | #define UIImage NSImage
56 | #endif
57 | #ifndef UIImageView
58 | #define UIImageView NSImageView
59 | #endif
60 | #ifndef UIView
61 | #define UIView NSView
62 | #endif
63 | #else
64 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
65 | #error SDWebImage doesn't support Deployment Target version < 5.0
66 | #endif
67 |
68 | #if SD_UIKIT
69 | #import
70 | #endif
71 | #if SD_WATCH
72 | #import
73 | #endif
74 | #endif
75 |
76 | #ifndef NS_ENUM
77 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
78 | #endif
79 |
80 | #ifndef NS_OPTIONS
81 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
82 | #endif
83 |
84 | FOUNDATION_EXPORT UIImage *SDScaledImageForKey(NSString *key, UIImage *image);
85 |
86 | typedef void(^SDWebImageNoParamsBlock)(void);
87 |
88 | FOUNDATION_EXPORT NSString *const SDWebImageErrorDomain;
89 |
90 | #ifndef dispatch_queue_async_safe
91 | #define dispatch_queue_async_safe(queue, block)\
92 | if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(queue)) == 0) {\
93 | block();\
94 | } else {\
95 | dispatch_async(queue, block);\
96 | }
97 | #endif
98 |
99 | #ifndef dispatch_main_async_safe
100 | #define dispatch_main_async_safe(block) dispatch_queue_async_safe(dispatch_get_main_queue(), block)
101 | #endif
102 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 | #import "UIImage+MultiFormat.h"
11 |
12 | #if !__has_feature(objc_arc)
13 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
14 | #endif
15 |
16 | #if !OS_OBJECT_USE_OBJC
17 | #error SDWebImage need ARC for dispatch object
18 | #endif
19 |
20 | inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) {
21 | if (!image) {
22 | return nil;
23 | }
24 |
25 | #if SD_MAC
26 | return image;
27 | #elif SD_UIKIT || SD_WATCH
28 | if ((image.images).count > 0) {
29 | NSMutableArray *scaledImages = [NSMutableArray array];
30 |
31 | for (UIImage *tempImage in image.images) {
32 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)];
33 | }
34 |
35 | UIImage *animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration];
36 | if (animatedImage) {
37 | animatedImage.sd_imageLoopCount = image.sd_imageLoopCount;
38 | }
39 | return animatedImage;
40 | } else {
41 | #if SD_WATCH
42 | if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) {
43 | #elif SD_UIKIT
44 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
45 | #endif
46 | CGFloat scale = 1;
47 | if (key.length >= 8) {
48 | NSRange range = [key rangeOfString:@"@2x."];
49 | if (range.location != NSNotFound) {
50 | scale = 2.0;
51 | }
52 |
53 | range = [key rangeOfString:@"@3x."];
54 | if (range.location != NSNotFound) {
55 | scale = 3.0;
56 | }
57 | }
58 |
59 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];
60 | image = scaledImage;
61 | }
62 | return image;
63 | }
64 | #endif
65 | }
66 |
67 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain";
68 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageFrame.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | @interface SDWebImageFrame : NSObject
13 |
14 | // This class is used for creating animated images via `animatedImageWithFrames` in `SDWebImageCoderHelper`. Attention if you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+MultiFormat`.
15 |
16 | /**
17 | The image of current frame. You should not set an animated image.
18 | */
19 | @property (nonatomic, strong, readonly, nonnull) UIImage *image;
20 | /**
21 | The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero.
22 | */
23 | @property (nonatomic, readonly, assign) NSTimeInterval duration;
24 |
25 | /**
26 | Create a frame instance with specify image and duration
27 |
28 | @param image current frame's image
29 | @param duration current frame's duration
30 | @return frame instance
31 | */
32 | + (instancetype _Nonnull)frameWithImage:(UIImage * _Nonnull)image duration:(NSTimeInterval)duration;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageFrame.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageFrame.h"
10 |
11 | @interface SDWebImageFrame ()
12 |
13 | @property (nonatomic, strong, readwrite, nonnull) UIImage *image;
14 | @property (nonatomic, readwrite, assign) NSTimeInterval duration;
15 |
16 | @end
17 |
18 | @implementation SDWebImageFrame
19 |
20 | + (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration {
21 | SDWebImageFrame *frame = [[SDWebImageFrame alloc] init];
22 | frame.image = image;
23 | frame.duration = duration;
24 |
25 | return frame;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageGIFCoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCoder.h"
11 |
12 | /**
13 | Built in coder using ImageIO that supports GIF encoding/decoding
14 | @note `SDWebImageIOCoder` supports GIF but only as static (will use the 1st frame).
15 | @note Use `SDWebImageGIFCoder` for fully animated GIFs - less performant than `FLAnimatedImage`
16 | @note If you decide to make all `UIImageView`(including `FLAnimatedImageView`) instance support GIF. You should add this coder to `SDWebImageCodersManager` and make sure that it has a higher priority than `SDWebImageIOCoder`
17 | @note The recommended approach for animated GIFs is using `FLAnimatedImage`. It's more performant than `UIImageView` for GIF displaying
18 | */
19 | @interface SDWebImageGIFCoder : NSObject
20 |
21 | + (nonnull instancetype)sharedCoder;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageImageIOCoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCoder.h"
11 |
12 | /**
13 | Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding.
14 |
15 | GIF
16 | Also supports static GIF (meaning will only handle the 1st frame).
17 | For a full GIF support, we recommend `FLAnimatedImage` or our less performant `SDWebImageGIFCoder`
18 |
19 | HEIC
20 | This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf
21 | Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13)
22 | Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU))
23 | Encode(Software): macOS 10.13
24 | Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU))
25 | */
26 | @interface SDWebImageImageIOCoder : NSObject
27 |
28 | + (nonnull instancetype)sharedCoder;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/SDWebImageOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 |
11 | @protocol SDWebImageOperation
12 |
13 | - (void)cancel;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIImage+ForceDecode.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | @interface UIImage (ForceDecode)
12 |
13 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image;
14 |
15 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIImage+ForceDecode.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIImage+ForceDecode.h"
10 | #import "SDWebImageCodersManager.h"
11 |
12 | @implementation UIImage (ForceDecode)
13 |
14 | + (UIImage *)decodedImageWithImage:(UIImage *)image {
15 | if (!image) {
16 | return nil;
17 | }
18 | NSData *tempData;
19 | return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(NO)}];
20 | }
21 |
22 | + (UIImage *)decodedAndScaledDownImageWithImage:(UIImage *)image {
23 | if (!image) {
24 | return nil;
25 | }
26 | NSData *tempData;
27 | return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(YES)}];
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIImage+GIF.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Laurin Brandner
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import "SDWebImageCompat.h"
11 |
12 | @interface UIImage (GIF)
13 |
14 | /**
15 | * Creates an animated UIImage from an NSData.
16 | * For static GIF, will create an UIImage with `images` array set to nil. For animated GIF, will create an UIImage with valid `images` array.
17 | */
18 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data;
19 |
20 | /**
21 | * Checks if an UIImage instance is a GIF. Will use the `images` array.
22 | */
23 | - (BOOL)isGIF;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIImage+GIF.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Laurin Brandner
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import "UIImage+GIF.h"
11 | #import "SDWebImageGIFCoder.h"
12 | #import "NSImage+WebCache.h"
13 |
14 | @implementation UIImage (GIF)
15 |
16 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data {
17 | if (!data) {
18 | return nil;
19 | }
20 | return [[SDWebImageGIFCoder sharedCoder] decodedImageWithData:data];
21 | }
22 |
23 | - (BOOL)isGIF {
24 | return (self.images != nil);
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 | #import "NSData+ImageContentType.h"
11 |
12 | @interface UIImage (MultiFormat)
13 |
14 | /**
15 | * UIKit:
16 | * For static image format, this value is always 0.
17 | * For animated image format, 0 means infinite looping.
18 | * Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.
19 | * AppKit:
20 | * NSImage currently only support animated via GIF imageRep unlike UIImage.
21 | * The getter of this property will get the loop count from GIF imageRep
22 | * The setter of this property will set the loop count from GIF imageRep
23 | */
24 | @property (nonatomic, assign) NSUInteger sd_imageLoopCount;
25 |
26 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data;
27 | - (nullable NSData *)sd_imageData;
28 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIImage+MultiFormat.h"
10 |
11 | #import "objc/runtime.h"
12 | #import "SDWebImageCodersManager.h"
13 |
14 | @implementation UIImage (MultiFormat)
15 |
16 | #if SD_MAC
17 | - (NSUInteger)sd_imageLoopCount {
18 | NSUInteger imageLoopCount = 0;
19 | for (NSImageRep *rep in self.representations) {
20 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
21 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
22 | imageLoopCount = [[bitmapRep valueForProperty:NSImageLoopCount] unsignedIntegerValue];
23 | break;
24 | }
25 | }
26 | return imageLoopCount;
27 | }
28 |
29 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
30 | for (NSImageRep *rep in self.representations) {
31 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
32 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
33 | [bitmapRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)];
34 | break;
35 | }
36 | }
37 | }
38 |
39 | #else
40 |
41 | - (NSUInteger)sd_imageLoopCount {
42 | NSUInteger imageLoopCount = 0;
43 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount));
44 | if ([value isKindOfClass:[NSNumber class]]) {
45 | imageLoopCount = value.unsignedIntegerValue;
46 | }
47 | return imageLoopCount;
48 | }
49 |
50 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
51 | NSNumber *value = @(sd_imageLoopCount);
52 | objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
53 | }
54 | #endif
55 |
56 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data {
57 | return [[SDWebImageCodersManager sharedInstance] decodedImageWithData:data];
58 | }
59 |
60 | - (nullable NSData *)sd_imageData {
61 | return [self sd_imageDataAsFormat:SDImageFormatUndefined];
62 | }
63 |
64 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat {
65 | NSData *imageData = nil;
66 | if (self) {
67 | imageData = [[SDWebImageCodersManager sharedInstance] encodedDataWithImage:self format:imageFormat];
68 | }
69 | return imageData;
70 | }
71 |
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIImageView+HighlightedWebCache.h"
10 |
11 | #if SD_UIKIT
12 |
13 | #import "UIView+WebCacheOperation.h"
14 | #import "UIView+WebCache.h"
15 |
16 | @implementation UIImageView (HighlightedWebCache)
17 |
18 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url {
19 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil];
20 | }
21 |
22 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options {
23 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil];
24 | }
25 |
26 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock {
27 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock];
28 | }
29 |
30 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {
31 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock];
32 | }
33 |
34 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url
35 | options:(SDWebImageOptions)options
36 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
37 | completed:(nullable SDExternalCompletionBlock)completedBlock {
38 | __weak typeof(self)weakSelf = self;
39 | [self sd_internalSetImageWithURL:url
40 | placeholderImage:nil
41 | options:options
42 | operationKey:@"UIImageViewImageOperationHighlighted"
43 | setImageBlock:^(UIImage *image, NSData *imageData) {
44 | weakSelf.highlightedImage = image;
45 | }
46 | progress:progressBlock
47 | completed:completedBlock];
48 | }
49 |
50 | @end
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if SD_UIKIT || SD_MAC
12 |
13 | #import "SDWebImageManager.h"
14 |
15 | // These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external.
16 | // All the stored operations are weak, so it will be dalloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them.
17 | @interface UIView (WebCacheOperation)
18 |
19 | /**
20 | * Set the image load operation (storage in a UIView based weak map table)
21 | *
22 | * @param operation the operation
23 | * @param key key for storing the operation
24 | */
25 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key;
26 |
27 | /**
28 | * Cancel all operations for the current UIView and key
29 | *
30 | * @param key key for identifying the operations
31 | */
32 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key;
33 |
34 | /**
35 | * Just remove the operations corresponding to the current UIView and key without cancelling them
36 | *
37 | * @param key key for identifying the operations
38 | */
39 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key;
40 |
41 | @end
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIView+WebCacheOperation.h"
10 |
11 | #if SD_UIKIT || SD_MAC
12 |
13 | #import "objc/runtime.h"
14 |
15 | static char loadOperationKey;
16 |
17 | // key is copy, value is weak because operation instance is retained by SDWebImageManager's runningOperations property
18 | // we should use lock to keep thread-safe because these method may not be acessed from main queue
19 | typedef NSMapTable> SDOperationsDictionary;
20 |
21 | @implementation UIView (WebCacheOperation)
22 |
23 | - (SDOperationsDictionary *)sd_operationDictionary {
24 | @synchronized(self) {
25 | SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey);
26 | if (operations) {
27 | return operations;
28 | }
29 | operations = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0];
30 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
31 | return operations;
32 | }
33 | }
34 |
35 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key {
36 | if (key) {
37 | [self sd_cancelImageLoadOperationWithKey:key];
38 | if (operation) {
39 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];
40 | @synchronized (self) {
41 | [operationDictionary setObject:operation forKey:key];
42 | }
43 | }
44 | }
45 | }
46 |
47 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key {
48 | // Cancel in progress downloader from queue
49 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];
50 | id operation;
51 | @synchronized (self) {
52 | operation = [operationDictionary objectForKey:key];
53 | }
54 | if (operation) {
55 | if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]){
56 | [operation cancel];
57 | }
58 | @synchronized (self) {
59 | [operationDictionary removeObjectForKey:key];
60 | }
61 | }
62 | }
63 |
64 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key {
65 | if (key) {
66 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];
67 | @synchronized (self) {
68 | [operationDictionary removeObjectForKey:key];
69 | }
70 | }
71 | }
72 |
73 | @end
74 |
75 | #endif
76 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/Pods-MDShockBannerViewOCDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/Pods-MDShockBannerViewOCDemo/Pods-MDShockBannerViewOCDemo-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## SDWebImage
5 |
6 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is furnished
13 | to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in all
16 | copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 |
27 | Generated by CocoaPods - https://cocoapods.org
28 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/Pods-MDShockBannerViewOCDemo/Pods-MDShockBannerViewOCDemo-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is furnished
24 | to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in all
27 | copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35 | THE SOFTWARE.
36 |
37 |
38 | License
39 | MIT
40 | Title
41 | SDWebImage
42 | Type
43 | PSGroupSpecifier
44 |
45 |
46 | FooterText
47 | Generated by CocoaPods - https://cocoapods.org
48 | Title
49 |
50 | Type
51 | PSGroupSpecifier
52 |
53 |
54 | StringsTable
55 | Acknowledgements
56 | Title
57 | Acknowledgements
58 |
59 |
60 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/Pods-MDShockBannerViewOCDemo/Pods-MDShockBannerViewOCDemo-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_MDShockBannerViewOCDemo : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_MDShockBannerViewOCDemo
5 | @end
6 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/Pods-MDShockBannerViewOCDemo/Pods-MDShockBannerViewOCDemo-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_MDShockBannerViewOCDemoVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_MDShockBannerViewOCDemoVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/Pods-MDShockBannerViewOCDemo/Pods-MDShockBannerViewOCDemo.debug.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SDWebImage"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/Pods-MDShockBannerViewOCDemo/Pods-MDShockBannerViewOCDemo.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_MDShockBannerViewOCDemo {
2 | umbrella header "Pods-MDShockBannerViewOCDemo-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/Pods-MDShockBannerViewOCDemo/Pods-MDShockBannerViewOCDemo.release.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SDWebImage"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/SDWebImage/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 4.3.3
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SDWebImage : NSObject
3 | @end
4 | @implementation PodsDummy_SDWebImage
5 | @end
6 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 | #import "NSButton+WebCache.h"
14 | #import "NSData+ImageContentType.h"
15 | #import "NSImage+WebCache.h"
16 | #import "SDAnimatedImageRep.h"
17 | #import "SDImageCache.h"
18 | #import "SDImageCacheConfig.h"
19 | #import "SDWebImageCoder.h"
20 | #import "SDWebImageCoderHelper.h"
21 | #import "SDWebImageCodersManager.h"
22 | #import "SDWebImageCompat.h"
23 | #import "SDWebImageDownloader.h"
24 | #import "SDWebImageDownloaderOperation.h"
25 | #import "SDWebImageFrame.h"
26 | #import "SDWebImageGIFCoder.h"
27 | #import "SDWebImageImageIOCoder.h"
28 | #import "SDWebImageManager.h"
29 | #import "SDWebImageOperation.h"
30 | #import "SDWebImagePrefetcher.h"
31 | #import "SDWebImageTransition.h"
32 | #import "UIButton+WebCache.h"
33 | #import "UIImage+ForceDecode.h"
34 | #import "UIImage+GIF.h"
35 | #import "UIImage+MultiFormat.h"
36 | #import "UIImageView+HighlightedWebCache.h"
37 | #import "UIImageView+WebCache.h"
38 | #import "UIView+WebCache.h"
39 | #import "UIView+WebCacheOperation.h"
40 |
41 | FOUNDATION_EXPORT double SDWebImageVersionNumber;
42 | FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[];
43 |
44 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap:
--------------------------------------------------------------------------------
1 | framework module SDWebImage {
2 | umbrella header "SDWebImage-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/MDShockBannerViewOC/Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SDWebImage
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_LDFLAGS = -framework "ImageIO"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage
9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
10 | SKIP_INSTALL = YES
11 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // MDShockBannerView
4 | //
5 | // Created by Alan on 2018/4/18.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1-bg.imageset/0banner1-bg@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1-bg.imageset/0banner1-bg@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1-bg.imageset/0banner1-bg@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1-bg.imageset/0banner1-bg@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1-bg.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "0banner1-bg@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "0banner1-bg@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1.imageset/0banner1-前@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1.imageset/0banner1-前@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1.imageset/0banner1-前@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1.imageset/0banner1-前@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner1.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "0banner1-前@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "0banner1-前@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2-bg.imageset/0banner2-bg@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2-bg.imageset/0banner2-bg@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2-bg.imageset/0banner2-bg@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2-bg.imageset/0banner2-bg@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2-bg.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "0banner2-bg@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "0banner2-bg@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2.imageset/0banner2-前@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2.imageset/0banner2-前@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2.imageset/0banner2-前@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2.imageset/0banner2-前@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner2.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "0banner2-前@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "0banner2-前@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_select.imageset/0banner-轮播-选@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_select.imageset/0banner-轮播-选@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_select.imageset/0banner-轮播-选@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_select.imageset/0banner-轮播-选@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_select.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "0banner-轮播-选@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "0banner-轮播-选@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_unselect.imageset/0banner-轮播-未选@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_unselect.imageset/0banner-轮播-未选@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_unselect.imageset/0banner-轮播-未选@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_unselect.imageset/0banner-轮播-未选@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/banner_unselect.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "0banner-轮播-未选@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "0banner-轮播-未选@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_select.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "轮播-选中@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "轮播-选中@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_select.imageset/轮播-选中@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_select.imageset/轮播-选中@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_select.imageset/轮播-选中@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_select.imageset/轮播-选中@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_unselect.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "轮播-点@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "轮播-点@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_unselect.imageset/轮播-点@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_unselect.imageset/轮播-点@2x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_unselect.imageset/轮播-点@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/MDShockBannerViewSwift/MDShockBannerView/Assets.xcassets/home_banner_unselect.imageset/轮播-点@3x.png
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | NSAppTransportSecurity
45 |
46 | NSAllowsArbitraryLoads
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/MDShockBanner/MDBannerCollectionViewCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MDBannerCollectionViewCell.swift
3 | // MDShockAnimate
4 | //
5 | // Created by Alan on 2018/4/17.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class MDBannerCollectionViewCell: UICollectionViewCell {
12 |
13 | @IBOutlet weak var i_image: UIImageView!
14 | override func awakeFromNib() {
15 | super.awakeFromNib()
16 | // Initialization code
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/MDShockBanner/MDBannerCollectionViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/MDShockBanner/MDBannerModel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MDBannerModel.swift
3 | // MDShockAnimate
4 | //
5 | // Created by Alan on 2018/4/17.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class MDBannerModel: NSObject {
12 |
13 | var url:String?
14 | var img:String?
15 | var bgImg:String?
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/MDShockBanner/MDMaskView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MDMaskView.swift
3 | // MDShockAnimate
4 | //
5 | // Created by Alan on 2018/4/17.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | enum MDBannerSrollDirection {
12 | case unknow
13 | case left
14 | case right
15 | }
16 |
17 | class MDMaskView: UIView {
18 |
19 | // Only override draw() if you perform custom drawing.
20 | // An empty implementation adversely affects performance during animation.
21 |
22 | var maskRadius:CGFloat = 0
23 | var direction:MDBannerSrollDirection = .unknow
24 | func setRadius(radius:CGFloat,direction:MDBannerSrollDirection){
25 | self.maskRadius = radius
26 | self.direction = direction
27 | if self.direction != .unknow{
28 | self.setNeedsDisplay()
29 | }
30 |
31 | }
32 |
33 | override func draw(_ rect: CGRect) {
34 | self.backgroundColor = .clear
35 | if direction != .unknow{
36 | let ctx = UIGraphicsGetCurrentContext()
37 | if direction == .left{
38 | ctx?.addArc(center: CGPoint(x: self.center.x + rect.width/2, y: self.center.y), radius: maskRadius, startAngle: 0, endAngle: .pi * 2, clockwise: false)
39 | }else{
40 | ctx?.addArc(center: CGPoint(x: self.center.x - rect.width/2, y: self.center.y), radius: maskRadius, startAngle: 0, endAngle: .pi * 2, clockwise: false)
41 | }
42 | ctx?.setFillColor(UIColor.white.cgColor)
43 | ctx?.fillPath()
44 | }
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/MDShockBanner/UIView+MDExtension.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+MDExtension.swift
3 | // MDStarCircle
4 | //
5 | // Created by Alan on 2018/2/5.
6 | //
7 |
8 | import UIKit
9 |
10 | extension UIView {
11 |
12 | var x : CGFloat {
13 | set {
14 | var frame = self.frame
15 | frame.origin.x = newValue
16 | self.frame = frame
17 | }
18 |
19 | get {
20 | return self.frame.origin.x
21 | }
22 | }
23 |
24 | var y : CGFloat {
25 | set {
26 | var frame = self.frame
27 | frame.origin.y = y
28 | self.frame = frame
29 | }
30 |
31 | get {
32 | return self.frame.origin.y
33 | }
34 | }
35 |
36 | var width : CGFloat {
37 | set {
38 | var frame = self.frame
39 | frame.size.width = newValue
40 | self.frame = frame
41 | }
42 |
43 | get {
44 | return self.frame.size.width
45 | }
46 | }
47 |
48 | var height : CGFloat {
49 | set {
50 | var frame = self.frame
51 | frame.size.height = newValue
52 | self.frame = frame
53 | }
54 |
55 | get {
56 | return self.frame.size.height
57 | }
58 | }
59 |
60 | var size : CGSize {
61 | set {
62 | var frame = self.frame
63 | frame.size = size
64 | self.frame = frame
65 | }
66 |
67 | get {
68 | return self.frame.size
69 | }
70 | }
71 |
72 | var centerX : CGFloat {
73 | set {
74 | var center = self.center
75 | center.x = newValue
76 | self.center = center
77 | }
78 |
79 | get {
80 | return self.center.x
81 | }
82 | }
83 |
84 | var centerY : CGFloat {
85 | set {
86 | var center = self.center
87 | center.y = centerY
88 | self.center = center
89 | }
90 |
91 | get {
92 | return self.center.y
93 | }
94 | }
95 |
96 | func borderWidth(borderWidth:CGFloat) {
97 | if (borderWidth < 0) {
98 | return
99 | }
100 | self.layer.borderWidth = borderWidth
101 | }
102 |
103 | func borderColor(borderColor:CGColor) {
104 | self.layer.borderColor = borderColor
105 | }
106 |
107 | var cornerRadius : CGFloat {
108 | set {
109 | self.layer.cornerRadius = newValue;
110 | self.layer.masksToBounds = true;
111 | }
112 |
113 | get {
114 | return self.layer.cornerRadius
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerView/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // MDShockAnimate
4 | //
5 | // Created by Alan on 2018/4/17.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController,UIScrollViewDelegate,MDShockBannerViewDelegate {
12 |
13 |
14 | var banner:MDShockBannerView?
15 |
16 |
17 | override func viewWillAppear(_ animated: Bool) {
18 | super.viewWillAppear(animated)
19 | banner?.adjustWhenControllerViewWillAppera()
20 | }
21 |
22 | override func viewDidLoad() {
23 | super.viewDidLoad()
24 |
25 | banner = MDShockBannerView.init(frame: CGRect(x: 0, y: 0, width: mainW, height: mainW * 47 / 75))
26 | banner?.selectImage = #imageLiteral(resourceName: "home_banner_select")
27 | banner?.unselectImage = #imageLiteral(resourceName: "home_banner_unselect")
28 | banner?.delegate = self
29 |
30 | self.view.addSubview(banner!)
31 |
32 | DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+1.5) {
33 | self.setBanner()
34 | }
35 | // Do any additional setup after loading the view, typically from a nib.
36 | }
37 |
38 |
39 | func setBanner(){
40 | let model1 = MDBannerModel()
41 | model1.img = "http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180417/6265b5b9bf8686f009cf44c366cfa4abd26b1a79.png"
42 | model1.bgImg = "http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180417/9bc42ce40490c854eab2e9969ac8e328caab0a17.png"
43 |
44 |
45 | let model2 = MDBannerModel()
46 | model2.img = "http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180417/16f7ab6124ae4688f0adef43ff3ab3b1f09ccc67.png"
47 | model2.bgImg = "http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180417/81e9ad49cba8dc479a09d146a1fabf4b9ef3504d.png"
48 |
49 | let model3 = MDBannerModel()
50 | model3.img = "http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180605/5f9c08df32dc9ef8bc477a1d0ba33c47b6977df9.png"
51 | model3.bgImg = "http://md-juhe.oss-cn-hangzhou.aliyuncs.com/upload/ad/20180605/a14b5d38137e33e765f6f5174aa99f59b2c285cf.png"
52 |
53 | banner?.setBanner(banners: [model1,model2,model3])
54 |
55 | }
56 |
57 |
58 | func clickBanner(index: Int) {
59 | print(index)
60 | }
61 |
62 |
63 |
64 | override func didReceiveMemoryWarning() {
65 | super.didReceiveMemoryWarning()
66 | // Dispose of any resources that can be recreated.
67 | }
68 |
69 |
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerViewTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerViewTests/MDShockBannerViewTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MDShockBannerViewTests.swift
3 | // MDShockBannerViewTests
4 | //
5 | // Created by Alan on 2018/4/18.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import MDShockBannerView
11 |
12 | class MDShockBannerViewTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measure {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerViewUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/MDShockBannerViewUITests/MDShockBannerViewUITests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MDShockBannerViewUITests.swift
3 | // MDShockBannerViewUITests
4 | //
5 | // Created by Alan on 2018/4/18.
6 | // Copyright © 2018年 MD. All rights reserved.
7 | //
8 |
9 | import XCTest
10 |
11 | class MDShockBannerViewUITests: XCTestCase {
12 |
13 | override func setUp() {
14 | super.setUp()
15 |
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 |
18 | // In UI tests it is usually best to stop immediately when a failure occurs.
19 | continueAfterFailure = false
20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
21 | XCUIApplication().launch()
22 |
23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
24 | }
25 |
26 | override func tearDown() {
27 | // Put teardown code here. This method is called after the invocation of each test method in the class.
28 | super.tearDown()
29 | }
30 |
31 | func testExample() {
32 | // Use recording to get started writing UI tests.
33 | // Use XCTAssert and related functions to verify your tests produce the correct results.
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | platform :ios, ‘8.0’
3 |
4 | target 'MDShockBannerView' do
5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
6 | use_frameworks!
7 |
8 | pod 'SDWebImage’
9 |
10 | end
11 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SDWebImage (4.3.3):
3 | - SDWebImage/Core (= 4.3.3)
4 | - SDWebImage/Core (4.3.3)
5 |
6 | DEPENDENCIES:
7 | - SDWebImage
8 |
9 | SPEC CHECKSUMS:
10 | SDWebImage: de4d90b5bff3571eae7bd16202b1f43135409fa5
11 |
12 | PODFILE CHECKSUM: f2f5dc444154ba7b1172de802fd8c77c685e6437
13 |
14 | COCOAPODS: 1.3.1
15 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SDWebImage (4.3.3):
3 | - SDWebImage/Core (= 4.3.3)
4 | - SDWebImage/Core (4.3.3)
5 |
6 | DEPENDENCIES:
7 | - SDWebImage
8 |
9 | SPEC CHECKSUMS:
10 | SDWebImage: de4d90b5bff3571eae7bd16202b1f43135409fa5
11 |
12 | PODFILE CHECKSUM: f2f5dc444154ba7b1172de802fd8c77c685e6437
13 |
14 | COCOAPODS: 1.3.1
15 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Fabrice Aneche
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import
11 | #import "SDWebImageCompat.h"
12 |
13 | typedef NS_ENUM(NSInteger, SDImageFormat) {
14 | SDImageFormatUndefined = -1,
15 | SDImageFormatJPEG = 0,
16 | SDImageFormatPNG,
17 | SDImageFormatGIF,
18 | SDImageFormatTIFF,
19 | SDImageFormatWebP,
20 | SDImageFormatHEIC
21 | };
22 |
23 | @interface NSData (ImageContentType)
24 |
25 | /**
26 | * Return image format
27 | *
28 | * @param data the input image data
29 | *
30 | * @return the image format as `SDImageFormat` (enum)
31 | */
32 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data;
33 |
34 | /**
35 | Convert SDImageFormat to UTType
36 |
37 | @param format Format as SDImageFormat
38 | @return The UTType as CFStringRef
39 | */
40 | + (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/NSImage+WebCache.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if SD_MAC
12 |
13 | #import
14 |
15 | @interface NSImage (WebCache)
16 |
17 | - (CGImageRef)CGImage;
18 | - (NSArray *)images;
19 | - (BOOL)isGIF;
20 |
21 | @end
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/NSImage+WebCache.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "NSImage+WebCache.h"
10 |
11 | #if SD_MAC
12 |
13 | @implementation NSImage (WebCache)
14 |
15 | - (CGImageRef)CGImage {
16 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);
17 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil];
18 | return cgImage;
19 | }
20 |
21 | - (NSArray *)images {
22 | return nil;
23 | }
24 |
25 | - (BOOL)isGIF {
26 | BOOL isGIF = NO;
27 | for (NSImageRep *rep in self.representations) {
28 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
29 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
30 | NSUInteger frameCount = [[bitmapRep valueForProperty:NSImageFrameCount] unsignedIntegerValue];
31 | isGIF = frameCount > 1 ? YES : NO;
32 | break;
33 | }
34 | }
35 | return isGIF;
36 | }
37 |
38 | @end
39 |
40 | #endif
41 |
42 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDAnimatedImageRep.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if SD_MAC
12 |
13 | // A subclass of `NSBitmapImageRep` to fix that GIF loop count issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`.
14 | // Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDWebImageImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image.
15 |
16 | @interface SDAnimatedImageRep : NSBitmapImageRep
17 |
18 | @end
19 |
20 | #endif
21 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDAnimatedImageRep.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDAnimatedImageRep.h"
10 |
11 | #if SD_MAC
12 |
13 | #import "SDWebImageGIFCoder.h"
14 |
15 | @interface SDWebImageGIFCoder ()
16 |
17 | - (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source;
18 |
19 | @end
20 |
21 | @interface SDAnimatedImageRep ()
22 |
23 | @property (nonatomic, assign, readonly, nullable) CGImageSourceRef imageSource;
24 |
25 | @end
26 |
27 | @implementation SDAnimatedImageRep
28 |
29 | // `NSBitmapImageRep` will use `kCGImagePropertyGIFDelayTime` whenever you call `setProperty:withValue:` with `NSImageCurrentFrame` to change the current frame. We override it and use the actual `kCGImagePropertyGIFUnclampedDelayTime` if need.
30 | - (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value {
31 | [super setProperty:property withValue:value];
32 | if ([property isEqualToString:NSImageCurrentFrame]) {
33 | // Access the image source
34 | CGImageSourceRef imageSource = self.imageSource;
35 | if (!imageSource) {
36 | return;
37 | }
38 | // Check format type
39 | CFStringRef type = CGImageSourceGetType(imageSource);
40 | if (!type) {
41 | return;
42 | }
43 | NSUInteger index = [value unsignedIntegerValue];
44 | float frameDuration = 0;
45 | // Through we currently process GIF only, in the 5.x we support APNG so we keep the extensibility
46 | if (CFStringCompare(type, kUTTypeGIF, 0) == kCFCompareEqualTo) {
47 | frameDuration = [[SDWebImageGIFCoder sharedCoder] sd_frameDurationAtIndex:index source:imageSource];
48 | }
49 | if (!frameDuration) {
50 | return;
51 | }
52 | // Reset super frame duration with the actual frame duration
53 | [super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)];
54 | }
55 | }
56 |
57 | - (CGImageSourceRef)imageSource {
58 | if (_tiffData) {
59 | return (__bridge CGImageSourceRef)(_tiffData);
60 | }
61 | return NULL;
62 | }
63 |
64 | @end
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | @interface SDImageCacheConfig : NSObject
13 |
14 | /**
15 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory.
16 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption.
17 | */
18 | @property (assign, nonatomic) BOOL shouldDecompressImages;
19 |
20 | /**
21 | * disable iCloud backup [defaults to YES]
22 | */
23 | @property (assign, nonatomic) BOOL shouldDisableiCloud;
24 |
25 | /**
26 | * use memory cache [defaults to YES]
27 | */
28 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory;
29 |
30 | /**
31 | * The reading options while reading cache from disk.
32 | * Defaults to 0. You can set this to `NSDataReadingMappedIfSafe` to improve performance.
33 | */
34 | @property (assign, nonatomic) NSDataReadingOptions diskCacheReadingOptions;
35 |
36 | /**
37 | * The writing options while writing cache to disk.
38 | * Defaults to `NSDataWritingAtomic`. You can set this to `NSDataWritingWithoutOverwriting` to prevent overwriting an existing file.
39 | */
40 | @property (assign, nonatomic) NSDataWritingOptions diskCacheWritingOptions;
41 |
42 | /**
43 | * The maximum length of time to keep an image in the cache, in seconds.
44 | */
45 | @property (assign, nonatomic) NSInteger maxCacheAge;
46 |
47 | /**
48 | * The maximum size of the cache, in bytes.
49 | */
50 | @property (assign, nonatomic) NSUInteger maxCacheSize;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDImageCacheConfig.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDImageCacheConfig.h"
10 |
11 | static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week
12 |
13 | @implementation SDImageCacheConfig
14 |
15 | - (instancetype)init {
16 | if (self = [super init]) {
17 | _shouldDecompressImages = YES;
18 | _shouldDisableiCloud = YES;
19 | _shouldCacheImagesInMemory = YES;
20 | _diskCacheReadingOptions = 0;
21 | _diskCacheWritingOptions = NSDataWritingAtomic;
22 | _maxCacheAge = kDefaultCacheMaxCacheAge;
23 | _maxCacheSize = 0;
24 | }
25 | return self;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageCoder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCoder.h"
10 |
11 | NSString * const SDWebImageCoderScaleDownLargeImagesKey = @"scaleDownLargeImages";
12 |
13 | CGColorSpaceRef SDCGColorSpaceGetDeviceRGB(void) {
14 | static CGColorSpaceRef colorSpace;
15 | static dispatch_once_t onceToken;
16 | dispatch_once(&onceToken, ^{
17 | colorSpace = CGColorSpaceCreateDeviceRGB();
18 | });
19 | return colorSpace;
20 | }
21 |
22 | BOOL SDCGImageRefContainsAlpha(CGImageRef imageRef) {
23 | if (!imageRef) {
24 | return NO;
25 | }
26 | CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef);
27 | BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone ||
28 | alphaInfo == kCGImageAlphaNoneSkipFirst ||
29 | alphaInfo == kCGImageAlphaNoneSkipLast);
30 | return hasAlpha;
31 | }
32 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageCoderHelper.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 | #import "SDWebImageFrame.h"
12 |
13 | @interface SDWebImageCoderHelper : NSObject
14 |
15 | /**
16 | Return an animated image with frames array.
17 | For UIKit, this will apply the patch and then create animated UIImage. The patch is because that `+[UIImage animatedImageWithImages:duration:]` just use the average of duration for each image. So it will not work if different frame has different duration. Therefore we repeat the specify frame for specify times to let it work.
18 | For AppKit, NSImage does not support animates other than GIF. This will try to encode the frames to GIF format and then create an animated NSImage for rendering. Attention the animated image may loss some detail if the input frames contain full alpha channel because GIF only supports 1 bit alpha channel. (For 1 pixel, either transparent or not)
19 |
20 | @param frames The frames array. If no frames or frames is empty, return nil
21 | @return A animated image for rendering on UIImageView(UIKit) or NSImageView(AppKit)
22 | */
23 | + (UIImage * _Nullable)animatedImageWithFrames:(NSArray * _Nullable)frames;
24 |
25 | /**
26 | Return frames array from an animated image.
27 | For UIKit, this will unapply the patch for the description above and then create frames array. This will also work for normal animated UIImage.
28 | For AppKit, NSImage does not support animates other than GIF. This will try to decode the GIF imageRep and then create frames array.
29 |
30 | @param animatedImage A animated image. If it's not animated, return nil
31 | @return The frames array
32 | */
33 | + (NSArray * _Nullable)framesFromAnimatedImage:(UIImage * _Nullable)animatedImage;
34 |
35 | #if SD_UIKIT || SD_WATCH
36 | /**
37 | Convert an EXIF image orientation to an iOS one.
38 |
39 | @param exifOrientation EXIF orientation
40 | @return iOS orientation
41 | */
42 | + (UIImageOrientation)imageOrientationFromEXIFOrientation:(NSInteger)exifOrientation;
43 | /**
44 | Convert an iOS orientation to an EXIF image orientation.
45 |
46 | @param imageOrientation iOS orientation
47 | @return EXIF orientation
48 | */
49 | + (NSInteger)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation;
50 | #endif
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageCodersManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCoder.h"
11 |
12 | /**
13 | Global object holding the array of coders, so that we avoid passing them from object to object.
14 | Uses a priority queue behind scenes, which means the latest added coders have the highest priority.
15 | This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data.
16 | That way, users can add their custom coders while preserving our existing prebuilt ones
17 |
18 | Note: the `coders` getter will return the coders in their reversed order
19 | Example:
20 | - by default we internally set coders = `IOCoder`, `WebPCoder`. (`GIFCoder` is not recommended to add only if you want to get GIF support without `FLAnimatedImage`)
21 | - calling `coders` will return `@[WebPCoder, IOCoder]`
22 | - call `[addCoder:[MyCrazyCoder new]]`
23 | - calling `coders` now returns `@[MyCrazyCoder, WebPCoder, IOCoder]`
24 |
25 | Coders
26 | ------
27 | A coder must conform to the `SDWebImageCoder` protocol or even to `SDWebImageProgressiveCoder` if it supports progressive decoding
28 | Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat`
29 | Those methods are called on each coder in the array (using the priority order) until one of them returns YES.
30 | That means that coder can decode that data / encode to that format
31 | */
32 | @interface SDWebImageCodersManager : NSObject
33 |
34 | /**
35 | Shared reusable instance
36 | */
37 | + (nonnull instancetype)sharedInstance;
38 |
39 | /**
40 | All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority
41 | */
42 | @property (nonatomic, strong, readwrite, nullable) NSArray* coders;
43 |
44 | /**
45 | Add a new coder to the end of coders array. Which has the highest priority.
46 |
47 | @param coder coder
48 | */
49 | - (void)addCoder:(nonnull id)coder;
50 |
51 | /**
52 | Remove a coder in the coders array.
53 |
54 | @param coder coder
55 | */
56 | - (void)removeCoder:(nonnull id)coder;
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 | #import "UIImage+MultiFormat.h"
11 |
12 | #if !__has_feature(objc_arc)
13 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
14 | #endif
15 |
16 | #if !OS_OBJECT_USE_OBJC
17 | #error SDWebImage need ARC for dispatch object
18 | #endif
19 |
20 | inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) {
21 | if (!image) {
22 | return nil;
23 | }
24 |
25 | #if SD_MAC
26 | return image;
27 | #elif SD_UIKIT || SD_WATCH
28 | if ((image.images).count > 0) {
29 | NSMutableArray *scaledImages = [NSMutableArray array];
30 |
31 | for (UIImage *tempImage in image.images) {
32 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)];
33 | }
34 |
35 | UIImage *animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration];
36 | if (animatedImage) {
37 | animatedImage.sd_imageLoopCount = image.sd_imageLoopCount;
38 | }
39 | return animatedImage;
40 | } else {
41 | #if SD_WATCH
42 | if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) {
43 | #elif SD_UIKIT
44 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
45 | #endif
46 | CGFloat scale = 1;
47 | if (key.length >= 8) {
48 | NSRange range = [key rangeOfString:@"@2x."];
49 | if (range.location != NSNotFound) {
50 | scale = 2.0;
51 | }
52 |
53 | range = [key rangeOfString:@"@3x."];
54 | if (range.location != NSNotFound) {
55 | scale = 3.0;
56 | }
57 | }
58 |
59 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];
60 | image = scaledImage;
61 | }
62 | return image;
63 | }
64 | #endif
65 | }
66 |
67 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain";
68 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageFrame.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCompat.h"
11 |
12 | @interface SDWebImageFrame : NSObject
13 |
14 | // This class is used for creating animated images via `animatedImageWithFrames` in `SDWebImageCoderHelper`. Attention if you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+MultiFormat`.
15 |
16 | /**
17 | The image of current frame. You should not set an animated image.
18 | */
19 | @property (nonatomic, strong, readonly, nonnull) UIImage *image;
20 | /**
21 | The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero.
22 | */
23 | @property (nonatomic, readonly, assign) NSTimeInterval duration;
24 |
25 | /**
26 | Create a frame instance with specify image and duration
27 |
28 | @param image current frame's image
29 | @param duration current frame's duration
30 | @return frame instance
31 | */
32 | + (instancetype _Nonnull)frameWithImage:(UIImage * _Nonnull)image duration:(NSTimeInterval)duration;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageFrame.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageFrame.h"
10 |
11 | @interface SDWebImageFrame ()
12 |
13 | @property (nonatomic, strong, readwrite, nonnull) UIImage *image;
14 | @property (nonatomic, readwrite, assign) NSTimeInterval duration;
15 |
16 | @end
17 |
18 | @implementation SDWebImageFrame
19 |
20 | + (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration {
21 | SDWebImageFrame *frame = [[SDWebImageFrame alloc] init];
22 | frame.image = image;
23 | frame.duration = duration;
24 |
25 | return frame;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageGIFCoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCoder.h"
11 |
12 | /**
13 | Built in coder using ImageIO that supports GIF encoding/decoding
14 | @note `SDWebImageIOCoder` supports GIF but only as static (will use the 1st frame).
15 | @note Use `SDWebImageGIFCoder` for fully animated GIFs - less performant than `FLAnimatedImage`
16 | @note If you decide to make all `UIImageView`(including `FLAnimatedImageView`) instance support GIF. You should add this coder to `SDWebImageCodersManager` and make sure that it has a higher priority than `SDWebImageIOCoder`
17 | @note The recommended approach for animated GIFs is using `FLAnimatedImage`. It's more performant than `UIImageView` for GIF displaying
18 | */
19 | @interface SDWebImageGIFCoder : NSObject
20 |
21 | + (nonnull instancetype)sharedCoder;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageImageIOCoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageCoder.h"
11 |
12 | /**
13 | Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding.
14 |
15 | GIF
16 | Also supports static GIF (meaning will only handle the 1st frame).
17 | For a full GIF support, we recommend `FLAnimatedImage` or our less performant `SDWebImageGIFCoder`
18 |
19 | HEIC
20 | This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf
21 | Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13)
22 | Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU))
23 | Encode(Software): macOS 10.13
24 | Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU))
25 | */
26 | @interface SDWebImageImageIOCoder : NSObject
27 |
28 | + (nonnull instancetype)sharedCoder;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/SDWebImageOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 |
11 | @protocol SDWebImageOperation
12 |
13 | - (void)cancel;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIImage+ForceDecode.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | @interface UIImage (ForceDecode)
12 |
13 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image;
14 |
15 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIImage+ForceDecode.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIImage+ForceDecode.h"
10 | #import "SDWebImageCodersManager.h"
11 |
12 | @implementation UIImage (ForceDecode)
13 |
14 | + (UIImage *)decodedImageWithImage:(UIImage *)image {
15 | if (!image) {
16 | return nil;
17 | }
18 | NSData *tempData;
19 | return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(NO)}];
20 | }
21 |
22 | + (UIImage *)decodedAndScaledDownImageWithImage:(UIImage *)image {
23 | if (!image) {
24 | return nil;
25 | }
26 | NSData *tempData;
27 | return [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&tempData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(YES)}];
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIImage+GIF.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Laurin Brandner
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import "SDWebImageCompat.h"
11 |
12 | @interface UIImage (GIF)
13 |
14 | /**
15 | * Creates an animated UIImage from an NSData.
16 | * For static GIF, will create an UIImage with `images` array set to nil. For animated GIF, will create an UIImage with valid `images` array.
17 | */
18 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data;
19 |
20 | /**
21 | * Checks if an UIImage instance is a GIF. Will use the `images` array.
22 | */
23 | - (BOOL)isGIF;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIImage+GIF.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Laurin Brandner
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import "UIImage+GIF.h"
11 | #import "SDWebImageGIFCoder.h"
12 | #import "NSImage+WebCache.h"
13 |
14 | @implementation UIImage (GIF)
15 |
16 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data {
17 | if (!data) {
18 | return nil;
19 | }
20 | return [[SDWebImageGIFCoder sharedCoder] decodedImageWithData:data];
21 | }
22 |
23 | - (BOOL)isGIF {
24 | return (self.images != nil);
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 | #import "NSData+ImageContentType.h"
11 |
12 | @interface UIImage (MultiFormat)
13 |
14 | /**
15 | * UIKit:
16 | * For static image format, this value is always 0.
17 | * For animated image format, 0 means infinite looping.
18 | * Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.
19 | * AppKit:
20 | * NSImage currently only support animated via GIF imageRep unlike UIImage.
21 | * The getter of this property will get the loop count from GIF imageRep
22 | * The setter of this property will set the loop count from GIF imageRep
23 | */
24 | @property (nonatomic, assign) NSUInteger sd_imageLoopCount;
25 |
26 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data;
27 | - (nullable NSData *)sd_imageData;
28 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIImage+MultiFormat.h"
10 |
11 | #import "objc/runtime.h"
12 | #import "SDWebImageCodersManager.h"
13 |
14 | @implementation UIImage (MultiFormat)
15 |
16 | #if SD_MAC
17 | - (NSUInteger)sd_imageLoopCount {
18 | NSUInteger imageLoopCount = 0;
19 | for (NSImageRep *rep in self.representations) {
20 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
21 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
22 | imageLoopCount = [[bitmapRep valueForProperty:NSImageLoopCount] unsignedIntegerValue];
23 | break;
24 | }
25 | }
26 | return imageLoopCount;
27 | }
28 |
29 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
30 | for (NSImageRep *rep in self.representations) {
31 | if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
32 | NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
33 | [bitmapRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)];
34 | break;
35 | }
36 | }
37 | }
38 |
39 | #else
40 |
41 | - (NSUInteger)sd_imageLoopCount {
42 | NSUInteger imageLoopCount = 0;
43 | NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount));
44 | if ([value isKindOfClass:[NSNumber class]]) {
45 | imageLoopCount = value.unsignedIntegerValue;
46 | }
47 | return imageLoopCount;
48 | }
49 |
50 | - (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
51 | NSNumber *value = @(sd_imageLoopCount);
52 | objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
53 | }
54 | #endif
55 |
56 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data {
57 | return [[SDWebImageCodersManager sharedInstance] decodedImageWithData:data];
58 | }
59 |
60 | - (nullable NSData *)sd_imageData {
61 | return [self sd_imageDataAsFormat:SDImageFormatUndefined];
62 | }
63 |
64 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat {
65 | NSData *imageData = nil;
66 | if (self) {
67 | imageData = [[SDWebImageCodersManager sharedInstance] encodedDataWithImage:self format:imageFormat];
68 | }
69 | return imageData;
70 | }
71 |
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIImageView+HighlightedWebCache.h"
10 |
11 | #if SD_UIKIT
12 |
13 | #import "UIView+WebCacheOperation.h"
14 | #import "UIView+WebCache.h"
15 |
16 | @implementation UIImageView (HighlightedWebCache)
17 |
18 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url {
19 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil];
20 | }
21 |
22 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options {
23 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil];
24 | }
25 |
26 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock {
27 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock];
28 | }
29 |
30 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {
31 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock];
32 | }
33 |
34 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url
35 | options:(SDWebImageOptions)options
36 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
37 | completed:(nullable SDExternalCompletionBlock)completedBlock {
38 | __weak typeof(self)weakSelf = self;
39 | [self sd_internalSetImageWithURL:url
40 | placeholderImage:nil
41 | options:options
42 | operationKey:@"UIImageViewImageOperationHighlighted"
43 | setImageBlock:^(UIImage *image, NSData *imageData) {
44 | weakSelf.highlightedImage = image;
45 | }
46 | progress:progressBlock
47 | completed:completedBlock];
48 | }
49 |
50 | @end
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if SD_UIKIT || SD_MAC
12 |
13 | #import "SDWebImageManager.h"
14 |
15 | // These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external.
16 | // All the stored operations are weak, so it will be dalloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them.
17 | @interface UIView (WebCacheOperation)
18 |
19 | /**
20 | * Set the image load operation (storage in a UIView based weak map table)
21 | *
22 | * @param operation the operation
23 | * @param key key for storing the operation
24 | */
25 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key;
26 |
27 | /**
28 | * Cancel all operations for the current UIView and key
29 | *
30 | * @param key key for identifying the operations
31 | */
32 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key;
33 |
34 | /**
35 | * Just remove the operations corresponding to the current UIView and key without cancelling them
36 | *
37 | * @param key key for identifying the operations
38 | */
39 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key;
40 |
41 | @end
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIView+WebCacheOperation.h"
10 |
11 | #if SD_UIKIT || SD_MAC
12 |
13 | #import "objc/runtime.h"
14 |
15 | static char loadOperationKey;
16 |
17 | // key is copy, value is weak because operation instance is retained by SDWebImageManager's runningOperations property
18 | // we should use lock to keep thread-safe because these method may not be acessed from main queue
19 | typedef NSMapTable> SDOperationsDictionary;
20 |
21 | @implementation UIView (WebCacheOperation)
22 |
23 | - (SDOperationsDictionary *)sd_operationDictionary {
24 | @synchronized(self) {
25 | SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey);
26 | if (operations) {
27 | return operations;
28 | }
29 | operations = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0];
30 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
31 | return operations;
32 | }
33 | }
34 |
35 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key {
36 | if (key) {
37 | [self sd_cancelImageLoadOperationWithKey:key];
38 | if (operation) {
39 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];
40 | @synchronized (self) {
41 | [operationDictionary setObject:operation forKey:key];
42 | }
43 | }
44 | }
45 | }
46 |
47 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key {
48 | // Cancel in progress downloader from queue
49 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];
50 | id operation;
51 | @synchronized (self) {
52 | operation = [operationDictionary objectForKey:key];
53 | }
54 | if (operation) {
55 | if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]){
56 | [operation cancel];
57 | }
58 | @synchronized (self) {
59 | [operationDictionary removeObjectForKey:key];
60 | }
61 | }
62 | }
63 |
64 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key {
65 | if (key) {
66 | SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];
67 | @synchronized (self) {
68 | [operationDictionary removeObjectForKey:key];
69 | }
70 | }
71 | }
72 |
73 | @end
74 |
75 | #endif
76 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/Pods-MDShockBannerView/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/Pods-MDShockBannerView/Pods-MDShockBannerView-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## SDWebImage
5 |
6 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is furnished
13 | to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in all
16 | copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 |
27 | Generated by CocoaPods - https://cocoapods.org
28 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/Pods-MDShockBannerView/Pods-MDShockBannerView-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Copyright (c) 2009-2017 Olivier Poitrey rs@dailymotion.com
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is furnished
24 | to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in all
27 | copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35 | THE SOFTWARE.
36 |
37 |
38 | License
39 | MIT
40 | Title
41 | SDWebImage
42 | Type
43 | PSGroupSpecifier
44 |
45 |
46 | FooterText
47 | Generated by CocoaPods - https://cocoapods.org
48 | Title
49 |
50 | Type
51 | PSGroupSpecifier
52 |
53 |
54 | StringsTable
55 | Acknowledgements
56 | Title
57 | Acknowledgements
58 |
59 |
60 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/Pods-MDShockBannerView/Pods-MDShockBannerView-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_MDShockBannerView : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_MDShockBannerView
5 | @end
6 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/Pods-MDShockBannerView/Pods-MDShockBannerView-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_MDShockBannerViewVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_MDShockBannerViewVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/Pods-MDShockBannerView/Pods-MDShockBannerView.debug.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SDWebImage"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/Pods-MDShockBannerView/Pods-MDShockBannerView.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_MDShockBannerView {
2 | umbrella header "Pods-MDShockBannerView-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/Pods-MDShockBannerView/Pods-MDShockBannerView.release.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SDWebImage"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/SDWebImage/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 4.3.3
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SDWebImage : NSObject
3 | @end
4 | @implementation PodsDummy_SDWebImage
5 | @end
6 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 | #import "NSButton+WebCache.h"
14 | #import "NSData+ImageContentType.h"
15 | #import "NSImage+WebCache.h"
16 | #import "SDAnimatedImageRep.h"
17 | #import "SDImageCache.h"
18 | #import "SDImageCacheConfig.h"
19 | #import "SDWebImageCoder.h"
20 | #import "SDWebImageCoderHelper.h"
21 | #import "SDWebImageCodersManager.h"
22 | #import "SDWebImageCompat.h"
23 | #import "SDWebImageDownloader.h"
24 | #import "SDWebImageDownloaderOperation.h"
25 | #import "SDWebImageFrame.h"
26 | #import "SDWebImageGIFCoder.h"
27 | #import "SDWebImageImageIOCoder.h"
28 | #import "SDWebImageManager.h"
29 | #import "SDWebImageOperation.h"
30 | #import "SDWebImagePrefetcher.h"
31 | #import "SDWebImageTransition.h"
32 | #import "UIButton+WebCache.h"
33 | #import "UIImage+ForceDecode.h"
34 | #import "UIImage+GIF.h"
35 | #import "UIImage+MultiFormat.h"
36 | #import "UIImageView+HighlightedWebCache.h"
37 | #import "UIImageView+WebCache.h"
38 | #import "UIView+WebCache.h"
39 | #import "UIView+WebCacheOperation.h"
40 |
41 | FOUNDATION_EXPORT double SDWebImageVersionNumber;
42 | FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[];
43 |
44 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap:
--------------------------------------------------------------------------------
1 | framework module SDWebImage {
2 | umbrella header "SDWebImage-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/MDShockBannerViewSwift/Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SDWebImage
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_LDFLAGS = -framework "ImageIO"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage
9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
10 | SKIP_INSTALL = YES
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MDShockBannerView
2 |
3 | 仿转转首页banner
4 |
5 | 包含Swift OC 安卓源码
6 |
7 | 
8 |
9 | 欢迎大家完善这个demo,我会收集大家的意见,进行优化完善。
10 |
--------------------------------------------------------------------------------
/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimengxiaozhi/MDShockBannerView/d41b42b910c6fb3497aa0c8f5efbfaf37c14a9f6/demo.gif
--------------------------------------------------------------------------------