/** * In onCreate() you setup any connections / cursors to your data source. Heavy lifting, for * example downloading or creating content etc, should be deferred to onDataSetChanged() or * getViewAt(). Taking more than 20 seconds in this call will result in an ANR. */ public void onCreate() { if (Constants.DEBUG) Log.d(TAG, "onCreate"); mOAuth = OAuthUtils.loadAccessToken(mContext); mUser = null; if (OAuthUtils.isLoggedIn(mContext)) { mUser = mOAuth.getUser(); } mPhotos = new ArrayList<Photo>(); mWidgetType = StackViewWidgetConfigure.loadWidgetType(mContext); }
@Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); /* Load the users oauth token */ mOAuth = OAuthUtils.loadAccessToken(this); if (mOAuth != null) { mUser = mOAuth.getUser(); } mTextUtils = new TextUtils(getAssets()); /* Set custom title on action bar (it will be null for dialog * activities */ mActionBar = getActionBar(); if (mActionBar != null) { if (!getResources().getBoolean(R.bool.sw600dp)) { new GlimmrAbCustomTitle(this).init(mActionBar); } else { mActionBar.setTitle(""); } } setProgressBarIndeterminateVisibility(Boolean.FALSE); /* Load default preferences */ PreferenceManager.setDefaultValues(this, R.xml.preferences, false); if (isTaskRoot()) { startTapeQueues(); } }
/** Start each service for any pending tasks */ private void startTapeQueues() { if (OAuthUtils.isLoggedIn(this)) { if (!AddToGroupTaskQueueService.IS_RUNNING) { if (Constants.DEBUG) Log.d(TAG, "Starting AddToGroupTaskQueueService"); startService(new Intent(this, AddToGroupTaskQueueService.class)); } if (!AddToPhotosetTaskQueueService.IS_RUNNING) { if (Constants.DEBUG) Log.d(TAG, "Starting AddToPhotosetTaskQueueService"); startService(new Intent(this, AddToPhotosetTaskQueueService.class)); } if (!UploadPhotoTaskQueueService.IS_RUNNING) { if (Constants.DEBUG) Log.d(TAG, "Starting UploadPhotoTaskQueueService"); startService(new Intent(this, UploadPhotoTaskQueueService.class)); } } }