Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): add fixedSize to RecyclerViews #13138

Merged
merged 5 commits into from Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -266,6 +266,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
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
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
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]
m1ga marked this conversation as resolved.
Show resolved Hide resolved

- 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
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