Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial commit.

Add Live SDK for Android source.
Add sample project that uses Live SDK for Android.
Add License.
Add README.
  • Loading branch information...
commit e4512a3d5a7cdd6e7ea7012d86844a6ba0f5fe67 0 parents
unknown authored

Showing 118 changed files with 9,563 additions and 0 deletions. Show diff stats Hide diff stats

  1. +7 0 .gitignore
  2. +72 0 LICENSE.txt
  3. +63 0 README
  4. +8 0 sample/.classpath
  5. +33 0 sample/.project
  6. +27 0 sample/AndroidManifest.xml
  7. +40 0 sample/proguard.cfg
  8. +12 0 sample/project.properties
  9. BIN  sample/res/drawable-hdpi/audio_x_generic.png
  10. BIN  sample/res/drawable-hdpi/folder.png
  11. BIN  sample/res/drawable-hdpi/folder_image.png
  12. BIN  sample/res/drawable-hdpi/image_x_generic.png
  13. BIN  sample/res/drawable-hdpi/text_x_preview.png
  14. BIN  sample/res/drawable-hdpi/video_x_generic.png
  15. BIN  sample/res/drawable-ldpi/audio_x_generic.png
  16. BIN  sample/res/drawable-ldpi/folder.png
  17. BIN  sample/res/drawable-ldpi/folder_image.png
  18. BIN  sample/res/drawable-ldpi/image_x_generic.png
  19. BIN  sample/res/drawable-ldpi/text_x_preview.png
  20. BIN  sample/res/drawable-ldpi/video_x_generic.png
  21. BIN  sample/res/drawable-mdpi/audio_x_generic.png
  22. BIN  sample/res/drawable-mdpi/folder.png
  23. BIN  sample/res/drawable-mdpi/folder_image.png
  24. BIN  sample/res/drawable-mdpi/icon.png
  25. BIN  sample/res/drawable-mdpi/image_x_generic.png
  26. BIN  sample/res/drawable-mdpi/text_x_preview.png
  27. BIN  sample/res/drawable-mdpi/video_x_generic.png
  28. BIN  sample/res/drawable-xhdpi/audio_x_generic.png
  29. BIN  sample/res/drawable-xhdpi/folder.png
  30. BIN  sample/res/drawable-xhdpi/folder_image.png
  31. BIN  sample/res/drawable-xhdpi/image_x_generic.png
  32. BIN  sample/res/drawable-xhdpi/text_x_preview.png
  33. BIN  sample/res/drawable-xhdpi/video_x_generic.png
  34. +61 0 sample/res/layout/create_contact.xml
  35. +51 0 sample/res/layout/create_folder.xml
  36. +85 0 sample/res/layout/explorer.xml
  37. +21 0 sample/res/layout/file_picker.xml
  38. +20 0 sample/res/layout/file_picker_list_item.xml
  39. +21 0 sample/res/layout/main.xml
  40. +32 0 sample/res/layout/signin.xml
  41. +20 0 sample/res/layout/skydrive.xml
  42. +32 0 sample/res/layout/skydrive_list_item.xml
  43. +49 0 sample/res/layout/view_contact.xml
  44. +17 0 sample/res/layout/view_contacts.xml
  45. +14 0 sample/res/layout/view_contacts_list_item.xml
  46. +20 0 sample/res/layout/view_profile.xml
  47. +28 0 sample/res/values/strings.xml
  48. +21 0 sample/src/com/microsoft/live/sample/Config.java
  49. +195 0 sample/src/com/microsoft/live/sample/ExplorerActivity.java
  50. +42 0 sample/src/com/microsoft/live/sample/LiveSdkSampleApplication.java
  51. +130 0 sample/src/com/microsoft/live/sample/MainActivity.java
  52. +115 0 sample/src/com/microsoft/live/sample/SignInActivity.java
  53. +56 0 sample/src/com/microsoft/live/sample/hotmail/Contact.java
  54. +275 0 sample/src/com/microsoft/live/sample/hotmail/ContactsActivity.java
  55. +65 0 sample/src/com/microsoft/live/sample/identity/User.java
  56. +149 0 sample/src/com/microsoft/live/sample/identity/ViewProfileActivity.java
  57. +773 0 sample/src/com/microsoft/live/sample/skydrive/SkyDriveActivity.java
  58. +25 0 sample/src/com/microsoft/live/sample/skydrive/SkyDriveAlbum.java
  59. +41 0 sample/src/com/microsoft/live/sample/skydrive/SkyDriveAudio.java
  60. +41 0 sample/src/com/microsoft/live/sample/skydrive/SkyDriveFile.java
  61. +24 0 sample/src/com/microsoft/live/sample/skydrive/SkyDriveFolder.java
  62. +136 0 sample/src/com/microsoft/live/sample/skydrive/SkyDriveObject.java
  63. +101 0 sample/src/com/microsoft/live/sample/skydrive/SkyDrivePhoto.java
  64. +65 0 sample/src/com/microsoft/live/sample/skydrive/SkyDriveVideo.java
  65. +147 0 sample/src/com/microsoft/live/sample/util/FilePicker.java
  66. +38 0 sample/src/com/microsoft/live/sample/util/JsonKeys.java
  67. +62 0 sample/src/com/microsoft/live/sample/util/Scopes.java
  68. +9 0 src/.classpath
  69. +33 0 src/.project
  70. +7 0 src/AndroidManifest.xml
  71. +77 0 src/internal/com/microsoft/live/AccessTokenRequest.java
  72. +247 0 src/internal/com/microsoft/live/ApiRequest.java
  73. +175 0 src/internal/com/microsoft/live/ApiRequestAsync.java
  74. +498 0 src/internal/com/microsoft/live/AuthorizationRequest.java
  75. +86 0 src/internal/com/microsoft/live/Config.java
  76. +55 0 src/internal/com/microsoft/live/CopyRequest.java
  77. +55 0 src/internal/com/microsoft/live/DefaultObservableOAuthRequest.java
  78. +47 0 src/internal/com/microsoft/live/DeleteRequest.java
  79. +37 0 src/internal/com/microsoft/live/DownloadRequest.java
  80. +184 0 src/internal/com/microsoft/live/EntityEnclosingApiRequest.java
  81. +37 0 src/internal/com/microsoft/live/ErrorMessages.java
  82. +49 0 src/internal/com/microsoft/live/GetRequest.java
  83. +42 0 src/internal/com/microsoft/live/HttpCopy.java
  84. +42 0 src/internal/com/microsoft/live/HttpMove.java
  85. +42 0 src/internal/com/microsoft/live/InputStreamResponseHandler.java
  86. +34 0 src/internal/com/microsoft/live/JsonEntity.java
  87. +49 0 src/internal/com/microsoft/live/JsonResponseHandler.java
  88. +59 0 src/internal/com/microsoft/live/LiveConnectUtils.java
  89. +55 0 src/internal/com/microsoft/live/MoveRequest.java
  90. +225 0 src/internal/com/microsoft/live/OAuth.java
  91. +173 0 src/internal/com/microsoft/live/OAuthErrorResponse.java
  92. +23 0 src/internal/com/microsoft/live/OAuthRequestObserver.java
  93. +25 0 src/internal/com/microsoft/live/OAuthResponse.java
  94. +25 0 src/internal/com/microsoft/live/OAuthResponseVisitor.java
  95. +302 0 src/internal/com/microsoft/live/OAuthSuccessfulResponse.java
  96. +28 0 src/internal/com/microsoft/live/ObservableOAuthRequest.java
  97. +56 0 src/internal/com/microsoft/live/PostRequest.java
  98. +22 0 src/internal/com/microsoft/live/PreferencesConstants.java
  99. +56 0 src/internal/com/microsoft/live/PutRequest.java
  100. +27 0 src/internal/com/microsoft/live/QueryParameters.java
  101. +55 0 src/internal/com/microsoft/live/RefreshAccessTokenRequest.java
  102. +125 0 src/internal/com/microsoft/live/TokenRequest.java
  103. +73 0 src/internal/com/microsoft/live/TokenRequestAsync.java
  104. +119 0 src/internal/com/microsoft/live/UploadRequest.java
  105. +40 0 src/proguard.cfg
  106. +12 0 src/project.properties
  107. +612 0 src/src/com/microsoft/live/LiveAuthClient.java
  108. +54 0 src/src/com/microsoft/live/LiveAuthException.java
  109. +12 0 src/src/com/microsoft/live/LiveAuthListener.java
  110. +1,783 0 src/src/com/microsoft/live/LiveConnectClient.java
  111. +257 0 src/src/com/microsoft/live/LiveConnectSession.java
  112. +113 0 src/src/com/microsoft/live/LiveDownloadOperation.java
  113. +19 0 src/src/com/microsoft/live/LiveDownloadOperationListener.java
  114. +110 0 src/src/com/microsoft/live/LiveOperation.java
  115. +20 0 src/src/com/microsoft/live/LiveOperationException.java
  116. +13 0 src/src/com/microsoft/live/LiveOperationListener.java
  117. +13 0 src/src/com/microsoft/live/LiveStatus.java
  118. +18 0 src/src/com/microsoft/live/LiveUploadOperationListener.java
