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

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-07-28 14:40:20 +02:00
parent c981833bc1
commit 376ad933fb
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -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);
}
}
}