Git Product home page Git Product logo

swirl's Introduction

Swirl

Android's animated fingerprint icon provided in a simple, standalone library.

Usage

Since Swirl uses animated vector drawables, default colors cannot be provided and must be specified in your theme.

<style name="Theme.YourApp" parent="@android:style/Theme.Material.Light">
  <item name="swirl_ridgeColor">?android:attr/textColorSecondary</item>
  <item name="swirl_errorColor">?android:attr/colorAccent</item>
</style>

Then, you may include SwirlView anywhere in your app.

<com.mattprecious.swirl.SwirlView
    android:layout_width="60dp"
    android:layout_height="60dp"
    />

Note that this example specifies a width and height and does not use wrap_content. Since the drawables are vectors, there isn't an appropriate size to default to so you must specify one.

Switch between icons by calling setState() or by using the app:swirl_state attribute.

See the provided sample for a complete implementation.

Download

Gradle:

implementation 'com.mattprecious.swirl:swirl:1.3.0'

License

Copyright 2016 Matthew Precious

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

swirl's People

Contributors

jrodbx avatar mattprecious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swirl's Issues

Ok Animation

I would like to show a animation from Fingerprint -> Ok Checkmark. But I can only find the Error action. Ofcourse I can fork and try to make it myself but I have the feeling it should be part of this library?

Image is not shown inside a module

I have added this dependency inside a module in a DialogFragment, but unfortunately the image is blank. I copied and pasted the code from your example. Too bad, it looks awesome!

SetState Not working

Hi , using this on android 7.1.1 nexus 5x , and set state does nothing and there's just a white blank view
, I've set the style and colors and when I use attr to set state its showing in Design mode but when running its again an blank view and setting state wont work

<com.mattprecious.swirl.SwirlView android:id="@+id/fingerprint_dialog_fingerprint_image" style="@style/Finger" android:layout_width="60dp" android:layout_height="60dp" android:layout_gravity="center" app:swirl_state="error"/>

<style name="Finger" parent="Theme.AppCompat"> <item name="swirl_ridgeColor">@color/sh</item> <item name="swirl_errorColor">@color/red</item> </style>

** I've also set the colors in myAppThemeStyle , not result

Stroke width

Hi,
first of all: great work! This looks awesome.

I want to use the lib in my project, but unfortunately all of our icons are using a stroke width of 1 instead of 1.45 or 2. Scaling the strokes is no issue, I just replaced the strokeWidth attribute. Unfortunately, the exclamation mark uses fillPath and thus is not scalable by this method.

Do you have any hint for how to make the exclamation mark thinner? Thanks!

Artifacts left at end of OFF animation

screenshot_20160311-162237

These pop up at the very beginning of the ON animation and remain after the end of the OFF animation. I'm seeing this both in my main app, and in the Whorlwind sample app.

It's worth noting that I'm running N preview here, not sure if that could be affecting anything.

Does not work with Jetifier

Jetifier breaks on transforming the 1.1.0 AAR:

Unable to resolve dependency for ':Mobile-Android@prodRelease/compileClasspath': Failed to transform file 'swirl-1.1.0.aar' to match attributes {artifactType=jetified-aar} using transform JetifyTransform

Looking at swirl-1.1.0.aar itself, it somehow contains two AndroidManifest.xml entries in the ZIP filesystem:

  • AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mattprecious.swirl"
    android:versionCode="1"
    android:versionName="1.0.1-SNAPSHOT" >

    <uses-sdk android:minSdkVersion="15" />

</manifest>
  • AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mattprecious.swirl"
    android:versionCode="1"
    android:versionName="1.1.0" >

    <uses-sdk android:minSdkVersion="14" />

</manifest>

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.