-
Notifications
You must be signed in to change notification settings - Fork 17
Add high contrast accessibility support for TV #237
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
Add high contrast accessibility support for TV #237
Conversation
swift-kim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better than before. Thanks!
| static void OnAccessibilityHighContrastChangedCallback( | ||
| system_settings_key_e key, | ||
| void* user_data) { | ||
| auto accessibilitySettings = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates the variable naming rule. As we already know that this file is an implementation file of AccessibilitySettings, you could simply rename the pointer to
| auto accessibilitySettings = | |
| auto* self = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| AccessibilitySettings::AccessibilitySettings(FlutterTizenEngine* engine) | ||
| : engine_(engine) { | ||
| Init(); | ||
| } | ||
|
|
||
| AccessibilitySettings::~AccessibilitySettings() { | ||
| Dispose(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Init() and Dispose() methods look redundant here. You may simply move the implementations to the constructor and destructor respectively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| << ret; | ||
| } | ||
| #endif | ||
| return enabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might simply change the return type to bool.
| return enabled; | |
| return enabled != 0; |
By the way cannot system_settings_set_value_bool be used instead of system_settings_get_value_int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might simply change the return type to
bool.By the way cannot
system_settings_set_value_boolbe used instead ofsystem_settings_get_value_int?
I had tried system_settings_set_value_bool, but met the parameter error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better than before. Thanks!
Thanks for your review. I have modified all of them.
Please check.
|
|
||
| // Set bold font and application color when accessibility high contrast state is | ||
| // changed. | ||
| void FlutterTizenEngine::SetAccessibilityHighContrastEnabled(int enabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FlutterTizenEngine is a wrapper class of the engine's embedder API so it is advised to follow the engine's terminology if possible. How about
| void FlutterTizenEngine::SetAccessibilityHighContrastEnabled(int enabled) { | |
| void FlutterTizenEngine::EnableAccessibilityFeature(bool bold_text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
162345c to
17dcac8
Compare
swift-kim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fixes. We're almost there.
| system_settings_set_changed_cb( | ||
| system_settings_key_e( | ||
| SYSTEM_SETTINGS_KEY_MENU_SYSTEM_ACCESSIBILITY_HIGHCONTRAST), | ||
| OnAccessibilityHighContrastChangedCallback, this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may simply inline the OnAccessibilityHighContrastChangedCallback function to reduce the use of ifdef:
| OnAccessibilityHighContrastChangedCallback, this); | |
| [](system_settings_key_e key, void* user_data) -> void { | |
| auto* self = reinterpret_cast<AccessibilitySettings*>(user_data); | |
| self->OnAccessibilityHighContrastStateChanged(); | |
| }, | |
| this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
The code is good, but the "high contrast" option from the TV settings and Flutter's "bold text" accessibility feature do not seem to match by their meaning. In the framework, they are two different concepts:
Have you considered other ways to enable the feature? The most desirable way I can think of right now is to add the missing |
|
Another question: Will this change work out of the box without having to change any app code (Dart)? |
No need to modify codes in App side. |
|
Let's merge this for now. I heard from @zhouleonlei that turning on the high contrast mode on TV enables both bold text and dark background for native apps. Flutter apps should be affected in the same way, but this PR enables bold text only. Let's see if we can add the highContrast (dark background) option to the embedder API in the future. |
|
Cherry-picked into the |
Add accessibility high contrast in TV menu settings
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.