7 .gitignore
... ... @@ -0,0 +1,7 @@
  1 +*.apk
  2 +*.ap_
  3 +*.dex
  4 +*.class
  5 +bin/
  6 +gen/
  7 +local.properties
72 LICENSE.txt
... ... @@ -0,0 +1,72 @@
  1 +MICROSOFT PRE-RELEASE SOFTWARE LICENSE TERMS
  2 +LIVE SDK
  3 +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the pre-release software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft
  4 +* updates,
  5 +* supplements,
  6 +* Internet-based services, and
  7 +* support services
  8 +for this software, unless other terms accompany those items. If so, those terms apply.
  9 +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.
  10 +If you comply with these license terms, you have the rights below.
  11 +1. PRE-RELEASE SOFTWARE. This software is a pre-release version. It may not operate correctly or work the way a final version of the software will. Microsoft may change it for the final, commercial version. We also may not release a commercial version. IF YOU DECIDE TO MAKE USE OF ANY OF THE RIGHTS UNDER THIS AGREEMENT YOU AGREE THAT IT IS AT YOUR SOLE DISCRETION AND YOU ASSUME ALL RESPONSIBILITY FOR AND RISK OF ANY AND ALL DAMAGES THAT MAY RESULT FROM OR IN CONNECTION WITH THE SOFTWARE, INCLUDING WITHOUT LIMITATION, THE UNAVAILABILITY OR INTERUPTION OF OPERATIONS OR THE LOSS OF ANY DATA OR OTHER CONTENT.
  12 +2. TERM. The term of this agreement is until December 31, 2012, or commercial release of the software, whichever is first.
  13 +3. INSTALLATION, USE RIGHTS AND RESTRICTIONS. You may install and use any number of copies of the software on your premises as follows:
  14 +a. Internal Production Use. If you comply with the rest of these license terms, you may use the software to design, develop and test your programs in a live production environment for your internal use, provided that:
  15 +i. you take adequate precautionary measures to back up and protect your data;
  16 +ii. you agree to cease such use immediately upon notice from Microsoft; and
  17 +iii. such production environment may only be accessible by your employees and contractors.
  18 +b. External Production Use. If you comply with the rest of these license terms, you may also use the software to design, develop and test your programs that you may distribute to third parties or deploy for third parties to access over the Internet, provided that:
  19 +i. you include in your programs a visible notice to your users that the programs were created with or rely on pre-release, time-sensitive unsupported software that may not operate correctly;
  20 +ii. if your program requires that certain portions of the software that are not distributable, such as Microsoft Silverlight, be installed on the end user�s computer, you will include a visible notice that your program does not include the relevant software and that the end user will need to obtain a copy of it directly from Microsoft; and
  21 +iii. you will not make any representation, warranty or promise on behalf of Microsoft or with respect to the software or its performance.
  22 +This right to deploy your programs for external access by third parties does not include the right to deploy programs that are designed for the purpose of hosting other software applications, unless you require those applications, when hosted by your programs, to comply with the restrictions in items c, d, and e below.
  23 +c. Hazardous Environments. You may not use the software to design, develop or test programs for hazardous environments requiring fail-safe controls, including without limitation, the design, construction, maintenance or operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, and life support or weapons systems.
  24 +d. Personal Information. You may not use the software to design, develop or test programs that collect personally identifiable or confidential data.
  25 +e. Commerce Transactions. You may not use the software to design, develop or test programs that conduct e-commerce transactions (exchange of goods or services by means of the Internet or other computer networks), including without limitation any shipping, credit card, monetary or other banking transactions.
  26 +4. CONDITIONS AND LIMITATIONS
  27 + a. No Trademark License- This license does not grant you rights to use any contributors� name, logo, or trademarks.
  28 + b. If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
  29 + c. If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
  30 + d. The software is licensed �as-is.� You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
  31 + e. The licenses granted herein extend only to software or derivative works that you create that call services owned or operated by Microsoft and/or Windows Live.
  32 +
  33 +4. �TERMINATION.� In the event that you sue Microsoft for patent or copyright infringement and assert a claim against the Original Software, a Derived Software Work, an Extensible Licensed Product, or the Licensed Platform, your rights under this agreement, including all copyright and patent licenses from Microsoft, terminate.
  34 +
  35 +5. UPDATES; SUBSEQUENT RELEASES.
  36 +a. If Microsoft makes bug fixes, security fixes or other error corrections to the software, you agree to use commercially reasonable efforts to install or distribute them for purposes of updating the software.
  37 +b. You understand and agree that the software may change substantially prior to the commercial release of the software and your programs may not work with these later releases of the software. This agreement does not provide you with any rights to any subsequent pre-release versions or commercial versions, if any.
  38 +6. FEEDBACK. If you give feedback about the software to Microsoft, you give to Microsoft, without charge, the right to use, share and commercialize your feedback in any way and for any purpose. You also give to third parties, without charge, any patent rights needed for their products, technologies and services to use or interface with any specific parts of a Microsoft software or service that includes the feedback. You will not give feedback that is subject to a license that requires Microsoft to license its software or documentation to third parties because we include your feedback in them. These rights survive this agreement.
  39 +7. INTERNET-BASED SERVICES. Microsoft provides Internet-based services in connection with the software. It may change or cancel them at any time. Separate terms of use, available at http://dev.live.com/terms, apply to the services.
  40 +8. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
  41 +* disclose the results of any benchmark tests of the software to any third party without Microsoft�s prior written approval;
  42 +* work around any technical limitations in the software;
  43 +* reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
  44 +* make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;
  45 +* publish the software for others to copy;
  46 +* rent, lease or lend the software;
  47 +* transfer the software or this agreement to any third party; or
  48 +* deploy the software on a standalone basis for others to access.
  49 +9. EXPORT RESTRICTIONS. The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting.
  50 +10. SUPPORT SERVICES. Because this software is �as is,� we may not provide support services for it.
  51 +11. INDEMNIFICATION. You agree to indemnify, hold harmless, and defend Microsoft from and against any claims, allegations, lawsuits, losses and costs (including attorney fees) that arise or result from any breach by you of the terms of this agreement.
  52 +12. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
  53 +13. APPLICABLE LAW.
  54 +a. United States. If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
  55 +b. Outside the United States. If you acquired the software in any other country, the laws of that country apply.
  56 +14. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
  57 +15. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED �AS-IS.� YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  58 +16. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
  59 +This limitation applies to
  60 +* anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
  61 +* claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
  62 +It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
  63 +
  64 +Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.
  65 +Remarque : Ce logiciel �tant distribu� au Qu�bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran�ais.
  66 +EXON�RATION DE GARANTIE. Le logiciel vis� par une licence est offert � tel quel �. Toute utilisation de ce logiciel est � votre seule risque et p�ril. Microsoft n�accorde aucune autre garantie expresse. Vous pouvez b�n�ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit� marchande, d�ad�quation � un usage particulier et d�absence de contrefa�on sont exclues.
  67 +LIMITATION DES DOMMAGES-INT�R�TS ET EXCLUSION DE RESPONSABILIT� POUR LES DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement � hauteur de 5,00 $ US. Vous ne pouvez pr�tendre � aucune indemnisation pour les autres dommages, y compris les dommages sp�ciaux, indirects ou accessoires et pertes de b�n�fices.
  68 +Cette limitation concerne :
  69 +* tout ce qui est reli� au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et
  70 +* les r�clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit� stricte, de n�gligence ou d�une autre faute dans la limite autoris�e par la loi en vigueur.
  71 +Elle s�applique �galement, m�me si Microsoft connaissait ou devrait conna�tre l��ventualit� d�un tel dommage. Si votre pays n�autorise pas l�exclusion ou la limitation de responsabilit� pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l�exclusion ci-dessus ne s�appliquera pas � votre �gard.
  72 +EFFET JURIDIQUE. Le pr�sent contrat d�crit certains droits juridiques. Vous pourriez avoir d�autres droits pr�vus par les lois de votre pays. Le pr�sent contrat ne modifie pas les droits que vous conf�rent les lois de votre pays si celles-ci ne le permettent pas.
