com.github.droidfu.activities
Class BetterDefaultActivity

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.github.droidfu.activities.BetterDefaultActivity
All Implemented Interfaces:
android.content.ComponentCallbacks, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback, BetterActivity

public class BetterDefaultActivity
extends android.app.Activity
implements BetterActivity


Field Summary
 
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, DOWNLOAD_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, STORAGE_SERVICE, TELEPHONY_SERVICE, UI_MODE_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Constructor Summary
BetterDefaultActivity()
           
 
Method Summary
 android.content.Intent getCurrentIntent()
          Retrieves the current intent that was used to create or resume this activity.
 int getWindowFeatures()
           
 boolean isApplicationBroughtToBackground()
          Android doesn't distinguish between your Activity being paused by another Activity of your own application, or by an Activity of an entirely different application.
 boolean isLandscapeMode()
           
 boolean isLaunching()
           
 boolean isPortraitMode()
           
 boolean isRestoring()
           
 boolean isResuming()
           
 android.app.AlertDialog newAlertDialog(int titleResourceId, int messageResourceId)
           
 android.app.AlertDialog newErrorHandlerDialog(Exception error)
           Creates a new error dialog, with the option to either dismiss or -- if an email application is installed -- report the given error.
 android.app.AlertDialog newErrorHandlerDialog(int titleResourceId, Exception error)
           Creates a new error dialog, with the option to either dismiss or -- if an email application is installed -- report the given error.
 android.app.AlertDialog newInfoDialog(int titleResourceId, int messageResourceId)
           
<T> android.app.Dialog
newListDialog(String title, List<T> elements, DialogClickListener<T> listener, boolean closeOnSelect)
          Creates a new list style dialog from a list of objects.
 android.app.AlertDialog newYesNoDialog(int titleResourceId, int messageResourceId, android.content.DialogInterface.OnClickListener listener)
           
protected  void onCreate(android.os.Bundle savedInstanceState)
           
protected  android.app.Dialog onCreateDialog(int id)
           
protected  void onDestroy()
           
 boolean onKeyDown(int keyCode, android.view.KeyEvent event)
           
protected  void onNewIntent(android.content.Intent intent)
           
protected  void onPause()
           
protected  void onRestoreInstanceState(android.os.Bundle savedInstanceState)
           
 void setProgressDialogMsgId(int progressDialogMsgId)
           
 void setProgressDialogTitleId(int progressDialogTitleId)
           
 
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, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onDetachedFromWindow, onKeyLongPress, onKeyMultiple, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareOptionsMenu, onPreparePanel, onRestart, onResume, onRetainNonConfigurationInstance, onSaveInstanceState, 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
 

Constructor Detail

BetterDefaultActivity

public BetterDefaultActivity()
Method Detail

onCreate

protected void onCreate(android.os.Bundle savedInstanceState)
Overrides:
onCreate in class android.app.Activity

onDestroy

protected void onDestroy()
Overrides:
onDestroy in class android.app.Activity

onRestoreInstanceState

protected void onRestoreInstanceState(android.os.Bundle savedInstanceState)
Overrides:
onRestoreInstanceState in class android.app.Activity

onPause

protected void onPause()
Overrides:
onPause in class android.app.Activity

onNewIntent

protected void onNewIntent(android.content.Intent intent)
Overrides:
onNewIntent in class android.app.Activity

onCreateDialog

protected android.app.Dialog onCreateDialog(int id)
Overrides:
onCreateDialog in class android.app.Activity

setProgressDialogTitleId

public void setProgressDialogTitleId(int progressDialogTitleId)
Specified by:
setProgressDialogTitleId in interface BetterActivity

setProgressDialogMsgId

public void setProgressDialogMsgId(int progressDialogMsgId)
Specified by:
setProgressDialogMsgId in interface BetterActivity

getWindowFeatures

public int getWindowFeatures()
Specified by:
getWindowFeatures in interface BetterActivity

isRestoring

