Re: [codenameone-discussions] Re: long press in Javascript in browser component

2019-02-11 Thread Steve Hannah
It is possible that there is a conflict with event dispatching on Android,
since all pointer events in webviews are handled by CN1 and routed to the
webview.  I took a quick look at the jquery longpress plugin and it doesn't
look like it uses anything special (other than just regular touch start/end
events and timers) for detecting a long press, so our event dispatching
should work properly.  Please file an issue in the issue tracker.  If you
can provide a smaller, self-contained test case that will help to ensure a
faster fix.  E.g. Create a simple page that only includes a single button
that is set up to detect a longpress event, and make it easy to demonstrate
whether the event is received or not.

On Fri, Feb 8, 2019 at 9:57 PM Shai Almog  wrote:

> Not sure. Maybe Steve has an idea.
>
> --
> You received this message because you are subscribed to the Google Groups
> "CodenameOne Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to codenameone-discussions+unsubscr...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/codenameone-discussions.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/codenameone-discussions/0a708247-3916-42d1-b52b-5d5f461fee82%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Steve Hannah
Software Developer
Codename One
http://www.codenameone.com

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKWL%3DRHyWo4Mn-cT183hXK35b9Kwf6qnTm65Q0Ygw7%3DUdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: long press in Javascript in browser component

2019-02-08 Thread Shai Almog
Not sure. Maybe Steve has an idea.

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/0a708247-3916-42d1-b52b-5d5f461fee82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: long press in Javascript in browser component

2019-02-08 Thread Ivan
Javascript:

$(document).ready(function() {

$('#calendar').fullCalendar({
  theme: true   ,
  defaultView: 'month',
  header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaDay'
},
editable: false,
eventLimit: true, // allow "more" link when too many events
events: loadEvents,
  height: "parent",
  locale: "sk",
  dayClick: dayClick,
  eventAfterAllRender: attachLongPress,
  eventClick: eventClick,
  eventRender: eventRender,
  eventRenderWait: 100,
  defaultTimedEventDuration:"00:15:00"
  });
  });

  var attachLongPress = function(view) {
if (view.name === 'agendaDay') {
  var date = view.start.format('-MM-DD');
  var tds = $('.fc-slats .ui-widget-content').not('.fc-axis');
  tds.longpress(function(evt) {
var dateWs = date + " " + evt.target.parentElement.attributes[
'data-time'].value;
log('Create event: ' + dateWs);
createNewEvent(dateWs)
  }, undefined, 1000);
} else
if (view.name === 'month') {
  var tds = $('td.fc-day.ui-widget-content');
  tds.longpress(function(evt) {
longPress = true;
var dateWs = evt.target.attributes['data-date'].value;
log('Create event: ' + dateWs);
createNewEvent(dateWs);
evt.stopPropagation();
evt.preventDefault();
  }, undefined, 1000);
}
  };


Java code:

public JSCalendarFrame(CalendarData dataProvider, TsviewExt view, final 
ListContainer lc, Date activeDate,
int scrollToY) {
this.dataProvider = dataProvider;
this.view = view;
this.lc = lc;

setLayout(new BorderLayout());
this.activeDate = (activeDate == null ? new Date() : activeDate);
createBrowserComponent();
String url = getCalendarUrl();
bc.setURL(url);
setupJSCallbacks();
Log.p("Callbacks", Log.ERROR);
revalidate();

}


   private void createBrowserComponent() {
this.bc = new BrowserComponent();
this.bc.setProperty("AllowFileAccessFromFileURLs", Boolean.TRUE);
this.bc.setProperty("AllowUniversalAccessFromFileURLs", Boolean.TRUE
);
this.add(BorderLayout.CENTER, bc);
bc.addWebEventListener("onLoad", new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Log.p("onLoad", Log.DEBUG);
setupJSCallbacks();
bc.execute("refreshCalendar()");
}
});
}


private String getCalendarUrl() {
   
String home = DocumentHelper.getDefaultDataDirectory();
if (!home.startsWith("file://")) {
home = "file://" + home;
}
return home + "calendar/calendar.html";
}


-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/a693e1eb-7533-4562-8512-7289c0936dd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: long press in Javascript in browser component

2019-02-07 Thread Shai Almog
Hi,
how did you add the long press?
Did you do that after the onLoad callback?
Which Java code did you use?

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/275ceed5-0bcf-437c-8964-05ed68784c9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.