Start MoveFileOperation when 'Choose' button is clicked [Work In
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileDisplayActivity.java
index 991ea30..b234dcf 100644 (file)
@@ -48,6 +48,7 @@ import android.provider.MediaStore;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
+import android.support.v4.widget.SwipeRefreshLayout;
 import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
@@ -109,8 +110,9 @@ import com.owncloud.android.utils.Log_OC;
  */
 
 public class FileDisplayActivity extends HookActivity implements
-FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener {
-
+FileFragment.ContainerActivity, OnNavigationListener, 
+OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener {
+    
     private ArrayAdapter<String> mDirectories;
 
     private SyncBroadcastReceiver mSyncBroadcastReceiver;
@@ -196,7 +198,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");
     }
@@ -963,7 +965,7 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
                     Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
                     setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/);
 
-                    showMessageView();
+                    setBackgroundText();
                         
                 }
                 
@@ -984,7 +986,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,7 +994,7 @@ 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");
         }
@@ -1551,7 +1553,7 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
         
         setSupportProgressBarIndeterminateVisibility(true);
 
-        showMessageView();
+        setBackgroundText();
     }
 
     /**
@@ -1654,4 +1656,17 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
         onTransferStateChanged(file, false, false);
     }
 
+    @Override
+    public void onRefresh() {
+        OCFileListFragment listOfFiles = getListOfFilesFragment();
+        if (listOfFiles != null) {
+            OCFile folder = listOfFiles.getCurrentFile();
+            if (folder != null) {
+                /*mFile = mContainerActivity.getStorageManager().getFileById(mFile.getFileId());
+                listDirectory(mFile);*/
+                startSyncFolderOperation(folder);
+            }
+        }
+    }
+
 }