Logs on activities life cycle simplified
authorDavid A. Velasco <dvelasco@solidgear.es>
Thu, 30 Apr 2015 11:30:55 +0000 (13:30 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Thu, 30 Apr 2015 11:30:55 +0000 (13:30 +0200)
src/com/owncloud/android/MainApp.java
src/com/owncloud/android/ui/activity/FileActivity.java
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

index b16198d..486ca65 100644 (file)
@@ -23,22 +23,17 @@ package com.owncloud.android;
 import android.app.Activity;
 import android.app.Application;
 import android.content.Context;
-import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.os.Build;
 import android.os.Bundle;
 
-import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.authentication.PassCodeManager;
 import com.owncloud.android.datamodel.ThumbnailsCacheManager;
 import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
 import com.owncloud.android.lib.common.OwnCloudClientManagerFactory.Policy;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.ui.activity.PinCodeActivity;
 
-import java.util.HashSet;
-import java.util.Set;
 
 /**
  * Main Application of the project
@@ -92,41 +87,39 @@ public class MainApp extends Application {
 
                 @Override
                 public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
-                    Log_OC.d(TAG, activity.getClass().getSimpleName() + " in onCreate(Bundle)" );
+                    Log_OC.d(activity.getClass().getSimpleName(),  "onCreate(Bundle) starting" );
                 }
 
                 @Override
                 public void onActivityStarted(Activity activity) {
-                    Log_OC.d(TAG, activity.getClass().getSimpleName() + " in onStart()" );
+                    Log_OC.d(activity.getClass().getSimpleName(),  "onStart() starting" );
                     PassCodeManager.getPassCodeManager().onActivityStarted(activity);
                 }
 
                 @Override
                 public void onActivityResumed(Activity activity) {
-                    Log_OC.d(TAG, activity.getClass().getSimpleName() + " in onResume()" );
+                    Log_OC.d(activity.getClass().getSimpleName(), "onResume() starting" );
                 }
 
                 @Override
                 public void onActivityPaused(Activity activity) {
-                    Log_OC.d(TAG, activity.getClass().getSimpleName() + " in onPause()");
+                    Log_OC.d(activity.getClass().getSimpleName(), "onPause() ending");
                 }
 
                 @Override
                 public void onActivityStopped(Activity activity) {
-                    Log_OC.d(TAG, activity.getClass().getSimpleName() + " in onStop()" );
+                    Log_OC.d(activity.getClass().getSimpleName(), "onStop() ending" );
                     PassCodeManager.getPassCodeManager().onActivityStopped(activity);
                 }
 
                 @Override
                 public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
-                    Log_OC.d(TAG, activity.getClass().getSimpleName() + " in onSaveInstanceState(Bundle)" );
-
+                    Log_OC.d(activity.getClass().getSimpleName(), "onSaveInstanceState(Bundle) starting" );
                 }
 
                 @Override
                 public void onActivityDestroyed(Activity activity) {
-                    Log_OC.d(TAG, activity.getClass().getSimpleName() + " in onDestroy()" );
-
+                    Log_OC.d(activity.getClass().getSimpleName(), "onDestroy() ending" );
                 }
             });
         }
index 17aa8c0..50b4175 100644 (file)
@@ -198,42 +198,34 @@ public class FileActivity extends SherlockFragmentActivity
     
     @Override 
     protected void onStart() {
-        Log_OC.v(TAG, "onStart() start");
         super.onStart();
 
         if (mAccountWasSet) {
             onAccountSet(mAccountWasRestored);
         }
-        Log_OC.v(TAG, "onStart() end");
     }
     
     @Override
     protected void onResume() {
-        Log_OC.v(TAG, "onResume() start");
         super.onResume();
         
         if (mOperationsServiceBinder != null) {
             doOnResumeAndBound();
         }
-        Log_OC.v(TAG, "onResume() end");
     }
     
     @Override
     protected void onPause()  {
-        Log_OC.v(TAG, "onPause() start");
-
         if (mOperationsServiceBinder != null) {
             mOperationsServiceBinder.removeOperationListener(this);
         }
         
         super.onPause();
-        Log_OC.v(TAG, "onPause() end");
     }
     
     
     @Override
     protected void onDestroy() {
-        Log_OC.v(TAG, "onDestroy() start");
         if (mOperationsServiceConnection != null) {
             unbindService(mOperationsServiceConnection);
             mOperationsServiceBinder = null;
@@ -248,7 +240,6 @@ public class FileActivity extends SherlockFragmentActivity
         }
 
         super.onDestroy();
-        Log_OC.v(TAG, "onDestroy() end");
     }
     
     
index 840339c..e095660 100644 (file)
@@ -159,7 +159,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
-        Log_OC.d(TAG, "onCreate() start");
+        Log_OC.v(TAG, "onCreate() start");
         requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
 
         super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid
@@ -200,22 +200,22 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         
         setBackgroundText();
 
-        Log_OC.d(TAG, "onCreate() end");
+        Log_OC.v(TAG, "onCreate() end");
     }
     
     @Override
     protected void onStart() {
-        Log_OC.d(TAG, "onStart() start");
+        Log_OC.v(TAG, "onStart() start");
         super.onStart();
         getSupportActionBar().setIcon(DisplayUtils.getSeasonalIconId());
-        Log_OC.d(TAG, "onStart() end");
+        Log_OC.v(TAG, "onStart() end");
     }
 
     @Override
     protected void onDestroy() {
-        Log_OC.d(TAG, "onDestroy() start");
+        Log_OC.v(TAG, "onDestroy() start");
         super.onDestroy();
-        Log_OC.d(TAG, "onDestroy() end");
+        Log_OC.v(TAG, "onDestroy() end");
     }
 
     /**
@@ -773,21 +773,21 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
     @Override
     protected void onSaveInstanceState(Bundle outState) {
         // responsibility of restore is preferred in onCreate() before than in onRestoreInstanceState when there are Fragments involved
-        Log_OC.d(TAG, "onSaveInstanceState() start");
+        Log_OC.v(TAG, "onSaveInstanceState() start");
         super.onSaveInstanceState(outState);
         outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW, mWaitingToPreview);
         outState.putBoolean(FileDisplayActivity.KEY_SYNC_IN_PROGRESS, mSyncInProgress);
         //outState.putBoolean(FileDisplayActivity.KEY_REFRESH_SHARES_IN_PROGRESS, mRefreshSharesInProgress);
         outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND, mWaitingToSend);
 
-        Log_OC.d(TAG, "onSaveInstanceState() end");
+        Log_OC.v(TAG, "onSaveInstanceState() end");
     }
     
 
 
     @Override
     protected void onResume() {
-        Log_OC.d(TAG, "onResume() start");
+        Log_OC.v(TAG, "onResume() start");
         super.onResume();
 
         // refresh list of files
@@ -814,13 +814,13 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         mDownloadFinishReceiver = new DownloadFinishReceiver();
         registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);
         
-        Log_OC.d(TAG, "onResume() end");
+        Log_OC.v(TAG, "onResume() end");
     }
 
 
     @Override
     protected void onPause() {
-        Log_OC.d(TAG, "onPause() start");
+        Log_OC.v(TAG, "onPause() start");
         if (mSyncBroadcastReceiver != null) {
             unregisterReceiver(mSyncBroadcastReceiver);
             //LocalBroadcastManager.getInstance(this).unregisterReceiver(mSyncBroadcastReceiver);
@@ -836,7 +836,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         }
         
         super.onPause();
-        Log_OC.d(TAG, "onPause() end");
+        Log_OC.v(TAG, "onPause() end");
     }
 
     /**