org.hermit.android.core
Class OneTimeDialog

java.lang.Object
  extended by org.hermit.android.core.OneTimeDialog

public class OneTimeDialog
extends java.lang.Object

A class which handles showing one-off notices. This can be used for a EULA, or for "new feature" notices which show once per app version.

A benefit of this class is that it doesn't create the notice object unless it needs to be shown; most times it doesn't.

Author:
Ian Cameron Smith

Constructor Summary
OneTimeDialog(Activity parent, java.lang.String name, int title, int text, int close)
          Create a dialog for showing a notice, or other warnings / disclaimers, once only.
 
Method Summary
protected  boolean isAccepted()
          Query whether the dialog has been shown to the user and accepted.
 void show()
          Show the dialog unconditionally.
 void showFirst()
          Show the dialog if this is the first program run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneTimeDialog

public OneTimeDialog(Activity parent,
                     java.lang.String name,
                     int title,
                     int text,
                     int close)
Create a dialog for showing a notice, or other warnings / disclaimers, once only.

When your app starts, call showFirst() to display the dialog the first time your app runs. This will actually show it if it hasn't been seen for the current version of the app.

To display the notice on demand, call show().

Parameters:
parent - Our parent activity.
name - Name for this notice. This should be an internal identifier; it will be used to name the preference we use.
title - Resource ID of the dialog title.
text - Resource ID of the notice / warning text.
close - Resource ID of the close button.
Method Detail

showFirst

public void showFirst()
Show the dialog if this is the first program run.


show

public void show()
Show the dialog unconditionally.


isAccepted

protected boolean isAccepted()
Query whether the dialog has been shown to the user and accepted.

Returns:
True iff the user has seen the dialog and clicked "OK".