Coder Social home page Coder Social logo

nl.fokkezb.pulltorefresh's People

Contributors

adesugbaa avatar angelkbrown avatar felipeconti avatar fokkezb avatar jasonkneen avatar mcongrove avatar stereoket avatar topener avatar wiltonkkw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nl.fokkezb.pulltorefresh's Issues

Cannot install new version

We recently changed the system that we are developing on, and as a result need to re-install the widget. It seems since our last install, the widget has been updated. This new version will not install into Appcelerator. On attempt, we receive the following message:

"Unable to download the module from the specified URL. Is the URL valid?"

Despite our best efforts, we cannot find a work around. We would appreciate any help possible.

Thanks.

pullToRefresh does not work well along with searchView on Android

Hi Fokke

I have been using your masterpiece - pull-to-refresh widget for quite a while and found quite useful.

I have recently started porting iOS version of my app to Android. What I found is that there is a layout issue when using pull-to-refresh widget along with Android SearchView. See the illustrated screenshot and code below

pull_to_ref_and_1
It shows a white area when the screen is ready - seems like tableview header? Also, the searchView is being pushed above the screen...

pull_to_ref_and_2
When updating, then searchView is visible

main.xml

<Alloy>
    <Window title="Job List" tabBarHidden="true">
        <TableView id="jobList" onClick="onTableClick">
            <Widget platform="ios, android" id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="refreshJobList" />
        </TableView>
    </Window>
</Alloy>

main.js

if(OS_ANDROID && Ti.Platform.Android.API_LEVEL > 11) {
        $.jobList.search = Alloy.createController("search_view").getView();
}

search_view.xml

<Alloy>
    <SearchView id="searchView" ns="Ti.UI.Android" platform="android" backgroundColor="#FFFFFF" />
</Alloy>

Can you please have a look at this issue?
Many thanks

TableView disappears when added to ScrollableView

If I go to the third page and return to the first , the list disappears.
HELP ME!

<Alloy>
    <Window class="container">
        <ScrollableView class="container">
            <View class="container">
                <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
                    <TableView class="container">
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                        <TableViewRow title="Testing pullToRefresh" />
                    </TableView>
                </Widget>
            </View>
            <View class="container">
                <Label>Testing second view</Label>
            </View>
            <View class="container">
                <Label>Testing third view</Label>
            </View>
        </ScrollableView>
    </Window>
</Alloy>

Widget disappear in scrollableview

Hi, can you help me, when i have the widget in a scrollable view with other views, this dissappear, You know how it could solve?

Thanks Regards

Android app crashes

My android app that uses this pullToRefresh widget crashes after clicking around in the app a couple of times. This issue seems to originate from the com.rkam.swiperefreshlayout module, which is discussed here: raymondkam/Ti.SwipeRefreshLayout#5

Ti version is 3.5.1. How can I solve this?

E/AndroidRuntime(21815): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
E/AndroidRuntime(21815):    at android.view.ViewGroup.addViewInner(ViewGroup.java:3759)
E/AndroidRuntime(21815):    at android.view.ViewGroup.addView(ViewGroup.java:3612)
E/AndroidRuntime(21815):    at android.view.ViewGroup.addView(ViewGroup.java:3557)
E/AndroidRuntime(21815):    at android.view.ViewGroup.addView(ViewGroup.java:3533)
E/AndroidRuntime(21815):    at com.rkam.swiperefreshlayout.SwipeRefresh.processProperties(SwipeRefresh.java:68)
E/AndroidRuntime(21815):    at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1209)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:500)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:491)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:469)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:507)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:491)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:469)
E/AndroidRuntime(21815):    at ti.modules.titanium.ui.widget.TiUIScrollableView$ViewPagerAdapter.instantiateItem(TiUIScrollableView.java:516)
E/AndroidRuntime(21815):    at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110)
E/AndroidRuntime(21815):    at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:832)
E/AndroidRuntime(21815):    at android.support.v4.view.ViewPager.populate(ViewPager.java:982)
E/AndroidRuntime(21815):    at android.support.v4.view.ViewPager.populate(ViewPager.java:914)
E/AndroidRuntime(21815):    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1436)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1451)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
E/AndroidRuntime(21815):    at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
E/AndroidRuntime(21815):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
E/AndroidRuntime(21815):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
E/AndroidRuntime(21815):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime(21815):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2533)
E/AndroidRuntime(21815):    at android.view.View.measure(View.java:17387)
E/AndroidRuntime(21815):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2213)
E/AndroidRuntime(21815):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1352)
E/AndroidRuntime(21815):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1549)
E/AndroidRuntime(21815):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1236)
E/AndroidRuntime(21815):    at an
W/ActivityManager(  819):   Force finishing activity nu.kodfabriken.ourapp/org.appcelerator.titanium.TiActivity

