-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(android): support touch feedback for all backgrounds or no background #11795
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2015-Present by Axway, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
/* eslint-env mocha */ | ||
/* eslint no-unused-expressions: "off" */ | ||
'use strict'; | ||
|
||
describe('Titanium.UI.View', function () { | ||
let win; | ||
|
||
this.timeout(5000); | ||
|
||
afterEach((done) => { | ||
if (win) { | ||
let t = setTimeout(function () { | ||
if (win) { | ||
win = null; | ||
done(); | ||
} | ||
}, 3000); | ||
win.addEventListener('close', function listener () { | ||
clearTimeout(t); | ||
if (win) { | ||
win.removeEventListener('close', listener); | ||
} | ||
win = null; | ||
done(); | ||
}); | ||
win.close(); | ||
} else { | ||
win = null; | ||
done(); | ||
} | ||
}); | ||
|
||
it.android('touchFeedback', (finish) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I appreciate the effort in creating a test, but I don't think it's really verifying anything since this is an interactive UI change, correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. It doesn't verify anything, but it does exercise the native API to make sure it doesn't crash. So, I guess it's better than nothing? 🤷♂️ Ideally, QE should test this by hand via a functional/smoke test since this is a visual feature. |
||
win = Ti.UI.createWindow({ layout: 'horizontal' }); | ||
win.add(Ti.UI.createLabel({ | ||
text: 'View 1', | ||
touchFeedback: true, | ||
touchFeedbackColor: 'yellow' | ||
})); | ||
win.add(Ti.UI.createLabel({ | ||
text: 'View 2', | ||
backgroundColor: 'gray', | ||
touchFeedback: true, | ||
touchFeedbackColor: 'yellow' | ||
})); | ||
win.add(Ti.UI.createLabel({ | ||
text: 'View 3', | ||
backgroundImage: '/Logo.png', | ||
touchFeedback: true, | ||
touchFeedbackColor: 'yellow' | ||
})); | ||
win.add(Ti.UI.createLabel({ | ||
text: 'View 4', | ||
backgroundGradient: { | ||
type: 'linear', | ||
startPoint: { x: '0%', y: '50%' }, | ||
endPoint: { x: '100%', y: '50%' }, | ||
colors: [ { color: 'red', offset: 0.0 }, { color: 'blue', offset: 1.0 } ] | ||
}, | ||
touchFeedback: true, | ||
touchFeedbackColor: 'yellow' | ||
})); | ||
win.add(Ti.UI.createLabel({ | ||
text: 'View 5', | ||
borderRadius: 20, | ||
borderColor: 'red', | ||
borderWidth: '8dp', | ||
touchFeedback: true, | ||
touchFeedbackColor: 'yellow' | ||
})); | ||
win.add(Ti.UI.createLabel({ | ||
text: 'View 6', | ||
backgroundColor: 'gray', | ||
borderRadius: 20, | ||
borderColor: 'red', | ||
borderWidth: '8dp', | ||
touchFeedback: true, | ||
touchFeedbackColor: 'yellow' | ||
})); | ||
win.add(Ti.UI.createLabel({ | ||
text: 'View 7', | ||
backgroundImage: '/Logo.png', | ||
borderRadius: 20, | ||
borderColor: 'red', | ||
borderWidth: '8dp', | ||
touchFeedback: true, | ||
touchFeedbackColor: 'yellow' | ||
})); | ||
win.add(Ti.UI.createLabel({ | ||
text: 'View 8', | ||
backgroundGradient: { | ||
type: 'linear', | ||
startPoint: { x: '0%', y: '50%' }, | ||
endPoint: { x: '100%', y: '50%' }, | ||
colors: [ { color: 'red', offset: 0.0 }, { color: 'blue', offset: 1.0 } ] | ||
}, | ||
borderRadius: 20, | ||
borderColor: 'red', | ||
borderWidth: '8dp', | ||
touchFeedback: true, | ||
touchFeedbackColor: 'yellow' | ||
})); | ||
win.addEventListener('open', () => { | ||
finish(); | ||
}); | ||
win.open(); | ||
}); | ||
}); |
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.
Any particular reason to drop the
@Nullable
? I kind of like having it be explicit in our APIs so we can use tools to verify checking for null pointers or not...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.
Personally, I question the value of the
@Nullable
annotation. All reference types are implicitly nullable. The only benefit it provides is more for IDE intellisense purposes since it reveals the annotations and effectively documents the API which we can already do via JavaDoc comments.The
@NonNull
annotation is far more valuable since we can use it to trigger compiler/linter errors. So, if it doesn't have the@NonNull
annotation, then it's assumed nullable.Anyways, that's my 2 cents. Unless you can think of something else that might benefit from 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.
I get that things are implicitly
@Nullable
(so long as they're not primitives). I saw it more as a marker of what APIs we've "done" since we've got this large legacy codebase that we didn't use the annotations on. If we don't use@Nullable
, it's unclear if we've already reviewed the API and decided they're all implicitly nullable, or if we simply haven't gotten around to adding annotations.