diff --git a/assets/README b/assets/README deleted file mode 100644 index 8c81fef..0000000 --- a/assets/README +++ /dev/null @@ -1,6 +0,0 @@ -Place your assets like PNG files in this directory and they will be packaged with your module. - -If you create a file named com.rkam.swiperefreshlayout.js in this directory, it will be -compiled and used as your module. This allows you to run pure Javascript -modules that are pre-compiled. - diff --git a/build.properties b/build.properties index 9cc4aed..7cb6e56 100644 --- a/build.properties +++ b/build.properties @@ -1,4 +1,4 @@ -titanium.platform=/Users/rkam/Library/Application Support/Titanium/mobilesdk/osx/3.2.3.GA/android -android.platform=/Users/rkam/Library/android-sdk-macosx/platforms/android-10 -google.apis=/Users/rkam/Library/android-sdk-macosx/add-ons/addon-google_apis-google-10 -android.ndk=/Users/rkam/Downloads/android-ndk-r10 \ No newline at end of file +titanium.platform=/Users/hknoechel/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/android +android.platform=/opt/android-sdk/platforms/android-10 +google.apis=/opt/android-sdk/add-ons/addon-google_apis-google-10 +android.ndk=/opt/android-ndk diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/LICENSE b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/LICENSE deleted file mode 100644 index 6ae867d..0000000 --- a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/LICENSE +++ /dev/null @@ -1 +0,0 @@ -TODO: place your license here and we'll include it in the module distribution diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/documentation/index.html b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/documentation/index.html deleted file mode 100644 index 9bb8aec..0000000 --- a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/documentation/index.html +++ /dev/null @@ -1,23 +0,0 @@ -

swiperefreshlayout Module

-

Description

-

TODO: Enter your module description here

-

Accessing the swiperefreshlayout Module

-

To access this module from JavaScript, you would do the following:

-
var swiperefreshlayout = require("com.raymondkam.swiperefreshlayout");
-
-

The swiperefreshlayout variable is a reference to the Module object.
-

-

Reference

-

TODO: If your module has an API, you should document -the reference here.

-

_PROJECTNAMEASIDENTIFIER.function

-

TODO: This is an example of a module function.

-

_PROJECTNAMEASIDENTIFIER.property

-

TODO: This is an example of a module property.

-

Usage

-

TODO: Enter your usage example here

-

Author

-

TODO: Enter your author name, email and other contact -details you want to share here.

-

License

-

TODO: Enter your license/legal information here.