63 README
... ... @@ -0,0 +1,63 @@
  1 +Live SDK for Android
  2 +
  3 +version 5.0
  4 +
  5 +1. Introduction
  6 +
  7 +The Live SDK for Android library is intended to help developers to easily
  8 +integrate SkyDrive and Hotmail contacts and calendars into their Android apps.
  9 +
  10 +2. Reference the API
  11 +
  12 +After you download the Android API source code, you must compile it. You need
  13 +to do this only once. After you compile the Android API source code on your
  14 +computer, you can reference it from multiple Eclipse Android projects on that
  15 +same computer.
  16 +
  17 +To compile the Android API source code
  18 +1. Start Eclipse, if it is not already running.
  19 +2. Click File > Import.
  20 +3. Expand General, click Existing Projects into Workspace, and then click Next.
  21 +4. With the Select root directory option selected, click Browse.
  22 +5. Go to and select the src folder within the downloaded Live SDK for Android, and then click OK.
  23 +6. In the Projects box, select the LiveSdk check box.
  24 +7. With the Copy projects into workspace check box selected, click Finish.
  25 + Eclipse adds the LiveSdk project to the Package Explorer pane and then
  26 + compiles the Android API source code in the background.
  27 +8. You can now reference the compiled Android API source code from your Eclipse
  28 + Android projects.
  29 +
  30 +
  31 +To reference the compiled Android API source code in an Eclipse Android
  32 +project
  33 +1. In Eclipse, display the Package Explorer pane, if it is not already visible.
  34 +2. Right-click your project's name, and then click Properties.
  35 +3. In the list of project properties, click Android.
  36 +4. In the Library area, click Add.
  37 +5. Click LiveSdk and then click OK.
  38 +6. Click OK. Eclipse sets a reference to the compiled Android API source code
  39 + project, and you can now call the Live Connect Android API from your own
  40 + Android project.
  41 +
  42 +Note: Before you run your project, you must add the Internet permission to your
  43 + project's manifest, as shown in the following steps. If you don't add the
  44 + Internet permission, your app may have problems accessing Live Connect
  45 + web services later.
  46 +1. With your project open, in the Package Explorer pane, open the AndroidManifest.xml file.
  47 +2. In the editor, click the Permissions tab.
  48 +3. Click Add.
  49 +4. Click Uses Permission, and then click OK.
  50 +5. the Name list, click android.permission.INTERNET.
  51 +6. Save the AndroidManifest.xml file.
  52 +
  53 +Notes:
  54 +The Java Compiler must be version 1.6 or higher.
  55 +
  56 +3. Documentation
  57 +
  58 +Visit: http://dev.live.com and click the "Documentation" link.
  59 +
  60 +4. Known issues:
  61 +
  62 +1) Logout does not clear cookies on oauth.live.com.
  63 +
