Update owncloud library reference
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileDisplayActivity.java
index 991ea30..8cd4374 100644 (file)
@@ -61,6 +61,7 @@ import com.actionbarsherlock.view.Menu;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 import com.actionbarsherlock.view.Window;
+import com.owncloud.android.BuildConfig;
 import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
@@ -77,6 +78,7 @@ import com.owncloud.android.lib.common.network.CertificateCombinedException;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.CreateFolderOperation;
 import com.owncloud.android.operations.CreateShareOperation;
 import com.owncloud.android.operations.RemoveFileOperation;
@@ -98,7 +100,6 @@ import com.owncloud.android.ui.preview.PreviewMediaFragment;
 import com.owncloud.android.ui.preview.PreviewVideoActivity;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
-import com.owncloud.android.utils.Log_OC;
 
 
 /**
@@ -196,7 +197,7 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
         getSupportActionBar().setHomeButtonEnabled(true);       // mandatory since Android ICS, according to the official documentation
         setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/);    // always AFTER setContentView(...) ; to work around bug in its implementation
         
-        showMessageView();
+        setBackgroundText();
 
         Log_OC.d(TAG, "onCreate() end");
     }
@@ -286,7 +287,7 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
             if (listOfFiles != null) {
                 listOfFiles.listDirectory(getCurrentDir());   
             } else {
-                Log.e(TAG, "Still have a chance to lose the initializacion of list fragment >(");
+                Log_OC.e(TAG, "Still have a chance to lose the initializacion of list fragment >(");
             }
             
             /// Second fragment
@@ -302,12 +303,12 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
             }
 
         } else {
-            Log.wtf(TAG, "initFragments() called with invalid NULLs!");
+            Log_OC.wtf(TAG, "initFragments() called with invalid NULLs!");
             if (getAccount() == null) {
-                Log.wtf(TAG, "\t account is NULL");
+                Log_OC.wtf(TAG, "\t account is NULL");
             }
             if (getFile() == null) {
-                Log.wtf(TAG, "\t file is NULL");
+                Log_OC.wtf(TAG, "\t file is NULL");
             }
         }
     }
@@ -446,6 +447,16 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
     }
 
     @Override
+    public boolean onPrepareOptionsMenu(Menu menu) {
+        if (BuildConfig.DEBUG) {
+            menu.findItem(R.id.action_logger).setVisible(true);
+        } else {
+            menu.findItem(R.id.action_logger).setVisible(false);
+        }
+        return super.onPrepareOptionsMenu(menu);
+    }
+
+    @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         MenuInflater inflater = getSherlock().getMenuInflater();
         inflater.inflate(R.menu.main_menu, menu);
@@ -475,6 +486,11 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
             startActivity(settingsIntent);
             break;
         }
+        case R.id.action_logger: {
+            Intent loggerIntent = new Intent(getApplicationContext(),LogHistoryActivity.class);
+            startActivity(loggerIntent);
+            break;
+        }
         case android.R.id.home: {
             FileFragment second = getSecondFragment();
             OCFile currentDir = getCurrentDir();
@@ -963,7 +979,7 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
                     Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
                     setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/);
 
-                    showMessageView();
+                    setBackgroundText();
                         
                 }
                 
@@ -984,7 +1000,7 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
      * Show a text message on screen view for notifying user if content is
      * loading or folder is empty
      */
-    private void showMessageView() {
+    private void setBackgroundText() {
         OCFileListFragment ocFileListFragment = getListOfFilesFragment();
         if (ocFileListFragment != null) {
             int message = R.string.file_list_loading;
@@ -992,9 +1008,9 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
                 // In case file list is empty
                 message = R.string.file_list_empty;
             }
-            ocFileListFragment.setMessageforEmptyView(getString(message));
+            ocFileListFragment.setMessageForEmptyList(getString(message));
         } else {
-            Log.e(TAG, "OCFileListFragment is null");
+            Log_OC.e(TAG, "OCFileListFragment is null");
         }
     }
 
@@ -1551,7 +1567,7 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
         
         setSupportProgressBarIndeterminateVisibility(true);
 
-        showMessageView();
+        setBackgroundText();
     }
 
     /**