From 72d37f2aa822bb12fd07aafccb09e6899f5b9ba2 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 20 May 2019 00:40:22 +0200 Subject: [PATCH] made one-column document-layout --- .../securesms/ProfileDocumentsFragment.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/ProfileDocumentsFragment.java b/src/org/thoughtcrime/securesms/ProfileDocumentsFragment.java index afa359ecb..176865aee 100644 --- a/src/org/thoughtcrime/securesms/ProfileDocumentsFragment.java +++ b/src/org/thoughtcrime/securesms/ProfileDocumentsFragment.java @@ -46,6 +46,7 @@ public class ProfileDocumentsFragment protected TextView noMedia; protected RecyclerView recyclerView; + private StickyHeaderGridLayoutManager gridManager; private ActionMode actionMode; private ActionModeCallback actionModeCallback = new ActionModeCallback(); @@ -69,18 +70,28 @@ public class ProfileDocumentsFragment this.recyclerView = ViewUtil.findById(view, R.id.recycler_view); this.noMedia = ViewUtil.findById(view, R.id.no_documents); + this.gridManager = new StickyHeaderGridLayoutManager(1); this.recyclerView.setAdapter(new ProfileDocumentsAdapter(getContext(), GlideApp.with(this), new BucketedThreadMediaLoader.BucketedThreadMedia(getContext()), locale, this)); - this.recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); + this.recyclerView.setLayoutManager(gridManager); this.recyclerView.setHasFixedSize(true); return view; } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + if (gridManager != null) { + this.gridManager = new StickyHeaderGridLayoutManager(1); + this.recyclerView.setLayoutManager(gridManager); + } + } + @Override public Loader onCreateLoader(int i, Bundle bundle) { return new BucketedThreadMediaLoader(getContext(), chatId, DcMsg.DC_MSG_FILE, DcMsg.DC_MSG_AUDIO, 0);