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): Click events for invisible/touchEnabled:false views #11695

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented May 8, 2020

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

Optional Description:

function onTouch(event) {
	console.log("touch");
}

var window = Ti.UI.createWindow();
var childView = Ti.UI.createView({
	backgroundColor: "blue",
	width: 200,
	height: 200
});
var btn = Ti.UI.createButton({
	title: "toggle opacity",
	bottom: 0,
	left: 0
});
var btn2 = Ti.UI.createButton({
	title: "toggle touch 1",
	bottom: 0,
	right: 0
});

var isTouch = true;
var isVis = true;
btn.addEventListener("click", function(e) {
	isVis = !isVis;
	if (isVis) {
		childView.opacity = 1;
	} else {
		childView.opacity = 0;
	}
})
btn2.addEventListener("click", function(e) {
	isTouch = !isTouch;
	childView.touchEnabled = isTouch
	btn2.title = isTouch ? "toggle touch 1" : "toggle touch 0";
})

childView.addEventListener("touchstart", onTouch);
childView.addEventListener("touchmove", onTouch);
childView.addEventListener("touchend", onTouch);
childView.addEventListener("touchcancel", onTouch);
childView.addEventListener("click", onTouch);
childView.addEventListener("dblclick", onTouch);
childView.addEventListener("doubletap", onTouch);
childView.addEventListener("longpress", onTouch);
childView.addEventListener("pinch", onTouch);
childView.addEventListener("swipe", onTouch);
window.add(btn);
window.add(btn2);
window.add(childView);
window.open();

Test:

  • click view -> touch output
  • toggle opacity
  • click view -> no touch output
  • toggle opacity
  • click view -> touch output
  • toggle touch
  • click view -> no touch output
  • toggle touch
  • click view -> touch output
  • toggle opacity
  • toggle touch
  • click view -> no touch output
  • toggle touch (still invisible)
  • click view -> no touch output
  • toggle opacity
  • click view -> touch output

@m1ga m1ga changed the title fix(android): Click events for invisible/touchEnabled views fix(android): Click events for invisible/touchEnabled:false views May 8, 2020
@build build added this to the 9.1.0 milestone May 8, 2020
@build build requested a review from a team May 8, 2020 21:12
@build
Copy link
Contributor

build commented May 8, 2020

Fails
🚫 Test reports missing for MacOS. This indicates that a build failed or the test app crashed
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

Warnings
⚠️

Commit 889c8ae709bdba019e0f84b5dc5ea1abed72381e has a message "click when invisible" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️ Tests have failed, see below for more information.
⚠️ This PR has milestone set to 10.0.0, but the version defined in package.json is 10.2.0 Please either: - Update the milestone on the PR - Update the version in package.json - Hold the PR to be merged later after a release and version bump on this branch
Messages
📖

🚨 This PR has one or more commits with warnings/errors for commit messages not matching our configuration. You may want to squash merge this PR and edit the message to match our conventions, or ask the original developer to modify their history.

📖 ❌ 1 tests have failed There are 1 tests failing and 900 skipped out of 17267 total tests.
📖 🎉 Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. 👍

Tests:

ClassnameNameTimeError
android.emulator.main.Titanium.Geolocation.methods#forwardGeocoder() works via callback argument (12)5.029
Error: expected false to be true
at Assertion.fail (/node_modules/should/cjs/should.js:275:13)
      at Assertion.value (/node_modules/should/cjs/should.js:356:9)
      at Geolocation.<anonymous> (/ti.geolocation.test.js:585:32)

Generated by 🚫 dangerJS against 01bb023

@sgtcoolguy sgtcoolguy added the bug label Jul 31, 2020
@sgtcoolguy sgtcoolguy modified the milestones: 9.1.0, 9.3.0 Jul 31, 2020
@sgtcoolguy sgtcoolguy modified the milestones: 9.3.0, 10.0.0 Nov 20, 2020
@hansemannn hansemannn modified the milestones: 10.0.0, 10.2.0 Mar 21, 2022
@hansemannn
Copy link
Collaborator

@m1ga Can you go over here and check again if everything works as expected? Maybe @drauggres can even help with a review :)

@m1ga
Copy link
Contributor Author

m1ga commented Mar 21, 2022

@hansemannn we have to check what we want here:
https://jira-archive.titaniumsdk.com/TIMOB/TIMOB-27893
see the comment by Joshua from 2020-06-20.

The touchEnabled:false part is working fine now in 10.1.1.GA. This PR will only remove the events for a hidden object (opacity 0) to be inline with iOS. But if we still want to be able to click invisible items we should change that part in iOS.

@hansemannn
Copy link
Collaborator

I would go with the parity with the existing iOS-behavior here, but let's put that onto the agenda for the next sync meetup.

@hansemannn hansemannn modified the milestones: 11.0.0, 11.1.0 May 27, 2022
@hansemannn hansemannn removed this from the 11.1.0 milestone Oct 7, 2022
@hansemannn hansemannn added this to the 12.0.0 milestone Oct 7, 2022
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.

4 participants