8 sample/.classpath
... ... @@ -0,0 +1,8 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
  4 + <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
  5 + <classpathentry kind="src" path="src"/>
  6 + <classpathentry kind="src" path="gen"/>
  7 + <classpathentry kind="output" path="bin/classes"/>
  8 +</classpath>
33 sample/.project
... ... @@ -0,0 +1,33 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>LiveSdkSample</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + <buildCommand>
  14 + <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
  15 + <arguments>
  16 + </arguments>
  17 + </buildCommand>
  18 + <buildCommand>
  19 + <name>org.eclipse.jdt.core.javabuilder</name>
  20 + <arguments>
  21 + </arguments>
  22 + </buildCommand>
  23 + <buildCommand>
  24 + <name>com.android.ide.eclipse.adt.ApkBuilder</name>
  25 + <arguments>
  26 + </arguments>
  27 + </buildCommand>
  28 + </buildSpec>
  29 + <natures>
  30 + <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
  31 + <nature>org.eclipse.jdt.core.javanature</nature>
  32 + </natures>
  33 +</projectDescription>
27 sample/AndroidManifest.xml
... ... @@ -0,0 +1,27 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<manifest package="com.microsoft.live.sample"
  3 + android:versionCode="1"
  4 + android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
  5 + <uses-sdk android:minSdkVersion="8" />
  6 + <uses-permission android:name="android.permission.INTERNET"></uses-permission>
  7 + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  8 + <application
  9 + android:name=".LiveSdkSampleApplication"
  10 + android:icon="@drawable/icon"
  11 + android:label="@string/app_name">
  12 + <activity android:name="SignInActivity" android:configChanges="orientation">
  13 + <intent-filter>
  14 + <action android:name="android.intent.action.MAIN"/>
  15 + <category android:name="android.intent.category.LAUNCHER"/>
  16 + </intent-filter>
  17 + </activity>
  18 + <activity android:name="ExplorerActivity"></activity>
  19 + <activity android:name="MainActivity"
  20 + android:theme="@android:style/Theme.NoTitleBar">
  21 + </activity>
  22 + <activity android:name=".skydrive.SkyDriveActivity"></activity>
  23 + <activity android:name=".identity.ViewProfileActivity"></activity>
  24 + <activity android:name=".util.FilePicker"></activity>
  25 + <activity android:name=".hotmail.ContactsActivity"></activity>
  26 + </application>
  27 +</manifest>
40 sample/proguard.cfg
... ... @@ -0,0 +1,40 @@
  1 +-optimizationpasses 5
  2 +-dontusemixedcaseclassnames
  3 +-dontskipnonpubliclibraryclasses
  4 +-dontpreverify
  5 +-verbose
  6 +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  7 +
  8 +-keep public class * extends android.app.Activity
  9 +-keep public class * extends android.app.Application
  10 +-keep public class * extends android.app.Service
  11 +-keep public class * extends android.content.BroadcastReceiver
  12 +-keep public class * extends android.content.ContentProvider
  13 +-keep public class * extends android.app.backup.BackupAgentHelper
  14 +-keep public class * extends android.preference.Preference
  15 +-keep public class com.android.vending.licensing.ILicensingService
  16 +
  17 +-keepclasseswithmembernames class * {
  18 + native <methods>;
  19 +}
  20 +
  21 +-keepclasseswithmembers class * {
  22 + public <init>(android.content.Context, android.util.AttributeSet);
  23 +}
  24 +
  25 +-keepclasseswithmembers class * {
  26 + public <init>(android.content.Context, android.util.AttributeSet, int);
  27 +}
  28 +
  29 +-keepclassmembers class * extends android.app.Activity {
  30 + public void *(android.view.View);
  31 +}
  32 +
  33 +-keepclassmembers enum * {
  34 + public static **[] values();
  35 + public static ** valueOf(java.lang.String);
  36 +}
  37 +
  38 +-keep class * implements android.os.Parcelable {
  39 + public static final android.os.Parcelable$Creator *;
  40 +}
12 sample/project.properties
... ... @@ -0,0 +1,12 @@
  1 +# This file is automatically generated by Android Tools.
  2 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
  3 +#
  4 +# This file must be checked in Version Control Systems.
  5 +#
  6 +# To customize properties used by the Ant build system use,
  7 +# "ant.properties", and override values to adapt the script to your
  8 +# project structure.
  9 +
  10 +# Project target.
  11 +target=android-8
  12 +android.library.reference.1=../src
