Skip to content

Commit 47bf01f

Browse files
authored
Merge pull request #11033 from nextcloud/fix/noid/jumping-file-list
File list "jumps" after scrolling when an asynchronous operation finishes
2 parents e963905 + 8faf600 commit 47bf01f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

app/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
5757
shortSleep()
5858
sut.runOnUiThread {
5959
sut.listOfFilesFragment!!.setFabEnabled(false)
60-
sut.resetScrolling()
60+
sut.resetScrolling(true)
6161
sut.listOfFilesFragment!!.setEmptyListLoadingMessage()
6262
sut.listOfFilesFragment!!.isLoading = false
6363
}
@@ -109,7 +109,7 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
109109
shortSleep()
110110
sut.runOnUiThread {
111111
sut.hideInfoBox()
112-
sut.resetScrolling()
112+
sut.resetScrolling(true)
113113
sut.listOfFilesFragment!!.setFabEnabled(false)
114114
sut.listOfFilesFragment!!.setEmptyListLoadingMessage()
115115
sut.listOfFilesFragment!!.isLoading = false

app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ OCFileListFragment getListOfFilesFragment() {
594594

595595
protected void resetTitleBarAndScrolling() {
596596
updateActionBarTitleAndHomeButton(null);
597-
resetScrolling();
597+
resetScrolling(true);
598598
}
599599

600600
public void updateListOfFilesFragment(boolean fromSearch) {
@@ -1070,7 +1070,7 @@ public void onBackPressed() {
10701070
createMinFragments(null);
10711071
} else {
10721072
// pop back
1073-
resetScrolling();
1073+
resetScrolling(true);
10741074
hideSearchView(getCurrentDir());
10751075
showSortListGroup(true);
10761076
super.onBackPressed();
@@ -1328,7 +1328,7 @@ public void onReceive(Context context, Intent intent) {
13281328
if (ocFileListFragment.isEmpty()) {
13291329
lockScrolling();
13301330
} else {
1331-
resetScrolling();
1331+
resetScrolling(false);
13321332
}
13331333
}
13341334
}
@@ -1568,7 +1568,7 @@ public void showDetails(OCFile file) {
15681568
public void showDetails(OCFile file, int activeTab) {
15691569
User currentUser = getUser().orElseThrow(RuntimeException::new);
15701570

1571-
resetScrolling();
1571+
resetScrolling(true);
15721572

15731573
Fragment detailFragment = FileDetailFragment.newInstance(file, currentUser, activeTab);
15741574
setLeftFragment(detailFragment);
@@ -1592,11 +1592,13 @@ public void lockScrolling() {
15921592
* Resets content scrolling and toolbar collapse
15931593
*/
15941594
@VisibleForTesting
1595-
public void resetScrolling() {
1595+
public void resetScrolling(boolean expandAppBar) {
15961596
AppBarLayout.LayoutParams appbarParams = (AppBarLayout.LayoutParams) binding.appbar.toolbarFrame.getLayoutParams();
15971597
appbarParams.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);
15981598
binding.appbar.toolbarFrame.setLayoutParams(appbarParams);
1599-
binding.appbar.appbar.setExpanded(true, false);
1599+
if (expandAppBar) {
1600+
binding.appbar.appbar.setExpanded(true, false);
1601+
}
16001602
}
16011603

16021604
@Override

0 commit comments

Comments
 (0)