Browse Source

remove unused code

AndyScherzinger 7 years ago
parent
commit
df55791c5d

+ 2 - 5
src/main/java/com/owncloud/android/operations/CopyFileOperation.java

@@ -1,4 +1,4 @@
-/* ownCloud Android client application
+    /* ownCloud Android client application
  *   Copyright (C) 2012-2014 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
@@ -17,8 +17,6 @@
 
 package com.owncloud.android.operations;
 
-import android.accounts.Account;
-
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@@ -47,9 +45,8 @@ public class CopyFileOperation extends SyncOperation {
      *
      * @param srcPath          Remote path of the {@link OCFile} to move.
      * @param targetParentPath Path to the folder where the file will be copied into.
-     * @param account          OwnCloud account containing both the file and the target folder
      */
-    public CopyFileOperation(String srcPath, String targetParentPath, Account account) {
+    public CopyFileOperation(String srcPath, String targetParentPath) {
         mSrcPath = srcPath;
         mTargetParentPath = targetParentPath;
         if (!mTargetParentPath.endsWith(OCFile.PATH_SEPARATOR)) {

+ 4 - 46
src/main/java/com/owncloud/android/providers/FileContentProvider.java

@@ -1,4 +1,4 @@
-/**
+/*
  * ownCloud Android client application
  *
  * @author Bartek Przybylski
@@ -6,16 +6,16 @@
  * @author masensio
  * Copyright (C) 2011  Bartek Przybylski
  * Copyright (C) 2016 ownCloud Inc.
- * <p>
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2,
  * as published by the Free Software Foundation.
- * <p>
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * <p>
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -1387,47 +1387,5 @@ public class FileContentProvider extends ContentProvider {
         } finally {
             c.close();
         }
-
     }
-
-    /**
-     * Grants that total count of successful uploads stored is not greater than MAX_SUCCESSFUL_UPLOADS.
-     *
-     * Removes older uploads if needed.
-     */
-    private void trimSuccessfulUploads(SQLiteDatabase db) {
-        Cursor c = null;
-        try {
-            String MAX_SUCCESSFUL_UPLOADS = "30";
-            c = db.rawQuery(
-                    "delete from " + ProviderTableMeta.UPLOADS_TABLE_NAME +
-                            " where " + ProviderTableMeta.UPLOADS_STATUS + " == "
-                            + UploadsStorageManager.UploadStatus.UPLOAD_SUCCEEDED.getValue() +
-                            " and " + ProviderTableMeta._ID +
-                            " not in (select " + ProviderTableMeta._ID +
-                            " from " + ProviderTableMeta.UPLOADS_TABLE_NAME +
-                            " where " + ProviderTableMeta.UPLOADS_STATUS + " == "
-                            + UploadsStorageManager.UploadStatus.UPLOAD_SUCCEEDED.getValue() +
-                            " order by " + ProviderTableMeta.UPLOADS_UPLOAD_END_TIMESTAMP +
-                            " desc limit " + MAX_SUCCESSFUL_UPLOADS +
-                            ")",
-                    null
-            );
-            c.moveToFirst(); // do something with the cursor, or deletion doesn't happen; true story
-
-        } catch (Exception e) {
-            Log_OC.e(
-                    TAG,
-                    "Something wrong trimming successful uploads, database could grow more than expected",
-                    e
-            );
-
-        } finally {
-            if (c != null) {
-                c.close();
-            }
-        }
-    }
-
-
 }

+ 1 - 1
src/main/java/com/owncloud/android/services/OperationsService.java

@@ -684,7 +684,7 @@ public class OperationsService extends Service {
                     // Copy file/folder
                     String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
                     String newParentPath = operationIntent.getStringExtra(EXTRA_NEW_PARENT_PATH);
-                    operation = new CopyFileOperation(remotePath, newParentPath, account);
+                    operation = new CopyFileOperation(remotePath, newParentPath);
 
                 } else if (action.equals(ACTION_CHECK_CURRENT_CREDENTIALS)) {
                     // Check validity of currently stored credentials for a given account

+ 0 - 9
src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java

@@ -44,7 +44,6 @@ import android.widget.Toast;
 
 import com.evernote.android.job.JobRequest;
 import com.owncloud.android.R;
-import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.datamodel.UploadsStorageManager;
 import com.owncloud.android.db.OCUpload;
 import com.owncloud.android.files.services.FileUploader;
@@ -195,14 +194,6 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
 
         }        
     }
-    
-    /**
-     * Same as openFileWithDefault() but user cannot save default app.
-     * @param ocFile
-     */
-    private void openFileWithDefaultNoDefault(OCFile ocFile) {
-        getFileOperationsHelper().openFile(ocFile);
-    }
 
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {

+ 3 - 23
src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java

@@ -126,7 +126,7 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
 
         if (savedInstanceState != null) {
             if (!mIgnoreFirstSavedState) {
-                setFile((OCFile) savedInstanceState.getParcelable(FileDownloadFragment.EXTRA_FILE));
+                setFile(savedInstanceState.getParcelable(FileDownloadFragment.EXTRA_FILE));
                 mAccount = savedInstanceState.getParcelable(FileDownloadFragment.EXTRA_ACCOUNT);
                 mError = savedInstanceState.getBoolean(FileDownloadFragment.EXTRA_ERROR);
             }
@@ -240,29 +240,9 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
         getView().findViewById(R.id.error_image).setVisibility(View.GONE);
     }
 
-    /**
-     * Enables or disables buttons for a file locally available
-     */
-    private void setButtonsForDown() {
-        getView().findViewById(R.id.cancelBtn).setVisibility(View.GONE);
-
-        // hides the progress bar
-        getView().findViewById(R.id.progressBar).setVisibility(View.GONE);
-
-        // updates the text message
-        TextView progressText = (TextView) getView().findViewById(R.id.progressText);
-        progressText.setText(R.string.common_loading);
-        progressText.setVisibility(View.VISIBLE);
-
-        // hides the error icon
-        getView().findViewById(R.id.errorText).setVisibility(View.GONE);
-        getView().findViewById(R.id.error_image).setVisibility(View.GONE);
-    }
-
-
     /**
      * Enables or disables buttons for a file not locally available
-     * <p/>
+     *
      * Currently, this is only used when a download was failed
      */
     private void setButtonsForRemote() {
@@ -307,7 +287,7 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
         WeakReference<ProgressBar> mProgressBar = null;
 
         ProgressListener(ProgressBar progressBar) {
-            mProgressBar = new WeakReference<ProgressBar>(progressBar);
+            mProgressBar = new WeakReference<>(progressBar);
         }
 
         @Override