BIN  sample/res/drawable-hdpi/audio_x_generic.png
BIN  sample/res/drawable-hdpi/folder.png
BIN  sample/res/drawable-hdpi/folder_image.png
BIN  sample/res/drawable-hdpi/image_x_generic.png
BIN  sample/res/drawable-hdpi/text_x_preview.png
BIN  sample/res/drawable-hdpi/video_x_generic.png
BIN  sample/res/drawable-ldpi/audio_x_generic.png
BIN  sample/res/drawable-ldpi/folder.png
BIN  sample/res/drawable-ldpi/folder_image.png
BIN  sample/res/drawable-ldpi/image_x_generic.png
BIN  sample/res/drawable-ldpi/text_x_preview.png
BIN  sample/res/drawable-ldpi/video_x_generic.png
BIN  sample/res/drawable-mdpi/audio_x_generic.png
BIN  sample/res/drawable-mdpi/folder.png
BIN  sample/res/drawable-mdpi/folder_image.png
BIN  sample/res/drawable-mdpi/icon.png
BIN  sample/res/drawable-mdpi/image_x_generic.png
BIN  sample/res/drawable-mdpi/text_x_preview.png
BIN  sample/res/drawable-mdpi/video_x_generic.png
BIN  sample/res/drawable-xhdpi/audio_x_generic.png
BIN  sample/res/drawable-xhdpi/folder.png
BIN  sample/res/drawable-xhdpi/folder_image.png
BIN  sample/res/drawable-xhdpi/image_x_generic.png
BIN  sample/res/drawable-xhdpi/text_x_preview.png
BIN  sample/res/drawable-xhdpi/video_x_generic.png
61 sample/res/layout/create_contact.xml
... ... @@ -0,0 +1,61 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical" >
  6 +
  7 + <TextView
  8 + android:id="@+id/textView1"
  9 + android:layout_width="wrap_content"
  10 + android:layout_height="wrap_content"
  11 + android:text="@string/first_name"
  12 + android:textAppearance="?android:attr/textAppearanceMedium" />
  13 +
  14 + <EditText
  15 + android:id="@+id/firstNameEditText"
  16 + android:layout_width="match_parent"
  17 + android:layout_height="wrap_content"
  18 + android:hint="@string/first_name" >
  19 +
  20 + <requestFocus />
  21 + </EditText>
  22 + <TextView
  23 + android:id="@+id/textView2"
  24 + android:layout_width="wrap_content"
  25 + android:layout_height="wrap_content"
  26 + android:text="@string/last_name"
  27 + android:textAppearance="?android:attr/textAppearanceMedium" />
  28 +
  29 + <EditText
  30 + android:id="@+id/lastNameEditText"
  31 + android:layout_width="match_parent"
  32 + android:layout_height="wrap_content"
  33 + android:hint="@string/last_name" />
  34 +
  35 + <RadioGroup
  36 + android:id="@+id/genderRadioGroup"
  37 + android:layout_width="wrap_content"
  38 + android:layout_height="wrap_content"
  39 + android:orientation="horizontal" >
  40 +
  41 + <RadioButton
  42 + android:id="@+id/maleRadio"
  43 + android:layout_width="wrap_content"
  44 + android:layout_height="wrap_content"
  45 + android:checked="true"
  46 + android:text="@string/male" />
  47 +
  48 + <RadioButton
  49 + android:id="@+id/femaleRadio"
  50 + android:layout_width="wrap_content"
  51 + android:layout_height="wrap_content"
  52 + android:text="@string/female" />
  53 + </RadioGroup>
  54 +
  55 + <Button
  56 + android:id="@+id/saveButton"
  57 + android:layout_width="wrap_content"
  58 + android:layout_height="wrap_content"
  59 + android:text="@string/save" />
  60 +
  61 +</LinearLayout>
51 sample/res/layout/create_folder.xml
... ... @@ -0,0 +1,51 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="300dp"
  4 + android:layout_height="190dp"
  5 + android:orientation="vertical" >
  6 +
  7 + <TextView
  8 + android:id="@+id/textView1"
  9 + android:layout_width="wrap_content"
  10 + android:layout_height="wrap_content"
  11 + android:text="@string/name"
  12 + android:textAppearance="?android:attr/textAppearanceMedium" />
  13 +
  14 + <EditText
  15 + android:id="@+id/nameEditText"
  16 + android:layout_width="match_parent"
  17 + android:layout_height="wrap_content"
  18 + android:hint="@string/name" >
  19 +
  20 + <requestFocus />
  21 + </EditText>
  22 + <TextView
  23 + android:id="@+id/textView2"
  24 + android:layout_width="wrap_content"
  25 + android:layout_height="wrap_content"
  26 + android:text="@string/description"
  27 + android:textAppearance="?android:attr/textAppearanceMedium" />
  28 +
  29 + <EditText
  30 + android:id="@+id/descriptionEditText"
  31 + android:layout_width="match_parent"
  32 + android:layout_height="wrap_content"
  33 + android:hint="@string/description"
  34 + android:inputType="textMultiLine" />
  35 +
  36 + <LinearLayout
  37 + android:id="@+id/linearLayout2"
  38 + android:layout_width="match_parent"
  39 + android:layout_height="wrap_content" >
  40 + <Button
  41 + android:id="@+id/saveButton"
  42 + android:layout_width="wrap_content"
  43 + android:layout_height="wrap_content"
  44 + android:text="@string/save" />
  45 + <Button
  46 + android:id="@+id/cancelButton"
  47 + android:layout_width="wrap_content"
  48 + android:layout_height="wrap_content"
  49 + android:text="@string/cancel" />
  50 + </LinearLayout>
  51 +</LinearLayout>
85 sample/res/layout/explorer.xml
... ... @@ -0,0 +1,85 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:orientation="vertical"
  4 + android:layout_width="fill_parent"
  5 + android:layout_height="fill_parent">
  6 + <LinearLayout android:orientation="vertical"
  7 + android:id="@+id/linearLayout2"
  8 + android:layout_width="fill_parent"
  9 + android:layout_height="wrap_content">
  10 +
  11 + <TextView
  12 + android:id="@+id/textView2"
  13 + android:layout_width="wrap_content"
  14 + android:layout_height="wrap_content"
  15 + android:text="@string/request_method"
  16 + android:textAppearance="?android:attr/textAppearanceMedium" />
  17 +
  18 + <Spinner
  19 + android:id="@+id/httpMethodSpinner"
  20 + android:layout_width="wrap_content"
  21 + android:layout_height="wrap_content"
  22 + android:layout_weight="1"
  23 + android:prompt="@string/http_method_prompt" />
  24 +
  25 + <TextView
  26 + android:id="@+id/textView1"
  27 + android:layout_width="wrap_content"
  28 + android:layout_height="wrap_content"
  29 + android:text="@string/request_path"
  30 + android:textAppearance="?android:attr/textAppearanceMedium" />
  31 +
  32 + <EditText
  33 + android:id="@+id/pathText"
  34 + android:layout_width="fill_parent"
  35 + android:layout_height="wrap_content"
  36 + android:layout_weight="1"
  37 + android:hint="@string/path_hint" >
  38 +
  39 + <requestFocus />
  40 + </EditText>
  41 +
  42 + <TextView
  43 + android:id="@+id/requestBodyTextView"
  44 + android:layout_width="wrap_content"
  45 + android:layout_height="wrap_content"
  46 + android:text="@string/request_body"
  47 + android:textAppearance="?android:attr/textAppearanceMedium"
  48 + android:visibility="gone" />
  49 +
  50 + <EditText
  51 + android:id="@+id/requestBodyText"
  52 + android:layout_width="fill_parent"
  53 + android:layout_height="wrap_content"
  54 + android:hint="@string/request_body_hint"
  55 + android:visibility="gone" >
  56 +
  57 + </EditText>
  58 +
  59 + <LinearLayout
  60 + android:id="@+id/linearLayout1"
  61 + android:layout_width="fill_parent"
  62 + android:layout_height="wrap_content"
  63 + android:gravity="right"
  64 + android:weightSum="1" >
  65 +
  66 + <Button
  67 + android:id="@+id/submitButton"
  68 + android:layout_width="wrap_content"
  69 + android:layout_height="wrap_content"
  70 + android:text="@string/submit_display" />
  71 + </LinearLayout>
  72 +
  73 + <TextView android:id="@+id/textView3"
  74 + android:layout_width="wrap_content"
  75 + android:layout_height="wrap_content"
  76 + android:textAppearance="?android:attr/textAppearanceMedium"
  77 + android:text="@string/response_display">
  78 + </TextView>
  79 + <EditText android:id="@+id/responseBodyText"
  80 + android:layout_width="fill_parent"
  81 + android:layout_height="wrap_content"
  82 + android:inputType="textMultiLine" >
  83 + </EditText>
  84 + </LinearLayout>
  85 +</ScrollView>
