Comments (15)
Android doesn't have a headerPullView
in TableViews, so that makes it very hard to implement. I will keep an eye out for solutions and if available, implement them.
from nl.fokkezb.pulltorefresh.
Have you seen this? jpurcell / pull-to-refresh(android).js https://gist.github.com/jpurcell/903895
from nl.fokkezb.pulltorefresh.
I've seen it but find it rather hackisch.
from nl.fokkezb.pulltorefresh.
Is Android compatibility in this latest version?
When I include it, I get a "java.lang.IndexOutOfBoundsException" error that kills my app in the emulator. This error goes away if I take the widget out.
Works great on iOS though!
from nl.fokkezb.pulltorefresh.
It runs fine on Android 4.3.
Can you post error logs and device/OS info?
from nl.fokkezb.pulltorefresh.
I'm new to Titanium so let me know if you need more info than this.
Default Android SDK: Google APIs (Android 4.3) [armeabi-v7a]
[ERROR][InputEventReceiver( 1082)] Exception dispatching input event.
[WARN][dalvikvm( 1082)] threadid=1: thread exiting with uncaught exception (group=0x40a71930)
[ERROR]TiApplication( 1082) [7627,9309] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2; Titanium 3.1.1,2013/06/15 16:10,f7592c1
[ERROR][TiApplication( 1082)] java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
[ERROR][TiApplication( 1082)] at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
[ERROR][TiApplication( 1082)] at java.util.ArrayList.get(ArrayList.java:304)
[ERROR][TiApplication( 1082)] at ti.modules.titanium.ui.widget.tableview.TiTableView.getItemAtPosition(TiTableView.java:411)
[ERROR][TiApplication( 1082)] at ti.modules.titanium.ui.TableViewProxy.fireEvent(TableViewProxy.java:163)
[ERROR][TiApplication( 1082)] at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1474)
[ERROR][TiApplication( 1082)] at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1465)
[ERROR][TiApplication( 1082)] at org.appcelerator.titanium.view.TiUIView$4.onFling(TiUIView.java:1186)
[ERROR][TiApplication( 1082)] at android.view.GestureDetector.onTouchEvent(GestureDetector.java:600)
[ERROR][TiApplication( 1082)] at org.appcelerator.titanium.view.TiUIView$5.onTouch(TiUIView.java:1219)
[ERROR][TiApplication( 1082)] at android.view.View.dispatchTouchEvent(View.java:7241)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2168)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1903)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][TiApplication( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][TiApplication( 1082)] at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953)
[ERROR][TiApplication( 1082)] at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1405)
[ERROR][TiApplication( 1082)] at android.app.Activity.dispatchTouchEvent(Activity.java:2410)
[ERROR][TiApplication( 1082)] at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1901)
[ERROR][TiApplication( 1082)] at android.view.View.dispatchPointerEvent(View.java:7426)
[ERROR][TiApplication( 1082)] at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3220)
[ERROR][TiApplication( 1082)] at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3165)
[ERROR][TiApplication( 1082)] at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4292)
[ERROR][TiApplication( 1082)] at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4271)
[ERROR][TiApplication( 1082)] at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4363)
[ERROR][TiApplication( 1082)] at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
[ERROR][TiApplication( 1082)] at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
[ERROR][TiApplication( 1082)] at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:171)
[ERROR][TiApplication( 1082)] at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4342)
[ERROR][TiApplication( 1082)] at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4382)
[ERROR][TiApplication( 1082)] at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
[ERROR][TiApplication( 1082)] at android.view.Choreographer.doCallbacks(Choreographer.java:562)
[ERROR][TiApplication( 1082)] at android.view.Choreographer.doFrame(Choreographer.java:530)
[ERROR][TiApplication( 1082)] at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
[ERROR][TiApplication( 1082)] at android.os.Handler.handleCallback(Handler.java:725)
[ERROR][TiApplication( 1082)] at android.os.Handler.dispatchMessage(Handler.java:92)
[ERROR][TiApplication( 1082)] at android.os.Looper.lo
[ERROR][AndroidRuntime( 1082)] FATAL EXCEPTION: main
[ERROR][AndroidRuntime( 1082)] java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
[ERROR][AndroidRuntime( 1082)] at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
[ERROR][AndroidRuntime( 1082)] at java.util.ArrayList.get(ArrayList.java:304)
[ERROR][AndroidRuntime( 1082)] at ti.modules.titanium.ui.widget.tableview.TiTableView.getItemAtPosition(TiTableView.java:411)
[ERROR][AndroidRuntime( 1082)] at ti.modules.titanium.ui.TableViewProxy.fireEvent(TableViewProxy.java:163)
[ERROR][AndroidRuntime( 1082)] at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1474)
[ERROR][AndroidRuntime( 1082)] at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1465)
[ERROR][AndroidRuntime( 1082)] at org.appcelerator.titanium.view.TiUIView$4.onFling(TiUIView.java:1186)
[ERROR][AndroidRuntime( 1082)] at android.view.GestureDetector.onTouchEvent(GestureDetector.java:600)
[ERROR][AndroidRuntime( 1082)] at org.appcelerator.titanium.view.TiUIView$5.onTouch(TiUIView.java:1219)
[ERROR][AndroidRuntime( 1082)] at android.view.View.dispatchTouchEvent(View.java:7241)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2168)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1903)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
[ERROR][AndroidRuntime( 1082)] at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953)
[ERROR][AndroidRuntime( 1082)] at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1405)
[ERROR][AndroidRuntime( 1082)] at android.app.Activity.dispatchTouchEvent(Activity.java:2410)
[ERROR][AndroidRuntime( 1082)] at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1901)
[ERROR][AndroidRuntime( 1082)] at android.view.View.dispatchPointerEvent(View.java:7426)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3220)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3165)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4292)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4271)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4363)
[ERROR][AndroidRuntime( 1082)] at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
[ERROR][AndroidRuntime( 1082)] at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
[ERROR][AndroidRuntime( 1082)] at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:171)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4342)
[ERROR][AndroidRuntime( 1082)] at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4382)
[ERROR][AndroidRuntime( 1082)] at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
[ERROR][AndroidRuntime( 1082)] at android.view.Choreographer.doCallbacks(Choreographer.java:562)
[ERROR][AndroidRuntime( 1082)] at android.view.Choreographer.doFrame(Choreographer.java:530)
[ERROR][AndroidRuntime( 1082)] at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
[ERROR][AndroidRuntime( 1082)] at android.os.Handler.handleCallback(Handler.java:725)
[ERROR][AndroidRuntime( 1082)] at android.os.Handler.dispatchMessage(Handler.java:92)
[ERROR][AndroidRuntime( 1082)] at android.os.Looper.loop(Looper.java:137)
[ERROR][AndroidRuntime( 1082)] at android.app.ActivityThread.main(ActivityThread.java:5041)
[ERROR][AndroidRuntime( 1082)] at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][AndroidRuntime( 1082)] at jav
[WARN][ActivityManager( 275)] Force finishing activity com.cletus.salt.mobile/.cletusSaltActivity
[WARN][WindowManager( 275)] Failure taking screenshot for (246x437) to layer 21010
[INFO][dalvikvm-heap( 275)] Grow heap (frag case) to 8.611MB for 635812-byte allocation
[ERROR][SurfaceFlinger( 37)] ro.sf.lcd_density must be defined as a build property
[WARN][ActivityManager( 275)] Activity pause timeout for ActivityRecord{40fb2208 u0 com.cletus.salt.mobile/.cletusSaltActivity}
[ERROR][SurfaceFlinger( 37)] ro.sf.lcd_density must be defined as a build property
[INFO][ActivityManager( 275)] No longer want android.process.media (pid 476): empty #17
[INFO][Process ( 1082)] Sending signal. PID: 1082 SIG: 9
[INFO][ActivityManager( 275)] Process com.cletus.salt.mobile (pid 1082) has died.
[INFO][WindowState( 275)] WIN DEATH: Window{411dc090 u0 com.cletus.salt.mobile/com.cletus.salt.mobile.cletusSaltActivity}
from nl.fokkezb.pulltorefresh.
Can you share some code on how you implemented it?
from nl.fokkezb.pulltorefresh.
This is the XML that includes it:
<Alloy>
<Collection src="listData" />
<View id="vwContent">
<View id="vwJumpMenu">
<Button id="btnJump1" class="btnJump" title="Jump 1" />
<Button id="btnJump2" class="btnJump" title="Jump 2" />
<Button id="btnJump3" class="btnJump" title="Jump 3" />
</View>
<TableView id="tblListData" dataCollection="listData" dataFilter="listDataFilter">
<Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="listDataLoader" />
<Require src="list/listRow" />
</TableView>
</View>
</Alloy>
For the onRelease call, I haven't done any development there so it is simply:
function listDataLoader(e) {
alert('load');
listData.fetch({
success: e.hide,
error: e.hide
})
}
I do notice that on Android, when it first loads (before it crashes), I don't see my view with the 3 Jump buttons at the top. When I get rid of the widget, that view becomes visible again. On iOS everything looks exactly as I expect it to.
from nl.fokkezb.pulltorefresh.
Aha, yeah.. the trick for the Android compatibility is for the TableView to get a negative position that correspondents to the height of the headerView that contains the PTR message.
So the TableView is expected to be absolute positioned and if there's any content above it, it should be added to the XML after the table, so that it has a higher z-Index.
from nl.fokkezb.pulltorefresh.
Okay, great. I'll try that out and will let you know how it goes! Thanks!
from nl.fokkezb.pulltorefresh.
So just to test things out, I removed the other view altogether. I'm still getting the same error unfortunately.
In case any of this might be complicating things, here is the style for the table:
"#tblListData": {
top: "36dp",
backgroundColor: "#FFF",
separatorStyle: 0,
rowHeight: "40dp",
allowsSelection: "false"
}
Also, it's possible things are being complicated even more that this TableView is included in a larger structure. I have my overall window which has a header bar (just a View, not anything platform-specific) and then a content view. The TableView gets added to the content view of that original window.
The end result XML would look something like this, though in practice there is no single XML file like this:
<Window id="windex_pl">
<View>
<View id="vwHeaderBar">
<Button id="btnHeaderLeft" title="Back" onClick="Alloy.Globals.ss_close">
</View>
<View id="vwHeaderContent">
<Collection src="listData" />
<View id="vwContent">
<TableView id="tblListData" dataCollection="listData" dataFilter="listDataFilter">
<Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="listDataLoader" />
<Require src="list/listRow" />
</TableView>
<!--<View id="vwJumpMenu">
<Button id="btnJumpState" class="btnJump" title="States" onClick="jumpStateMenu" />
<Button id="btnJumpTaxType" class="btnJump" title="Tax Types" />
<Button id="btnJumpTopic" class="btnJump" title="Topics" />
</View>-->
</View>
</View>
</View>
</Window>
If anything jumps out at you, please let me know. I'll do my own tinkering and see if I can come up with anything.
from nl.fokkezb.pulltorefresh.
Th #tblListData
needs to have top
set to 0
, other then that I don't see anything strange.
Let me know if you find out more on the crash. If not, I'll have another look at it.
from nl.fokkezb.pulltorefresh.
I switched that to 0, and I did see it working briefly. But then it crashed the same as before. Probably something to do with how I've got everything structured. I'm going to try to eliminate pieces from my structure one at a time and I'll report back if/when I find the problem! Thanks for the help!
from nl.fokkezb.pulltorefresh.
I've narrowed it down to what seems to be causing the issue.
Each of my TableViewRows has a view that I am trapping events on through the TableView's touchstart/end/cancel listeners. When I comment those out, it works fine!
from nl.fokkezb.pulltorefresh.
Mmm, the widget only listens to the TableView
's scroll
and swipe
events and it shouldn't matter how much listeners there are on one event. Strange..
Closing.
from nl.fokkezb.pulltorefresh.
Related Issues (20)
- can you tell me how to create this widget in controller file HOT 3
- Nice to have: Example without models/collections but normal payloads HOT 2
- Failed to run dexer: HOT 1
- Make the widget a child instead of a parent of the ListView/TableView HOT 1
- Add Windows Phone support HOT 1
- Accordion tableView on 3 lavel HOT 2
- Create this widget programatically HOT 1
- Is it possible to disable the pull to refresh? HOT 7
- New "Ti.SwipeRefreshLayout" pull request HOT 2
- Uncaught Error in Android 6.0.1 HOT 10
- Cannot install new version HOT 3
- How to Integrate Pull to refresh and Infinite Scroll Widget in Single List or table View HOT 1
- Crash on single tap HOT 2
- Android problem with version 2.2.3 HOT 7
- widget programatically TabGroup HOT 4
- Use in Appcelerator Corporate Directory Example HOT 3
- Loading indicator only shown once
- Should also work with Ti.UI.ScrollView
- Not working on 6.1.1.GA HOT 1
- Tableview with Swipe event does not trigger refreshstart event directly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nl.fokkezb.pulltorefresh.