瀏覽代碼

When going into subfolder or show details: show header even if it was scrolled away

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 4 年之前
父節點
當前提交
376ad933fb
共有 1 個文件被更改,包括 15 次插入1 次删除
  1. 15 1
      src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

+ 15 - 1
src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -44,6 +44,7 @@ import android.view.ViewGroup;
 import android.widget.AbsListView;
 import android.widget.PopupMenu;
 
+import com.google.android.material.appbar.AppBarLayout;
 import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
 import com.google.android.material.floatingactionbutton.FloatingActionButton;
 import com.google.android.material.snackbar.Snackbar;
@@ -902,11 +903,13 @@ public class OCFileListFragment extends ExtendedListFragment implements
                 int position = mAdapter.getItemPosition(file);
 
                 if (file.isFolder()) {
+                    resetHeaderScrollingState();
+
                     if (file.isEncrypted()) {
                         // check if API >= 19
                         if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
                             Snackbar.make(getRecyclerView(), R.string.end_to_end_encryption_not_supported,
-                                Snackbar.LENGTH_LONG).show();
+                                          Snackbar.LENGTH_LONG).show();
                             return;
                         }
 
@@ -1115,6 +1118,9 @@ public class OCFileListFragment extends ExtendedListFragment implements
                     if (mActiveActionMode != null) {
                         mActiveActionMode.finish();
                     }
+
+                    resetHeaderScrollingState();
+
                     mContainerActivity.showDetails(singleFile);
                     setFabVisible(false);
                     mContainerActivity.showSortListGroup(false);
@@ -1851,4 +1857,12 @@ public class OCFileListFragment extends ExtendedListFragment implements
             });
         }
     }
+
+    private void resetHeaderScrollingState() {
+        AppBarLayout appBarLayout = ((FileDisplayActivity) requireActivity()).findViewById(R.id.appbar);
+
+        if (appBarLayout != null) {
+            appBarLayout.setExpanded(true);
+        }
+    }
 }