21 sample/res/layout/file_picker.xml
... ... @@ -0,0 +1,21 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical" >
  6 +
  7 + <ListView
  8 + android:id="@id/android:list"
  9 + android:layout_width="fill_parent"
  10 + android:layout_height="0dp"
  11 + android:layout_weight="2"
  12 + android:drawSelectorOnTop="false">
  13 + </ListView>
  14 +
  15 + <TextView
  16 + android:id="@id/android:empty"
  17 + android:layout_width="fill_parent"
  18 + android:layout_height="fill_parent"
  19 + android:text="@string/no_files" />
  20 +
  21 +</LinearLayout>
20 sample/res/layout/file_picker_list_item.xml
... ... @@ -0,0 +1,20 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical" >
  6 + <TextView
  7 + android:id="@+id/nameTextView"
  8 + android:layout_width="fill_parent"
  9 + android:layout_height="fill_parent"
  10 + android:padding="10dp"
  11 + android:textSize="16sp" >
  12 + </TextView>
  13 + <TextView
  14 + android:id="@+id/typeTextView"
  15 + android:layout_width="fill_parent"
  16 + android:layout_height="fill_parent"
  17 + android:padding="10dp"
  18 + android:textSize="16sp" >
  19 + </TextView>
  20 +</LinearLayout>
21 sample/res/layout/main.xml
... ... @@ -0,0 +1,21 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:id="@android:id/tabhost"
  4 + android:layout_width="fill_parent"
  5 + android:layout_height="fill_parent">
  6 + <LinearLayout
  7 + android:orientation="vertical"
  8 + android:layout_width="fill_parent"
  9 + android:layout_height="fill_parent"
  10 + android:padding="5dp">
  11 + <TabWidget
  12 + android:id="@android:id/tabs"
  13 + android:layout_width="fill_parent"
  14 + android:layout_height="wrap_content" />
  15 + <FrameLayout
  16 + android:id="@android:id/tabcontent"
  17 + android:layout_width="fill_parent"
  18 + android:layout_height="fill_parent"
  19 + android:padding="5dp" />
  20 + </LinearLayout>
  21 +</TabHost>
32 sample/res/layout/signin.xml
... ... @@ -0,0 +1,32 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:live="http://schemas.android.com/apk/res/com.microsoft.live.sample"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="match_parent"
  6 + android:gravity="center"
  7 + android:orientation="vertical" >
  8 +
  9 + <TextView
  10 + android:id="@+id/textView1"
  11 + android:layout_width="wrap_content"
  12 + android:layout_height="wrap_content"
  13 + android:gravity="center"
  14 + android:text="@string/welcome"
  15 + android:textAppearance="?android:attr/textAppearanceLarge" />
  16 +
  17 + <TextView
  18 + android:id="@+id/beginTextView"
  19 + android:layout_width="wrap_content"
  20 + android:layout_height="wrap_content"
  21 + android:text="@string/begin"
  22 + android:textAppearance="?android:attr/textAppearanceSmall"
  23 + android:visibility="invisible" />
  24 +
  25 + <Button
  26 + android:id="@+id/signInButton"
  27 + android:layout_width="wrap_content"
  28 + android:layout_height="wrap_content"
  29 + android:text="@string/sign_in"
  30 + android:visibility="invisible" />
  31 +
  32 +</LinearLayout>
20 sample/res/layout/skydrive.xml
... ... @@ -0,0 +1,20 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical" >
  6 + <ListView
  7 + android:id="@id/android:list"
  8 + android:layout_width="fill_parent"
  9 + android:layout_height="0dip"
  10 + android:layout_weight="2"
  11 + android:drawSelectorOnTop="false">
  12 + </ListView>
  13 +
  14 + <TextView
  15 + android:id="@id/android:empty"
  16 + android:layout_width="fill_parent"
  17 + android:layout_height="fill_parent"
  18 + android:text="@string/no_skydrive_items" />
  19 +
  20 +</LinearLayout>
32 sample/res/layout/skydrive_list_item.xml
... ... @@ -0,0 +1,32 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="horizontal" >
  6 +
  7 + <ImageView
  8 + android:id="@+id/skyDriveItemIcon"
  9 + android:layout_width="wrap_content"
  10 + android:layout_height="wrap_content"
  11 + android:layout_gravity="center_vertical"
  12 + android:contentDescription="@string/skydrive_icon_description" />
  13 +
  14 + <LinearLayout
  15 + android:id="@+id/linearLayout1"
  16 + android:layout_width="match_parent"
  17 + android:layout_height="wrap_content"
  18 + android:orientation="vertical">
  19 + <TextView
  20 + android:id="@+id/nameTextView"
  21 + android:layout_width="fill_parent"
  22 + android:layout_height="fill_parent"
  23 + android:padding="10dp"
  24 + android:textSize="16sp"/>
  25 + <TextView
  26 + android:id="@+id/descriptionTextView"
  27 + android:layout_width="fill_parent"
  28 + android:layout_height="fill_parent"
  29 + android:padding="10dp"
  30 + android:textSize="16sp"/>
  31 + </LinearLayout>
  32 +</LinearLayout>
