Skip to content

Commit

Permalink
Fix threading issues, update to SDK 6.0.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Feb 12, 2017
1 parent ef349f7 commit db81d8c
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 128 deletions.
6 changes: 0 additions & 6 deletions assets/README

This file was deleted.

8 changes: 4 additions & 4 deletions build.properties
Original file line number Diff line number Diff line change
@@ -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
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

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 0 additions & 19 deletions dist/modules/android/com.rkam.swiperefreshlayout/0.1/manifest

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
13 changes: 0 additions & 13 deletions dist/modules/android/com.rkam.swiperefreshlayout/0.1/timodule.xml

This file was deleted.

Binary file modified dist/swiperefreshlayout.jar
Binary file not shown.
Binary file modified libs/armeabi-v7a/libcom.rkam.swiperefreshlayout.so
Binary file not shown.
Binary file removed libs/armeabi/libcom.rkam.swiperefreshlayout.so
Binary file not shown.
Binary file modified libs/x86/libcom.rkam.swiperefreshlayout.so
Binary file not shown.
8 changes: 4 additions & 4 deletions manifest
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
40 changes: 35 additions & 5 deletions src/com/rkam/swiperefreshlayout/SwipeRefreshProxy.java
Original file line number Diff line number Diff line change
@@ -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();
}
Expand All @@ -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);
}
}

0 comments on commit db81d8c

Please sign in to comment.