Skip to content

Conversation

@zhouleonlei
Copy link

@zhouleonlei zhouleonlei commented Feb 9, 2022

Add accessibility high contrast in TV menu settings

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Member

@swift-kim swift-kim left a 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 =
Copy link
Member

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

Suggested change
auto accessibilitySettings =
auto* self =

Copy link
Author

Choose a reason for hiding this comment

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

done

Comment on lines 28 to 35
AccessibilitySettings::AccessibilitySettings(FlutterTizenEngine* engine)
: engine_(engine) {
Init();
}

AccessibilitySettings::~AccessibilitySettings() {
Dispose();
}
Copy link
Member

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.

Copy link
Author

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;
Copy link
Member

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.

Suggested change
return enabled;
return enabled != 0;

By the way cannot system_settings_set_value_bool be used instead of system_settings_get_value_int?

Copy link
Author

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_bool be used instead of system_settings_get_value_int?

I had tried system_settings_set_value_bool, but met the parameter error

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Author

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) {
Copy link
Member

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

Suggested change
void FlutterTizenEngine::SetAccessibilityHighContrastEnabled(int enabled) {
void FlutterTizenEngine::EnableAccessibilityFeature(bool bold_text) {

Copy link
Author

Choose a reason for hiding this comment

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

done

@swift-kim swift-kim changed the title Add high contrast Add high contrast accessibility support for TV Feb 10, 2022
@zhouleonlei zhouleonlei force-pushed the lei_281 branch 2 times, most recently from 162345c to 17dcac8 Compare February 10, 2022 09:01
Copy link
Member

@swift-kim swift-kim left a 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);
Copy link
Member

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:

Suggested change
OnAccessibilityHighContrastChangedCallback, this);
[](system_settings_key_e key, void* user_data) -> void {
auto* self = reinterpret_cast<AccessibilitySettings*>(user_data);
self->OnAccessibilityHighContrastStateChanged();
},
this);

Copy link
Author

Choose a reason for hiding this comment

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

done

@swift-kim
Copy link
Member

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 kFlutterAccessibilityFeatureHighContrast flag to the embedder API and send a PR to the upstream.

@swift-kim
Copy link
Member

Another question: Will this change work out of the box without having to change any app code (Dart)?

@zhouleonlei
Copy link
Author

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.

@swift-kim
Copy link
Member

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.

@swift-kim swift-kim merged commit d1741f2 into flutter-tizen:flutter-2.8.1-tizen Mar 4, 2022
@swift-kim
Copy link
Member

Cherry-picked into the flutter-2.10.1-tizen branch: dba8fff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants