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 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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
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 @@ -827,6 +827,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
13 changes: 11 additions & 2 deletions apidoc/Titanium/UI/ListView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,15 @@ 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
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 Expand Up @@ -1459,7 +1468,7 @@ examples:
win.open();
```

- title: List View with a pullView
- title: List View with a pullView
example: |
This sample shows how the [pullView](Titanium.UI.ListView.pullView) property could be
utilized along with the [pull](Titanium.UI.ListView.pull) and [pullend](Titanium.UI.ListView.pullend) events to
Expand All @@ -1482,7 +1491,7 @@ examples:
{properties: { title: 'Potatoes'}},
];
var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables', items: vegDataSet});

var fishDataSet = [
{properties: { title: 'Cod'}},
{properties: { title: 'Haddock'}},
Expand Down
27 changes: 18 additions & 9 deletions apidoc/Titanium/UI/TableView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ events:

- name: rowsselected
summary: |
Fired when user stops two-pan gesture interaction for selecting multiple rows.
Fired when user stops two-pan gesture interaction for selecting multiple rows.
It is used in conjunction with <Titanium.UI.TableView.allowsMultipleSelectionInteraction>.
platforms: [android, iphone, ipad, macos]
since: {android: "10.1.0", iphone: "8.2.0", ipad: "8.2.0", macos: "9.2.0"}
Expand Down Expand Up @@ -1074,7 +1074,7 @@ properties:
default: false
since: {android: "10.1.0", iphone: "5.4.0", ipad: "5.4.0", macos: "9.2.0"}
platforms: [android, iphone, ipad, macos]

- name: backgroundColor
summary: Background color of the view, as a color name or hex triplet.
description: |
Expand Down Expand Up @@ -1154,6 +1154,15 @@ 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
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 Expand Up @@ -1240,9 +1249,9 @@ properties:
- name: allowsMultipleSelectionInteraction
summary: Allows a two-finger pan gesture to automatically transition the table view into editing mode and start selecting rows.
description: |
Setting this property to true allows the user to start selecting multiple contiguous rows via a two-finger pan gesture.
If the table view is already in editing mode, the user can also select multiple rows via a one-finger pan gesture along
the edge of the table that contains editing controls (checkboxes). In order to support this behavior,
Setting this property to true allows the user to start selecting multiple contiguous rows via a two-finger pan gesture.
If the table view is already in editing mode, the user can also select multiple rows via a one-finger pan gesture along
the edge of the table that contains editing controls (checkboxes). In order to support this behavior,
you must also set <Titanium.UI.TableView.allowsMultipleSelectionDuringEditing> to true.
Once user interaction stops the <Titanium.UI.TableView.rowsselected> event is fired.
type: Boolean
Expand Down Expand Up @@ -1418,16 +1427,16 @@ properties:
- name: showSearchBarInNavBar
summary: A Boolean indicating whether search bar will be in navigation bar.
description: |
If you want to show the search bar in navigation bar, set this property `true` during creation.
Use the <Titanium.UI.Window.hidesSearchBarWhenScrolling> property to control the visibility of the
If you want to show the search bar in navigation bar, set this property `true` during creation.
Use the <Titanium.UI.Window.hidesSearchBarWhenScrolling> property to control the visibility of the
searchbar when scrolling.
type: Boolean
default: false
since: 8.1.0
platforms: [iphone, ipad, macos]
osver: {ios: {min: "11.0"}}
availability: creation

- name: searchAsChild
summary: Determines whether the [SearchBar](Titanium.UI.SearchBar) or [SearchView](Titanium.UI.Android.SearchView) appears as part of the TableView.
description: Set to false if the search view will be displayed in the action bar.
Expand Down Expand Up @@ -1832,7 +1841,7 @@ properties:
name: SelectedRowObject
summary: The arguments for the <Titanium.UI.TableView.rowsselected> event.
since: {android: "10.1.0", iphone: "8.2.0", ipad: "8.2.0", macos: "9.2.0"}
platforms: [android, iphone, ipad, macos]
platforms: [android, iphone, ipad, macos]
properties:
- name: index
summary: Row index.
Expand Down