Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Adding Graph, OneNote and LiveAuth SDKs
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos Torres committed Apr 24, 2015
1 parent 934561c commit 8d8a389
Show file tree
Hide file tree
Showing 390 changed files with 31,033 additions and 721 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Office 365 SDK for Android #

### Version 0.13.0 ###

* Added OneNote SDK
* Added Graph Services (Preview)
* Added Live Auth SDK
* Added LiveDependencyResolver
* Updated the Exchange SDK to use TimeZone, CalendarColor, GeoCoordinates

### Version 0.12.0 ###

* Fixing classpath for javadoc generation
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ Now we'll create a simple application that retrieves messages using this SDK and
```Groovy
dependencies {
// base OData stuff:
compile group: 'com.microsoft.services', name: 'odata-engine-core', version: '0.12.0'
compile group: 'com.microsoft.services', name: 'odata-engine-android-impl', version: '0.12.0', ext:'aar'
compile group: 'com.microsoft.services', name: 'odata-engine-core', version: '0.13.0'
compile group: 'com.microsoft.services', name: 'odata-engine-android-impl', version: '0.13.0', ext:'aar'

// choose the services/SDKs you need:
compile group: 'com.microsoft.services', name: 'outlook-services', version: '0.12.0'
compile group: 'com.microsoft.services', name: 'discovery-services', version: '0.12.0'
compile group: 'com.microsoft.services', name: 'directory-services', version: '0.12.0'
compile group: 'com.microsoft.services', name: 'file-services', version: '0.12.0'
compile group: 'com.microsoft.services', name: 'sharepoint-services', version: '0.12.0', ext:'aar'
compile group: 'com.microsoft.services', name: 'graph-services', version: '0.1.0'
compile group: 'com.microsoft.services', name: 'onenote-services', version: '0.13.0'
compile group: 'com.microsoft.services', name: 'outlook-services', version: '0.13.0'
compile group: 'com.microsoft.services', name: 'discovery-services', version: '0.13.0'
compile group: 'com.microsoft.services', name: 'directory-services', version: '0.13.0'
compile group: 'com.microsoft.services', name: 'file-services', version: '0.13.0'
compile group: 'com.microsoft.services', name: 'sharepoint-services', version: '0.13.0', ext:'aar'
// ADAL
compile (group: 'com.microsoft.aad', name: 'adal', version: '1.0.5') {
Expand Down
27 changes: 27 additions & 0 deletions samples/OneNoteSample/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "com.microsoft.samples.onenotesample"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile 'com.android.support:appcompat-v7:22.0.0'
compile project(':odata-engine-android-impl')
compile project(':onenote-services')
compile project(':live-auth')
}
17 changes: 17 additions & 0 deletions samples/OneNoteSample/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/joshgav/dev/android-sdk-macosx/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.microsoft.samples.onenotesample;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
21 changes: 21 additions & 0 deletions samples/OneNoteSample/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microsoft.samples.onenotesample" >

<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.microsoft.samples.onenotesample;

import com.google.common.collect.Iterators;

import java.util.Arrays;

public class Constants {
final static public String CLIENT_ID = "00000000DDDDDDDD"; // get your own please
final static public String[] SCOPES = {
"wl.signin",
"wl.basic",
"wl.offline_access",
"wl.skydrive_update",
"wl.contacts_create",
"office.onenote_create"
};
final static public String ONENOTE_API_ROOT = "https://www.onenote.com/api/v1.0";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
package com.microsoft.samples.onenotesample;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.microsoft.live.LiveAuthClient;
import com.microsoft.services.odata.impl.LiveAuthDependencyResolver;
import com.microsoft.onenote.api.Notebook;
import com.microsoft.onenote.api.odata.OneNoteApiClient;
import com.microsoft.services.odata.interfaces.LogLevel;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MainActivity extends ActionBarActivity {

private static final String TAG = "OneNoteSampleActivity";

private ListView lvNotebooks;
private Button btnNotebooks;
private OneNoteApiClient oneNoteClient;
private LiveAuthDependencyResolver dependencyResolver;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

lvNotebooks = (ListView) findViewById(R.id.listView1);
btnNotebooks = (Button) findViewById(R.id.button1);
btnNotebooks.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getNotebooks();
}
});

logon();
}


protected OneNoteApiClient getOneNoteClient() {
if (oneNoteClient == null) {
oneNoteClient = new OneNoteApiClient(Constants.ONENOTE_API_ROOT, getDependencyResolver());
}
return oneNoteClient;
}

protected LiveAuthDependencyResolver getDependencyResolver() {

if (dependencyResolver == null) {
LiveAuthClient theAuthClient = new LiveAuthClient(getApplicationContext(), Constants.CLIENT_ID,
Arrays.asList(Constants.SCOPES));

dependencyResolver = new LiveAuthDependencyResolver(theAuthClient);

dependencyResolver.getLogger().setEnabled(true);
dependencyResolver.getLogger().setLogLevel(LogLevel.VERBOSE);
}

return dependencyResolver;
}


private void logon() {

try {
Futures.addCallback(this.getDependencyResolver().interactiveInitialize(this), new FutureCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
btnNotebooks.setEnabled(true);
}

@Override
public void onFailure(Throwable t) {
getDependencyResolver().getLogger().log(t.getMessage(), LogLevel.ERROR);
}
});
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}

private void getNotebooks() {

Futures.addCallback(getOneNoteClient().getnotebooks().read(), new FutureCallback<List<Notebook>>() {
@Override
public void onSuccess(List<Notebook> notebooks) {
List<String> nbNames = new ArrayList<String>();
for (Notebook nb : notebooks) {
nbNames.add(nb.getname());
}
final ArrayAdapter<String> adapter =
new ArrayAdapter<String>(getBaseContext(),android.R.layout.simple_list_item_1, nbNames);

runOnUiThread(new Runnable() {
@Override
public void run() {
lvNotebooks.setAdapter(adapter);
}
});
}

@Override
public void onFailure(Throwable t) {
Log.e(TAG, t.getMessage());
}
});

}



@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

if (id == R.id.action_logout) {
getDependencyResolver().logout();
btnNotebooks.setEnabled(false);
lvNotebooks.setAdapter(new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1, new String[0]));
}

if (id == R.id.action_login) {
logon();
}

return super.onOptionsItemSelected(item);
}
}
21 changes: 21 additions & 0 deletions samples/OneNoteSample/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button1"
android:text="Get Notebooks"
android:enabled="false" />

<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listView1"
android:layout_gravity="center_horizontal"
tools:listitem="@android:layout/simple_list_item_2" />
</LinearLayout>
10 changes: 10 additions & 0 deletions samples/OneNoteSample/app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
<item android:id="@+id/action_logout" android:title="Logout"
android:orderInCategory="50" />
<item android:id="@+id/action_login" android:title="Login"
android:orderInCategory="75" />
</menu>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
5 changes: 5 additions & 0 deletions samples/OneNoteSample/app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
6 changes: 6 additions & 0 deletions samples/OneNoteSample/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<resources>
<string name="app_name">One Note Sample</string>

<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
</resources>
8 changes: 8 additions & 0 deletions samples/OneNoteSample/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

</resources>
15 changes: 15 additions & 0 deletions samples/OneNoteSample/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.2'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:0.6"
}
}

allprojects {
repositories {
jcenter()
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
Expand Down
11 changes: 11 additions & 0 deletions samples/OneNoteSample/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include ':app',
':onenote-services',
':live-auth',
':odata-engine-android-impl',
':odata-engine-core'


project (':onenote-services').projectDir = file('../../sdk/onenote-services')
project (':live-auth').projectDir = file('../../sdk/live-auth')
project (':odata-engine-android-impl').projectDir = file('../../sdk/odata-engine-android-impl')
project (':odata-engine-core').projectDir = file('../../sdk/odata-engine-core')
Loading

0 comments on commit 8d8a389

Please sign in to comment.