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

Android: onMarker event not fired when postlayout event set #13753

Open
1 task done
PietroGranati opened this issue Feb 21, 2023 · 14 comments
Open
1 task done

Android: onMarker event not fired when postlayout event set #13753

PietroGranati opened this issue Feb 21, 2023 · 14 comments
Labels
android bug needs triage This issue hasn't been reviewed by maintainers

Comments

@PietroGranati
Copy link

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

Hello everyone, I have encountered a bug, I have a ListView with onMarker event set on creation in Alloy.
When you open the view I load the data in the listview and use the setMarker method to launch the update and append data to the list.
Everything was working fine until I put the first loading data on a postlayout event in the container view like this:
function loadView() { $.bodyView.removeEventListener('postlayout', loadView); loadNote(); }
On iOS everything is working fine, on Android it stops the marker event to fire

Expected Behavior

The makerk event should fire

Actual behavior

The marker is not firing

Reproducible sample

/

Steps to reproduce

Create an alloy view with postlayout event ad a listview inside with marker event
In the controller add the code for post layout with the removal code for postlayout

Platform

Android

SDK version you are using

9.3.2

Alloy version you are using

No response

@PietroGranati PietroGranati added bug needs triage This issue hasn't been reviewed by maintainers labels Feb 21, 2023
@m1ga
Copy link
Contributor

m1ga commented Feb 21, 2023

can you check it in a recent SDK. 9.3.2 is very old and even if there was an error in that version it won't be fixed.

@m1ga m1ga added the android label Feb 21, 2023
@m1ga
Copy link
Contributor

m1ga commented Feb 21, 2023

and a side note: I've #13095 because I had trouble with the markers too. I've used them for lazy loading and especially on very fast scrolls not all makers fired. With the continuousUpdate event I can check firstVisibleItemIndex during scrolling and not only when the direction changes. Its in 11.1.1

@PietroGranati
Copy link
Author

I was trying on 11.1.1 too, but maybe yesterday I got the cache dirty, today on 11.1.1 it's working fine.
On fast scrolling I got the same result as you, maybe the setMarker isn't fast enough

@PietroGranati
Copy link
Author

The error from the log:
java.lang.NullPointerException: Attempt to read from field 'android.graphics.Rect androidx.recyclerview.widget.RecyclerView$LayoutParams.mDecorInsets' on a null object reference in method 'int androidx.recyclerview.widget.RecyclerView$LayoutManager.getLeftDecorationWidth(android.view.View)'

@m1ga
Copy link
Contributor

m1ga commented Feb 23, 2023

any other lines with Titanium classes in that error?

@PietroGranati
Copy link
Author

Sure:
[ERROR] InputEventReceiver: Exception dispatching input event. [ERROR] E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback [ERROR] E/MessageQueue-JNI: java.lang.NullPointerException: Attempt to read from field 'android.graphics.Rect androidx.recyclerview.widget.RecyclerView$LayoutParams.mDecorInsets' on a null object reference in method 'int androidx.recyclerview.widget.RecyclerView$LayoutManager.getLeftDecorationWidth(android.view.View)' [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$LayoutManager.getLeftDecorationWidth(RecyclerView.java:9757) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$LayoutManager.getDecoratedLeft(RecyclerView.java:9650) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$LayoutManager$1.getChildStart(RecyclerView.java:7611) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.ViewBoundsCheck.isViewWithinBoundFlags(ViewBoundsCheck.java:249) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$LayoutManager.isViewPartiallyVisible(RecyclerView.java:9946) [ERROR] E/MessageQueue-JNI: at ti.modules.titanium.ui.widget.listview.ListViewProxy.handleMarker(ListViewProxy.java:461) [ERROR] E/MessageQueue-JNI: at ti.modules.titanium.ui.widget.listview.ListViewAdapter.onBindViewHolder(ListViewAdapter.java:107) [ERROR] E/MessageQueue-JNI: at ti.modules.titanium.ui.widget.listview.ListViewAdapter.onBindViewHolder(ListViewAdapter.java:23) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7065) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7107) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6012) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6279) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1391) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1128) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1841) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView.scrollByInternal(RecyclerView.java:1940) [ERROR] E/MessageQueue-JNI: at androidx.recyclerview.widget.RecyclerView.onTouchEvent(RecyclerView.java:3391) [ERROR] E/MessageQueue-JNI: at android.view.View.dispatchTouchEvent(View.java:15076) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3917) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3581) [ERROR] E/MessageQueue-JNI: at ti.modules.titanium.ui.widget.listview.TiNestedRecyclerView.dispatchTouchEvent(TiNestedRecyclerView.java:110) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3923) [ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:3597) [ERROR] E/MessageQueue-JNI: at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:1016) [ERROR] E/MessageQueue-JNI: at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1962) [ERROR] E/MessageQueue-JNI: at android.app.Activity.dispatchTouchEvent(Activity.java:4265) [ERROR] E/MessageQueue-JNI: at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) [ERROR] E/MessageQueue-JNI: at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:974) [ERROR] E/MessageQueue-JNI: at android.view.View.dispatchPointerEvent(View.java:15335) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:7815) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:7588) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6922) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6979) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6945) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:7143) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6953) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:7200) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6926) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6979) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6945) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6953) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6926) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:10400) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:10248) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:10204) [ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:10532) [ERROR] E/MessageQueue-JNI: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:259) [ERROR] E/MessageQueue-JNI: at android.os.MessageQueue.nativePollOnce(Native Method) [ERROR] E/MessageQueue-JNI: at android.os.MessageQueue.next(MessageQueue.java:335) [ERROR] E/MessageQueue-JNI: at android.os.Looper.loopOnce(Looper.java:186) [ERROR] E/MessageQueue-JNI: at android.os.Looper.loop(Looper.java:313) [ERROR] E/MessageQueue-JNI: at android.app.ActivityThread.main(ActivityThread.java:8669) [ERROR] E/MessageQueue-JNI: at java.lang.reflect.Method.invoke(Native Method) [ERROR] E/MessageQueue-JNI: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) [ERROR] E/MessageQueue-JNI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

@m1ga
Copy link
Contributor

m1ga commented Feb 23, 2023

but that is with 9.3.1 again, correct?

https://github.com/tidev/titanium_mobile/blob/9_3_X/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewProxy.java#L461

The isVisible check is different in SDK >= 11

@PietroGranati
Copy link
Author

Yeah I've a new version in developing using sdk 11 but trying to fixing the sdk 9 in production now

@m1ga
Copy link
Contributor

m1ga commented Feb 23, 2023

if you want to patch your 9.3.x then have a look at the current implementation:
https://github.com/tidev/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewProxy.java#L662
and move that over to 9.x. It's the last line in Ti, the other classes its going in are native classes. So have to make the check in that line

@PietroGranati
Copy link
Author

It's possible that I cannot find the file in 9.3.2 ?

@m1ga
Copy link
Contributor

m1ga commented Feb 23, 2023

@PietroGranati
Copy link
Author

Yep I saw it maybe is my fault but if I go to the folder in OSX where are stored the SDKs I cannot find the lines your're pointing, I will check

@m1ga
Copy link
Contributor

m1ga commented Feb 23, 2023

you have to build a custom SDK for Android, you can't just change the lines in an existing SDK

@PietroGranati
Copy link
Author

Ok so I were understanding it right, sorry for the misunderstood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug needs triage This issue hasn't been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants