Start working on shared filter

This commit is contained in:
Mario Danic 2017-03-29 10:38:43 +02:00
parent 6bdb618014
commit cd17ac2c7a
3 changed files with 19 additions and 7 deletions

View file

@ -173,7 +173,7 @@ dependencies {
compile name: 'touch-image-view' compile name: 'touch-image-view'
compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:multidex:1.0.1'
compile 'com.github.nextcloud:android-library:master-SNAPSHOT' compile 'com.github.nextcloud:android-library:notifications-SNAPSHOT'
compile "com.android.support:support-v4:${supportLibraryVersion}" compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}" compile "com.android.support:design:${supportLibraryVersion}"
compile 'com.jakewharton:disklrucache:2.0.2' compile 'com.jakewharton:disklrucache:2.0.2'

View file

@ -137,7 +137,9 @@ public class ExtendedListFragment extends Fragment
RECENTLY_MODIFIED_SEARCH, RECENTLY_MODIFIED_SEARCH,
RECENTLY_MODIFIED_SEARCH_FILTER, RECENTLY_MODIFIED_SEARCH_FILTER,
RECENTLY_ADDED_SEARCH, RECENTLY_ADDED_SEARCH,
RECENTLY_ADDED_SEARCH_FILTER RECENTLY_ADDED_SEARCH_FILTER,
// not a real filter, but nevertheless
SHARED_FILTER
} }
protected void setListAdapter(BaseAdapter listAdapter) { protected void setListAdapter(BaseAdapter listAdapter) {

View file

@ -65,6 +65,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.SearchOperation; import com.owncloud.android.lib.resources.files.SearchOperation;
import com.owncloud.android.lib.resources.files.ToggleFavoriteOperation; import com.owncloud.android.lib.resources.files.ToggleFavoriteOperation;
import com.owncloud.android.lib.resources.shares.GetRemoteSharesOperation;
import com.owncloud.android.lib.resources.status.OwnCloudVersion; import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.ui.activity.FileActivity; import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.ui.activity.FileDisplayActivity;
@ -1262,6 +1263,8 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
currentSearchType = SearchType.RECENTLY_ADDED_SEARCH; currentSearchType = SearchType.RECENTLY_ADDED_SEARCH;
} else if (event.getSearchType().equals(SearchOperation.SearchType.RECENTLY_MODIFIED_SEARCH)) { } else if (event.getSearchType().equals(SearchOperation.SearchType.RECENTLY_MODIFIED_SEARCH)) {
currentSearchType = SearchType.RECENTLY_MODIFIED_SEARCH; currentSearchType = SearchType.RECENTLY_MODIFIED_SEARCH;
} else if (event.getSearchType().equals(SearchOperation.SearchType.SHARED_FILTER)) {
currentSearchType = SearchType.SHARED_FILTER;
} }
Runnable switchViewsRunnable = new Runnable() { Runnable switchViewsRunnable = new Runnable() {
@ -1285,11 +1288,18 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
OwnCloudClient mClient = OwnCloudClientManagerFactory.getDefaultSingleton(). OwnCloudClient mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
getClientFor(ocAccount, MainApp.getAppContext()); getClientFor(ocAccount, MainApp.getAppContext());
SearchOperation operation = new SearchOperation(event.getSearchQuery(), event.getSearchType()); if (!currentSearchType.equals(SearchType.SHARED_FILTER)) {
RemoteOperationResult remoteOperationResult = operation.execute(mClient); SearchOperation operation = new SearchOperation(event.getSearchQuery(), event.getSearchType());
RemoteOperationResult remoteOperationResult = operation.execute(mClient);
if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null) { if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null) {
mAdapter.setData(remoteOperationResult.getData(), currentSearchType); mAdapter.setData(remoteOperationResult.getData(), currentSearchType);
}
} else {
GetRemoteSharesOperation operation = new GetRemoteSharesOperation();
RemoteOperationResult remoteOperationResult = operation.execute(mClient);
if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null) {
mAdapter.setData(remoteOperationResult.getData(), currentSearchType);
}
} }
if (event.getSearchType().equals(SearchOperation.SearchType.FILE_SEARCH)) { if (event.getSearchType().equals(SearchOperation.SearchType.FILE_SEARCH)) {