From: masensio Date: Tue, 6 May 2014 11:28:26 +0000 (+0200) Subject: Revert "FileListListAdapter is a SimpleCursorAdapter" X-Git-Tag: oc-android-1.7.0_signed~309^2~49 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/53a168c5a6328396ef223ed139b7488d353348a4 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 --- diff --git a/src/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/com/owncloud/android/datamodel/FileDataStorageManager.java index 69e1d71c..44d78206 100644 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/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; diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index 9f7e0d74..38ade7c8 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/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 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() { diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index 530a0d55..800eaf97 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/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);