\ No newline at end of file diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/example/app.js b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/example/app.js deleted file mode 100644 index 581c2a6..0000000 --- a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/example/app.js +++ /dev/null @@ -1,39 +0,0 @@ -// This is a test harness for your module -// You should do something interesting in this harness -// to test out the module and to provide instructions -// to users on how to use it by example. - - -// open a single window -var win = Ti.UI.createWindow({ - backgroundColor:'white' -}); -var label = Ti.UI.createLabel(); -win.add(label); -win.open(); - -// TODO: write your module tests here -var swiperefreshlayout = require('com.rkam.swiperefreshlayout'); -Ti.API.info("module is => " + swiperefreshlayout); - -label.text = swiperefreshlayout.example(); - -Ti.API.info("module exampleProp is => " + swiperefreshlayout.exampleProp); -swiperefreshlayout.exampleProp = "This is a test value"; - -if (Ti.Platform.name == "android") { - var proxy = swiperefreshlayout.createExample({ - message: "Creating an example Proxy", - backgroundColor: "red", - width: 100, - height: 100, - top: 100, - left: 150 - }); - - proxy.printMessage("Hello world!"); - proxy.message = "Hi world!. It's me again."; - proxy.printMessage("Hello world!"); - win.add(proxy); -} - diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/armeabi-v7a/libcom.rkam.swiperefreshlayout.so b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/armeabi-v7a/libcom.rkam.swiperefreshlayout.so deleted file mode 100644 index 062d827..0000000 Binary files a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/armeabi-v7a/libcom.rkam.swiperefreshlayout.so and /dev/null differ diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/armeabi/libcom.rkam.swiperefreshlayout.so b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/armeabi/libcom.rkam.swiperefreshlayout.so deleted file mode 100644 index ba58c6c..0000000 Binary files a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/armeabi/libcom.rkam.swiperefreshlayout.so and /dev/null differ diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/x86/libcom.rkam.swiperefreshlayout.so b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/x86/libcom.rkam.swiperefreshlayout.so deleted file mode 100644 index 12c53be..0000000 Binary files a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/libs/x86/libcom.rkam.swiperefreshlayout.so and /dev/null differ diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/manifest b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/manifest deleted file mode 100644 index 5d32e62..0000000 --- a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/manifest +++ /dev/null @@ -1,19 +0,0 @@ -# -# this is your module manifest and used by Titanium -# during compilation, packaging, distribution, etc. -# -version: 0.1 -apiversion: 2 -description: Android Swipe Refresh Layout -architectures: armeabi armeabi-v7a x86 x86_64 -author: Raymond Kam -license: Specify your license -copyright: Copyright (c) 2016 by Your Company - - -# these should not be edited -name: swiperefreshlayout -moduleid: com.rkam.swiperefreshlayout -guid: fc0f2168-ac27-4239-bcb0-c51d7683eb05 -platform: android -minsdk: 5.1.2.GA diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/platform/android/res/layout/swipe_refresh.xml b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/platform/android/res/layout/swipe_refresh.xml deleted file mode 100644 index a6fd370..0000000 --- a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/platform/android/res/layout/swipe_refresh.xml +++ /dev/null @@ -1,6 +0,0 @@ - - diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/platform/android/res/values/colors.xml b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/platform/android/res/values/colors.xml deleted file mode 100644 index 7ffa1ea..0000000 --- a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/platform/android/res/values/colors.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - #1996BE - #48B6D9 - #80D3ED - #C2F0FF - \ No newline at end of file diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/swiperefreshlayout.jar b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/swiperefreshlayout.jar deleted file mode 100644 index a5de900..0000000 Binary files a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/swiperefreshlayout.jar and /dev/null differ diff --git a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/timodule.xml b/dist/modules/android/com.rkam.swiperefreshlayout/0.1/timodule.xml deleted file mode 100644 index 6affb2f..0000000 --- a/dist/modules/android/com.rkam.swiperefreshlayout/0.1/timodule.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/dist/swiperefreshlayout.jar b/dist/swiperefreshlayout.jar index a5de900..c8b3599 100644 Binary files a/dist/swiperefreshlayout.jar and b/dist/swiperefreshlayout.jar differ diff --git a/libs/armeabi-v7a/libcom.rkam.swiperefreshlayout.so b/libs/armeabi-v7a/libcom.rkam.swiperefreshlayout.so index 062d827..7c5ab39 100644 Binary files a/libs/armeabi-v7a/libcom.rkam.swiperefreshlayout.so and b/libs/armeabi-v7a/libcom.rkam.swiperefreshlayout.so differ diff --git a/libs/armeabi/libcom.rkam.swiperefreshlayout.so b/libs/armeabi/libcom.rkam.swiperefreshlayout.so deleted file mode 100644 index ba58c6c..0000000 Binary files a/libs/armeabi/libcom.rkam.swiperefreshlayout.so and /dev/null differ diff --git a/libs/x86/libcom.rkam.swiperefreshlayout.so b/libs/x86/libcom.rkam.swiperefreshlayout.so index 12c53be..7cd472d 100644 Binary files a/libs/x86/libcom.rkam.swiperefreshlayout.so and b/libs/x86/libcom.rkam.swiperefreshlayout.so differ diff --git a/manifest b/manifest index ad00150..f5a3b35 100644 --- a/manifest +++ b/manifest @@ -2,10 +2,10 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 0.1 -apiversion: 2 +version: 1.0.0 +apiversion: 3 description: Titanium version of SwipeRefreshLayout -architectures: armeabi armeabi-v7a x86 x86_64 +architectures: armeabi-v7a x86 author: Raymond Kam license: Specify your license copyright: Copyright (c) 2016 by Your Company @@ -16,4 +16,4 @@ name: swiperefreshlayout moduleid: com.rkam.swiperefreshlayout guid: fc0f2168-ac27-4239-bcb0-c51d7683eb05 platform: android -minsdk: 5.1.2.GA +minsdk: 6.0.0 diff --git a/src/com/rkam/swiperefreshlayout/SwipeRefreshProxy.java b/src/com/rkam/swiperefreshlayout/SwipeRefreshProxy.java index 30daecc..2688b4b 100644 --- a/src/com/rkam/swiperefreshlayout/SwipeRefreshProxy.java +++ b/src/com/rkam/swiperefreshlayout/SwipeRefreshProxy.java @@ -1,16 +1,22 @@ package com.rkam.swiperefreshlayout; import org.appcelerator.kroll.annotations.Kroll; +import org.appcelerator.kroll.KrollProxy; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiUIView; +import org.appcelerator.titanium.TiApplication; import android.app.Activity; +import android.os.Handler; +import android.os.Message; @Kroll.proxy(creatableInModule=SwiperefreshlayoutModule.class) -public class SwipeRefreshProxy extends TiViewProxy { +public class SwipeRefreshProxy extends TiViewProxy implements Handler.Callback { private SwipeRefresh swipeRefresh; - + + protected static final int MSG_SET_REFRESHING = KrollProxy.MSG_LAST_ID + 101; + public SwipeRefreshProxy() { super(); } @@ -20,15 +26,39 @@ public TiUIView createView(Activity activity) { swipeRefresh = new SwipeRefresh(this); return this.swipeRefresh; } + + /* Public API */ @Kroll.method public void setRefreshing(boolean refreshing) { - this.swipeRefresh.setRefreshing(refreshing); - return; + if (TiApplication.isUIThread()) { + doSetRefreshing(refreshing); + } else { + Message message = getMainHandler().obtainMessage(MSG_SET_REFRESHING, refreshing); + message.sendToTarget(); + } + } - + @Kroll.method @Kroll.getProperty public boolean isRefreshing() { return this.swipeRefresh.isRefreshing(); } + + /* Utilities */ + + public boolean handleMessage(Message message) { + switch (message.what) { + case MSG_SET_REFRESHING: { + doSetRefreshing((Boolean) message.obj); + return true; + } + } + + return super.handleMessage(message); + } + + protected void doSetRefreshing(boolean refreshing) { + this.swipeRefresh.setRefreshing(refreshing); + } }