Jelajahi Sumber

Revert "FileListListAdapter is a SimpleCursorAdapter"

This reverts commit 44dae87d2f5610108f87018dfa86e01cfc89c259.

Conflicts:
	src/com/owncloud/android/datamodel/FileDataStorageManager.java
	src/com/owncloud/android/ui/adapter/FileListListAdapter.java
	src/com/owncloud/android/ui/fragment/OCFileListFragment.java
masensio 11 tahun lalu
induk
melakukan
53a168c5a6

+ 25 - 53
src/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -610,34 +610,6 @@ public class FileDataStorageManager {
     }
     
     
-    public Cursor getContent(long parentId) {
-        Log_OC.d(TAG, "getContent start");
-        Uri req_uri = Uri.withAppendedPath(
-                ProviderTableMeta.CONTENT_URI_DIR,
-                String.valueOf(parentId));
-        Cursor c = null;
-
-        if (getContentProviderClient() != null) {
-            try {
-                c = getContentProviderClient().query(req_uri, null, 
-                        ProviderTableMeta.FILE_PARENT + "=?" ,
-                        new String[] { String.valueOf(parentId)}, null);
-            } catch (RemoteException e) {
-                Log_OC.e(TAG, e.getMessage());
-                return c;
-            }
-        } else {
-            c = getContentResolver().query(req_uri, null, 
-                    ProviderTableMeta.FILE_PARENT + "=?" ,
-                    new String[] { String.valueOf(parentId)}, null);
-            
-            //c.setNotificationUri(getContentResolver(), req_uri);
-        }
-        
-        Log_OC.d(TAG, "getContent end");
-        return c;
-    }
-    
     private OCFile createRootDir() {
         OCFile file = new OCFile(OCFile.ROOT_PATH);
         file.setMimetype("DIR");
@@ -702,31 +674,31 @@ public class FileDataStorageManager {
         return c;
     }
     
-//    private Cursor getShareCursorForValue(String key, String value) {
-//        Cursor c = null;
-//        if (getContentResolver() != null) {
-//            c = getContentResolver()
-//                    .query(ProviderTableMeta.CONTENT_URI_SHARE,
-//                            null,
-//                            key + "=? AND "
-//                                    + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER
-//                                    + "=?",
-//                                    new String[] { value, mAccount.name }, null);
-//        } else {
-//            try {
-//                c = getContentProviderClient().query(
-//                        ProviderTableMeta.CONTENT_URI_SHARE,
-//                        null,
-//                        key + "=? AND " + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER
-//                        + "=?", new String[] { value, mAccount.name },
-//                        null);
-//            } catch (RemoteException e) {
-//                Log_OC.e(TAG, "Could not get file details: " + e.getMessage());
-//                c = null;
-//            }
-//        }
-//        return c;
-//    }
+    private Cursor getShareCursorForValue(String key, String value) {
+        Cursor c = null;
+        if (getContentResolver() != null) {
+            c = getContentResolver()
+                    .query(ProviderTableMeta.CONTENT_URI_SHARE,
+                            null,
+                            key + "=? AND "
+                                    + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER
+                                    + "=?",
+                                    new String[] { value, mAccount.name }, null);
+        } else {
+            try {
+                c = getContentProviderClient().query(
+                        ProviderTableMeta.CONTENT_URI_SHARE,
+                        null,
+                        key + "=? AND " + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER
+                        + "=?", new String[] { value, mAccount.name },
+                        null);
+            } catch (RemoteException e) {
+                Log_OC.e(TAG, "Could not get file details: " + e.getMessage());
+                c = null;
+            }
+        }
+        return c;
+    }
 
     private OCFile createFileInstance(Cursor c) {
         OCFile file = null;

+ 10 - 12
src/com/owncloud/android/ui/adapter/FileListListAdapter.java

@@ -18,12 +18,11 @@
 package com.owncloud.android.ui.adapter;
 
 import android.accounts.Account;
-import android.content.Context;
-import android.support.v4.widget.SimpleCursorAdapter;
+import android.content.Context;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-//import android.widget.BaseAdapter;
+import android.widget.BaseAdapter;
 import android.widget.ImageView;
 import android.widget.ListAdapter;
 import android.widget.ListView;
@@ -49,21 +48,20 @@ import com.owncloud.android.utils.DisplayUtils;
  * @author Bartek Przybylski
  * 
  */
-public class FileListListAdapter extends SimpleCursorAdapter /*BaseAdapter*/ implements ListAdapter {
-
+public class FileListListAdapter extends BaseAdapter implements ListAdapter {
     private Context mContext;
-    private static OCFile mFile = null;
+    private OCFile mFile = null;
     private Vector<OCFile> mFiles = null;
-    private static FileDataStorageManager mStorageManager;
+
+    private FileDataStorageManager mStorageManager;
     private Account mAccount;
     private ComponentsGetter mTransferServiceGetter;
-    
-
-    public FileListListAdapter(Context context, ComponentsGetter componentsGetter) {
-        super(context, 0, null, null, null, 0);
+    
+    public FileListListAdapter(Context context, ComponentsGetter transferServiceGetter) {
         mContext = context;
         mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
-        mTransferServiceGetter = componentsGetter;    }
+        mTransferServiceGetter = transferServiceGetter;
+    }
 
     @Override
     public boolean areAllItemsEnabled() {

+ 1 - 2
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -111,7 +111,6 @@ public class OCFileListFragment extends ExtendedListFragment implements EditName
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
         Log_OC.e(TAG, "onActivityCreated() start");
-
         mAdapter = new FileListListAdapter(getSherlockActivity(), mContainerActivity); 
                 
         if (savedInstanceState != null) {
@@ -129,7 +128,7 @@ public class OCFileListFragment extends ExtendedListFragment implements EditName
             
         }
         
-        mAdapter = new FileListListAdapter(getActivity(), mContainerActivity);
+        mAdapter = new FileListListAdapter(getSherlockActivity(), mContainerActivity);
         
         setListAdapter(mAdapter);