GithubHelp home page GithubHelp logo

raybon-lee / acpdownload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antoniocasero/acpdownload

0.0 2.0 0.0 394 KB

ACPDownload provides a view indicator of your download process

License: MIT License

Ruby 1.18% Objective-C 98.82%

acpdownload's Introduction

Purpose

ACPDownload provides a view indicator of your download process. This project defines 4 states: initial, indeterminate, running and finished. The images are defined programatically so you dont need to worry about the resolution in the devices. It also allow to be customized with your own needs.

Opening Drawer Animation

Installation

From CocoaPods

pod 'ACPDownload', '~> 1.1.0'

From source

Clone the repository

$ git clone [email protected]:antoniocasero/ACPDownload.git

Or just drag the folder ACPDownload to your project.


## How to use it

Set your view as ACPDownloadView, in the storyboard or programatically.

ScreenShot

This method will define the behaviour of the view. The change of the states is manually defined.

- (void)setIndicatorStatus:(ACPDownloadStatus)newStatus;

States:

  • ACPDownloadStatusNone: The initial state.
  • ACPDownloadStatusRunning: When the process is running, the view present a progress indicator.
  • ACPDownloadStatusIndeterminate: Indeterminate state, when your process is waiting for an action.
  • ACPDownloadStatusCompleted: The process has finished correctly.

This method defines the progress of your process.

- (void)setProgress:(float)progress animated:(BOOL)animated; 

Defines the behaviour when the user tap it. (The implementation is optional).

- (void)setActionForTap:(ACPViewTappedBlock)blockAction;

Replaces the default animation for the indeterminate state.

- (void)setIndeterminateLayer:(id<ACPLayerProtocol>)layer;

Replaces the default animation for the running state.

- (void)setProgressLayer:(id<ACPLayerProtocol>)layer;

Replaces the default images for each state.

- (void)setImages:(id<ACPStaticImagesProtocol>)images;

###How to customize

I decided to split up the customization into two main parts, animations and images.

Customize your images

All the images has been created using Core Graphics, they will adapt to any resolution without lose quality.

To define your own images, create your own class that conforms the protocol ACPStaticImagesProtocol where you define the images for each state. In the code you inject this object using the method -setStatusImages into the view.

ACPStaticImagesAlternative * myOwnImages = [ACPStaticImagesAlternative new];
[self.downloadIndicator setImages:myOwnImages];

Customize your animations

In order to define your own animations (only for the states running and indeterminate) you can create your own class that conforms the protocol ACPLayerProtocol.

For example to use your own animation for the indeterminate state, you inject an instances of your animation class using -setIndeterminateLayer to replace the default animation.

ACPIndeterminateGoogleLayer * myAnimation = [ACPIndeterminateGoogleLayer new];
[layer updateColor:[UIColor blueColor]]; 
[self.downloadView setIndeterminateLayer:myAnimation];

If you don't define a color, it will use the by default the tintColor of the view container.

For more details on this, check the Sample Application in this repo.

##Attributions Thanks to MMMaterialDesignSpinner for the inspiration.

##Contributing

Any contribution is welcome, just need to create a pull request with your custom images or your own animations!

Compatibility

  • Supports ARC.
  • Compatible with iOS7, iOS8 and iOS9.

Release Notes

  • v1.1 IB_DESIGNABLE Added. Podfile support iOS7.0
  • v1.0 Initial release

License

ACPDownload is available under the MIT license. See the LICENSE file for more info.

acpdownload's People

Contributors

antoniocasero avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.