mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
(temporary) fix for navigation issue
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
863261b3a1
commit
b32f63ab68
5 changed files with 61 additions and 31 deletions
|
@ -405,9 +405,10 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
case R.id.nav_all_files:
|
||||
if (this instanceof FileDisplayActivity) {
|
||||
if (((FileDisplayActivity) this).getListOfFilesFragment() instanceof PhotoFragment) {
|
||||
showFiles(false);
|
||||
// showFiles(false);
|
||||
Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class);
|
||||
intent.putExtra(FileDisplayActivity.DRAWER_MENU_ID, menuItem.getItemId());
|
||||
intent.setAction(FileDisplayActivity.ALL_FILES);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
|
|
|
@ -135,7 +135,6 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
@ -162,6 +161,8 @@ public class FileDisplayActivity extends FileActivity
|
|||
SendShareDialog.SendShareDialogDownloader, Injectable {
|
||||
|
||||
public static final String RESTART = "RESTART";
|
||||
public static final String ALL_FILES = "ALL_FILES";
|
||||
public static final String PHOTO_SEARCH = "PHOTO_SEARCH";
|
||||
|
||||
private SyncBroadcastReceiver mSyncBroadcastReceiver;
|
||||
private UploadFinishReceiver mUploadFinishReceiver;
|
||||
|
@ -194,7 +195,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
|
||||
private static final String TAG = FileDisplayActivity.class.getSimpleName();
|
||||
|
||||
private static final String TAG_LIST_OF_FILES = "LIST_OF_FILES";
|
||||
public static final String TAG_LIST_OF_FILES = "LIST_OF_FILES";
|
||||
public static final String TAG_SECOND_FRAGMENT = "SECOND_FRAGMENT";
|
||||
|
||||
public static final String TEXT_PREVIEW = "TEXT_PREVIEW";
|
||||
|
@ -570,7 +571,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
if (SearchRemoteOperation.SearchType.PHOTO_SEARCH.equals(searchEvent.searchType)) {
|
||||
Log_OC.d(this, "Switch to photo search fragment");
|
||||
|
||||
PhotoFragment photoFragment = new PhotoFragment();
|
||||
PhotoFragment photoFragment = new PhotoFragment(true);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(searchEvent));
|
||||
photoFragment.setArguments(bundle);
|
||||
|
@ -578,7 +579,15 @@ public class FileDisplayActivity extends FileActivity
|
|||
transaction.replace(R.id.left_fragment_container, photoFragment, TAG_LIST_OF_FILES);
|
||||
transaction.commit();
|
||||
} else {
|
||||
Log_OC.w(TAG, "Ignored Intent requesting to query for " + query);
|
||||
Log_OC.d(this, "Switch to oc file search fragment");
|
||||
|
||||
OCFileListFragment photoFragment = new OCFileListFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(searchEvent));
|
||||
photoFragment.setArguments(bundle);
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.left_fragment_container, photoFragment, TAG_LIST_OF_FILES);
|
||||
transaction.commit();
|
||||
}
|
||||
} else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) {
|
||||
Uri data = intent.getData();
|
||||
|
@ -598,8 +607,13 @@ public class FileDisplayActivity extends FileActivity
|
|||
doShareWith(shareWith, shareType);
|
||||
}
|
||||
|
||||
} else {
|
||||
Log_OC.e(TAG, String.format(Locale.US, "Unexpected intent %s", intent));
|
||||
} else if (ALL_FILES.equals(intent.getAction())) {
|
||||
Log_OC.d(this, "Switch to oc file fragment");
|
||||
|
||||
OCFileListFragment fragment = new OCFileListFragment();
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.left_fragment_container, fragment, TAG_LIST_OF_FILES);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2573,16 +2587,17 @@ public class FileDisplayActivity extends FileActivity
|
|||
if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == event.searchType) {
|
||||
Log_OC.d(this, "Switch to photo search fragment");
|
||||
|
||||
fragment = new PhotoFragment();
|
||||
} else {
|
||||
Log_OC.d(this, "Switch to OCFileListFragment");
|
||||
|
||||
fragment = new OCFileListFragment();
|
||||
fragment = new PhotoFragment(true);
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.left_fragment_container, fragment, TAG_LIST_OF_FILES);
|
||||
transaction.commit();
|
||||
}
|
||||
// else {
|
||||
// Log_OC.d(this, "Switch to OCFileListFragment");
|
||||
//
|
||||
// fragment = new OCFileListFragment();
|
||||
// }
|
||||
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.add(R.id.left_fragment_container, fragment, TAG_LIST_OF_FILES);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
|
|
|
@ -882,7 +882,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
long currentSyncTime = System.currentTimeMillis();
|
||||
RemoteOperation refreshFolderOperation = new RefreshFolderOperation(ocFile,
|
||||
currentSyncTime,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
mStorageManager,
|
||||
account,
|
||||
|
|
|
@ -363,6 +363,10 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
}
|
||||
|
||||
setTitle();
|
||||
|
||||
if (searchEvent != null) {
|
||||
onMessageEvent(searchEvent);
|
||||
}
|
||||
}
|
||||
|
||||
protected void prepareCurrentSearch(SearchEvent event) {
|
||||
|
|
|
@ -52,10 +52,28 @@ public class PhotoFragment extends OCFileListFragment {
|
|||
private boolean photoSearchNoNew = false;
|
||||
private SearchRemoteOperation searchRemoteOperation;
|
||||
private AsyncTask photoSearchTask;
|
||||
private SearchEvent searchEvent;
|
||||
private boolean refresh = false;
|
||||
|
||||
public PhotoFragment() {
|
||||
|
||||
}
|
||||
|
||||
public PhotoFragment(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
searchEvent = new SearchEvent("image/%",
|
||||
SearchRemoteOperation.SearchType.PHOTO_SEARCH,
|
||||
SearchEvent.UnsetType.NO_UNSET);
|
||||
|
||||
searchRemoteOperation = new SearchRemoteOperation(searchEvent.getSearchQuery(),
|
||||
searchEvent.getSearchType(),
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,14 +114,15 @@ public class PhotoFragment extends OCFileListFragment {
|
|||
menuItemAddRemoveValue = MenuItemAddRemove.REMOVE_GRID_AND_SORT;
|
||||
requireActivity().invalidateOptionsMenu();
|
||||
|
||||
handleSearchEvent(searchEvent, false);
|
||||
handleSearchEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
super.onRefresh();
|
||||
|
||||
handleSearchEvent(searchEvent, true);
|
||||
refresh = true;
|
||||
handleSearchEvent();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,8 +130,8 @@ public class PhotoFragment extends OCFileListFragment {
|
|||
super.onMessageEvent(changeMenuEvent);
|
||||
}
|
||||
|
||||
private void handleSearchEvent(final SearchEvent event, boolean refresh) {
|
||||
prepareCurrentSearch(event);
|
||||
private void handleSearchEvent() {
|
||||
prepareCurrentSearch(searchEvent);
|
||||
searchFragment = true;
|
||||
setEmptyListLoadingMessage();
|
||||
|
||||
|
@ -124,6 +143,8 @@ public class PhotoFragment extends OCFileListFragment {
|
|||
mContainerActivity.getStorageManager(),
|
||||
mFile,
|
||||
true);
|
||||
|
||||
refresh = false;
|
||||
} else {
|
||||
mAdapter.showVirtuals(VirtualFolderType.PHOTOS, true, mContainerActivity.getStorageManager());
|
||||
preferences.setPhotoSearchTimestamp(System.currentTimeMillis());
|
||||
|
@ -133,17 +154,6 @@ public class PhotoFragment extends OCFileListFragment {
|
|||
|
||||
setFabVisible(false);
|
||||
|
||||
if (currentSearchType != SearchType.SHARED_FILTER) {
|
||||
boolean searchOnlyFolders = false;
|
||||
if (getArguments() != null && getArguments().getBoolean(ARG_SEARCH_ONLY_FOLDER, false)) {
|
||||
searchOnlyFolders = true;
|
||||
}
|
||||
|
||||
searchRemoteOperation = new SearchRemoteOperation(event.getSearchQuery(),
|
||||
event.getSearchType(),
|
||||
searchOnlyFolders);
|
||||
}
|
||||
|
||||
searchAndDisplay();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue