com.drismo.gui
Class Tutorial

java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.view.ContextThemeWrapper
              extended by android.app.Activity
                  extended by com.drismo.gui.Tutorial
All Implemented Interfaces:
android.content.ComponentCallbacks, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback

public class Tutorial
extends android.app.Activity

Tutorial activity, connected to several different layout-files. The layout and content is changed according to user navigation.


Field Summary
private  int currentStep
           
private  java.lang.String TAG
           
private  int TUTORIAL_PAGES
           
 
Fields inherited from class android.app.Activity
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
 
Fields inherited from class android.content.Context
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_NOT_FOREGROUND, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, TELEPHONY_SERVICE, UI_MODE_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Constructor Summary
Tutorial()
           
 
Method Summary
 void onCreate(android.os.Bundle savedInstanceState)
          Loading the content for the initial tutorial page, and set button listeners.
 void onRestoreInstanceState(android.os.Bundle savedInstanceState)
          Get the current page nr., in case the activity has had an (unintended) restart mid-tutorial.
 void onSaveInstanceState(android.os.Bundle savedInstanceState)
          If the device is flipped when navigating in the tutorial, we make sure we store the current page nr., so the same page will be loaded when the activity restarts, and the savedInstanceState is reloaded.
private  void setContent(int step)
          This function will change the window content when the user navigates between pages.
 void setFont(java.lang.String fontName, android.widget.TextView txt)
          Create a font (Typeface) from asset, and assign it to a TextView.
private  void setTutorialFonts(java.lang.String fontNameHeader, java.lang.String fontNameTxt)
          Going through the whole tutorial and set the fonts for each TextView on every page.
 
Methods inherited from class android.app.Activity
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchKeyEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, finish, finishActivity, finishActivityFromChild, finishFromChild, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getInstanceCount, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLocalClassName, getMenuInflater, getParent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, getWindow, getWindowManager, hasWindowFocus, isChild, isFinishing, isTaskRoot, managedQuery, moveTaskToBack, onActivityResult, onApplyThemeResource, onAttachedToWindow, onBackPressed, onChildTitleChanged, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onDestroy, onDetachedFromWindow, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPause, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareOptionsMenu, onPreparePanel, onRestart, onResume, onRetainNonConfigurationInstance, onSearchRequested, onStart, onStop, onTitleChanged, onTouchEvent, onTrackballEvent, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, openContextMenu, openOptionsMenu, overridePendingTransition, registerForContextMenu, removeDialog, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setIntent, setPersistent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, showDialog, showDialog, startActivity, startActivityForResult, startActivityFromChild, startActivityIfNeeded, startIntentSender, startIntentSenderForResult, startIntentSenderFromChild, startManagingCursor, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
 
Methods inherited from class android.view.ContextThemeWrapper
attachBaseContext, getTheme, setTheme
 
Methods inherited from class android.content.ContextWrapper
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getWallpaper, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, sendStickyOrderedBroadcast, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiver
 
Methods inherited from class android.content.Context
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentStep

private int currentStep

TUTORIAL_PAGES

private final int TUTORIAL_PAGES
See Also:
Constant Field Values

TAG

private final java.lang.String TAG
See Also:
Constant Field Values
Constructor Detail

Tutorial

public Tutorial()
Method Detail

setContent

private void setContent(int step)
This function will change the window content when the user navigates between pages.

Parameters:
step - The current position in the page navigation. Initial page value is 0.

onCreate

public void onCreate(android.os.Bundle savedInstanceState)
Loading the content for the initial tutorial page, and set button listeners.

Overrides:
onCreate in class android.app.Activity
Parameters:
savedInstanceState - Bundle containing the current step of the tutorial. Note: value is null if nothing has been stored yet.

onSaveInstanceState

public void onSaveInstanceState(android.os.Bundle savedInstanceState)
If the device is flipped when navigating in the tutorial, we make sure we store the current page nr., so the same page will be loaded when the activity restarts, and the savedInstanceState is reloaded.

Overrides:
onSaveInstanceState in class android.app.Activity
Parameters:
savedInstanceState - Bundle containing the current step of the tutorial.
See Also:
currentStep

onRestoreInstanceState

public void onRestoreInstanceState(android.os.Bundle savedInstanceState)
Get the current page nr., in case the activity has had an (unintended) restart mid-tutorial. The most common use is when the orientation change.

Overrides:
onRestoreInstanceState in class android.app.Activity
Parameters:
savedInstanceState - Bundle to store the current step of the tutorial.

setFont

public void setFont(java.lang.String fontName,
                    android.widget.TextView txt)
Create a font (Typeface) from asset, and assign it to a TextView.

Parameters:
fontName - Name of the font-file in the asset-folder.
txt - The TextView which the font will be assigned to.

setTutorialFonts

private void setTutorialFonts(java.lang.String fontNameHeader,
                              java.lang.String fontNameTxt)
Going through the whole tutorial and set the fonts for each TextView on every page.

Parameters:
fontNameHeader - Font name for the first TextView on the page.
fontNameTxt - Font name for the remaining TextViews