Skip to content

Commit

Permalink
feat(android): add fixedSize to RecyclerViews (#13138)
Browse files Browse the repository at this point in the history
* feat(android): add fixedSize to ListView

* feat(android): add fixedSize to TableView

* docs

* docs
  • Loading branch information
m1ga committed Apr 12, 2022
1 parent 0d20ec0 commit d057eed
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ public boolean inSelectionHotspot(@NonNull MotionEvent e)
final boolean allowsMultipleSelection
= properties.optBoolean(TiC.PROPERTY_ALLOWS_MULTIPLE_SELECTION_DURING_EDITING, false);

if (properties.optBoolean(TiC.PROPERTY_FIXED_SIZE, false)) {
this.recyclerView.setHasFixedSize(true);
}
if (editing && allowsSelection) {
if (allowsMultipleSelection) {
this.tracker = trackerBuilder.withSelectionPredicate(SelectionPredicates.createSelectAnything())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ public boolean inSelectionHotspot(@NonNull MotionEvent e)
final boolean allowsMultipleSelection
= properties.optBoolean(TiC.PROPERTY_ALLOWS_MULTIPLE_SELECTION_DURING_EDITING, false);

if (properties.optBoolean(TiC.PROPERTY_FIXED_SIZE, false)) {
this.recyclerView.setHasFixedSize(true);
}
if (editing && allowsSelection) {
if (allowsMultipleSelection) {
this.tracker = trackerBuilder.withSelectionPredicate(SelectionPredicates.createSelectAnything())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ public class TiC
public static final String PROPERTY_LASTPHONETIC = "lastPhonetic";
public static final String PROPERTY_JOBTITLE = "jobTitle";
public static final String PROPERTY_DEPARTMENT = "department";
public static final String PROPERTY_FIXED_SIZE = "fixedSize";

public static final String SIZE_AUTO = "auto";
public static final String URL_APP_PREFIX = "app://";
Expand Down
10 changes: 10 additions & 0 deletions apidoc/Titanium/UI/ListView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,16 @@ properties:
since: 7.5.0
platforms: [android]

- name: fixedSize
summary: Sets fixedSize mode on Android ListViews.
description: |
Set it to `true` if all ListItems have the same size to gain some performance.
type: Boolean
default: false
availability: creation
since: 10.2.0
platforms: [android]

- name: allowsSelectionDuringEditing
summary: Determines whether this list view items can be selected while editing the table.
type: Boolean
Expand Down
10 changes: 10 additions & 0 deletions apidoc/Titanium/UI/TableView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,16 @@ properties:
default: true
platforms: [android, iphone, ipad, macos]

- name: fixedSize
summary: Sets fixedSize mode on Android TableView.
description: |
Set it to `true` if all TableView items have the same size to gain some performance.
type: Boolean
default: false
availability: creation
since: 10.2.0
platforms: [android]

- name: footerDividersEnabled
summary: When set to false, the ListView will not draw the divider before the footer view.
type: Boolean
Expand Down

0 comments on commit d057eed

Please sign in to comment.