Code Monkey home page Code Monkey logo

tutorialview's Introduction

Android Arsenal ##TutorialView

alt tag

An Android library project providing Activity with explanation about views in your app.

The TutorialActivity can be used as a walk through for the entire screen that is currently visible, Or just for one view on the screen.

To get the intent to start the TutorialActivity you need to use the TutorialIntentBuilder, The builder will help you build the intent to start the activity, You would have to pass a Tutorial object to the intent builder.

###Usage ####Tutorial The tutorial object holds the tutorial info and attributes. You can create a Tutorial by using the TutorialBuilder. You can customize the following:

  • Title - Will appear on the top of the view, If the view that is surrounded is on top it will be shown below it.
  • TutorialText - The explanation of about the view, It will appear above or below the view.
  • BackgroundColor - The background color of the view.
  • TutorialTextSize - The size that will be used for the tutorial explanation text.
  • TypefaceName - The path to the wanted typeface to use for all text view in the tutorial, Example: "/fonts/arial.ttf".
  • AnimationDuration - the duration time in milliseconds that will be used for the animation.
  • InfoPosition - The position of the info text, This could be Above, Below, LeftOf and Right of all relevant to the view that need to be surrounded. Values are stored in Tutorial.InfoPosition
  • GotItPosition - The position of the "GotIt" button, This could be Top(If has title it will be below it) and Bottom. Values are stored in Tutorial.GotItPosition
  • AnimationType - the animation that will be used for showing and hiding the tutorial This is a work in progress currently not working.

Each tutorial that was passed holds it's position on screen, title, background color, the text explenation and more customizable attributes.

######Example of creating a simple tutorial.

TutorialIntentBuilder builder = new TutorialIntentBuilder(MainActivity.this);
            
TutorialBuilder tBuilder = new TutorialBuilder();
            
tBuilder.setTitle("The Title")
            .setViewToSurround(v)
            .setInfoText("This is the explanation about the view.")
            .setBackgroundColor(randomColor())
            .setTutorialTextColor(Color.WHITE)
            .setTutorialTextTypeFaceName("fonts/test_name.ttf")
            .setTutorialTextSize(25)
            .setAnimationDuration(500);

builder.setTutorial(tBuilder.build());

startActivity(builder.getIntent());
            
// Override the default animation of the entering activity.
// This will allow the nice wrapping of the view by the tutorial activity.
overridePendingTransition(R.anim.dummy, R.anim.dummy);

######Example of creating a walk through from two Tutorials.

ArrayList<Tutorial> tutorials = new ArrayList<>();
tutorials.add(tutorial);
tutorials.add(tutorial2);
tutorials.add(tutorial3);
tutorials.add(tutorial4);

builder.skipTutorialOnBackPressed(true);
 
builder.setWalkThroughList(tutorials);

// Starting the activity with an intent from the builder.
startActivity(builder.getIntent());
overridePendingTransition(R.anim.dummy, R.anim.dummy);

####Important! You should override the Activity pending transition animation like this, If you wont override it the TutorialActivity would animate itself in and will ruin the view animation. (Call it after you call startActivity(Intent) ).

startActivity(builder.getIntent());
overridePendingTransition(R.anim.dummy, R.anim.dummy);

###INCLUDING IN YOUR PROJECT Import the "tutorial_view" module to your project, Then in your build.gradle file add this.(You probably already have the dependencies so just add the "compile project(':tutorial_view')" ).

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':tutorial_view')
}

You can also copy past it to your project and before adding it to your dependencies you need to add it to settings.gradle so the system will understand it's a module like this:

// Notice that in your settings file there would be more names so dont delete them, This are your other modules.
include':tutorial_view'

###TODO:

  • Return result when TutorialActivity finishes so you could know when it was done and if was skipped.

###Author Itzik Braun - Google+

###LICENSE Copyright (C) 2014 Itzik Braun

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

tutorialview's People

Contributors

itzikbraun avatar yelinaung avatar

Watchers

william 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.