android: Stop calling RecyclerView.setHasFixedSize

Stop calling the method RecyclerView.setHasFixedSize
meant to allow optimiziations (see doc at [1]), because
that is not compatible with the size used in the layout
file.

This prepares for upcoming commit

    Change-Id: Id22a2130379fb11372d210049b4f02df29ec52d8
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Mon Nov 17 12:56:47 2025 +0100

        android: Update com.google.android.material:material to 1.13.0

which would otherwise trigger errors like this one:

    > Task :lintReportStrippedUIEditingDebug
    Wrote HTML report to file:///home/michi/development/git/libreoffice-WORKTREE-android/android/source/build/reports/lint-results-strippedUIEditingDebug.html
    Lint found 4 errors, 1 hint (and 199 errors and 2 hints filtered by baseline lint-baseline.xml)

    2 errors/warnings were listed in the baseline file (/home/michi/development/git/libreoffice-WORKTREE-android/android/source/lint-baseline.xml) but not found in the project; perhaps they have been fixed?
    Lint found 4 errors and 1 hint. First failure:
    /home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/FontController.java:257: Error: When using `setHasFixedSize() in an RecyclerView, wrap_content cannot be used as a value for size in the scrolling direction. [InvalidSetHasFixedSize from androidx.recyclerview.lint.recyclerview]
            recyclerView.setHasFixedSize(true);
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    > Task :lintStrippedUIEditingDebug FAILED

[1] https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView#setHasFixedSize(boolean)

Change-Id: I34b7b88506d549aa38d06e292ce8a6e96057e619
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194105
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2025-11-17 20:52:24 +01:00
parent 262f52c9d8
commit 83b7e5325c
@@ -254,14 +254,12 @@ public class FontController implements AdapterView.OnItemSelectedListener {
RecyclerView recyclerView = colorPickerLayout.findViewById(R.id.fontColorView);
GridLayoutManager gridLayoutManager = new GridLayoutManager(mActivity, 11, GridLayoutManager.VERTICAL, true);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(gridLayoutManager);
RecyclerView recyclerView2 = colorPickerLayout.findViewById(R.id.fontColorViewSub);
GridLayoutManager gridLayoutManager2 = new GridLayoutManager(mActivity,4);
recyclerView2.setHasFixedSize(true);
recyclerView2.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
@@ -317,14 +315,12 @@ public class FontController implements AdapterView.OnItemSelectedListener {
RecyclerView recyclerView = backColorPickerLayout.findViewById(R.id.fontColorView);
GridLayoutManager gridLayoutManager = new GridLayoutManager(mActivity, 11, GridLayoutManager.VERTICAL, true);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(gridLayoutManager);
RecyclerView recyclerView2 = backColorPickerLayout.findViewById(R.id.fontColorViewSub);
GridLayoutManager gridLayoutManager2 = new GridLayoutManager(mActivity,4);
recyclerView2.setHasFixedSize(true);
recyclerView2.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override