Merge branch 'zmatsuo-detailThumbnail' into develop
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / FileActivity.java
index 09fc255..1c21cab 100644 (file)
@@ -43,6 +43,7 @@ import android.support.v4.widget.DrawerLayout;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.ActionBarDrawerToggle;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.ActionBarDrawerToggle;
 import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.ListView;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.ListView;
@@ -314,12 +315,26 @@ public class FileActivity extends AppCompatActivity
         super.onBackPressed();
     }
 
         super.onBackPressed();
     }
 
+    /**
+     * checks if the drawer exists and is opened.
+     *
+     * @return <code>true</code> if the drawer is open, else <code>false</code>
+     */
     public boolean isDrawerOpen() {
     public boolean isDrawerOpen() {
-        return mDrawerLayout.isDrawerOpen(GravityCompat.START);
+        if(mDrawerLayout != null) {
+            return mDrawerLayout.isDrawerOpen(GravityCompat.START);
+        } else {
+            return false;
+        }
     }
 
     }
 
+    /**
+     * closes the navigation drawer.
+     */
     public void closeNavDrawer() {
     public void closeNavDrawer() {
-        mDrawerLayout.closeDrawer(GravityCompat.START);
+        if(mDrawerLayout != null) {
+            mDrawerLayout.closeDrawer(GravityCompat.START);
+        }
     }
 
     protected void initDrawer(){
     }
 
     protected void initDrawer(){
@@ -416,7 +431,7 @@ public class FileActivity extends AppCompatActivity
 
         // Set the drawer toggle as the DrawerListener
         mDrawerLayout.setDrawerListener(mDrawerToggle);
 
         // Set the drawer toggle as the DrawerListener
         mDrawerLayout.setDrawerListener(mDrawerToggle);
-
+        mDrawerToggle.setDrawerIndicatorEnabled(false);
     }
 
     /**
     }
 
     /**
@@ -495,7 +510,7 @@ public class FileActivity extends AppCompatActivity
      */
     private void swapToDefaultAccount() {
         // default to the most recently used account
      */
     private void swapToDefaultAccount() {
         // default to the most recently used account
-        Account newAccount  = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
+        Account newAccount = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
         if (newAccount == null) {
             /// no account available: force account creation
             createFirstAccount();
         if (newAccount == null) {
             /// no account available: force account creation
             createFirstAccount();
@@ -587,7 +602,7 @@ public class FileActivity extends AppCompatActivity
     }
 
     /**
     }
 
     /**
-     * @return  'True' when the Activity is finishing to enforce the setup of a new account.
+     * @return 'True' when the Activity is finishing to enforce the setup of a new account.
      */
     protected boolean isRedirectingToSetupAccount() {
         return mRedirectingToSetupAccount;
      */
     protected boolean isRedirectingToSetupAccount() {
         return mRedirectingToSetupAccount;
@@ -737,6 +752,7 @@ public class FileActivity extends AppCompatActivity
     }
 
 
     }
 
 
+
     private void onCreateShareOperationFinish(CreateShareOperation operation,
                                               RemoteOperationResult result) {
         dismissLoadingDialog();
     private void onCreateShareOperationFinish(CreateShareOperation operation,
                                               RemoteOperationResult result) {
         dismissLoadingDialog();
@@ -805,14 +821,15 @@ public class FileActivity extends AppCompatActivity
                 i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile);
                 i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount());
                 startActivity(i);
                 i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile);
                 i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount());
                 startActivity(i);
-
             }
             }
+
         } else {
             if (!operation.transferWasRequested()) {
                 Toast msg = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result,
                         operation, getResources()), Toast.LENGTH_LONG);
                 msg.show();
             }
         } else {
             if (!operation.transferWasRequested()) {
                 Toast msg = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result,
                         operation, getResources()), Toast.LENGTH_LONG);
                 msg.show();
             }
+            invalidateOptionsMenu();
         }
     }
 
         }
     }
 
@@ -841,7 +858,7 @@ public class FileActivity extends AppCompatActivity
     /**
      * Dismiss loading dialog
      */
     /**
      * Dismiss loading dialog
      */
-    public void dismissLoadingDialog(){
+    public void dismissLoadingDialog() {
         Fragment frag = getSupportFragmentManager().findFragmentByTag(DIALOG_WAIT_TAG);
         if (frag != null) {
             LoadingDialog loading = (LoadingDialog) frag;
         Fragment frag = getSupportFragmentManager().findFragmentByTag(DIALOG_WAIT_TAG);
         if (frag != null) {
             LoadingDialog loading = (LoadingDialog) frag;