public boolean isRestoring()
Specified by:
isRestoring in interface BetterActivity
Returns:
true, if the activity is recovering from in interruption (i.e. onRestoreInstanceState was called.

isResuming

public boolean isResuming()
Specified by:
isResuming in interface BetterActivity
Returns:
true, if the activity is "soft-resuming", i.e. onResume has been called without a prior call to onCreate

isLaunching

public boolean isLaunching()
Specified by:
isLaunching in interface BetterActivity
Returns:
true, if the activity is launching, i.e. is going through onCreate but is not restoring.

isApplicationBroughtToBackground

public boolean isApplicationBroughtToBackground()
Description copied from interface: BetterActivity
Android doesn't distinguish between your Activity being paused by another Activity of your own application, or by an Activity of an entirely different application. This function only returns true, if your Activity is being paused by an Activity of another app, thus hiding yours.

Specified by:
isApplicationBroughtToBackground in interface BetterActivity
Returns:
true, if the Activity is being paused because an Activity of another application received focus.

getCurrentIntent

public android.content.Intent getCurrentIntent()
Description copied from interface: BetterActivity
Retrieves the current intent that was used to create or resume this activity. If the activity received a call to onNewIntent (e.g. because it was launched in singleTop mode), then the Intent passed to that method is returned. Otherwise the returned Intent is the intent returned by getIntent (which is the Intent which was used to initially launch this activity).

Specified by:
getCurrentIntent in interface BetterActivity
Returns:
the current Intent

isLandscapeMode

public boolean isLandscapeMode()
Specified by:
isLandscapeMode in interface BetterActivity

isPortraitMode

public boolean isPortraitMode()
Specified by:
isPortraitMode in interface BetterActivity

newYesNoDialog

public android.app.AlertDialog newYesNoDialog(int titleResourceId,
                                              int messageResourceId,
                                              android.content.DialogInterface.OnClickListener listener)
Specified by:
newYesNoDialog in interface BetterActivity

newInfoDialog

public android.app.AlertDialog newInfoDialog(int titleResourceId,
                                             int messageResourceId)
Specified by:
newInfoDialog in interface BetterActivity

newAlertDialog

public android.app.AlertDialog newAlertDialog(int titleResourceId,
                                              int messageResourceId)
Specified by:
newAlertDialog in interface BetterActivity

newErrorHandlerDialog

public android.app.AlertDialog newErrorHandlerDialog(int titleResourceId,
                                                     Exception error)
Description copied from interface: BetterActivity

Creates a new error dialog, with the option to either dismiss or -- if an email application is installed -- report the given error. Clicking the report button will cause the app to collect diagnostic information, compile it to a single text body, and launch the email application with the error report being preset as the email's body.

For this to work, you must define the following string resources in your application:

Specified by:
newErrorHandlerDialog in interface BetterActivity
Parameters:
titleResourceId - the string resource that should be used as the dialog title
error - the exception that should be displayed and/or reported
Returns:
the dialog

newErrorHandlerDialog

public android.app.AlertDialog newErrorHandlerDialog(Exception error)
Description copied from interface: BetterActivity

Creates a new error dialog, with the option to either dismiss or -- if an email application is installed -- report the given error. Clicking the report button will cause the app to collect diagnostic information, compile it to a single text body, and launch the email application with the error report being preset as the email's body.

For this to work, you must define the following string resources in your application:

Specified by:
newErrorHandlerDialog in interface BetterActivity
Parameters:
error - the exception that should be displayed and/or reported
Returns:
the dialog

newListDialog

public <T> android.app.Dialog newListDialog(String title,
                                            List<T> elements,
                                            DialogClickListener<T> listener,
                                            boolean closeOnSelect)
Description copied from interface: BetterActivity
Creates a new list style dialog from a list of objects. The toString() method of any such object will be used to generate the list item's label.

Specified by:
newListDialog in interface BetterActivity
Type Parameters:
T - the type of the list items
elements - the list items
listener - the listener used for processing list item clicks
closeOnSelect - if true, the dialog will close when an item has been clicked
Returns:
the dialog

onKeyDown

public boolean onKeyDown(int keyCode,
                         android.view.KeyEvent event)
Specified by:
onKeyDown in interface android.view.KeyEvent.Callback
Overrides:
onKeyDown in class android.app.Activity


Copyright © 2011. All Rights Reserved.