Skip to content

Commit a6bde33

Browse files
committed
Initial commit
0 parents  commit a6bde33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1649
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.gradle
2+
/local.properties
3+
/.idea/workspace.xml
4+
/.idea/libraries
5+
.DS_Store
6+
/build

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/scopes/scope_settings.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OfyTest.iml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="java-gradle" name="Java-Gradle">
5+
<configuration>
6+
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
7+
</configuration>
8+
</facet>
9+
</component>
10+
<component name="NewModuleRootManager" inherit-compiler-output="true">
11+
<exclude-output />
12+
<content url="file://$MODULE_DIR$">
13+
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
14+
</content>
15+
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
16+
<orderEntry type="sourceFolder" forTests="false" />
17+
</component>
18+
</module>
19+

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/app.iml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="OfyTest" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="android-gradle" name="Android-Gradle">
5+
<configuration>
6+
<option name="GRADLE_PROJECT_PATH" value=":app" />
7+
</configuration>
8+
</facet>
9+
<facet type="android" name="Android">
10+
<configuration>
11+
<option name="SELECTED_BUILD_VARIANT" value="debug" />
12+
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
13+
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
14+
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
15+
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
16+
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
17+
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
18+
<option name="ALLOW_USER_CONFIGURATION" value="false" />
19+
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
20+
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
21+
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
22+
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
23+
</configuration>
24+
</facet>
25+
</component>
26+
<component name="NewModuleRootManager" inherit-compiler-output="false">
27+
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
28+
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
29+
<exclude-output />
30+
<content url="file://$MODULE_DIR$">
31+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
32+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
33+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
34+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
35+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
36+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
37+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
38+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
39+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
40+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
41+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
42+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
43+
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
44+
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
45+
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
46+
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
47+
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
48+
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
49+
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
50+
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
51+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
52+
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
53+
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
54+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
55+
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
56+
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
57+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
58+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
59+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
60+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
61+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
62+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
63+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
64+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
65+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
66+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
67+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
68+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
69+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
70+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
71+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
72+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
73+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
77+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
78+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
79+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
80+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
81+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
82+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
83+
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
84+
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
85+
</content>
86+
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
87+
<orderEntry type="sourceFolder" forTests="false" />
88+
<orderEntry type="library" exported="" name="appcompat-v7-22.0.0" level="project" />
89+
<orderEntry type="library" exported="" name="google-http-client-1.19.0" level="project" />
90+
<orderEntry type="library" exported="" name="support-v4-22.0.0" level="project" />
91+
<orderEntry type="library" exported="" name="jackson-core-2.1.3" level="project" />
92+
<orderEntry type="library" exported="" name="backend-android-endpoints" level="project" />
93+
<orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" />
94+
<orderEntry type="library" exported="" name="jsr305-1.3.9" level="project" />
95+
<orderEntry type="library" exported="" name="google-http-client-jackson2-1.19.0" level="project" />
96+
<orderEntry type="library" exported="" name="google-http-client-android-1.19.0" level="project" />
97+
<orderEntry type="library" exported="" name="google-api-client-android-1.19.0" level="project" />
98+
<orderEntry type="library" exported="" name="guava-jdk5-13.0" level="project" />
99+
<orderEntry type="library" exported="" name="google-oauth-client-1.19.0" level="project" />
100+
<orderEntry type="library" exported="" name="google-api-client-1.19.0" level="project" />
101+
</component>
102+
</module>
103+

app/build.gradle

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 22
5+
buildToolsVersion "22.0.1"
6+
7+
defaultConfig {
8+
applicationId "com.mycompany.ofytest"
9+
minSdkVersion 15
10+
targetSdkVersion 22
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
compile 'com.android.support:appcompat-v7:22.0.0'
25+
compile project(path: ':backend', configuration: 'android-endpoints')
26+
}

app/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in C:\Users\Ilay\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.mycompany.ofytest;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.mycompany.ofytest" >
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:theme="@style/AppTheme" >
12+
<activity
13+
android:name=".MainActivity"
14+
android:label="@string/app_name" >
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
18+
<category android:name="android.intent.category.LAUNCHER" />
19+
</intent-filter>
20+
</activity>
21+
</application>
22+
23+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.mycompany.ofytest;
2+
3+
import android.content.Context;
4+
import android.os.AsyncTask;
5+
import android.widget.Toast;
6+
7+
import com.google.api.client.extensions.android.http.AndroidHttp;
8+
import com.google.api.client.extensions.android.json.AndroidJsonFactory;
9+
import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
10+
import com.google.api.client.googleapis.services.GoogleClientRequestInitializer;
11+
import com.mindstorm.api.quoteEndpoint.QuoteEndpoint;
12+
import com.mindstorm.api.quoteEndpoint.model.Quote;
13+
14+
import java.io.IOException;
15+
import java.util.Collections;
16+
import java.util.List;
17+
18+
/**
19+
* Created by Ilay on 15/4/2015.
20+
*/
21+
class EndpointsAsyncTask extends AsyncTask<Void, Void, List<Quote>> {
22+
private static QuoteEndpoint myApiService = null;
23+
private Context context;
24+
25+
EndpointsAsyncTask(Context context) {
26+
this.context = context;
27+
}
28+
29+
@Override
30+
protected List<Quote> doInBackground(Void... params) {
31+
if(myApiService == null) { // Only do this once
32+
QuoteEndpoint.Builder builder = new QuoteEndpoint.Builder(AndroidHttp.newCompatibleTransport(),
33+
new AndroidJsonFactory(), null)
34+
// options for running against local devappserver
35+
// - 10.0.2.2 is localhost's IP address in Android emulator
36+
// - turn off compression when running against local devappserver
37+
.setRootUrl("http://10.0.0.10:8080/_ah/api/")
38+
.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
39+
@Override
40+
public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
41+
abstractGoogleClientRequest.setDisableGZipContent(true);
42+
}
43+
});
44+
// end options for devappserver
45+
46+
myApiService = builder.build();
47+
}
48+
49+
try {
50+
return myApiService.listQuote().execute().getItems();
51+
} catch (IOException e) {
52+
return Collections.EMPTY_LIST;
53+
}
54+
}
55+
56+
@Override
57+
protected void onPostExecute(List<Quote> result) {
58+
for (Quote q : result) {
59+
Toast.makeText(context, q.getWho() + " : " + q.getWhat(), Toast.LENGTH_LONG).show();
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)