49 sample/res/layout/view_contact.xml
... ... @@ -0,0 +1,49 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical" >
  6 +
  7 + <TextView
  8 + android:id="@+id/nameTextView"
  9 + android:layout_width="wrap_content"
  10 + android:layout_height="wrap_content"
  11 + android:textAppearance="?android:attr/textAppearanceLarge" />
  12 +
  13 + <TextView
  14 + android:id="@+id/idTextView"
  15 + android:layout_width="wrap_content"
  16 + android:layout_height="wrap_content"
  17 + android:textAppearance="?android:attr/textAppearanceSmall" />
  18 +
  19 + <TextView
  20 + android:id="@+id/userIdTextView"
  21 + android:layout_width="wrap_content"
  22 + android:layout_height="wrap_content"
  23 + android:textAppearance="?android:attr/textAppearanceSmall" />
  24 +
  25 + <TextView
  26 + android:id="@+id/genderTextView"
  27 + android:layout_width="wrap_content"
  28 + android:layout_height="wrap_content"
  29 + android:textAppearance="?android:attr/textAppearanceSmall" />
  30 +
  31 + <TextView
  32 + android:id="@+id/isFriendTextView"
  33 + android:layout_width="wrap_content"
  34 + android:layout_height="wrap_content"
  35 + android:textAppearance="?android:attr/textAppearanceSmall" />
  36 +
  37 + <TextView
  38 + android:id="@+id/isFavoriteTextView"
  39 + android:layout_width="wrap_content"
  40 + android:layout_height="wrap_content"
  41 + android:textAppearance="?android:attr/textAppearanceSmall" />
  42 +
  43 + <TextView
  44 + android:id="@+id/updatedTimeTextView"
  45 + android:layout_width="wrap_content"
  46 + android:layout_height="wrap_content"
  47 + android:textAppearance="?android:attr/textAppearanceSmall" />
  48 +
  49 +</LinearLayout>
17 sample/res/layout/view_contacts.xml
... ... @@ -0,0 +1,17 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical" >
  6 + <ListView
  7 + android:id="@id/android:list"
  8 + android:layout_width="fill_parent"
  9 + android:layout_height="0dp"
  10 + android:layout_weight="2"
  11 + android:drawSelectorOnTop="false">
  12 + </ListView>
  13 + <TextView android:id="@id/android:empty"
  14 + android:layout_width="fill_parent"
  15 + android:layout_height="fill_parent"
  16 + android:text="@string/no_contacts" />
  17 +</LinearLayout>
14 sample/res/layout/view_contacts_list_item.xml
... ... @@ -0,0 +1,14 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical" >
  6 +
  7 + <TextView
  8 + android:id="@+id/nameTextView"
  9 + android:layout_width="fill_parent"
  10 + android:layout_height="fill_parent"
  11 + android:padding="10dp"
  12 + android:textSize="22sp" >
  13 + </TextView>
  14 +</LinearLayout>
20 sample/res/layout/view_profile.xml
... ... @@ -0,0 +1,20 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical" >
  6 + <TextView
  7 + android:id="@+id/nameTextView"
  8 + android:layout_width="wrap_content"
  9 + android:layout_height="wrap_content"
  10 + android:drawablePadding="4dp"
  11 + android:textAppearance="?android:attr/textAppearanceLarge" />
  12 +
  13 + <Button
  14 + android:id="@+id/signOutButton"
  15 + android:layout_width="wrap_content"
  16 + android:layout_height="wrap_content"
  17 + android:layout_gravity="center_horizontal"
  18 + android:text="@string/sign_out" />
  19 +
  20 +</LinearLayout>
