Posted By

redfoundry on 02/22/11


Tagged


Versions (?)

Foursquare_Venue.xml


 / Published in: XML
 

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <rfapp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:noNamespaceSchemaLocation="http://developer.redfoundry.com/rfml.xsd">
  4. <views>
  5. <view>
  6. <property name="title">Foursquare</property>
  7. <property name="background-image">/resources/view-bg.jpg</property>
  8. <property name="padding">0</property>
  9. <property name="title-bar-visible">NO</property>
  10. <property name="top-padding">44</property>
  11. <property name="top-padding" device="iPad">64</property>
  12. <datasources>
  13.  
  14. <!-- Foursqure Venue API documentation: http://groups.google.com/group/foursquare-api/web/api-documentation
  15. Here we use the 'Venue details' - When given a venue identifier (vid), returns venue data, including mayorship, tips/to-dos and tags.
  16. If the vid given is one that has been merged into another "master" venue, the response will show data about the "master"
  17. instead of giving you an error.
  18. -->
  19. <RFXMLDataProvider id="foursquareVenueData">
  20. <property name="data-location">https://api.foursquare.com/v1/venue</property>
  21. <property name="allow-cache">NO</property>
  22. <property name="method">GET</property>
  23. <submit_values>
  24. <property name="vid">[form:vid]</property>
  25. </submit_values>
  26. <actions>
  27. <modify on="success">
  28. <property name="widget-id">innerLayout</property>
  29. <values>
  30. <property name="visible">YES</property>
  31. </values>
  32. </modify>
  33. <modify on="success">
  34. <property name="widget-id">Loading</property>
  35. <property name="delay">0.5</property>
  36. <property name="duration">0.5</property>
  37. <values>
  38. <property name="alpha">0.0</property>
  39. </values>
  40. </modify>
  41. </actions>
  42. </RFXMLDataProvider>
  43.  
  44. <!-- Foursquare Checkin We are using OAuth for Foursquare checkin below.
  45. In order to make this work you will need to register your app with Foursquare
  46. to obtain a consumer key and a secret key. You can do this for free at http://foursquare.com/oauth/.
  47. If you need info on using Foursquare OAuth visit http://groups.google.com/group/foursquare-api/web/oauth.
  48. Below you will need to replace MY_FOURSQUARE_CONSUMER_KEY and MY_FOURSQUARE_SECRET
  49. with your assigned values.
  50. -->
  51. <RFXMLDataProvider id="foursquareCheckin">
  52. <property name="auto-load">NO</property>
  53. <property name="auth-method">OAUTH</property>
  54. <property name="data-location">https://api.foursquare.com/v1/checkin</property>
  55. <property name="method">POST</property>
  56. <property name="oauth-consumer-key">MY_FOURSQUARE_CONSUMER_KEY</property>
  57. <property name="oauth-consumer-secret">MY_FOURSQUARE_SECRET</property>
  58. <property name="oauth-request-token-url">http://foursquare.com/oauth/request_token</property>
  59. <property name="oauth-access-token-url">http://foursquare.com/oauth/access_token</property>
  60. <property name="oauth-authorize-url">http://foursquare.com/oauth/authorize</property>
  61. <property name="oauth-callback-url">MY_FOURSQUARE_CALLBACKURL</property>
  62. <submit_values>
  63. <property name="vid">[form:vid]</property>
  64. <property name="geolat">[app:user-lat]</property>
  65. <property name="geolong">[app:user-lon]</property>
  66. <property name="shout">[form:shout]</property>
  67. <property name="private">[eval:("if ('[form:private]' == 'YES') { '1' } else { '0'}")]</property>
  68. </submit_values>
  69. <actions>
  70. <alert on="success">
  71. <property name="message">Your check-in was successful!</property>
  72. </alert>
  73. <alert on="failed">
  74. <property name="message">The check-in failed!</property>
  75. </alert>
  76. <modify on="touch">
  77. <property name="widget-id">checkinDialog</property>
  78. <property name="duration">0.6</property>
  79. <values>
  80. <property name="top-position">[app:screen-height]</property>
  81. </values>
  82. </modify>
  83. </actions>
  84. </RFXMLDataProvider>
  85. </datasources>
  86. <widgets>
  87.  
  88. <!-- START Title Bar -->
  89. <RFLayoutWidget id="rfTitleBar">
  90. <property name="width">100%</property>
  91. <property name="height">44</property>
  92. <property name="height" device="iPad">64</property>
  93. <property name="background-color">#000000A0</property>
  94. <property name="layout-type">float</property>
  95. <widgets>
  96. <RFImageWidget>
  97. <property name="image">/resources/foursquare_header.png</property>
  98. <property name="height">44</property>
  99. <property name="width">320</property>
  100. <property name="height" device="iPad">64</property>
  101. <property name="width" device="iPad">64</property>
  102. <property name="horizontal-alignment">center</property>
  103. <property name="vertical-alignment">bottom</property>
  104. <property name="layout-type">float</property>
  105. </RFImageWidget>
  106. <RFButtonWidget>
  107. <actions>
  108. <navigate on="touch">
  109. <property name="navigation-stack-type">pop</property>
  110. </navigate>
  111. </actions>
  112. <property name="text">Places</property>
  113. <property name="width">70</property>
  114. <property name="height">32</property>
  115. <property name="style">glossy-back</property>
  116. <property name="horizontal-alignment">left</property>
  117. <property name="vertical-alignment">middle</property>
  118. <property name="background-color">#8f8f8f</property>
  119. <property name="font">Helvetica-Bold:14.0</property>
  120. <property name="color">#FFFFFF</property>
  121. <property name="left-margin">10</property>
  122. <property name="alpha">.85</property>
  123. <property name="layout-type">float</property>
  124. </RFButtonWidget>
  125. </widgets>
  126. </RFLayoutWidget>
  127. <!-- END Title Bar -->
  128.  
  129. <!-- START The outer layout -->
  130. <RFLayoutWidget id="outerLayout">
  131. <property name="width">100%</property>
  132. <property name="height">100%</property>
  133. <property name="background-color">#ffffff</property>
  134. <widgets>
  135.  
  136. <!-- START loading dialog. this appears while the datasource foursquareVenueData is loading -->
  137. <RFTextWidget id="Loading">
  138. <property name="height">100</property>
  139. <property name="width">200</property>
  140. <property name="background-color">#000000A0</property>
  141. <property name="font">Helvetica:18.0</property>
  142. <property name="layout-type">float</property>
  143. <property name="horizontal-alignment">center</property>
  144. <property name="vertical-alignment">middle</property>
  145. <property name="include-in-parent-autosize">NO</property>
  146. <property name="text">Loading...</property>
  147. <property name="border-width">1.0</property>
  148. <property name="border-color">#000000A0</property>
  149. <property name="border-radius">10.0</property>
  150. <property name="justification">center</property>
  151. <property name="alpha">1.0</property>
  152. </RFTextWidget>
  153. <!-- END loading dialog -->
  154.  
  155. <!-- START the inner layout, this is hidden by default and once the datasource foursquareVenueData is
  156. loading we show this layout.
  157. -->
  158. <RFLayoutWidget id="innerLayout">
  159. <property name="width">100%</property>
  160. <property name="height">100%</property>
  161. <property name="layout-flow">vertical</property>
  162. <property name="layout-type">absolute</property>
  163. <property name="background-color">#e9e9e9</property>
  164. <property name="visible">NO</property>
  165. <widgets>
  166.  
  167. <!-- START top header section -->
  168. <RFLayoutWidget>
  169. <property name="bottom-margin">0</property>
  170. <property name="width">100%</property>
  171. <property name="height">110</property>
  172. <property name="background-color">#1d99bc</property>
  173. <property name="include-in-parent-autosize">NO</property>
  174. <widgets>
  175.  
  176. <!-- This is the top header background image -->
  177. <RFImageWidget>
  178. <property name="image">/resources/fourquare_place_header.png</property>
  179. <property name="layout-type">absolute</property>
  180. <property name="top-position">0</property>
  181. <property name="left-position">0</property>
  182. <property name="width">100%</property>
  183. <property name="height">110</property>
  184. <property name="allow-stretch">YES</property>
  185. </RFImageWidget>
  186.  
  187. <!-- START inner content area of the top header -->
  188. <RFLayoutWidget>
  189. <property name="height">100%</property>
  190. <property name="width">100%</property>
  191. <property name="include-in-parent-autosize">NO</property>
  192. <property name="bottom-margin">0</property>
  193. <property name="padding">10</property>
  194. <widgets>
  195. <RFTextWidget>
  196. <property name="font">Helvetica-Bold:19.0</property>
  197. <property name="color">#ffffff</property>
  198. <property name="text">[data:foursquareVenueData("//venue/name")]</property>
  199. <property name="bottom-margin">-2</property>
  200. <property name="max-lines">1</property>
  201. </RFTextWidget>
  202. <RFTextWidget>
  203. <property name="font">Helvetica:15.0</property>
  204. <property name="color">#ffffff</property>
  205. <property name="text">[data:foursquareVenueData("//venue/address")]</property>
  206. <property name="max-lines">1</property>
  207. </RFTextWidget>
  208. <RFButtonWidget>
  209. <property name="text">CHECK IN HERE</property>
  210. <property name="style">glossy</property>
  211. <property name="width">100%</property>
  212. <property name="height">40</property>
  213. <property name="color">#ffffff</property>
  214. <property name="background-color">#b0e10e</property>
  215. <property name="font">Helvetica-Bold:18.0</property>
  216. <property name="border-width">2.0</property>
  217. <property name="border-color">#cee249</property>
  218. <property name="border-radius">6.0</property>
  219. <!-- This action will show the Checkin Dialog box will will roll-up from the bottom -->
  220. <actions>
  221. <modify on="touch">
  222. <property name="widget-id">checkinDialog</property>
  223. <property name="duration">0.6</property>
  224. <values>
  225. <property name="top-position">0</property>
  226. </values>
  227. </modify>
  228. </actions>
  229. </RFButtonWidget>
  230. </widgets>
  231. </RFLayoutWidget>
  232. <!-- END inner content area of the top header -->
  233.  
  234. </widgets>
  235. </RFLayoutWidget>
  236. <!-- END top header section -->
  237.  
  238. <RFHorizontalRuleWidget>
  239. <property name="color">#b0e10e</property>
  240. <property name="width">100%</property>
  241. <property name="height">10</property>
  242. <property name="padding">0</property>
  243. <property name="margin">0</property>
  244. </RFHorizontalRuleWidget>
  245. <RFHorizontalRuleWidget>
  246. <property name="color">#aaaaaa</property>
  247. <property name="width">100%</property>
  248. <property name="height">1</property>
  249. <property name="padding">0</property>
  250. <property name="margin">0</property>
  251. </RFHorizontalRuleWidget>
  252. <RFHorizontalRuleWidget>
  253. <property name="color">#ffffff</property>
  254. <property name="width">100%</property>
  255. <property name="height">1</property>
  256. <property name="padding">0</property>
  257. <property name="margin">0</property>
  258. </RFHorizontalRuleWidget>
  259.  
  260. <!-- START mayor section -->
  261. <RFLayoutWidget>
  262. <property name="width">100%</property>
  263. <property name="visible">[eval:("if ('[data:foursquareVenueData("//venue/stats/mayor/user/firstname")]'.length == 0) { 'NO' } else { 'YES'}")]</property>
  264. <widgets>
  265. <RFLayoutWidget>
  266. <property name="width">100%</property>
  267. <property name="height">60</property>
  268. <property name="layout-flow">horizontal</property>
  269. <property name="background-color">#e9e9e9</property>
  270. <property name="vertical-alignment">top</property>
  271. <property name="padding">10</property>
  272. <property name="bottom-margin">0</property>
  273. <widgets>
  274. <RFImageWidget>
  275. <property name="image">[data:foursquareVenueData("//venue/stats/mayor/user/photo")]</property>
  276. <property name="vertical-alignment">middle</property>
  277. <property name="visible" if="'[data:foursquareVenueData(&quot;//venue/stats/mayor/user/photo&quot;)]'==''">NO</property>
  278. <property name="width">40</property>
  279. <property name="height">40</property>
  280. <property name="right-margin">10</property>
  281. <property name="border-width">1.0</property>
  282. <property name="border-color">#aaaaaa</property>
  283. </RFImageWidget>
  284. <RFLayoutWidget>
  285. <property name="layout-flow">vertical</property>
  286. <property name="vertical-alignment">middle</property>
  287. <widgets>
  288. <RFTextWidget>
  289. <property name="font">Helvetica-Bold:16.0</property>
  290. <property name="color">#353535</property>
  291. <property name="text">[data:foursquareVenueData("//venue/stats/mayor/user/firstname")] [data:foursquareVenueData("//venue/stats/mayor/user/lastname")]</property>
  292. <property name="max-lines">1</property>
  293. <property name="margin">0</property>
  294. </RFTextWidget>
  295. <RFTextWidget>
  296. <property name="font">Helvetica:14.0</property>
  297. <property name="color">#555555</property>
  298. <property name="text">is the mayor.</property>
  299. <property name="max-lines">1</property>
  300. <property name="margin">0</property>
  301. </RFTextWidget>
  302. </widgets>
  303. </RFLayoutWidget>
  304. <RFImageWidget>
  305. <property name="image">http://foursquare.com/img/mayorCrown.png</property>
  306. <property name="width">32</property>
  307. <property name="height">32</property>
  308. <property name="horizontal-alignment">right</property>
  309. <property name="vertical-alignment">middle</property>
  310. <property name="right-margin">10</property>
  311. </RFImageWidget>
  312. </widgets>
  313. </RFLayoutWidget>
  314. <RFHorizontalRuleWidget>
  315. <property name="color">#aaaaaa</property>
  316. <property name="width">100%</property>
  317. <property name="height">1</property>
  318. <property name="padding">0</property>
  319. <property name="margin">0</property>
  320. </RFHorizontalRuleWidget>
  321. <RFHorizontalRuleWidget>
  322. <property name="color">#ffffff</property>
  323. <property name="width">100%</property>
  324. <property name="height">1</property>
  325. <property name="padding">0</property>
  326. <property name="margin">0</property>
  327. </RFHorizontalRuleWidget>
  328. </widgets>
  329. </RFLayoutWidget>
  330. <!-- END mayor section -->
  331.  
  332. <!-- START stats section -->
  333. <RFLayoutWidget>
  334. <property name="width">100%</property>
  335. <property name="height">66</property>
  336. <property name="layout-flow">horizontal</property>
  337. <property name="background-color">#e9e9e9</property>
  338. <property name="vertical-alignment">top</property>
  339. <property name="padding">10</property>
  340. <property name="bottom-margin">10</property>
  341. <widgets>
  342. <RFLayoutWidget>
  343. <property name="layout-flow">vertical</property>
  344. <property name="vertical-alignment">top</property>
  345. <property name="horizontal-alignment">left</property>
  346. <property name="width">45%</property>
  347. <property name="height">100%</property>
  348. <property name="border-width">1.0</property>
  349. <property name="border-color">#aaaaaa</property>
  350. <property name="layout-type">float</property>
  351. <property name="left-margin">10</property>
  352. <property name="border-radius">6.0</property>
  353. <property name="padding">10</property>
  354. <property name="background-color">#ffffff</property>
  355. <widgets>
  356. <RFTextWidget>
  357. <property name="font">Helvetica:14.0</property>
  358. <property name="color">#555555</property>
  359. <property name="text">Here now</property>
  360. <property name="horizontal-alignment">center</property>
  361. <property name="max-lines">1</property>
  362. <property name="margin">0</property>
  363. </RFTextWidget>
  364. <RFTextWidget>
  365. <property name="font">Helvetica-Bold:22.0</property>
  366. <property name="color">#000000</property>
  367. <property name="text">[data:foursquareVenueData("//venue/stats/herenow")]</property>
  368. <property name="horizontal-alignment">center</property>
  369. <property name="max-lines">1</property>
  370. <property name="margin">0</property>
  371. </RFTextWidget>
  372. </widgets>
  373. </RFLayoutWidget>
  374. <RFLayoutWidget>
  375. <property name="layout-flow">vertical</property>
  376. <property name="vertical-alignment">top</property>
  377. <property name="horizontal-alignment">right</property>
  378. <property name="width">45%</property>
  379. <property name="height">100%</property>
  380. <property name="border-width">1.0</property>
  381. <property name="border-color">#aaaaaa</property>
  382. <property name="layout-type">float</property>
  383. <property name="right-margin">10</property>
  384. <property name="border-radius">6.0</property>
  385. <property name="padding">10</property>
  386. <property name="background-color">#ffffff</property>
  387. <widgets>
  388. <RFTextWidget>
  389. <property name="font">Helvetica:14.0</property>
  390. <property name="color">#555555</property>
  391. <property name="text">Check-ins</property>
  392. <property name="horizontal-alignment">center</property>
  393. <property name="max-lines">1</property>
  394. <property name="margin">0</property>
  395. </RFTextWidget>
  396. <RFTextWidget>
  397. <property name="font">Helvetica-Bold:22.0</property>
  398. <property name="color">#000000</property>
  399. <property name="text">[data:foursquareVenueData("//venue/stats/checkins")]</property>
  400. <property name="horizontal-alignment">center</property>
  401. <property name="max-lines">1</property>
  402. <property name="margin">0</property>
  403. </RFTextWidget>
  404. </widgets>
  405. </RFLayoutWidget>
  406. </widgets>
  407. </RFLayoutWidget>
  408. <!-- END stats section -->
  409.  
  410. </widgets>
  411. </RFLayoutWidget>
  412. <!-- END the inner layout -->
  413.  
  414. </widgets>
  415. </RFLayoutWidget>
  416. <!-- END The outer layout -->
  417.  
  418. <!-- START Check-in dialog - this is hidden below the view and roll-ups when needed (user clicks the CHECKIN button) -->
  419. <RFLayoutWidget id="checkinDialog">
  420. <property name="width">100%</property>
  421. <property name="height">100%</property>
  422. <property name="layout-flow">vertical</property>
  423. <property name="background-color">#515151</property>
  424. <property name="layout-type">float</property>
  425. <property name="top-position">[app:screen-height]</property>
  426. <property name="include-in-parent-autosize">NO</property>
  427. <widgets>
  428.  
  429. <!-- START Check-in dialog header -->
  430. <RFLayoutWidget>
  431. <property name="bottom-margin">0</property>
  432. <property name="width">100%</property>
  433. <property name="height">45</property>
  434. <property name="background-color">#0f8fb5</property>
  435. <property name="include-in-parent-autosize">NO</property>
  436. <widgets>
  437. <RFImageWidget>
  438. <property name="image">/resources/fourquare_places_header.png</property>
  439. <property name="layout-type">absolute</property>
  440. <property name="top-position">0</property>
  441. <property name="left-position">0</property>
  442. <property name="width">100%</property>
  443. <property name="height">45</property>
  444. <property name="allow-stretch">YES</property>
  445. </RFImageWidget>
  446. <RFButtonWidget>
  447. <property name="text">Cancel</property>
  448. <property name="width">60</property>
  449. <property name="height">32</property>
  450. <property name="layout-type">float</property>
  451. <property name="style">glossy</property>
  452. <property name="horizontal-alignment">left</property>
  453. <property name="vertical-alignment">middle</property>
  454. <property name="background-color">#0f8fb5</property>
  455. <property name="font">Helvetica-Bold:14.0</property>
  456. <property name="color">#FFFFFF</property>
  457. <property name="margin">0</property>
  458. <property name="left-margin">10</property>
  459. <property name="alpha">.85</property>
  460. <actions>
  461. <modify on="touch">
  462. <property name="widget-id">checkinDialog</property>
  463. <property name="duration">0.6</property>
  464. <values>
  465. <property name="top-position">[app:screen-height]</property>
  466. </values>
  467. </modify>
  468. </actions>
  469. </RFButtonWidget>
  470. </widgets>
  471. </RFLayoutWidget>
  472. <!-- END Check-in dialog header -->
  473.  
  474. <!-- START Check-in dialog content area -->
  475. <RFLayoutWidget>
  476. <property name="bottom-margin">0</property>
  477. <property name="width">100%</property>
  478. <property name="padding">20</property>
  479. <property name="include-in-parent-autosize">NO</property>
  480. <widgets>
  481. <RFImageWidget>
  482. <property name="image">/resources/fourquare_background.png</property>
  483. <property name="layout-type">absolute</property>
  484. <property name="top-position">0</property>
  485. <property name="left-position">0</property>
  486. <property name="width">100%</property>
  487. <property name="height">100%</property>
  488. <property name="allow-stretch">YES</property>
  489. </RFImageWidget>
  490. <RFTextWidget>
  491. <property name="font">Helvetica-Bold:19.0</property>
  492. <property name="color">#ffffff</property>
  493. <property name="text">[data:foursquareVenueData("//venue/name")]</property>
  494. <property name="bottom-margin">-2</property>
  495. <property name="max-lines">1</property>
  496. </RFTextWidget>
  497. <RFTextWidget>
  498. <property name="font">Helvetica:15.0</property>
  499. <property name="color">#ffffff</property>
  500. <property name="text">[data:foursquareVenueData("//venue/address")]</property>
  501. <property name="max-lines">1</property>
  502. </RFTextWidget>
  503. <RFTextInputWidget id="shout">
  504. <property name="max-length">140</property>
  505. <property name="height">140</property>
  506. <property name="required">NO</property>
  507. <property name="placeholder-text">Enter a message...</property>
  508. <property name="style">plain</property>
  509. </RFTextInputWidget>
  510. <RFLayoutWidget>
  511. <property name="background-color">#000000A0</property>
  512. <property name="border-width">1.0</property>
  513. <property name="border-color">#000000A0</property>
  514. <property name="border-radius">10.0</property>
  515. <property name="layout-flow">horizontal</property>
  516. <property name="padding">10</property>
  517. <property name="bottom-margin">15</property>
  518. <widgets>
  519. <RFCheckboxWidget id="private">
  520. <property name="text">Share with friends?</property>
  521. <property name="font">Helvetica:15.0</property>
  522. <property name="horizontal-alignment">left</property>
  523. <property name="vertical-alignment">middle</property>
  524. </RFCheckboxWidget>
  525. </widgets>
  526. </RFLayoutWidget>
  527. <RFButtonWidget>
  528. <property name="text">CHECK IN HERE</property>
  529. <property name="style">glossy</property>
  530. <property name="width">100%</property>
  531. <property name="height">45</property>
  532. <property name="color">#ffffff</property>
  533. <property name="background-color">#b0e10e</property>
  534. <property name="font">Helvetica-Bold:18.0</property>
  535. <property name="border-width">2.0</property>
  536. <property name="border-color">#cee249</property>
  537. <property name="border-radius">6.0</property>
  538. <!-- This action will load the datasource foursquareCheckin which if the user is not already authenticated
  539. by Foursquare will be asked to login via OAuth athentication
  540. -->
  541. <actions>
  542. <load_datasource on="touch">
  543. <property name="datasource-id">foursquareCheckin</property>
  544. </load_datasource>
  545. </actions>
  546. </RFButtonWidget>
  547.  
  548. <!-- This is just a floating image that give the background depth -->
  549. <RFImageWidget>
  550. <property name="image">/resources/fourquare_background_gradient.png</property>
  551. <property name="layout-type">absolute</property>
  552. <property name="top-position">0</property>
  553. <property name="left-position">0</property>
  554. <property name="width">100%</property>
  555. <property name="height">30</property>
  556. <property name="allow-stretch">YES</property>
  557. </RFImageWidget>
  558. </widgets>
  559. </RFLayoutWidget>
  560. <!-- END Check-in dialog content area -->
  561.  
  562. </widgets>
  563. </RFLayoutWidget>
  564. <!-- START Check-in dialog -->
  565.  
  566. </widgets>
  567. </view>
  568. </views>
  569. </rfapp>

Report this snippet  

You need to login to post a comment.