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
TIMOB-16080: Added New sound property for views #8852
Conversation
@@ -2746,6 +2746,11 @@ | |||
/** | |||
* @module.api | |||
*/ | |||
public static final String PROPERTY_TOUCH_SOUND_ENABLED = "soundEnabled"; |
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.
We should name it the same (soundEffectsEnabled
), which would be mapped to PROPERTY_SOUND_EFFECTS_ENABLED
.
@@ -1726,8 +1726,14 @@ protected void registerForTouch(final View touchable) | |||
touchable.setEnabled(false); | |||
} | |||
} | |||
//Checking and setting touch sound for view | |||
if (proxy.hasProperty(TiC.PROPERTY_TOUCH_SOUND_ENABLED)) { | |||
boolean soundEnabled = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_TOUCH_SOUND_ENABLED), true); |
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.
Indentation incorrect.
//Checking and setting touch sound for view | ||
if (proxy.hasProperty(TiC.PROPERTY_TOUCH_SOUND_ENABLED)) { | ||
boolean soundEnabled = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_TOUCH_SOUND_ENABLED), true); | ||
if (!soundEnabled) { |
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.
If this is false
first, setting it to true
will skip every time. Rather call the setter directly.
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.
It is set to true as default as that is the native behavior, I tested it and it works so i am not sure, if I am still wrong please let me know
if (proxy.hasProperty(TiC.PROPERTY_TOUCH_ENABLED)) { | ||
boolean enabled = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_TOUCH_ENABLED), true); | ||
if (!enabled) { | ||
touchable.setEnabled(false); | ||
} | ||
} | ||
//Checking and setting touch sound for view | ||
if (proxy.hasProperty(TiC.PROPERTY_SOUND_EFFECTS_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.
if (proxy.hasProperty(TiC.PROPERTY_SOUND_EFFECTS_ENABLED)) {
boolean soundEnabled = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_SOUND_EFFECTS_ENABLED), true);
touchable.setSoundEffectsEnabled(soundEnabled);
}
@@ -116,6 +116,7 @@ public TiViewProxy() | |||
pendingAnimationLock = new Object(); | |||
|
|||
defaultValues.put(TiC.PROPERTY_TOUCH_ENABLED, true); | |||
defaultValues.put(TiC.PROPERTY_SOUND_EFFECTS_ENABLED, true); |
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 is necessarily needed since it's already enabled by default
for the PROPERTY_TOUCH_ENABLED should i change it to match, as it is set up the same with default as true? |
@antw12 Yes, as that will not allow you to set |
CR: PASS (note: try not to change the formatting of code you are not changing) |
FR Passed, was able to set Steps I took to test:
Environment Appcelerator Command-Line Interface, version 6.1.0 |
JIRA:
https://jira.appcelerator.org/browse/TIMOB-16080
Description:
Added a new property PROPERTY_TOUCH_SOUND_ENABLED allowing a user to set sound effects for views on or off.
Default for property is true
Test Case