View id typo

view.xml has line id 'prtLine', but it should be 'ptrLine'.

The widget is not working for Android devices

Hi Fokke,

I have setup a demo for you to test the widget how I implemented. I agree with you that Android is exception for this functionality but somehow my clients are not able to understand this and I need to create the same effect which iPhone gives for the functionality.

Please check my code from the google drive link where I have placed: https://drive.google.com/file/d/0BwrEZRw3ujafLTU5QW1RWUxOeTQ/edit?usp=sharing

(You can download the code by saving it from File menu.)

Please help me for the same if I can achieve the functionality. Let me know if there's any work around. There's also another widget which I had used in code, "jollicode-pull-to-refresh". You can also check the widget if you wish to.

Thanks for your help. It would be my pleasure to receive any help.

Failed to run dexer:

I get these error while compile the project after add the Ti.SwipeRefreshLayout module to my project.

[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;

Android and iOS difference

Hi, I know that it isn't a properly issue but here I go:
The widget works so much well for iOS, but I have some complications using it on Android and decided to remove it of the Android version of my app.
This is my .xml code:

< TableView id="table" onClick="myEventHandler" >
< Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myLoader"/ >
< TableView >

How I need to proceed to use the widget on iOS and drop it off the table when I'm in Android?

Thank you so much and congratulations on the 1.5 version! Is working pretty well on iOS 7!

Android TableViews don't allow you to scroll back up

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.

Code Sample:

<Alloy>
    <Window id="homeWindow">
        <Widget id="swipeRefresh" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
            <TableView id="table">
            </TableView>
        </Widget>
    </Window>
</Alloy>

Issue when updating nl.fokkezb.pullToRefresh to 1.4 from 1.2 for android support

I do not know if this the issue of this widget or ChariTi project, so I raised in both project.

Since nl.fokkezb.pullToRefresh 1.2 does not support android, in order to support ChariTi in android for views that use this widget, I tried to update the widget to version 1.4.

After updated the widget to latest version of 1.4, error occurs when loading the widget:

'undefined' is not an object (evaluating '__parentSymbol.headerPullView = $.__views.vew.getViewEx({resurse: true})') at widget.js (line 117)

This error happens in both iOS and Android

Is it possible to disable the pull to refresh?

I am trying to work out a method to disable the pull-to-refresh.
So one sets it up and uses it and at a later date one wants to disable it. On Android this mainly means that the pull down spinner does not show. All other functionality of the embedded ListView, say, to carry on.
Is this possible?

Can't scroll up with listview on android

When I scroll up, the 'show' event is triggered and the refresh view or bar is displayed, so, I can't scroll up, scrolling up is canceled and the bar is displayed instead of scrolling up.

The bar or refreshView should only be displayed when the listview is displaying the first list items.

The bug is, can not scroll up on the listview on android, because scrolling up only fires the refresh event.

Accordion tableView on 3 lavel

I have same problem in my code Titanium Alloy to create Accordion tableView, i m new student and i have end of studies project to finish my study. see attach files
accordiontableview

App crash

Hi,

I follow steps in ReadMe. The view contains an empty TableView that is filled with myRefresher function. Without the widget the loadAllNews function works fine. The module is installed. I installed the widget with gittio.

View

<Alloy>
    <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
        <TableView id="newsList" backgroundcolor="#f1f2ef">
        </TableView>
    </Widget>
</Alloy>

Controller

var loadAllNews = function() {
    var loaderArgs = {
        callbackFunction : callBackLoadAllNews,
        url              : Alloy.CFG.Urls.baseURL + Alloy.CFG.Urls.getAllNews 
    };
    loader.get(loaderArgs);
};

var callBackLoadAllNews = function(argsNews) {
    if(argsNews != null) {
        Ti.API.log(argsNews);
        $.newsList.setData([]);
        $.newsList.removeAllChildren();
        var rows = [];
        for (var i = 0; i < argsNews.result; ++i)
        {
            var row = Alloy.createController("newsRow", argsNews.data[i]).getView("newsItem");
            rows.push(row);
        }
        $.newsList.setData(rows);
    }
};

function myRefresher(e) {
    loadAllNews();
    e.hide();
}

$.ptr.refresh();

Log

[WARN] :   dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb0d72b20)
[ERROR] :  TiApplication: (main) [16292,16292] Sending event: exception on thread: main msg:java.lang.ClassCastException: java.util.HashMap cannot be cast to org.appcelerator.titanium.proxy.TiViewProxy; Titanium 3.5.0,2015/01/12 15:33,0014f83
[ERROR] :  TiApplication: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.appcelerator.titanium.proxy.TiViewProxy
[ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:230)
[ERROR] :  TiApplication:   at android.os.Handler.dispatchMessage(Handler.java:98)
[ERROR] :  TiApplication:   at android.os.Looper.loop(Looper.java:136)
[ERROR] :  TiApplication:   at android.app.ActivityThread.main(ActivityThread.java:5017)
[ERROR] :  TiApplication:   at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] :  TiApplication:   at java.lang.reflect.Method.invoke(Method.java:515)
[ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
[ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
[ERROR] :  TiApplication:   at dalvik.system.NativeStart.main(Native Method)

Widget stops working consistently after multiple instances of containing Controller

I’m on iOS using Alloy.

I have an application that uses a TabGroup and in one of the tabs I am using this Widget.

When the user is logged out the TabGroup is destroyed and if they log back in a new instance of the TabGroup is started.

Any instance after the first, the ListView would most of the time not render, and no pull refresh would work either.

I tried a bunch of things and then started looking at the behavior in the widget.js file and found one small change that seems to fix the issue.

I don’t have a 100% sound reason why this works, but I think it has to do somehow with widget lifespan/scope or something.

Changing

refreshControl = Ti.UI.createRefreshControl();

to

refreshControl = $.UI.create('Ti.UI.RefreshControl');

somehow fixes the problem.

So the only thing that I can think of is that using the Ti.UI.create... method somehow is using global app scope and it’s running into some sort of issue with the RefreshControl not being able to be created again.

Whereas $.UI.create creates the RefreshControl within the scope of the Controller, in this case the Widget, and somehow that makes things work.

Again, I really have no idea why this fixes the issue as the documentation for $.UI.create doesn’t clearly explain all the differences from the Ti.UI.create... methods, but I believe that they do create using the controller styles if they are defined, so that’s what makes me think that there is some Widget “scope” at play.

This might explain the issue in #46.

[Android] It doesn't work well with SearchBar

Hi,
I can't make it work with a SearchBar in my tableview (even if I move the searchbar at the same level of the tableview).

<TableView id="table" onClick="openDetail">
   <SearchBar id="search" barColor="#385292" hintText="Recherche" />
   <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="refreshList" />
</TableView>

There is always the "Pull to refresh" in front of my searchBar, I'm still investigating.
Do you have any ideas/suggestions? Can you reproduce the case?

Uncaught Error in Android 6.0.1

screenshot_20160713-154834

Hi there, I got this issue when trying on my phone... I use Titanium SDK 5.2.0 /// Funny thing is that this works perfectly on my emulators..

This is my code:

  <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
        <ListView id="listView" defaultItemTemplate="template" onItemclick="onItemClick">
            <Templates>
                    <ItemTemplate name="template" class="itemContenedor" >
                        <View>
                            <ImageView bindId="imgNota" class="imagenLista" defaultImage="/images/imgDefault.jpg"  />
                        </View>
                        <View class="contenedorTitulo" >
                            <Label bindId="title" id="title" /> 
                        </View>
                    </ItemTemplate>
                </Templates>
                <Widget id="listWidgetNotas" src="nl.fokkezb.infiniteScroll" onEnd="listLoader" />
                <ListSection id="section" dataCollection="notasHome" >
                    <ListItem notaid:id="{id}" title:text="{titulonota}" imgNota:image="{imageintro}" />
                </ListSection>
            </ListView>
        </Widget>

Using this with a backbone Collection ?

Hey,
i really wanna use this widget in my project. Is it possible to assign a "normal" Collection (just available in the view corresponding controller) to the list as a dataprovider?

"normal" i mean not available on the global alloy space or/and created through Alloy.createCollec.... ?

Best, nico

Create this widget programatically

I have to create the widget programatically but I can't add the table view like a child of the widget because it isn't a view. Is this possible?

My code is:

    var ptr = Alloy.createWidget("nl.fokkezb.pullToRefresh", {
        onRelease: myRefresher()
    });

    var table = Ti.UI.createTableView({
      id: ('table' + i),
      data: tableData,
      separatorStyle: OS_ANDROID ? Ti.UI.TABLE_VIEW_SEPARATOR_STYLE_NONE : Ti.UI.iPhone.TableViewSeparatorStyle.NONE,
      headerView: header.getView()
    });
    ptr.add(table); // This crashes

Widget disappears from table inside scrollview

I have a table with the widget wrapped around it and both of those are inside a scrollview. When I open a window from that view and then return to the view with the widget, the widget disappears. The widget is working correctly before it disappears.

<Alloy> 
    <View id="standardview">
        <ScrollView id="incidentScrollView" showVerticalScrollIndicator="true">
            <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
                <TableView id="incidentTable" backgroundColor="transparent"/>
            </Widget>
        </ScrollView>
    </View>
</Alloy>

If I remove the scrollview and just have the widget and table, the widget will refresh as soon as the table is pulled down any distance, it will not refresh onRelease. The widget does not disappear, but it is not working correctly.

<Alloy> 
    <View id="standardview">
        <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="refreshIncidents">
            <TableView id="incidentTable" backgroundColor="transparent"/>
        </Widget>
    </View>
</Alloy>

Styling

Your documentation indicates that we should use ids, (#ptr etc) for overriding the styles, however the actual styles are classes (.ptr etc).

You might want to update the docs.

Love it tho.

Cheers

TypeError: Cannot call method 'on' of undefined

Looks like a great package, so thought I'd have a go and implementing into an app I'm building.

My view:

<Alloy>
    <Tab title="Nearby">
        <Window title="MyVenues">
            <TableView id="venuesTable"> 
                <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myLoader" />
                <TableViewRow venueId="{venues.id}">
                    <Label id="title" text="{venues.title}" class="h6"/>
                </TableViewRow>
            </TableView>
        </Window>
    </Tab>
</Alloy>

and it's controller:

var venues = Alloy.Collections.venues;
function myLoader(e) {
    venues.fetch({  
        success: e.hide,
        error: e.hide,
        query: {
                sql: 'SELECT * FROM venues'
            },
        localOnly:true
    });
    $.venuesTable.data = venues;
}

Note: I'm also using the restsql adapter. Error I'm getting is:

Uncaught TypeError: Cannot call method 'on' of undefined
Alloy.Models.venues.on("fetch change detroy",___allotId87);

For unknown reason, listView wasn't the first child element, but the second, even though there was only one,

The widget didn't detect my listView because it came in 2nd. The first child was the template. Might have something to do with the <require>

My code:

            <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="updateStation">

                <ListView defaultItemTemplate="departure" onItemclick="itemClick">

                    <Templates>
                        <Require src="Departure"></Require>
                    </Templates>

                    <ListSection
                        dataCollection="departures"
                        dataTransform="parseDeparture"
                        dataFunction="refreshListView"
                        >
                    </ListSection>

                </ListView>
            </Widget>

I adjusted the widget in my case. Perhaps a proper change would be to loop through the child elements, find the first ListItem/TableView and attach itself to that?

ps: my listItem is missing here for example sake ;)

Make background/font colors customizable

Currently, it forces the blue colors for both the background and font. Can you allow these to be set on instantiation?

(Also, as an aside, any update on Android compatibility?)

Enhancement for Android

I found the scroll is not smooth in Android TableView. I have added some code to make the scroll smoother especially for long list.

after line 164:

offset = e.firstVisibleItem;

add the following lines:

if (offset == 0) {
__parentSymbol.addEventListener('swipe', swipeListener);
} else {
__parentSymbol.removeEventListener('swipe', swipeListener);
}

The reason adding these lines is because the swipe makes the scroll become swipe. So, I add the code to check if the firstVisibleItem is not the first row of the table. It will add back when the first row become the firstVisibleItem again.

Android problem with version 2.2.3

In iOS it works perfectly , but Android is positioned above the Tableview entirely regardless the top of the TSS.
Here I put my TSS to see if I can help.
If I remove the Widget from the Tableview XML is positioned correctly.

".container": {

    "backgroundColor": "white"
}
"#cabecera": {

    "left": "0.00%",
    "top": "0.00%",
    "height": "10.68%",
    "width": "100.00%",
    "backgroundColor": "#19ddf2"
}
"#btnCerrar": {

    "left": "2.13%",
    "top": "2.60%",
    "height": "7.95%",
    "width": "16.80%",
    "backgroundImage": "/images/cerrar.png",
    "backgroundSelectedImage": "/images/cerrar.png"
}
"#btnAnadir": {

    "left": "86.00%",
    "top": "3.5%",
    "height": "5.54%",
    "width": "10.00%",
    "backgroundImage": "/images/plus.png",
    "backgroundSelectedImage": "/images/plus_s.png"
}
"#root[platform=ios]": {

    "left": "0",
    "width": "100%",
    "top": "0",
    "height": "100%",
    "navBarHidden": "true"
}
"#root[platform=android]": {

    "theme": "Theme.AppCompat.NoTitleBar.Fullscreen",
    "left": "0",
    "width": "100%",
    "top": "0",
    "height": "100%",
    "navBarHidden": "true"
}
"#lblCabecera": {

    "text": "Aguas Abiertas",
    "left": "0.00%",
    "top": "4.95%",
    "height": "4%",
    "textAlign": "center",
    "width": "100.00%",
    "color": "#000000"
}
"#lblAtras": {

    "text": "Atrás",
    "left": "9.73%",
    "top": "6.15%"
}
"#listaAguasAbiertas": {

    "height": "89.21%",
    "left": "0.00%",
    "top": "10.79%",
    "width": "100.00%",
}

Here you can see the XML:

<Alloy>
    <NavigationWindow module="xp.ui" id="nav">
        <Window class="container" id="root" onOpen="compruebaPrimerInicio">


            <ImageView id="cabecera"/>
            <Button id="btnCerrar" onClick="cerrar"/>
            <Label id="lblCabecera"/>
            <Button id="btnAnadir" onClick="nuevaTravesia" />

            <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
                <TableView id="listaAguasAbiertas" onClick="muestraPrueba"/>
            </Widget>


        </Window>
    </NavigationWindow>
</Alloy>

Here You Can See a screenshot of Como appears look in iOS:
simulator screen shot 3 sept 2016 8 19 45

And here the screenshot of Android where you see the Tableview is positioned wrong.
captura de pantalla 2016-09-03 a las 0 36 27

Thank you very much in advance

Crash on single tap

Hi,
i'm trying to add your widget to my app but i have a problem:

my index.xml

<Alloy>
    <Collection src="books" />
    <TabGroup id="tabGroup">
        <Tab>
            <Require id="showcase" src="showcase" />
        </Tab>

        <Tab>
            ...
        </Tab>
    </TabGroup>
</Alloy>

This is my showcase.xml:

<Alloy>
    <Collection src="books" />
    <Window id="showcaseWin">
        <Picker id="picker" onChange="pickerChanged">
            <PickerColumn>
                ....
            </PickerColumn>
        </Picker>
        <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
            <TableView id="booksList" dataCollection="books" dataFilter="filterBooksList">
                <SearchView id="searchView" ns="Ti.UI.Android" platform="android" />
                <TableViewRow title="{title}" model="{alloy_id}">
                    <CardView>
                        <View id="detailsBook">
                            <Label>Title: {title}</Label>
                            ....
                        </View>
                    </CardView>
                </TableViewRow>
            </TableView>
        </Widget>
    </Window>
</Alloy>

and in my controller i just do:

$.ptr.refresh();

function myRefresher(e) {
  if(Ti.Network.online) net.getBooksList(setBooksList);
  e.hide();
}

The app starts correctly but when i do a single tap on the "showcase" window i get a crash: "Unfortunately, TiShadow has stopped".

I'd like to use your widget but i'm a novice with Appcelerator Titanium.. any suggestions?
(I'm using Titanium SDK 5.4.0 GA, last version of TiShadow and Genymotion emulator with Android 6.0)
Thank you!

Widget disappear in scrollableview(Re-open)

Hi,

With the classic code in my controller it works, but how I can do the callback to refresh the control?, here is my code

var ptr = Alloy.createWidget("nl.fokkezb.pullToRefresh", {
        id : "ptr",
        children : [tableview]
    }).getView();

    ptr.addEventListener("onRelease",function(e){
        alert("");
    });

Thanks
Regards

iOS native pullToRefresh animation?

I just found and implemented this widget, it's great.

If you are bored :) it would be great if you could support the native iOS animation in Mail.app UIRefreshControl to get the "blob" in iOS mail. I don't even know if you can include a module in a widget, but just something to think about.

thanks for creating this.

Wrapping pullToRefresh around ListView hides the listview

Hello Fokke,

I am trying to use your widget for refreshing my listview.

For some reason when I wrap your widget around the listview it doesn't show anything in my application.

The view that contains the widget is programmatically added to a window of a tab in a tabgroup.

I use data binding on the listsection to show the list items.

When I remove your widget it works.

Code below of the xml view:
schermafbeelding 2015-02-08 om 23 08 01

In the controller I call $.ptr.refresh() and $.ptr.hide() when the movies are retrieved

Ti SDK 3.4.1/3.5.0
iOS 8.1

Titanium classic?

hi, can this be translated / converted for use in classic Titanium?

Runtime Error

Exception occurred at ti:/module.js:280: Uncaught Error: Requested module not found: com.rkam.swiperefreshlayout.
This happened only on Android.

Refactor to use native PTR only

  • iOS: Ti.UI.RefreshControl
  • Android: com.rkam.swiperefreshlayout

Usage:

<Widget src="nl.fokkezb.pullToRefresh">
  <TableView/ListView />
</Widget>

Or maybe even better:

<TableView/ListView module="nl.fokkezb.pullToRefresh" />

Android Compatibility

Hello!

I am currently working on an application that will be both IOS and Android compatibile. The widget looks and works fantastic for IOS! Before I attempt to alter the code for Android, has someone already done that?

Thank you so much,
Addie

Error durring Compile

I get the following ERROR when I try to compile my Project with the Widget.

[ERROR] :  widget "nl.fokkezb.pullToRefresh" view "view" does not exist.
[ERROR] :  Alloy compiler failed
[ERROR] Application Installer abnormal process termination. Process exit value was 1

Titanium Studio, build: 3.2.0.201312191547 (Newest Version All Updates) + Alloy
Ti SDK - 3.2.0.GA

Android

Thanks for a great plugin. In Android, when I normally scroll and reach top of the tableview, refresh function is triggered. Its not waiting for any swipe/drag event at the top. Is it the functionality or for me its working wrongly?

Make the widget a child instead of a parent of the ListView/TableView

Because the widget is a parent, it is impossible to disable it ad-hoc, especially platform specific.

Reason for this ticket, I want to disable it for Windows Phone, but not for Android and iOS

So this would be great:

<ListView>
    <Widget src="nl.fokkezb.pullToRefresh" platform="android,ios />
</ListView>

Instead of

<Widget src="nl.fokkezb.pullToRefresh" />
     <ListView>
     </ListView>
</Widget>

because in the 2nd/current option it is not possible to disable it platform specific

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.