From 733c8147ad745631977e837ca97599f0292616ef Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Mon, 19 May 2014 11:56:29 +0200 Subject: [PATCH] Review of calls to super. in Activity/Fragment life cycle methods --- .../android/files/services/FileObserverService.java | 2 +- src/com/owncloud/android/media/MediaService.java | 2 ++ src/com/owncloud/android/services/OperationsService.java | 2 +- .../android/ui/activity/AccountSelectActivity.java | 2 +- src/com/owncloud/android/ui/activity/FileActivity.java | 2 +- src/com/owncloud/android/ui/activity/Preferences.java | 2 +- src/com/owncloud/android/ui/dialog/LoadingDialog.java | 2 +- .../owncloud/android/ui/fragment/FileDetailFragment.java | 2 +- .../owncloud/android/ui/preview/FileDownloadFragment.java | 2 +- .../owncloud/android/ui/preview/PreviewImageActivity.java | 2 +- .../owncloud/android/ui/preview/PreviewImageFragment.java | 2 +- .../owncloud/android/ui/preview/PreviewMediaFragment.java | 7 ++++--- 12 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/com/owncloud/android/files/services/FileObserverService.java b/src/com/owncloud/android/files/services/FileObserverService.java index c6753896e0..1bcd8d630e 100644 --- a/src/com/owncloud/android/files/services/FileObserverService.java +++ b/src/com/owncloud/android/files/services/FileObserverService.java @@ -82,10 +82,10 @@ public class FileObserverService extends Service { @Override public void onDestroy() { - super.onDestroy(); unregisterReceiver(mDownloadReceiver); mObserversMap = null; // TODO study carefully the life cycle of Services to grant the best possible observance Log_OC.d(TAG, "Bye, bye"); + super.onDestroy(); } diff --git a/src/com/owncloud/android/media/MediaService.java b/src/com/owncloud/android/media/MediaService.java index 0a74635518..7ee8057089 100644 --- a/src/com/owncloud/android/media/MediaService.java +++ b/src/com/owncloud/android/media/MediaService.java @@ -218,6 +218,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre */ @Override public void onCreate() { + super.onCreate(); Log_OC.d(TAG, "Creating ownCloud media service"); mWifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)). @@ -637,6 +638,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre mState = State.STOPPED; releaseResources(true); giveUpAudioFocus(); + super.onDestroy(); } diff --git a/src/com/owncloud/android/services/OperationsService.java b/src/com/owncloud/android/services/OperationsService.java index 1c841f5125..a638848895 100644 --- a/src/com/owncloud/android/services/OperationsService.java +++ b/src/com/owncloud/android/services/OperationsService.java @@ -172,10 +172,10 @@ public class OperationsService extends Service { @Override public void onDestroy() { //Log_OC.wtf(TAG, "onDestroy init" ); - super.onDestroy(); //Log_OC.wtf(TAG, "Clear mUndispatchedFinisiedOperations" ); mUndispatchedFinishedOperations.clear(); //Log_OC.wtf(TAG, "onDestroy end" ); + super.onDestroy(); } diff --git a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java index e1c7b47ae8..27ce4d946f 100644 --- a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java +++ b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java @@ -89,7 +89,6 @@ public class AccountSelectActivity extends SherlockListActivity implements @Override protected void onPause() { - super.onPause(); if (this.isFinishing()) { Account current = AccountUtils.getCurrentOwnCloudAccount(this); if ((mPreviousAccount == null && current != null) || @@ -102,6 +101,7 @@ public class AccountSelectActivity extends SherlockListActivity implements startActivity(i); } } + super.onPause(); } @Override diff --git a/src/com/owncloud/android/ui/activity/FileActivity.java b/src/com/owncloud/android/ui/activity/FileActivity.java index 11e0a39961..d38d69de98 100644 --- a/src/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/com/owncloud/android/ui/activity/FileActivity.java @@ -204,7 +204,6 @@ implements OnRemoteOperationListener, ComponentsGetter { @Override protected void onDestroy() { - super.onDestroy(); if (mOperationsServiceConnection != null) { unbindService(mOperationsServiceConnection); mOperationsServiceBinder = null; @@ -217,6 +216,7 @@ implements OnRemoteOperationListener, ComponentsGetter { unbindService(mUploadServiceConnection); mUploadServiceConnection = null; } + super.onDestroy(); } diff --git a/src/com/owncloud/android/ui/activity/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java index 3ebb432cc4..1f18ca8a62 100644 --- a/src/com/owncloud/android/ui/activity/Preferences.java +++ b/src/com/owncloud/android/ui/activity/Preferences.java @@ -261,10 +261,10 @@ public class Preferences extends SherlockPreferenceActivity { @Override protected void onResume() { + super.onResume(); SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); boolean state = appPrefs.getBoolean("set_pincode", false); pCode.setChecked(state); - super.onResume(); } @Override diff --git a/src/com/owncloud/android/ui/dialog/LoadingDialog.java b/src/com/owncloud/android/ui/dialog/LoadingDialog.java index 5622441bfe..d0dcfb7b50 100644 --- a/src/com/owncloud/android/ui/dialog/LoadingDialog.java +++ b/src/com/owncloud/android/ui/dialog/LoadingDialog.java @@ -69,6 +69,6 @@ public class LoadingDialog extends DialogFragment { public void onDestroyView() { if (getDialog() != null && getRetainInstance()) getDialog().setDismissMessage(null); - super.onDestroyView(); + super.onDestroyView(); } } diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index c9d6b33516..76cee973f6 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -147,8 +147,8 @@ public class FileDetailFragment extends FileFragment implements OnClickListener @Override public void onStop() { - super.onStop(); leaveTransferProgress(); + super.onStop(); } diff --git a/src/com/owncloud/android/ui/preview/FileDownloadFragment.java b/src/com/owncloud/android/ui/preview/FileDownloadFragment.java index 849afaf204..fe7bf6c908 100644 --- a/src/com/owncloud/android/ui/preview/FileDownloadFragment.java +++ b/src/com/owncloud/android/ui/preview/FileDownloadFragment.java @@ -164,8 +164,8 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene @Override public void onStop() { - super.onStop(); leaveTransferProgress(); + super.onStop(); } @Override diff --git a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java index d4e95cbd17..954f4a7d37 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java @@ -269,9 +269,9 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener { @Override public void onPause() { - super.onPause(); unregisterReceiver(mDownloadFinishReceiver); mDownloadFinishReceiver = null; + super.onPause(); } diff --git a/src/com/owncloud/android/ui/preview/PreviewImageFragment.java b/src/com/owncloud/android/ui/preview/PreviewImageFragment.java index fd22b3a9a5..b8219a5f51 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImageFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewImageFragment.java @@ -294,10 +294,10 @@ public class PreviewImageFragment extends FileFragment { @Override public void onDestroy() { - super.onDestroy(); if (mBitmap != null) { mBitmap.recycle(); } + super.onDestroy(); } diff --git a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java index 5f5ceaa6af..8364972911 100644 --- a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -457,8 +457,8 @@ public class PreviewMediaFragment extends FileFragment implements @Override public void onPause() { - super.onPause(); Log_OC.e(TAG, "onPause"); + super.onPause(); } @Override @@ -469,14 +469,13 @@ public class PreviewMediaFragment extends FileFragment implements @Override public void onDestroy() { - super.onDestroy(); Log_OC.e(TAG, "onDestroy"); + super.onDestroy(); } @Override public void onStop() { Log_OC.e(TAG, "onStop"); - super.onStop(); mPrepared = false; if (mMediaServiceConnection != null) { @@ -488,6 +487,8 @@ public class PreviewMediaFragment extends FileFragment implements mMediaServiceConnection = null; mMediaServiceBinder = null; } + + super.onStop(); } @Override