Search in sources :

Example 16 with WritableNativeArray

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);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) WritableArray(com.facebook.react.bridge.WritableArray) PointF(android.graphics.PointF) WritableNativeMap(com.facebook.react.bridge.WritableNativeMap) WritableNativeArray(com.facebook.react.bridge.WritableNativeArray) AndroidCallbackEvent(com.mapbox.rctmgl.events.AndroidCallbackEvent)

Example 17 with WritableNativeArray

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);
                }
            });
        }
    });
}
Also used : FAQCategoryListener(com.zoho.livechat.android.listeners.FAQCategoryListener) WritableMap(com.facebook.react.bridge.WritableMap) WritableArray(com.facebook.react.bridge.WritableArray) WritableNativeMap(com.facebook.react.bridge.WritableNativeMap) ArrayList(java.util.ArrayList) Handler(android.os.Handler) WritableNativeArray(com.facebook.react.bridge.WritableNativeArray) SalesIQArticleCategory(com.zoho.livechat.android.models.SalesIQArticleCategory) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 18 with WritableNativeArray

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);
                }
            });
        }
    });
}
Also used : SIQDepartment(com.zoho.livechat.android.SIQDepartment) WritableMap(com.facebook.react.bridge.WritableMap) WritableArray(com.facebook.react.bridge.WritableArray) DepartmentListener(com.zoho.livechat.android.listeners.DepartmentListener) WritableNativeMap(com.facebook.react.bridge.WritableNativeMap) ArrayList(java.util.ArrayList) Handler(android.os.Handler) WritableNativeArray(com.facebook.react.bridge.WritableNativeArray) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 19 with WritableNativeArray

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);
                }
            });
        }
    });
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) WritableArray(com.facebook.react.bridge.WritableArray) FAQListener(com.zoho.livechat.android.listeners.FAQListener) SalesIQFAQListener(com.zoho.livechat.android.listeners.SalesIQFAQListener) WritableNativeMap(com.facebook.react.bridge.WritableNativeMap) ArrayList(java.util.ArrayList) Handler(android.os.Handler) WritableNativeArray(com.facebook.react.bridge.WritableNativeArray) SalesIQArticle(com.zoho.livechat.android.models.SalesIQArticle) ReactMethod(com.facebook.react.bridge.ReactMethod)

Aggregations

WritableNativeArray (com.facebook.react.bridge.WritableNativeArray)19 WritableArray (com.facebook.react.bridge.WritableArray)18 WritableMap (com.facebook.react.bridge.WritableMap)17 WritableNativeMap (com.facebook.react.bridge.WritableNativeMap)14 ArrayList (java.util.ArrayList)10 Handler (android.os.Handler)7 ReactMethod (com.facebook.react.bridge.ReactMethod)7 AndroidCallbackEvent (com.mapbox.rctmgl.events.AndroidCallbackEvent)3 BluetoothDevice (android.bluetooth.BluetoothDevice)2 LatLng (com.mapbox.mapboxsdk.geometry.LatLng)2 RequestPoint (com.yandex.mapkit.RequestPoint)2 Point (com.yandex.mapkit.geometry.Point)2 Polyline (com.yandex.mapkit.geometry.Polyline)2 VisitorChat (com.zoho.livechat.android.VisitorChat)2 ConversationListener (com.zoho.livechat.android.listeners.ConversationListener)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Activity (android.app.Activity)1 BluetoothClass (android.bluetooth.BluetoothClass)1 SharedPreferences (android.content.SharedPreferences)1