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

fix(android): drop-down picker text color for dark/light theme change #12734

Merged
merged 3 commits into from Apr 22, 2021

Conversation

jquick-axway
Copy link
Contributor

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

Summary:

  • Default text color not changing after switching dark/light theme.
  • Caused by storing default text color to a "static" variable. Changed to store to an instance member variable.

Dark/Light Theme Test:

  1. Build the below on Android 10 or higher.
  2. Verify you can see the text in the picker. (Dark text with light theme or light text with dark theme.)
  3. Go to System Settings -> Display.
  4. Toggle the Dark/Light theme switch.
  5. Go back to the Titanium app.
  6. Verify that the picker's text color has changed. (Used to use previous theme's text color.)
const window = Ti.UI.createWindow();
const rows = [];
for (let index = 1; index <= 5; index++) {
	rows.push(Ti.UI.createPickerRow({ title: `Item ${index}` }));
}
const picker = Ti.UI.createPicker({
	columns: [Ti.UI.createPickerColumn({ rows: rows })],
	width: "50%",
});
picker.addEventListener("change", (e) => {
	Ti.API.info(`@@@ Selected rowIndex: ${e.rowIndex}, rowTitle: "${e.row.title}"`);
});
window.add(picker);
window.open();

Custom Color Test:

  1. Build and run the below on Android.
  2. Tap on the picker.
  3. Verify rows 1, 3, and 5 are green.
  4. Verify rows 2 and 4 are red.
const window = Ti.UI.createWindow();
const rows = [];
for (let index = 1; index <= 5; index++) {
	rows.push(Ti.UI.createPickerRow({ title: `Item ${index}`, color: (index % 2) ? "green" : "orange" }));
}
const picker = Ti.UI.createPicker({
	columns: [Ti.UI.createPickerColumn({ rows: rows })],
	width: "50%",
});
picker.addEventListener("change", (e) => {
	Ti.API.info(`@@@ Selected rowIndex: ${e.rowIndex}, rowTitle: "${e.row.title}"`);
});
window.add(picker);
window.open();

@jquick-axway jquick-axway added android bug no tests backport 10_2_X when applied, PRs with this label will get an auto-generated backport to 10_2_X branch on merge labels Apr 20, 2021
@jquick-axway jquick-axway added this to the 10.1.0 milestone Apr 20, 2021
@build build requested a review from a team April 20, 2021 22:45
@build
Copy link
Contributor

build commented Apr 20, 2021

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

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

📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS against 41476c1

Copy link
Contributor

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

@lokeshchdhry
Copy link
Contributor

FR Passed.

@lokeshchdhry lokeshchdhry merged commit 400fea9 into tidev:master Apr 22, 2021
@build build removed the backport 10_2_X when applied, PRs with this label will get an auto-generated backport to 10_2_X branch on merge label Apr 22, 2021
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

4 participants