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(ios,android): expose Ti.UI.Slider „tintColor“ and „trackTintColor“ #11074

Merged
merged 7 commits into from Oct 8, 2019

Conversation

hansemannn
Copy link
Collaborator

@hansemannn hansemannn commented Jul 23, 2019

JIRA:
https://jira.appcelerator.org/browse/TIMOB-27272

Summary:
Added new properties "tintColor" and "trackTintColor" to Ti.UI.Slider.


Test 1 - Set Colors Upon Creation:

  1. Build and run the below on iOS.
  2. Verify that the left side of the slider is red.
  3. Verify that the right side of the slider is green.
  4. Repeat test on Android.
var window = Ti.UI.createWindow({
	backgroundColor: "white",
});
window.add(Ti.UI.createSlider({
	min: 0.0,
	max: 1.0,
	value: 0.5,
	tintColor: "red",
	trackTintColor: "green",
}));
window.open();

Test 2 - Set Colors After Creation:

  1. Build and run the below code on iOS.
  2. Tap on the "Change Slider Color" button.
  3. Verify left side of the slider bar changed to red.
  4. Verify right side of the slider bar changed to green.
  5. Repeat test on Android.
var window = Ti.UI.createWindow({
	backgroundColor: "#CCCCCC",
});
var slider = Ti.UI.createSlider({
	min: 0.0,
	max: 1.0,
	value: 0.5,
});
window.add(slider);
var button = Ti.UI.createButton({
	title: "Change Slider Color",
	bottom: "30dp",
});
button.addEventListener("click", function() {
	slider.tintColor = "red";
	slider.trackTintColor = "green";
});
window.add(button);
window.open();

@build
Copy link
Contributor

build commented Jul 23, 2019

Messages
📖

💾 Here's the generated SDK zipfile.

📖 🎉 Another contribution from our awesome community member, hansemannn! Thanks again for helping us make Titanium SDK better. 👍
📖

✅ All tests are passing
Nice one! All 4122 tests are passing.
(There are 469 skipped tests not included in that total)

📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.

Generated by 🚫 dangerJS against 5a69ffd

if (d.containsKey(TiC.PROPERTY_TINT_COLOR)) {
handleSetTintColor(TiConvert.toColor(d, TiC.PROPERTY_TINT_COLOR));
}
if (d.containsKey(TiC.PROPERTY_TINT_COLOR)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should be

Suggested change
if (d.containsKey(TiC.PROPERTY_TINT_COLOR)) {
if (d.containsKey(TiC.PROPERTY_TRACK_TINT_COLOR)) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, yeah that was actually copy pasted from the TiUIProgressBar.java where it was probably also copy pasted from the tint color. I'll fix both together

@hansemannn
Copy link
Collaborator Author

@janvennemann Updated

Copy link
Contributor

@janvennemann janvennemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jquick-axway Can you please take a quick look at the Android changes too? I think they are fine, just so someone from the Android team approves this too. Thanks!

@vijaysingh-axway vijaysingh-axway modified the milestones: 8.2.0, 8.3.0 Aug 22, 2019
Copy link
Contributor

@sgtcoolguy sgtcoolguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android changes look fine

@jquick-axway
Copy link
Contributor

jquick-axway commented Sep 9, 2019

Sorry about the late response.

I see one parity issue. On Android, you can only set the properties upon creation. On iOS, it looks like the color can be changed dynamically. On Android, we would need to add tintColor and trackTintColor property handlers in the TiUISlider.propertyChanged() method. This may be useful if we want to support changing dark/light themes dynamically in the future.

@jquick-axway
Copy link
Contributor

@hansemannn, are you willing to make the change I suggested above? This is in regards to it being creation-only properties on Android versus iOS supports changing them dynamically. This is the only thing that's blocking this PR. I can get someone else to make the final changes to this PR if you don't have time. Thanks.

@hansemannn
Copy link
Collaborator Author

Please assign it internally, thank you!

@jquick-axway
Copy link
Contributor

Updated PR:

  • Modified Android tint properties to be set dynamically like iOS.
  • Added unit test.

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass
FR: Pass

@ssaddique
Copy link
Contributor

FR: Passed.

Studio Ver: 5.1.4.201909061933
SDK Ver: 8.3.0 (from PR)
Mac OS Ver: 10.14.6
Xcode Ver: Xcode 11.0
Appc NPM: 4.2.15
Appc CLI: 7.1.1
Node Ver: 10.16.3
NPM Ver: 6.11.3
Emulators: ⇨ Pixel 3 (API 28), iPhone 11 Pro (13.0)

@ewanharris ewanharris merged commit 7238427 into tidev:master Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants