iskugor / ti.swiperefreshlayout Goto Github PK
View Code? Open in Web Editor NEWThis project forked from raymondkam/ti.swiperefreshlayout
Titanium module for Android's SwipeRefreshLayout.
This project forked from raymondkam/ti.swiperefreshlayout
Titanium module for Android's SwipeRefreshLayout.
I am wondering if you might have some ideas, I have been working on this all day without any progress.
I am looking at installing Ti.SwipeRefreshLayout as a prerequisite of SwiperRefreshLayout.
I am using TI 3.4.1.GA on a Windows 7 PC
I have tried the following with no luck
1/ I have try to import the module into Titanium SDK using Help\Install Mobile Module and copying the URL of the zip file. The module was put into the
C:\ProgramData\Titanium\ directory
2/ I tried copying by hand into c:\ProgramData\Titanium\modules\android
3/ I tried to import directly into the project and it was inserted in the project
I have tried a number of other suggestions I have found on the internet but they all end up with the same result
The module is not found when I use the TiApp Editor and when I add it in by hand in tiapp.xml
then when I build my app I get an
[ERROR] Application Installer abnormal process termination. Process exit value was 1
Any help would be much appreciated.
Thanks
SDK 3.3.0
OSX
Titanium Studio, build: 3.4.1
view
<Alloy>
<View id="Wrapper">
<Require type="widget" src="com.mcongrove.navigationBar" id="NavigationBar" image="logo.png" />
<View id="content">
<View id="NonRows">
<Label id="heading" />
<Label id="text" />
</View>
<Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="refreshList">
<TableView id="container">
<Widget id="is" src="nl.fokkezb.infiniteScroll" onEnd="nextbatch" />
</TableView>
</Widget>
</View>
</View>
</Alloy>
controler
$.init = function() {
$.is.init($.container);
$.ptr.refresh();
};
function refreshList(e) {
var callback = function(result) {
ProcessResults(result);//builds up array and set it with this call $.container.setData(rows);
if (e) {
e.hide();
}
};
rows = [];
_params.StartIndex = 0;
_params.Force = true;
$.GetData(e, callback);//Calls rest api to get the data
}
$.init();
using com.mcongrove.tabs for navigation and on selection i call a handleNavigation function,
handleNavigation : function(_id) {
APP.Tabs.setIndex(_id);
APP.currentStack = _id;
// Create new controller stack if it doesn't exist
if ( typeof APP.controllerStacks[_id] === "undefined") {
APP.controllerStacks[_id] = [];
}
// Set current controller stack
var controllerStack = APP.controllerStacks[_id];
// If we're opening for the first time, create new screen
// Otherwise, add the last screen in the stack (screen we navigated away from earlier on)
var screen;
APP.hasDetail = false;
APP.previousDetailScreen = null;
if (controllerStack.length > 0) {
// Retrieve the last screen
screen = controllerStack[controllerStack.length - 1];
controllerStack[0].fireEvent("APP:screenAdded");
} else {
// Create a new screen
var type = APP.Nodes[_id].type.toLowerCase();
screen = Alloy.createController(type, APP.Nodes[_id]).getView();
// Add screen to the controller stack
controllerStack.push(screen);
screen.fireEvent("APP:screenAdded");
}
// Add the screen to the window
addScreen(screen);
// Reset the modal stack
APP.modalStack = [];
}
}
addScreen : function(_screen) {
if (_screen) {
APP.ContentWrapper.add(_screen);
if (APP.previousScreen) {
APP.removeScreen(APP.previousScreen);
}
APP.previousScreen = _screen;
}
}
the above code works perfect the first time, after navigating away and returning the 2nd time no error but list does not appear,
navigate away again and return to the view and exception is threw, in the processProperties function in the SwipeRefresh.java
i changed the function to
@Override
public void processProperties(KrollDict d) {
if (d.containsKey(PROPERTY_VIEW)) {
Object view = d.get(PROPERTY_VIEW);
if (view != null && view instanceof TiViewProxy) {
this.view = (TiViewProxy) view;
// view is table
// layout is the SwipeRefreshLayout
this.layout.setNativeView(this.view.getOrCreateView()
.getNativeView());
try {
//this.layout.addView(this.view.getOrCreateView().getOuterView());
ViewGroup p = (ViewGroup)this.view.getOrCreateView().getNativeView().getParent();
if(p != null){
p.removeView(this.view.getOrCreateView().getNativeView());
}
this.layout.addView(this.view.getOrCreateView().getOuterView());
} catch (Exception ex) {
Log.e("TiAPI", ex.getMessage());
ViewGroup p = (ViewGroup)this.view.getOrCreateView().getNativeView().getParent();
p.removeView(this.view.getOrCreateView().getNativeView());
this.layout.addView(this.view.getOrCreateView().getOuterView());
}
// this.layout.setVisibility(View.VISIBLE);
// this.view.getOrCreateView().getOuterView().setVisibility(View.VISIBLE);
this.layout.setColorScheme(color1, color2, color3, color4);
}
}
super.processProperties(d);
}
exception no longer occurs but the list is not displaying
When I add a swipe Event to the Window which contains the Widget (for example to catch the left / right swipe) then The reloadprocess doesn't get called. The Refresh Icon just stay there when I pulled it down (The Circle with the rotating Arrow in it)
Android 5.1
Hi,
I use the widget nl.fokkezb.pullToRefresh with a dependency to your module for Android and all that find on a ListView with a searchView but if I add the searchView to the actionBar or if I use another widgets like the nl.fokkezb.infiniteScroll, the app crash with this error:
[ERROR] InputEventReceiver: Exception dispatching input event.
[ERROR] E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
[ERROR] E/MessageQueue-JNI: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.widget.FrameLayout.getChildAt(int)' on a null object reference
[ERROR] E/MessageQueue-JNI: at com.rkam.swiperefreshlayout.MySwipeRefreshLayout.canChildScrollUp(MySwipeRefreshLayout.java:49)
[ERROR] E/MessageQueue-JNI: at com.rkam.swiperefreshlayout.SwipeRefreshLayout.onInterceptTouchEvent(SwipeRefreshLayout.java:640)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1960)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
[ERROR] E/MessageQueue-JNI: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
[ERROR] E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2369)
[ERROR] E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1719)
[ERROR] E/MessageQueue-JNI: at android.app.Activity.dispatchTouchEvent(Activity.java:2742)
[ERROR] E/MessageQueue-JNI: at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
[ERROR] E/MessageQueue-JNI: at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2330)
[ERROR] E/MessageQueue-JNI: at android.view.View.dispatchPointerEvent(View.java:8666)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4123)
[INFO] JNI: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3989)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3680)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3737)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5807)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5781)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5752)
[ERROR] E/MessageQueue-JNI: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5897)
[ERROR] E/MessageQueue-JNI: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
[ERROR] E/MessageQueue-JNI: at android.os.MessageQueue.nativePollOnce(Native Method)
[ERROR] E/MessageQueue-JNI: at android.os.MessageQueue.next(MessageQueue.java:143)
[ERROR] E/MessageQueue-JNI: at android.os.Looper.loop(Looper.java:122)
[ERROR] E/MessageQueue-JNI: at android.app.ActivityThread.main(ActivityThread.java:5254)
[ERROR] E/MessageQueue-JNI: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] E/MessageQueue-JNI: at java.lang.reflect.Method.invoke(Method.java:372)
[ERROR] E/MessageQueue-JNI: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[ERROR] E/MessageQueue-JNI: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[INFO] Process: Sending signal. PID: 2037 SIG: 9
All the click / swipe events crash the app. Any idea of what happen?
Thank you for your help!
Damien
Hi, this is more of a new solution than an issue!
I was getting frustrated with duplicating my xml code just so that i could wrap it in <SwipeRefresh>
for Android, also using 'Require' to pull in the code was proving messy. The solution was simpler than I thought... simply 'remove' the ListView from the display before then adding it to the swipeRefresh module.
Consider the following:
<Alloy>
<View id="main">
<ListView id="scrollContent">
// my content
</ListView>
</View>
</Alloy>
In your controller you can do this:
if (OS_ANDROID){
var swipeRefreshModule = require('com.rkam.swiperefreshlayout');
$.main.remove($.scrollContent); // application crashes without this line
var swipeRefresh = swipeRefreshModule.createSwipeRefresh({
view: $.scrollContent,
height: Ti.UI.FILL,
width: Ti.UI.FILL
});
$.main.add(swipeRefresh);
}
Hope this helps some people!
On Android, you cannot scroll back up if you have scrolled down the table. If you try, the pull to refresh will be activated.
If I substitute a ListView in place of the TableView, it works as expected.
Lollipop uses a refresh spinner instead of the cycling color line. I believe the version of the support library needs to be updated to 21 for this to be supported. See http://stackoverflow.com/questions/26807763/android-lollipop-pull-to-refresh
I get these error while compile the project after add this module. Any idea?
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatJellyBeanMr2;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoJellyBeanMr2;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/print/PrintHelper;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/print/PrintHelper$PrintHelperStubImpl;
Hi Mate,
Can i know what's the license for this library?
I have a scrollableView with 3 views in it. Each view contains a listView. If the scrollableView contains 3 (or probably more) views with the swiperefresh enabled, the listViews disappear / go blank.
It works with a maximum of 2 views in the scrollableView though. Both ListViews keep working properly.
I use the the scrollableTab addon (https://marketplace.appcelerator.com/apps/10618), but I also tested it with a clean/custom scrollableView in a new window.
Screencast of the problem: https://www.youtube.com/watch?v=WoSHP4SygvE&feature=youtu.be
I am developing an Android app, where I am forced to run it as singleTask. This means that when returning to the app, either from clicking the app icon or from another app, all activities but the root are closed. The root window is closed as well, but just needs to be opened again by calling the open() method. This works fine, but it seems like the listview hooked up to the Ti.SwipeRefreshLayout is not redrawn/not visible after that. As a test, I tried to use the listview without Ti.SwipeRefreshLayout, and then it's visible after reopening the app.
I tried setRefreshing(true)
but that gives:
[DEBUG] OpenGLRenderer: Enabling debug mode 0
[WARN] W/System.err: java.lang.NullPointerException
[WARN] W/System.err: at com.rkam.swiperefreshlayout.SwipeRefreshLayout.ensureTarget(SwipeRefreshLayout.java:312)
[WARN] W/System.err: at com.rkam.swiperefreshlayout.SwipeRefreshLayout.setRefreshing(SwipeRefreshLayout.java:255)
[WARN] W/System.err: at com.rkam.swiperefreshlayout.SwipeRefresh.setRefreshing(SwipeRefresh.java:88)
[WARN] W/System.err: at com.rkam.swiperefreshlayout.SwipeRefreshProxy.setRefreshing(SwipeRefreshProxy.java:27)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[WARN] W/System.err: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884)
[WARN] W/System.err: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107)
[WARN] W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347)
[WARN] W/System.err: at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:99)
[WARN] W/System.err: at ti.modules.titanium.ui.TabGroupProxy.handleMessage(TabGroupProxy.java:104)
[WARN] W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
[WARN] W/System.err: at android.os.Looper.loop(Looper.java:137)
[WARN] W/System.err: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[ERROR] TiExceptionHandler: (main) [510,510] ----- Titanium Javascript Runtime Error -----
[ERROR] TiExceptionHandler: (main) [0,510] - In alloy/widgets/nl.fokkezb.pullToRefresh/controllers/widget.js:25,24
[ERROR] TiExceptionHandler: (main) [1,511] - Message: Uncaught Error: Java Exception occurred
[ERROR] TiExceptionHandler: (main) [0,511] - Source: refreshControl.setRefreshing(true);
[ERROR] V8Exception: Exception occurred at alloy/widgets/nl.fokkezb.pullToRefresh/controllers/widget.js:25: Uncaught Error: Java Exception occurred
When using a listview, if a user scrolls down the list, and then attempts to scroll back up, the refresh action is initiated again immediately
Hi I trying to build my project. But after i adding module i get this error.Please help thanks
[ERROR] Failed to compile Java source files:
[ERROR]
[ERROR] D:\Titanium_Studio_Workspace\Button_Merchant\build\appify\build\android
gen\com\button\merchant\Button_merchantActivity.java:5: error: cannot access Tas
kStackBuilder
[ERROR] public final class Button_merchantActivity extends TiRootActivity
[ERROR] ^
[ERROR] class file for android.support.v4.app.TaskStackBuilder not found
[ERROR] D:\Titanium_Studio_Workspace\Button_Merchant\build\appify\build\android
gen\com\button\merchant\Button_merchantApplication.java:229: error: cannot acces
s FragmentActivity
[ERROR] org.appcelerator.titanium.TiVerify verify = new org.appc
elerator.titanium.TiVerify(rootActivity, this);
[ERROR] ^
[ERROR] class file for android.support.v4.app.FragmentActivity not found
[ERROR] Note: D:\Titanium_Studio_Workspace\Button_Merchant\build\appify\build\an
droid\gen\com\button\merchant\AssetCryptImpl.java uses unchecked or unsafe opera
tions.
[ERROR] Note: Recompile with -Xlint:unchecked for details.
[ERROR] 2 errors
Titanium 6.0.0 needed all native modules to be recompiled against the latest V8 version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.