com.github.droidfu.activities
Class BetterActivityHelper

java.lang.Object
  extended by com.github.droidfu.activities.BetterActivityHelper

public class BetterActivityHelper
extends Object


Field Summary
static String ERROR_DIALOG_TITLE_RESOURCE
           
 
Constructor Summary
BetterActivityHelper()
           
 
Method Summary
static android.app.ProgressDialog createProgressDialog(android.app.Activity activity, int progressDialogTitleId, int progressDialogMsgId)
          Creates a new ProgressDialog
static int getWindowFeatures(android.app.Activity activity)
           
static boolean isApplicationBroughtToBackground(android.content.Context context)
          Checks if the application is in the background (i.e behind another application's Activity).
static android.app.AlertDialog newErrorHandlerDialog(android.app.Activity activity, String dialogTitle, Exception error)
          Displays a error dialog with an exception as its body.
static
<T> android.app.Dialog
newListDialog(android.app.Activity context, String dialogTitle, List<T> elements, DialogClickListener<T> listener, boolean closeOnSelect)
          Creates a AlertDialog that shows a list of elements.
static
<T> android.app.Dialog
newListDialog(android.app.Activity context, String dialogTitle, List<T> elements, DialogClickListener<T> listener, boolean closeOnSelect, int selectedItem)
           
static android.app.AlertDialog newMessageDialog(android.content.Context context, String dialogTitle, String screenMessage, int iconResourceId)
          Creates a new AlertDialog to display a simple message
static android.app.AlertDialog newYesNoDialog(android.content.Context context, String dialogTitle, String screenMessage, int iconResourceId, android.content.DialogInterface.OnClickListener listener)
          Creates a new Yes/No AlertDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_DIALOG_TITLE_RESOURCE

public static final String ERROR_DIALOG_TITLE_RESOURCE
See Also:
Constant Field Values
Constructor Detail

BetterActivityHelper

public BetterActivityHelper()
Method Detail

getWindowFeatures

public static int getWindowFeatures(android.app.Activity activity)

createProgressDialog

public static android.app.ProgressDialog createProgressDialog(android.app.Activity activity,
                                                              int progressDialogTitleId,
                                                              int progressDialogMsgId)
Creates a new ProgressDialog

Parameters:
activity -
progressDialogTitleId - The resource id for the title. If this is less than or equal to 0, a default title is used.
progressDialogMsgId - The resource id for the message.
Returns:
The new dialog

newYesNoDialog

public static android.app.AlertDialog newYesNoDialog(android.content.Context context,
                                                     String dialogTitle,
                                                     String screenMessage,
                                                     int iconResourceId,
                                                     android.content.DialogInterface.OnClickListener listener)
Creates a new Yes/No AlertDialog

Parameters:
context -
dialogTitle -
screenMessage -
iconResourceId -
listener -
Returns:

newMessageDialog

public static android.app.AlertDialog newMessageDialog(android.content.Context context,
                                                       String dialogTitle,
                                                       String screenMessage,
                                                       int iconResourceId)
Creates a new AlertDialog to display a simple message

Parameters:
context -
dialogTitle -
screenMessage -
iconResourceId -
Returns:

newErrorHandlerDialog

public static android.app.AlertDialog newErrorHandlerDialog(android.app.Activity activity,
                                                            String dialogTitle,
                                                            Exception error)
Displays a error dialog with an exception as its body. Also displays a Send Email button to send the exception to the developer. Implement the following resource IDs droidfu_error_report_email_address - The email address the exception is sent to. droidfu_error_report_email_subject - The subject of the email. droidfu_dialog_button_send_error_report - The text on the Send Email button.

Parameters:
activity -
dialogTitle -
error -
Returns:

newListDialog

public static <T> android.app.Dialog newListDialog(android.app.Activity context,
                                                   String dialogTitle,
                                                   List<T> elements,
                                                   DialogClickListener<T> listener,
                                                   boolean closeOnSelect)
Creates a AlertDialog that shows a list of elements. The listener's onClick method gets called when the user taps a list item.

Type Parameters:
T - The type of each element
Parameters:
context -
dialogTitle - the title or null to disable the title
elements - List of elements to be displayed. Each elements toString() method will be called.
listener - The listener to handle the onClick events.
closeOnSelect - If true the dialog closes as soon as one list item is selected, otherwise multiple onClick events may be sent.
Returns:
The new dialog.

newListDialog

public static <T> android.app.Dialog newListDialog(android.app.Activity context,
                                                   String dialogTitle,
                                                   List<T> elements,
                                                   DialogClickListener<T> listener,
                                                   boolean closeOnSelect,
                                                   int selectedItem)

isApplicationBroughtToBackground

public static boolean isApplicationBroughtToBackground(android.content.Context context)
Checks if the application is in the background (i.e behind another application's Activity).

Parameters:
context -
Returns:
true if another application is above this one.


Copyright © 2011. All Rights Reserved.