use of com.facebook.react.bridge.WritableNativeArray in project maps by rnmapbox.
the class RCTMGLMapView method getPointInView.
public void getPointInView(String callbackID, LatLng mapCoordinate) {
PointF pointInView = mMap.getProjection().toScreenLocation(mapCoordinate);
float density = getDisplayDensity();
pointInView.x /= density;
pointInView.y /= density;
WritableMap payload = new WritableNativeMap();
WritableArray array = new WritableNativeArray();
array.pushDouble(pointInView.x);
array.pushDouble(pointInView.y);
payload.putArray("pointInView", array);
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}
use of com.facebook.react.bridge.WritableNativeArray in project SalesIQ-Mobilisten-ReactNative by zoho.
the class RNZohoSalesIQ method getCategories.
@ReactMethod
public void getCategories(@NonNull final Callback categoryCallback) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
ZohoSalesIQ.FAQ.getCategories(new FAQCategoryListener() {
@Override
public void onSuccess(ArrayList<SalesIQArticleCategory> categoryList) {
if (categoryList != null) {
WritableArray array = new WritableNativeArray();
for (int i = 0; i < categoryList.size(); i++) {
SalesIQArticleCategory category = categoryList.get(i);
WritableMap categoryMap = new WritableNativeMap();
// No I18N
categoryMap.putString("id", category.getCategoryid());
// No I18N
categoryMap.putString("name", category.getCategoryname());
// No I18N
categoryMap.putInt("articleCount", category.getCount());
array.pushMap(categoryMap);
}
categoryCallback.invoke(null, array);
}
}
@Override
public void onFailure(int code, String message) {
WritableMap errorMap = new WritableNativeMap();
// No I18N
errorMap.putInt("code", code);
// No I18N
errorMap.putString("message", message);
categoryCallback.invoke(errorMap, null);
}
});
}
});
}
use of com.facebook.react.bridge.WritableNativeArray in project SalesIQ-Mobilisten-ReactNative by zoho.
the class RNZohoSalesIQ method getDepartments.
@ReactMethod
public void getDepartments(@NonNull final Callback departmentCallback) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
ZohoSalesIQ.Chat.getDepartments(new DepartmentListener() {
@Override
public void onSuccess(ArrayList<SIQDepartment> departmentList) {
if (departmentList != null) {
WritableArray array = new WritableNativeArray();
for (int i = 0; i < departmentList.size(); i++) {
SIQDepartment department = departmentList.get(i);
WritableMap departmentMap = getDepartmentMapObject(department);
array.pushMap(departmentMap);
}
departmentCallback.invoke(null, array);
}
}
@Override
public void onFailure(int code, String message) {
WritableMap errorMap = new WritableNativeMap();
// No I18N
errorMap.putInt("code", code);
// No I18N
errorMap.putString("message", message);
departmentCallback.invoke(errorMap, null);
}
});
}
});
}
use of com.facebook.react.bridge.WritableNativeArray in project SalesIQ-Mobilisten-ReactNative by zoho.
the class RNZohoSalesIQ method getArticlesWithCategoryID.
@ReactMethod
public void getArticlesWithCategoryID(@NonNull final String categoryId, @NonNull final Callback articlesCallback) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
ZohoSalesIQ.FAQ.getArticles(categoryId, new FAQListener() {
@Override
public void onSuccess(ArrayList<SalesIQArticle> articlesList) {
if (articlesList != null) {
WritableArray array = new WritableNativeArray();
for (int i = 0; i < articlesList.size(); i++) {
SalesIQArticle article = articlesList.get(i);
WritableMap articleMap = getArticleMapObject(article);
array.pushMap(articleMap);
}
articlesCallback.invoke(null, array);
}
}
@Override
public void onFailure(int code, String message) {
WritableMap errorMap = new WritableNativeMap();
// No I18N
errorMap.putInt("code", code);
// No I18N
errorMap.putString("message", message);
articlesCallback.invoke(errorMap, null);
}
});
}
});
}
Aggregations