Coder Social home page Coder Social logo

pmc-konami-code's Introduction

KonamiCode


Easy install of our favorite easter-egg!

konami-code-tutorial

JitPack Badge Android Arsenal

Preview

Get it on Google Play

a screenshot

Inculde in your project

Gradle

Add the JitPack repository to your build file:

repositories {
    maven {
	    url "https://jitpack.io"
	}
}

Add the dependency in the form:

dependencies {
    compile 'com.github.thiagokimo:KonamiCode:1.1.6'
}

Maven

If you use Maven, add this into your build file:

<repository>
    <id>jitpack.io</id>
	<url>https://jitpack.io</url>
</repository>

And them this into your dependencies

<dependency>
    <groupId>com.github.thiagokimo</groupId>
    <artifactId>KonamiCode</artifactId>
	<version>1.1.6</version>
</dependency>

How to use

Add the following code in your Activity:

new KonamiCode.Installer(context)
        .on(activity-or-fragment-or-view)
        .install();

The library injects a KonamiCodeLayout as the first child of your Activity's view. It listens your swipe events without harming the touch events of the original view.

For the first part of the Konami code, swipe into the correct directions. If you do it correctly, an AlertDialog with the buttons A, B and START will appear. Pressing them correctly will trigger the final callback.

By default a callback with a Toast message will appear. You can customize the final callback by yourself:

new KonamiCode.Installer(context)
        .on(activity-or-fragment-or-view)
        .callback(new KonamiCodeLayout.Callback() {
            @Override
            public void onFinish() {
                //whatever
            }
        })
        .install();

Attention

Make sure you add this AFTER your view is set, otherwise it won't listen to your swipes. KonamiCode adds a swipe listener into the root view of your Activity.

Contribuiting

  1. Fork it
  2. Create your feature/bug-fix branch(git checkout -b my-new-feature-or-fix)
  3. Commit your changes (git commit -am 'Add some feature/fix')
  4. Do your pull-request

Developed by

License

Copyright 2011, 2012 Thiago Rocha

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.

pmc-konami-code's People

Contributors

thiagokimo avatar paulmarkcastillo 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.