28 sample/res/values/strings.xml
... ... @@ -0,0 +1,28 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <string name="app_name">Live Connect Sample</string>
  4 + <string name="response_display">Response</string>
  5 + <string name="submit_display">Submit</string>
  6 + <string name="http_method_prompt">HTTP Method</string>
  7 + <string name="name">Name</string>
  8 + <string name="description">Description</string>
  9 + <string name="first_name">First Name</string>
  10 + <string name="last_name">Last Name</string>
  11 + <string name="male">Male</string>
  12 + <string name="female">Female</string>
  13 + <string name="save">Save</string>
  14 + <string name="cancel">Cancel</string>
  15 + <string name="sign_in">Sign in</string>
  16 + <string name="no_files">No files.</string>
  17 + <string name="path_hint">e.g., me/skydrive</string>
  18 + <string name="request_body">Request Body</string>
  19 + <string name="request_body_hint">e.g., { \"name\": \"My new object\" }</string>
  20 + <string name="skydrive_icon_description">An icon that represents the SkyDrive item.</string>
  21 + <string name="no_contacts">No contacts.</string>
  22 + <string name="no_skydrive_items">No SkyDrive items.</string>
  23 + <string name="request_path">Request Path</string>
  24 + <string name="request_method">Request Method</string>
  25 + <string name="sign_out">Sign out</string>
  26 + <string name="welcome">Welcome to the Live SDK for Android Sample Application!</string>
  27 + <string name="begin">Begin by hitting in the \"Sign in\" button.</string>
  28 +</resources>
21 sample/src/com/microsoft/live/sample/Config.java
... ... @@ -0,0 +1,21 @@
  1 +//------------------------------------------------------------------------------
  2 +// Copyright (c) 2012 Microsoft Corporation. All rights reserved.
  3 +//------------------------------------------------------------------------------
  4 +
  5 +package com.microsoft.live.sample;
  6 +
  7 +final public class Config {
  8 + public static final String CLIENT_ID = "YOUR_CLIENT_ID_HERE";
  9 +
  10 + public static final String[] SCOPES = {
  11 + "wl.signin",
  12 + "wl.basic",
  13 + "wl.offline_access",
  14 + "wl.skydrive_update",
  15 + "wl.contacts_create",
  16 + };
  17 +
  18 + private Config() {
  19 + throw new AssertionError("Unable to create Config object.");
  20 + }
  21 +}
195 sample/src/com/microsoft/live/sample/ExplorerActivity.java
... ... @@ -0,0 +1,195 @@
  1 +//------------------------------------------------------------------------------
  2 +// Copyright (c) 2012 Microsoft Corporation. All rights reserved.
  3 +//------------------------------------------------------------------------------
  4 +
  5 +package com.microsoft.live.sample;
  6 +
  7 +import org.json.JSONException;
  8 +
  9 +import android.app.Activity;
  10 +import android.app.ProgressDialog;
  11 +import android.os.Bundle;
  12 +import android.text.TextUtils;
  13 +import android.view.KeyEvent;
  14 +import android.view.View;
  15 +import android.view.View.OnClickListener;
  16 +import android.widget.AdapterView;
  17 +import android.widget.AdapterView.OnItemSelectedListener;
  18 +import android.widget.ArrayAdapter;
  19 +import android.widget.EditText;
  20 +import android.widget.Spinner;
  21 +import android.widget.TextView;
  22 +import android.widget.Toast;
  23 +
  24 +import com.microsoft.live.LiveConnectClient;
  25 +import com.microsoft.live.LiveOperation;
  26 +import com.microsoft.live.LiveOperationException;
  27 +import com.microsoft.live.LiveOperationListener;
  28 +
  29 +public class ExplorerActivity extends Activity {
  30 + private class OperationListener implements LiveOperationListener {
  31 + @Override
  32 + public void onComplete(LiveOperation operation) {
  33 + dismissProgressDialog();
  34 + try {
  35 + mResponseBodyText.setText(operation.getResult().toString(2));
  36 + mResponseBodyText.requestFocus();
  37 + } catch (JSONException e) {
  38 + makeToast(e.getMessage());
  39 + }
  40 + }
  41 +
  42 + @Override
  43 + public void onError(LiveOperationException exception, LiveOperation operation) {
  44 + dismissProgressDialog();
  45 + makeToast(exception.getMessage());
  46 + }
  47 + }
  48 +
  49 + private static final String[] HTTP_METHODS = {
  50 + "GET",
  51 + "DELETE",
  52 + "PUT",
  53 + "POST"
  54 + };
  55 +
  56 + private static final int GET = 0;
  57 + private static final int DELETE = 1;
  58 + private static final int PUT = 2;
  59 + private static final int POST = 3;
  60 +
  61 + private LiveConnectClient mConnectClient;
  62 + private EditText mResponseBodyText;
  63 + private EditText mPathText;
  64 + private EditText mRequestBodyText;
  65 + private TextView mRequestBodyTextView;
  66 + private ProgressDialog mProgressDialog;
  67 + private OperationListener mOperationListener;
  68 +
  69 + @Override
  70 + public void onCreate(Bundle savedInstanceState) {
  71 + super.onCreate(savedInstanceState);
  72 + setContentView(R.layout.explorer);
  73 +
  74 + LiveSdkSampleApplication app = (LiveSdkSampleApplication) getApplication();
  75 + mConnectClient = app.getConnectClient();
  76 + mOperationListener = new OperationListener();
  77 +
  78 + mResponseBodyText = (EditText) findViewById(R.id.responseBodyText);
  79 + mPathText = (EditText) findViewById(R.id.pathText);
  80 + mRequestBodyText = (EditText) findViewById(R.id.requestBodyText);
  81 + mRequestBodyTextView = (TextView) findViewById(R.id.requestBodyTextView);
  82 +
  83 + final Spinner httpMethodSpinner = (Spinner) findViewById(R.id.httpMethodSpinner);
  84 + ArrayAdapter<String> adapter =
  85 + new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, HTTP_METHODS);
  86 + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  87 + httpMethodSpinner.setAdapter(adapter);
  88 + httpMethodSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
  89 + @Override
  90 + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
  91 + switch (position) {
  92 + case GET:
  93 + case DELETE:
  94 + hideRequestBody();
  95 + break;
  96 + case POST:
  97 + case PUT:
  98 + showRequestBody();
  99 + break;
  100 + default: {
  101 + makeToast("Unknown HTTP method selected: " +
  102 + httpMethodSpinner.getSelectedItem().toString());
  103 + break;
  104 + }
  105 + }
  106 + }
  107 +
  108 + @Override
  109 + public void onNothingSelected(AdapterView<?> parent) {
  110 + // Do nothing.
  111 + }
  112 + });
  113 +
  114 + findViewById(R.id.submitButton).setOnClickListener(new OnClickListener() {
  115 + @Override
  116 + public void onClick(View v) {
  117 + String path = mPathText.getText().toString();
  118 + String bodyString = mRequestBodyText.getText().toString();
  119 +
  120 + if (TextUtils.isEmpty(path)) {
  121 + makeToast("Path must not be empty.");
  122 + return;
  123 + }
  124 +
  125 + int selectedPosition = httpMethodSpinner.getSelectedItemPosition();
  126 + boolean httpMethodRequiresBody =
  127 + selectedPosition == POST || selectedPosition == PUT;
  128 + if (httpMethodRequiresBody && TextUtils.isEmpty(bodyString)) {
  129 + makeToast("Request body must not be empty.");
  130 + return;
  131 + }
  132 +
  133 + mProgressDialog = showProgressDialog("Loading. Please wait...");
  134 + switch (selectedPosition) {
  135 + case GET: {
  136 + mConnectClient.getAsync(path, mOperationListener);
  137 + break;
  138 + }
  139 + case DELETE: {
  140 + mConnectClient.deleteAsync(path, mOperationListener);
  141 + break;
  142 + }
  143 + case POST: {
  144 + mConnectClient.postAsync(path, bodyString, mOperationListener);
  145 + break;
  146 + }
  147 + case PUT: {
  148 + mConnectClient.putAsync(path, bodyString, mOperationListener);
  149 + break;
  150 + }
  151 + default: {
  152 + makeToast("Unknown HTTP method selected: " +
  153 + httpMethodSpinner.getSelectedItem().toString());
  154 + break;
  155 + }
  156 + }
  157 + }
  158 + });
  159 + }
  160 +
  161 + @Override
  162 + public boolean onKeyDown(int keyCode, KeyEvent event) {
  163 + // Since this activity is part of a TabView we want to send
  164 + // the back button to the TabView activity.
  165 + if (keyCode == KeyEvent.KEYCODE_BACK) {
  166 + return false;
  167 + } else {
  168 + return super.onKeyDown(keyCode, event);
  169 + }
  170 + }
  171 +
  172 + private void showRequestBody() {
  173 + mRequestBodyText.setVisibility(View.VISIBLE);
  174 + mRequestBodyTextView.setVisibility(View.VISIBLE);
  175 + }
  176 +
  177 + private void hideRequestBody() {
  178 + mRequestBodyText.setVisibility(View.GONE);
  179 + mRequestBodyTextView.setVisibility(View.GONE);
  180 + }
  181 +
  182 + private void dismissProgressDialog() {
  183 + if (mProgressDialog != null && mProgressDialog.isShowing()) {
  184 + mProgressDialog.dismiss();
  185 + }
  186 + }
  187 +
  188 + private void makeToast(String message) {
  189 + Toast.makeText(this, message, Toast.LENGTH_LONG).show();
  190 + }
  191 +
  192 + private ProgressDialog showProgressDialog(String message) {
  193 + return ProgressDialog.show(this, "", message);
  194 + }
  195 +}
42 sample/src/com/microsoft/live/sample/LiveSdkSampleApplication.java
... ... @@ -0,0 +1,42 @@
  1 +//------------------------------------------------------------------------------
  2 +// Copyright (c) 2012 Microsoft Corporation. All rights reserved.
  3 +//------------------------------------------------------------------------------
  4 +
  5 +package com.microsoft.live.sample;
  6 +
  7 +import android.app.Application;
  8 +
  9 +import com.microsoft.live.LiveAuthClient;
  10 +import com.microsoft.live.LiveConnectClient;
  11 +import com.microsoft.live.LiveConnectSession;