TutorialView


Source link: https://github.com/itzikBraun/TutorialView

TutorialView

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

The TutorialActivity can be used as a walkthrough 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.

If you use any kind of analytics to track your user behavior in your app you can start the TutorialActivity for result and so when it returns you can collect the data whether the user skipped the tutorials or watched it fully. You can also retrieve the amount of tutorials the user have viewed before skipping the walkthrough using TutorialActivity.VIEWED_TUTORIALS.

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 a 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 the screen, title, background color, the text explanation and more customizable attributes. By default the "StatusBar" and the "NavigationBar" are also being colored on Lollipop devices, You can change the default behavior by using:

TutorialIntentBuilder builder = new TutorialIntentBuilder(MainActivity.this);
  builder.changeSystemUiColor(false);
 
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

From Maven Central

Add as a dependency to your build.gradle:

dependencies{

  compile 'com.github.itzikbraun:TutorialView:0.8.1' 
}
 
Downloading the source code

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 don't delete them, Those are your other modules. include':tutorial_view' 

TODO:

  • add the roboto font family to the app assets so it will work on lower versions
  • Make a sample app and publish it on Google Play

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

Resources

A Simple Log Tool.

An encapsulation of android.util.Log, which provides:

  • Log level control. You can display different log according different environment.
  • Log with parameters

This project aims to provide a simple and customizable pull to refresh implementation.

ContextMenu allows you can to add awesome animated context menu in your app.

Side Menu project allows to create side menu with some categories to choose.

Camera module for Android applications.

MonkeyEngine is a 3D game engine for adventurous Java developers. It’s open source, cross platform and cutting edge. And it is all beautifully documented.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes