Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁlvaro Brey <alvaro.brey@nextcloud.com>2022-01-27 17:40:48 +0300
committerGitHub <noreply@github.com>2022-01-27 17:40:48 +0300
commit7dfaf3e6050bf0ef1b1c257c0044a9a091990369 (patch)
tree85fbc65176ad18ab47507e289158797f885a8ea5
parent4d3f6d1323fd180fd3d2ec587227dbfaccecdcb4 (diff)
parent52e3faecdd65f7b47836c777112e75305e7b5f17 (diff)
Merge pull request #9767 from nextcloud/backport/9743/stable-3.19rc-3.19.0-02
[stable-3.19] Fix crashes and double loading in GalleryFragment when changing dark theme
-rw-r--r--src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java6
-rw-r--r--src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java37
2 files changed, 24 insertions, 19 deletions
diff --git a/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
index 7e26a87ce3..11c90ceb13 100644
--- a/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
+++ b/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
@@ -525,7 +525,7 @@ public class FileDisplayActivity extends FileActivity
if (SearchRemoteOperation.SearchType.PHOTO_SEARCH.equals(searchEvent.searchType)) {
Log_OC.d(this, "Switch to photo search fragment");
- GalleryFragment photoFragment = new GalleryFragment(true);
+ GalleryFragment photoFragment = new GalleryFragment();
Bundle bundle = new Bundle();
bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(searchEvent));
photoFragment.setArguments(bundle);
@@ -2071,7 +2071,7 @@ public class FileDisplayActivity extends FileActivity
OCFileListFragment fragment = getListOfFilesFragment();
- if (fragment != null) {
+ if (fragment != null && !(fragment instanceof GalleryFragment)) {
fragment.setLoading(true);
}
@@ -2341,7 +2341,7 @@ public class FileDisplayActivity extends FileActivity
if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == event.searchType) {
Log_OC.d(this, "Switch to photo search fragment");
- setLeftFragment(new GalleryFragment(true));
+ setLeftFragment(new GalleryFragment());
}
}
diff --git a/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java b/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java
index 474a4606b7..3e595cba2c 100644
--- a/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java
+++ b/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java
@@ -54,27 +54,25 @@ public class GalleryFragment extends OCFileListFragment {
private SearchEvent searchEvent;
private boolean refresh;
- public GalleryFragment() {
- this.refresh = false;
- }
-
- public GalleryFragment(boolean refresh) {
- this.refresh = refresh;
+ private void createOperation() {
+ if(searchEvent == null) {
+ searchEvent = new SearchEvent("", SearchRemoteOperation.SearchType.GALLERY_SEARCH);
+ }
+ if(searchRemoteOperation == null) {
+ OCCapability ocCapability = mContainerActivity.getStorageManager()
+ .getCapability(accountManager.getUser().getAccountName());
+
+ searchRemoteOperation = new SearchRemoteOperation(searchEvent.getSearchQuery(),
+ searchEvent.getSearchType(),
+ false,
+ ocCapability);
+ }
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- searchEvent = new SearchEvent("", SearchRemoteOperation.SearchType.GALLERY_SEARCH);
-
- OCCapability ocCapability = mContainerActivity.getStorageManager()
- .getCapability(accountManager.getUser().getAccountName());
-
- searchRemoteOperation = new SearchRemoteOperation(searchEvent.getSearchQuery(),
- searchEvent.getSearchType(),
- false,
- ocCapability);
+ refresh = true;
}
@Override
@@ -91,6 +89,7 @@ public class GalleryFragment extends OCFileListFragment {
*/
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ createOperation();
View v = super.onCreateView(inflater, container, savedInstanceState);
getRecyclerView().addOnScrollListener(new RecyclerView.OnScrollListener() {
@@ -127,6 +126,12 @@ public class GalleryFragment extends OCFileListFragment {
}
@Override
+ public void onResume() {
+ super.onResume();
+ setLoading(photoSearchQueryRunning);
+ }
+
+ @Override
public void onMessageEvent(ChangeMenuEvent changeMenuEvent) {
super.onMessageEvent(changeMenuEvent);
}