コード例 #1
0
            void SearchResultPoiView::CreateAndShowGeoNamesPoiView(const Search::SdkModel::SearchResultModel& model, bool isPinned)
            {
            	const std::string viewClass = "com/eegeo/searchresultpoiview/GeoNamesSearchResultPoiView";
            	m_uiViewClass = CreateJavaClass(viewClass);
            	m_uiView = CreateJavaObject(m_uiViewClass);

            	AndroidSafeNativeThreadAttachment attached(m_nativeState);
            	JNIEnv* env = attached.envForThread;

            	jstring titleStr = env->NewStringUTF(model.GetTitle().c_str());
            	jstring addressStr = env->NewStringUTF(model.GetSubtitle().c_str());
            	jstring categoryStr = env->NewStringUTF(model.GetCategory().c_str());

            	jmethodID displayPoiInfoMethod = env->GetMethodID(m_uiViewClass, "displayPoiInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V");
            	env->CallVoidMethod(
            			m_uiView,
						displayPoiInfoMethod,
						titleStr,
						addressStr,
						categoryStr,
						isPinned
            	);

            	env->DeleteLocalRef(categoryStr);
            	env->DeleteLocalRef(addressStr);
            	env->DeleteLocalRef(titleStr);
            }
コード例 #2
0
 ExampleApp::Search::SdkModel::SearchResultModel MutateMeetingRoomAvailability(const Search::SdkModel::SearchResultModel& searchResultModel, const std::string& updatedAvailability)
 {
     rapidjson::Document json;
     if (!json.Parse<0>(searchResultModel.GetJsonData().c_str()).HasParseError())
     {
         json[SearchConstants::AVAILABILITY_FIELD_NAME.c_str()] = rapidjson::Value(updatedAvailability.c_str(), json.GetAllocator()).Move();
     }
     
     rapidjson::StringBuffer strbuf;
     rapidjson::Writer<rapidjson::StringBuffer> writer(strbuf);
     json.Accept(writer);
     
     return Search::SdkModel::SearchResultModel(ExampleApp::Search::SdkModel::SearchResultModel::CurrentVersion,
                                                searchResultModel.GetIdentifier(),
                                                searchResultModel.GetTitle(),
                                                searchResultModel.GetSubtitle(),
                                                searchResultModel.GetLocation(),
                                                0.0f,
                                                true,
                                                searchResultModel.GetBuildingId(),
                                                searchResultModel.GetFloor(),
                                                Search::Lax::SearchConstants::DEFIBRILLATOR_CATEGORY_NAME,
                                                std::vector<std::string>(),
                                                Search::EegeoVendorName,
                                                strbuf.GetString(),
                                                searchResultModel.GetCreationTimestamp());
 }
コード例 #3
0
            void SearchResultPoiView::CreateAndShowYelpPoiView(const Search::SdkModel::SearchResultModel& model, bool isPinned)
            {
            	const std::string viewClass = "com/eegeo/searchresultpoiview/YelpSearchResultPoiView";
            	m_uiViewClass = CreateJavaClass(viewClass);
            	m_uiView = CreateJavaObject(m_uiViewClass);

            	Search::Yelp::SdkModel::YelpSearchResultModel yelpModel;
            	yelpModel = Search::Yelp::SdkModel::TransformToYelpSearchResult(model);

            	AndroidSafeNativeThreadAttachment attached(m_nativeState);
            	JNIEnv* env = attached.envForThread;

            	jobjectArray humanReadableCategoriesArray = CreateJavaArray(model.GetHumanReadableCategories());
            	jobjectArray reviewsArray = CreateJavaArray(yelpModel.GetReviews());

            	jstring titleStr = env->NewStringUTF(model.GetTitle().c_str());
            	jstring addressStr = env->NewStringUTF(model.GetSubtitle().c_str());
            	jstring phoneStr = env->NewStringUTF(yelpModel.GetPhone().c_str());
            	jstring urlStr = env->NewStringUTF(yelpModel.GetWebUrl().c_str());
            	jstring categoryStr = env->NewStringUTF(model.GetCategory().c_str());
            	jstring imageUrlStr = env->NewStringUTF(yelpModel.GetImageUrl().c_str());
            	jstring ratingImageUrlStr = env->NewStringUTF(yelpModel.GetRatingImageUrl().c_str());
            	jstring vendorStr = env->NewStringUTF(model.GetVendor().c_str());

            	jmethodID displayPoiInfoMethod = env->GetMethodID(m_uiViewClass, "displayPoiInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;IZ)V");
            	env->CallVoidMethod(
            			m_uiView,
						displayPoiInfoMethod,
						titleStr,
						addressStr,
						phoneStr,
						urlStr,
						categoryStr,
						humanReadableCategoriesArray,
						imageUrlStr,
						ratingImageUrlStr,
						vendorStr,
						reviewsArray,
						yelpModel.GetReviewCount(),
						isPinned
            	);

            	env->DeleteLocalRef(vendorStr);
            	env->DeleteLocalRef(ratingImageUrlStr);
            	env->DeleteLocalRef(imageUrlStr);
            	env->DeleteLocalRef(categoryStr);
            	env->DeleteLocalRef(urlStr);
            	env->DeleteLocalRef(phoneStr);
            	env->DeleteLocalRef(addressStr);
            	env->DeleteLocalRef(titleStr);
            	env->DeleteLocalRef(reviewsArray);
            	env->DeleteLocalRef(humanReadableCategoriesArray);
            }