Giter VIP home page Giter VIP logo

android-widget-connectpattern's Introduction

Build Status Download Android Arsenal

ConnectPatternView

A widget that can be used to confirm the user's action, unlocking the screen etc. by providing the desired pattern with specified configuration. Widget can be animated in and out.

Nine connectors Five connectors
Three connectors Two connectors

Features

  • Widget can contain different number of connectors: 2, 3, 5 or 9.
  • Size and color of the connector (circle by default) can be specified in the xml.
  • Width and color of the connecting lines can be specified in the xml.
  • Connector can be defined as a drawable so any image or icon can be specified in the xml.

Adding it to your project

compile 'com.bcgdv.asia.lib:connectpattern:0.3'

Usage

The connect pattern needs to be configured in the XML.

<com.bcgdv.asia.lib.connectpattern.ConnectPatternView
    android:id="@+id/connect"
    android:padding="32dp"
    android:layout_width="350dp"
    android:layout_height="350dp"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    app:connectPatternAnimationType="none|middle|bottom"
    app:connectPatternNumber="nine"
    app:connectPatternCircleColor="@color/colorPrimary"
    app:connectPatternLineColor="@color/colorAccent"
    app:connectPatternCircleRadius="14dp"
    app:connectPatternLineWidth="7dp"
    app:connectPatternDrawable="@mipmap/ic_star"/>
  • app:connectPatternAnimationType (Optional) - none|middle|bottom. Default middle
  • app:connectPatternNumber (Optional) - determines how many connectors will be used
  • app:connectPatternCircleColor (Optional) - color of the circle
  • app:connectPatternCircleRadius (Optional) - radius of the circle
  • app:connectPatternLineColor (Optional) - color of the connecting lines
  • app:connectPatternLineWidth (Optional) - width of the connecting lines
  • app:connectPatternDrawable (Optional) - custom icon / image / drawable to use instead of circle

Callbacks

view.setOnConnectPatternListener(new ConnectPatternView.OnConnectPatternListener() {
        @Override
        public void onPatternEntered(ArrayList<Integer> result) {
        }

        @Override
        public void onPatternAbandoned() {
        }

        @Override
        public void animateInStart() {
        }

        @Override
        public void animateInEnd() {
        }

        @Override
        public void animateOutStart() {
        }

        @Override
        public void animateOutEnd() {
        }
    });

android-widget-connectpattern's People

Contributors

magda-em 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

android-widget-connectpattern's Issues

manifest: android:allowBackup = "true" causes some trouble.

Hi.
I have been using your very cool library, and it has been doing great, but lately, for security reasons, I needed to turn auto backup off from the manifest.
Unfortunately, when changing to android:allowBackup="false" I get the following error:

Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:78:9-36
is also present at [com.bcgdv.asia.lib:connectpattern:0.3] AndroidManifest.xml:12:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:76:5-353:19 to override.

Is it possible to remove the allowBackup flag from the manifest of the library?

Note: actually, tools:replace="android:allowBackup" in the application block solves the issue, but it's less pretty.

Thanks

Proximity thresholds - too sensitive.

Hi.
Great engine. Correctly engineered. Just one thing: Can you please make the thresholds of the proximity to dots more conservative?
It is a bit frustrating to draw a diagonal around a point.

Thanks.

Crash in some strange case of drawing with no points

/**
 * Setup circles on a screen
 */
private void drawLineToTouchPoint(Canvas canvas) {
    if (touchPoint.height() > 0 && touchPoint.width() > 0) {
        drawLine(canvas, circles[connectionOrder.get(connectionOrder.size() - 1)], touchPoint);
    }
}

Forgot to check that !connectionOrder.isEmpty()
It may crash if the view refreshes when you your finger on, and it's blank.

Nice Project

How to make to save the pattern and open a page with it?

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.