com.github.jobs.ui.activity
Class BaseActivity

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 android.support.v4.app.FragmentActivity
                      extended by android.support.v4.app._ActionBarSherlockTrojanHorse
                          extended by com.actionbarsherlock.app.SherlockFragmentActivity
                              extended by com.github.jobs.ui.activity.BaseActivity
All Implemented Interfaces:
android.content.ComponentCallbacks, android.content.ComponentCallbacks2, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.LayoutInflater.Factory2, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback, ActionBarSherlock.OnActionModeFinishedListener, ActionBarSherlock.OnActionModeStartedListener, ActionBarSherlock.OnCreatePanelMenuListener, ActionBarSherlock.OnMenuItemSelectedListener, ActionBarSherlock.OnPreparePanelListener
Direct Known Subclasses:
TrackActivity

public abstract class BaseActivity
extends SherlockFragmentActivity


Nested Class Summary
 
Nested classes/interfaces inherited from class android.support.v4.app._ActionBarSherlockTrojanHorse
_ActionBarSherlockTrojanHorse.OnCreateOptionsMenuListener, _ActionBarSherlockTrojanHorse.OnOptionsItemSelectedListener, _ActionBarSherlockTrojanHorse.OnPrepareOptionsMenuListener
 
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_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, 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_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NFC_SERVICE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, UI_MODE_SERVICE, USB_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Fields inherited from interface android.content.ComponentCallbacks2
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_UI_HIDDEN
 
Constructor Summary
BaseActivity()
           
 
Method Summary
<T> T
findFragment(Class<? extends T> fragmentClass)
          Allows to retrieve the instance of a previously added fragment.
protected  void onCreate(android.os.Bundle savedInstanceState)
           
 void openActivityOrFragment(android.content.Intent intent)
          Takes a given intent and either starts a new ui to handle it (the default behavior), or creates/updates a fragment (in the case of a multi-pane ui) that can handle the intent.
 void setContentView(int layoutResId)
           
 void setContentView(android.view.View view)
           
 void setContentView(android.view.View view, android.view.ViewGroup.LayoutParams params)
           
protected  void setupBaseFragment(int containerId, Class<? extends android.support.v4.app.Fragment> fragmentClass)
          Helper method that allows to initialize and add a fragment to activities that usually have just one single fragment.
protected  void setupBaseFragment(int containerId, Class<? extends android.support.v4.app.Fragment> fragmentClass, android.os.Bundle args)
          Helper method that allows to initialize and add a fragment to activities that usually have just one single fragment.
 
Methods inherited from class com.actionbarsherlock.app.SherlockFragmentActivity
addContentView, closeOptionsMenu, dispatchKeyEvent, getSherlock, getSupportActionBar, getSupportMenuInflater, invalidateOptionsMenu, onActionModeFinished, onActionModeStarted, onConfigurationChanged, onCreateOptionsMenu, onCreateOptionsMenu, onCreatePanelMenu, onDestroy, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsItemSelected, onPanelClosed, onPause, onPostCreate, onPostResume, onPrepareOptionsMenu, onPrepareOptionsMenu, onPreparePanel, onStop, onTitleChanged, openOptionsMenu, requestWindowFeature, setSupportProgress, setSupportProgressBarIndeterminate, setSupportProgressBarIndeterminateVisibility, setSupportProgressBarVisibility, setSupportSecondaryProgress, startActionMode, supportInvalidateOptionsMenu
 
Methods inherited from class android.support.v4.app._ActionBarSherlockTrojanHorse
onCreatePanelMenu, onMenuItemSelected, onPreparePanel
 
Methods inherited from class android.support.v4.app.FragmentActivity
dump, getLastCustomNonConfigurationInstance, getSupportFragmentManager, getSupportLoaderManager, onActivityResult, onAttachFragment, onBackPressed, onCreateView, onKeyDown, onLowMemory, onResume, onRetainCustomNonConfigurationInstance, onRetainNonConfigurationInstance, onSaveInstanceState, onStart, startActivityForResult, startActivityFromFragment
 
Methods inherited from class android.app.Activity
closeContextMenu, createPendingResult, dismissDialog, dispatchGenericMotionEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, finish, finishActivity, finishActivityFromChild, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMenuInflater, getParent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, isChangingConfigurations, isChild, isFinishing, isTaskRoot, managedQuery, moveTaskToBack, onActionModeFinished, onActionModeStarted, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onChildTitleChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreatePanelView, onCreateThumbnail, onCreateView, onDetachedFromWindow, onGenericMotionEvent, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onNewIntent, onOptionsMenuClosed, onPrepareDialog, onPrepareDialog, onRestart, onRestoreInstanceState, onSearchRequested, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, overridePendingTransition, recreate, registerForContextMenu, removeDialog, requestWindowFeature, runOnUiThread, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setIntent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, showDialog, showDialog, startActionMode, startActivities, startActivity, startActivityFromChild, startActivityFromFragment, 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, getObbDir, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, 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, registerComponentCallbacks, unregisterComponentCallbacks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseActivity

public BaseActivity()
Method Detail

onCreate

protected void onCreate(android.os.Bundle savedInstanceState)
Overrides:
onCreate in class android.support.v4.app.FragmentActivity

setContentView

public void setContentView(int layoutResId)
Overrides:
setContentView in class SherlockFragmentActivity

setContentView

public void setContentView(android.view.View view)
Overrides:
setContentView in class SherlockFragmentActivity

setContentView

public void setContentView(android.view.View view,
                           android.view.ViewGroup.LayoutParams params)
Overrides:
setContentView in class SherlockFragmentActivity

setupBaseFragment

protected void setupBaseFragment(int containerId,
                                 Class<? extends android.support.v4.app.Fragment> fragmentClass)
Helper method that allows to initialize and add a fragment to activities that usually have just one single fragment. Fragment is added using its class.getName() as tag.

Parameters:
containerId - resource id of the fragment container (must be created through android resources)
fragmentClass - the class of the fragment to setup

setupBaseFragment

protected void setupBaseFragment(int containerId,
                                 Class<? extends android.support.v4.app.Fragment> fragmentClass,
                                 android.os.Bundle args)
Helper method that allows to initialize and add a fragment to activities that usually have just one single fragment. Fragment is added using its class.getName() as tag.

Parameters:
containerId - resource id of the fragment container (must be created through android resources)
fragmentClass - the class of the fragment to setup
args - bundle with the arguments to pass to the fragment

findFragment

public <T> T findFragment(Class<? extends T> fragmentClass)
Allows to retrieve the instance of a previously added fragment. We use fragmentClass.getName() to find by tag.

Parameters:
fragmentClass - the fragment class
Returns:
the fragment or null if it was has not been added

openActivityOrFragment

public void openActivityOrFragment(android.content.Intent intent)
Takes a given intent and either starts a new ui to handle it (the default behavior), or creates/updates a fragment (in the case of a multi-pane ui) that can handle the intent.

Must be called from the main (UI) thread.



Copyright © 2012-2013. All Rights Reserved.