Commit 51314e2bf10755bd85a9c9b7f9928f5fcb8fd7ee
1 parent
9f8c42483b
Exists in
master
3.2.0版本
增加facebook sdk登录 重构回调方式,不依赖activity
Showing 17 changed files with 554 additions and 105 deletions Side-by-side Diff
- android/GameSDKRelease/.gitignore
- android/GameSDKRelease/libs/GameSDK_v3.1.1_proguard.jar
- android/GameSDKRelease/libs/GameSDK_v3.2.0_proguard.jar
- android/GameSDKRelease/libs/android-support-v4.jar
- android/GameSDKRelease/lint.xml
- android/GameSDKRelease/project.properties
- android/GameSDKSample/.gitignore
- android/GameSDKSample/AndroidManifest.xml
- android/GameSDKSample/GameSDKSample.iml
- android/GameSDKSample/build.gradle
- android/GameSDKSample/gradlew
- android/GameSDKSample/gradlew.bat
- android/GameSDKSample/lint.xml
- android/GameSDKSample/local.properties
- android/GameSDKSample/project.properties
- android/GameSDKSample/settings.gradle
- android/GameSDKSample/src/com/gumptech/loginsdk/sample/MainActivity.java
android/GameSDKRelease/.gitignore
android/GameSDKRelease/libs/GameSDK_v3.1.1_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/GameSDK_v3.2.0_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/android-support-v4.jar
No preview for this file type
android/GameSDKRelease/lint.xml
android/GameSDKRelease/project.properties
android/GameSDKSample/.gitignore
android/GameSDKSample/AndroidManifest.xml
... | ... | @@ -2,11 +2,11 @@ |
2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | 3 | package="com.loginsdk.sample" |
4 | 4 | android:versionCode="6" |
5 | - android:versionName="1.6" > | |
5 | + android:versionName="1.6"> | |
6 | 6 | |
7 | 7 | <uses-sdk |
8 | - android:minSdkVersion="8" | |
9 | - android:targetSdkVersion="8" /> | |
8 | + android:minSdkVersion="9" | |
9 | + android:targetSdkVersion="22" /> | |
10 | 10 | |
11 | 11 | <uses-permission android:name="android.permission.INTERNET" /> |
12 | 12 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
... | ... | @@ -40,12 +40,12 @@ |
40 | 40 | <application |
41 | 41 | android:allowBackup="true" |
42 | 42 | android:icon="@drawable/ic_launcher" |
43 | - android:label="@string/app_name" > | |
43 | + android:label="@string/app_name"> | |
44 | 44 | <activity |
45 | 45 | android:name="com.gumptech.loginsdk.sample.MainActivity" |
46 | 46 | android:configChanges="navigation|orientation|keyboard" |
47 | 47 | android:label="@string/app_name" |
48 | - android:screenOrientation="portrait" > | |
48 | + android:screenOrientation="portrait"> | |
49 | 49 | <intent-filter> |
50 | 50 | <action android:name="android.intent.action.MAIN" /> |
51 | 51 | |
... | ... | @@ -55,21 +55,23 @@ |
55 | 55 | <activity |
56 | 56 | android:name="com.gumptech.sdk.ContainerActivity" |
57 | 57 | android:configChanges="orientation|screenLayout" |
58 | - android:theme="@style/container_dialog" > | |
59 | - </activity> | |
58 | + android:theme="@style/container_dialog"></activity> | |
60 | 59 | <activity |
61 | 60 | android:name="com.gumptech.sdk.PaymentActivity" |
62 | 61 | android:configChanges="orientation|screenLayout" |
63 | - android:theme="@android:style/Theme.Translucent.NoTitleBar" > | |
64 | - </activity> | |
62 | + android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity> | |
65 | 63 | <activity |
66 | 64 | android:name="com.gumptech.sdk.ExchangeWindow" |
67 | 65 | android:configChanges="orientation|screenLayout" |
68 | - android:theme="@style/ex_win" > | |
69 | - </activity> | |
66 | + android:theme="@style/ex_win"></activity> | |
70 | 67 | |
71 | - <service android:name="com.gumptech.sdk.PushService" > | |
72 | - </service> | |
68 | + <service android:name="com.gumptech.sdk.PushService"></service> | |
69 | + | |
70 | + <activity | |
71 | + android:name="com.facebook.FacebookActivity" | |
72 | + android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" | |
73 | + android:label="@string/app_name" | |
74 | + android:theme="@android:style/Theme.Translucent.NoTitleBar" /> | |
73 | 75 | </application> |
74 | 76 | |
75 | 77 | </manifest> |
76 | 78 | \ No newline at end of file |
android/GameSDKSample/GameSDKSample.iml
... | ... | @@ -0,0 +1,85 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<module external.linked.project.id="GameSDKSample" 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="android-gradle" name="Android-Gradle"> | |
5 | + <configuration> | |
6 | + <option name="GRADLE_PROJECT_PATH" value=":" /> | |
7 | + </configuration> | |
8 | + </facet> | |
9 | + <facet type="java-gradle" name="Java-Gradle"> | |
10 | + <configuration> | |
11 | + <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" /> | |
12 | + <option name="BUILDABLE" value="false" /> | |
13 | + </configuration> | |
14 | + </facet> | |
15 | + <facet type="android" name="Android"> | |
16 | + <configuration> | |
17 | + <option name="SELECTED_BUILD_VARIANT" value="release" /> | |
18 | + <option name="SELECTED_TEST_ARTIFACT" value="_android_test_" /> | |
19 | + <option name="ASSEMBLE_TASK_NAME" value="assembleRelease" /> | |
20 | + <option name="COMPILE_JAVA_TASK_NAME" value="compileReleaseSources" /> | |
21 | + <option name="SOURCE_GEN_TASK_NAME" value="generateReleaseSources" /> | |
22 | + <option name="ALLOW_USER_CONFIGURATION" value="false" /> | |
23 | + <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/res" /> | |
24 | + </configuration> | |
25 | + </facet> | |
26 | + </component> | |
27 | + <component name="NewModuleRootManager" inherit-compiler-output="false"> | |
28 | + <output url="file://$MODULE_DIR$/build/intermediates/classes/release" /> | |
29 | + <output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" /> | |
30 | + <exclude-output /> | |
31 | + <content url="file://$MODULE_DIR$"> | |
32 | + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/release" isTestSource="false" generated="true" /> | |
33 | + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/release" isTestSource="false" generated="true" /> | |
34 | + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/release" isTestSource="false" generated="true" /> | |
35 | + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/release" isTestSource="false" generated="true" /> | |
36 | + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/release" type="java-resource" /> | |
37 | + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/release" type="java-resource" /> | |
38 | + <sourceFolder url="file://$MODULE_DIR$/build-types/release/res" type="java-resource" /> | |
39 | + <sourceFolder url="file://$MODULE_DIR$/build-types/release/resources" type="java-resource" /> | |
40 | + <sourceFolder url="file://$MODULE_DIR$/build-types/release/assets" type="java-resource" /> | |
41 | + <sourceFolder url="file://$MODULE_DIR$/build-types/release/aidl" isTestSource="false" /> | |
42 | + <sourceFolder url="file://$MODULE_DIR$/build-types/release/java" isTestSource="false" /> | |
43 | + <sourceFolder url="file://$MODULE_DIR$/build-types/release/jni" isTestSource="false" /> | |
44 | + <sourceFolder url="file://$MODULE_DIR$/build-types/release/rs" isTestSource="false" /> | |
45 | + <sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" /> | |
46 | + <sourceFolder url="file://$MODULE_DIR$/src" type="java-resource" /> | |
47 | + <sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" /> | |
48 | + <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |
49 | + <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" /> | |
50 | + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" /> | |
51 | + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" /> | |
52 | + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" /> | |
53 | + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" /> | |
54 | + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" /> | |
55 | + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" /> | |
56 | + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> | |
57 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> | |
58 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> | |
59 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> | |
60 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" /> | |
61 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> | |
62 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" /> | |
63 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" /> | |
64 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> | |
65 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" /> | |
66 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" /> | |
67 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" /> | |
68 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" /> | |
69 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> | |
70 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" /> | |
71 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" /> | |
72 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" /> | |
73 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> | |
74 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> | |
75 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> | |
76 | + <excludeFolder url="file://$MODULE_DIR$/build/outputs" /> | |
77 | + <excludeFolder url="file://$MODULE_DIR$/build/tmp" /> | |
78 | + </content> | |
79 | + <orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" /> | |
80 | + <orderEntry type="sourceFolder" forTests="false" /> | |
81 | + <orderEntry type="library" exported="" name="bolts-android-1.2.1" level="project" /> | |
82 | + <orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" /> | |
83 | + <orderEntry type="module" module-name="GameSDK" exported="" /> | |
84 | + </component> | |
85 | +</module> | |
0 | 86 | \ No newline at end of file |
android/GameSDKSample/build.gradle
... | ... | @@ -0,0 +1,70 @@ |
1 | +buildscript { | |
2 | + repositories { | |
3 | + mavenCentral() | |
4 | + } | |
5 | + dependencies { | |
6 | + classpath 'com.android.tools.build:gradle:1.2.3' | |
7 | + } | |
8 | +} | |
9 | +repositories { | |
10 | + mavenCentral() | |
11 | +} | |
12 | +apply plugin: 'com.android.application' | |
13 | + | |
14 | +dependencies { | |
15 | + compile fileTree(dir: 'libs', include: '*.jar') | |
16 | + compile project(':GameSDK') | |
17 | +} | |
18 | + | |
19 | +android { | |
20 | + signingConfigs { | |
21 | + letsgame { | |
22 | + keyAlias 'ZzTYEadlf2349UIkdf38934KDlsfdKqpzmdhewri387429LKDJL' | |
23 | + keyPassword 'ZDJDLL23YRPQM3BBXjdfpow3KDehwyrojafdajfjadfLDK83I' | |
24 | + storeFile file('E:/cert/letsgame.keystore') | |
25 | + storePassword 'ZDJDLL23YRPQM3BBXjdfpow3KDehwyrojafdajfjadfLDK83I' | |
26 | + } | |
27 | + } | |
28 | + compileSdkVersion 22 | |
29 | + buildToolsVersion '22.0.1' | |
30 | + sourceSets { | |
31 | + main { | |
32 | + manifest.srcFile 'AndroidManifest.xml' | |
33 | + java.srcDirs = ['src'] | |
34 | + resources.srcDirs = ['src'] | |
35 | + aidl.srcDirs = ['src'] | |
36 | + renderscript.srcDirs = ['src'] | |
37 | + res.srcDirs = ['res'] | |
38 | + assets.srcDirs = ['assets'] | |
39 | + } | |
40 | + | |
41 | + // Move the tests to tests/java, tests/res, etc... | |
42 | + instrumentTest.setRoot('tests') | |
43 | + | |
44 | + // Move the build types to build-types/<type> | |
45 | + // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... | |
46 | + // This moves them out of them default location under src/<type>/... which would | |
47 | + // conflict with src/ being used by the main source set. | |
48 | + // Adding new build types or product flavors should be accompanied | |
49 | + // by a similar customization. | |
50 | + debug.setRoot('build-types/debug') | |
51 | + release.setRoot('build-types/release') | |
52 | + } | |
53 | + compileOptions { | |
54 | + sourceCompatibility JavaVersion.VERSION_1_7 | |
55 | + targetCompatibility JavaVersion.VERSION_1_7 | |
56 | + } | |
57 | + buildTypes { | |
58 | + release { | |
59 | + signingConfig signingConfigs.letsgame | |
60 | + } | |
61 | + debug { | |
62 | + signingConfig signingConfigs.letsgame | |
63 | + } | |
64 | + } | |
65 | + defaultConfig { | |
66 | + signingConfig signingConfigs.letsgame | |
67 | + } | |
68 | + productFlavors { | |
69 | + } | |
70 | +} |
android/GameSDKSample/gradlew
... | ... | @@ -0,0 +1,164 @@ |
1 | +#!/usr/bin/env bash | |
2 | + | |
3 | +############################################################################## | |
4 | +## | |
5 | +## Gradle start up script for UN*X | |
6 | +## | |
7 | +############################################################################## | |
8 | + | |
9 | +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |
10 | +DEFAULT_JVM_OPTS="" | |
11 | + | |
12 | +APP_NAME="Gradle" | |
13 | +APP_BASE_NAME=`basename "$0"` | |
14 | + | |
15 | +# Use the maximum available, or set MAX_FD != -1 to use that value. | |
16 | +MAX_FD="maximum" | |
17 | + | |
18 | +warn ( ) { | |
19 | + echo "$*" | |
20 | +} | |
21 | + | |
22 | +die ( ) { | |
23 | + echo | |
24 | + echo "$*" | |
25 | + echo | |
26 | + exit 1 | |
27 | +} | |
28 | + | |
29 | +# OS specific support (must be 'true' or 'false'). | |
30 | +cygwin=false | |
31 | +msys=false | |
32 | +darwin=false | |
33 | +case "`uname`" in | |
34 | + CYGWIN* ) | |
35 | + cygwin=true | |
36 | + ;; | |
37 | + Darwin* ) | |
38 | + darwin=true | |
39 | + ;; | |
40 | + MINGW* ) | |
41 | + msys=true | |
42 | + ;; | |
43 | +esac | |
44 | + | |
45 | +# For Cygwin, ensure paths are in UNIX format before anything is touched. | |
46 | +if $cygwin ; then | |
47 | + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | |
48 | +fi | |
49 | + | |
50 | +# Attempt to set APP_HOME | |
51 | +# Resolve links: $0 may be a link | |
52 | +PRG="$0" | |
53 | +# Need this for relative symlinks. | |
54 | +while [ -h "$PRG" ] ; do | |
55 | + ls=`ls -ld "$PRG"` | |
56 | + link=`expr "$ls" : '.*-> \(.*\)$'` | |
57 | + if expr "$link" : '/.*' > /dev/null; then | |
58 | + PRG="$link" | |
59 | + else | |
60 | + PRG=`dirname "$PRG"`"/$link" | |
61 | + fi | |
62 | +done | |
63 | +SAVED="`pwd`" | |
64 | +cd "`dirname \"$PRG\"`/" >&- | |
65 | +APP_HOME="`pwd -P`" | |
66 | +cd "$SAVED" >&- | |
67 | + | |
68 | +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | |
69 | + | |
70 | +# Determine the Java command to use to start the JVM. | |
71 | +if [ -n "$JAVA_HOME" ] ; then | |
72 | + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | |
73 | + # IBM's JDK on AIX uses strange locations for the executables | |
74 | + JAVACMD="$JAVA_HOME/jre/sh/java" | |
75 | + else | |
76 | + JAVACMD="$JAVA_HOME/bin/java" | |
77 | + fi | |
78 | + if [ ! -x "$JAVACMD" ] ; then | |
79 | + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | |
80 | + | |
81 | +Please set the JAVA_HOME variable in your environment to match the | |
82 | +location of your Java installation." | |
83 | + fi | |
84 | +else | |
85 | + JAVACMD="java" | |
86 | + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |
87 | + | |
88 | +Please set the JAVA_HOME variable in your environment to match the | |
89 | +location of your Java installation." | |
90 | +fi | |
91 | + | |
92 | +# Increase the maximum file descriptors if we can. | |
93 | +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then | |
94 | + MAX_FD_LIMIT=`ulimit -H -n` | |
95 | + if [ $? -eq 0 ] ; then | |
96 | + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | |
97 | + MAX_FD="$MAX_FD_LIMIT" | |
98 | + fi | |
99 | + ulimit -n $MAX_FD | |
100 | + if [ $? -ne 0 ] ; then | |
101 | + warn "Could not set maximum file descriptor limit: $MAX_FD" | |
102 | + fi | |
103 | + else | |
104 | + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" | |
105 | + fi | |
106 | +fi | |
107 | + | |
108 | +# For Darwin, add options to specify how the application appears in the dock | |
109 | +if $darwin; then | |
110 | + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | |
111 | +fi | |
112 | + | |
113 | +# For Cygwin, switch paths to Windows format before running java | |
114 | +if $cygwin ; then | |
115 | + APP_HOME=`cygpath --path --mixed "$APP_HOME"` | |
116 | + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | |
117 | + | |
118 | + # We build the pattern for arguments to be converted via cygpath | |
119 | + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | |
120 | + SEP="" | |
121 | + for dir in $ROOTDIRSRAW ; do | |
122 | + ROOTDIRS="$ROOTDIRS$SEP$dir" | |
123 | + SEP="|" | |
124 | + done | |
125 | + OURCYGPATTERN="(^($ROOTDIRS))" | |
126 | + # Add a user-defined pattern to the cygpath arguments | |
127 | + if [ "$GRADLE_CYGPATTERN" != "" ] ; then | |
128 | + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" | |
129 | + fi | |
130 | + # Now convert the arguments - kludge to limit ourselves to /bin/sh | |
131 | + i=0 | |
132 | + for arg in "$@" ; do | |
133 | + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` | |
134 | + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option | |
135 | + | |
136 | + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition | |
137 | + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` | |
138 | + else | |
139 | + eval `echo args$i`="\"$arg\"" | |
140 | + fi | |
141 | + i=$((i+1)) | |
142 | + done | |
143 | + case $i in | |
144 | + (0) set -- ;; | |
145 | + (1) set -- "$args0" ;; | |
146 | + (2) set -- "$args0" "$args1" ;; | |
147 | + (3) set -- "$args0" "$args1" "$args2" ;; | |
148 | + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; | |
149 | + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | |
150 | + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | |
151 | + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | |
152 | + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | |
153 | + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | |
154 | + esac | |
155 | +fi | |
156 | + | |
157 | +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules | |
158 | +function splitJvmOpts() { | |
159 | + JVM_OPTS=("$@") | |
160 | +} | |
161 | +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS | |
162 | +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" | |
163 | + | |
164 | +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" |
android/GameSDKSample/gradlew.bat
... | ... | @@ -0,0 +1,90 @@ |
1 | +@if "%DEBUG%" == "" @echo off | |
2 | +@rem ########################################################################## | |
3 | +@rem | |
4 | +@rem Gradle startup script for Windows | |
5 | +@rem | |
6 | +@rem ########################################################################## | |
7 | + | |
8 | +@rem Set local scope for the variables with windows NT shell | |
9 | +if "%OS%"=="Windows_NT" setlocal | |
10 | + | |
11 | +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |
12 | +set DEFAULT_JVM_OPTS= | |
13 | + | |
14 | +set DIRNAME=%~dp0 | |
15 | +if "%DIRNAME%" == "" set DIRNAME=. | |
16 | +set APP_BASE_NAME=%~n0 | |
17 | +set APP_HOME=%DIRNAME% | |
18 | + | |
19 | +@rem Find java.exe | |
20 | +if defined JAVA_HOME goto findJavaFromJavaHome | |
21 | + | |
22 | +set JAVA_EXE=java.exe | |
23 | +%JAVA_EXE% -version >NUL 2>&1 | |
24 | +if "%ERRORLEVEL%" == "0" goto init | |
25 | + | |
26 | +echo. | |
27 | +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |
28 | +echo. | |
29 | +echo Please set the JAVA_HOME variable in your environment to match the | |
30 | +echo location of your Java installation. | |
31 | + | |
32 | +goto fail | |
33 | + | |
34 | +:findJavaFromJavaHome | |
35 | +set JAVA_HOME=%JAVA_HOME:"=% | |
36 | +set JAVA_EXE=%JAVA_HOME%/bin/java.exe | |
37 | + | |
38 | +if exist "%JAVA_EXE%" goto init | |
39 | + | |
40 | +echo. | |
41 | +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | |
42 | +echo. | |
43 | +echo Please set the JAVA_HOME variable in your environment to match the | |
44 | +echo location of your Java installation. | |
45 | + | |
46 | +goto fail | |
47 | + | |
48 | +:init | |
49 | +@rem Get command-line arguments, handling Windowz variants | |
50 | + | |
51 | +if not "%OS%" == "Windows_NT" goto win9xME_args | |
52 | +if "%@eval[2+2]" == "4" goto 4NT_args | |
53 | + | |
54 | +:win9xME_args | |
55 | +@rem Slurp the command line arguments. | |
56 | +set CMD_LINE_ARGS= | |
57 | +set _SKIP=2 | |
58 | + | |
59 | +:win9xME_args_slurp | |
60 | +if "x%~1" == "x" goto execute | |
61 | + | |
62 | +set CMD_LINE_ARGS=%* | |
63 | +goto execute | |
64 | + | |
65 | +:4NT_args | |
66 | +@rem Get arguments from the 4NT Shell from JP Software | |
67 | +set CMD_LINE_ARGS=%$ | |
68 | + | |
69 | +:execute | |
70 | +@rem Setup the command line | |
71 | + | |
72 | +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | |
73 | + | |
74 | +@rem Execute Gradle | |
75 | +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% | |
76 | + | |
77 | +:end | |
78 | +@rem End local scope for the variables with windows NT shell | |
79 | +if "%ERRORLEVEL%"=="0" goto mainEnd | |
80 | + | |
81 | +:fail | |
82 | +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | |
83 | +rem the _cmd.exe /c_ return code! | |
84 | +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 | |
85 | +exit /b 1 | |
86 | + | |
87 | +:mainEnd | |
88 | +if "%OS%"=="Windows_NT" endlocal | |
89 | + | |
90 | +:omega |
android/GameSDKSample/lint.xml
android/GameSDKSample/local.properties
... | ... | @@ -0,0 +1,11 @@ |
1 | +## This file is automatically generated by Android Studio. | |
2 | +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | |
3 | +# | |
4 | +# This file must *NOT* be checked into Version Control Systems, | |
5 | +# as it contains information specific to your local configuration. | |
6 | +# | |
7 | +# Location of the SDK. This is only used by Gradle. | |
8 | +# For customization when using a Version Control System, please read the | |
9 | +# header note. | |
10 | +#Thu Jul 23 18:18:45 CST 2015 | |
11 | +sdk.dir=D\:\\DevTools\\android-sdk-windows |
android/GameSDKSample/project.properties
android/GameSDKSample/settings.gradle
android/GameSDKSample/src/com/gumptech/loginsdk/sample/MainActivity.java
... | ... | @@ -10,89 +10,109 @@ import android.widget.TextView; |
10 | 10 | import android.widget.Toast; |
11 | 11 | |
12 | 12 | import com.gumptech.sdk.GumpSDK; |
13 | +import com.gumptech.sdk.bean.GumpUser; | |
14 | +import com.gumptech.sdk.bean.PurchaseResult; | |
15 | +import com.gumptech.sdk.callback.InitializeCallback; | |
16 | +import com.gumptech.sdk.callback.LoginStateListener; | |
17 | +import com.gumptech.sdk.callback.PurchaseCallback; | |
13 | 18 | import com.loginsdk.sample.R; |
14 | 19 | |
15 | -public class MainActivity extends Activity implements GumpSDK.Callback { | |
16 | - | |
17 | - private TextView tvVersion; | |
18 | - private TextView userInfo; | |
19 | - | |
20 | - private Button btnLoginOrLogout; | |
21 | - | |
22 | - private String appId = "10009"; | |
23 | - | |
24 | - @Override | |
25 | - protected void onCreate(Bundle savedInstanceState) { | |
26 | - super.onCreate(savedInstanceState); | |
27 | - setContentView(R.layout.activity_main); | |
28 | - tvVersion = (TextView) findViewById(R.id.version); | |
29 | - userInfo = (TextView) findViewById(R.id.user_info); | |
30 | - btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); | |
31 | - btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { | |
32 | - | |
33 | - @Override | |
34 | - public void onClick(View v) { | |
35 | - if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) | |
36 | - GumpSDK.start(MainActivity.this); | |
37 | - else | |
38 | - GumpSDK.logout(MainActivity.this, MainActivity.this); | |
39 | - } | |
40 | - }); | |
41 | - findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { | |
42 | - | |
43 | - @Override | |
44 | - public void onClick(View v) { | |
45 | - Bundle payInfo = new Bundle(); | |
46 | - payInfo.putString("nick", "thi"); | |
47 | - payInfo.putString("product", "元宝"); | |
48 | - payInfo.putFloat("amount", 0.0f); | |
49 | - payInfo.putString("extraInfo", "This is demo!"); | |
50 | - payInfo.putString("serverId", "4019"); | |
51 | - GumpSDK.pay(MainActivity.this, payInfo, "2263806"); | |
52 | - } | |
53 | - }); | |
54 | - GumpSDK.init(getApplicationContext(), appId, "483d8df877b31405c1e8fe4247f02d86", "1000"); | |
55 | - GumpSDK.setLogoShow(true); | |
56 | - GumpSDK.setScreenLandscape(false); | |
57 | - tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); | |
58 | - GumpSDK.start(this); | |
59 | - } | |
60 | - | |
61 | - @Override | |
62 | - protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
63 | - Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode); | |
64 | - if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) { | |
65 | - if (resultCode == RESULT_OK) { | |
66 | - String uid = data.getStringExtra("userId"); | |
67 | - int accountType = data.getIntExtra("accountType", -1); | |
68 | - String sessionkey = data.getStringExtra("sessionKey"); | |
69 | - userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey); | |
70 | - btnLoginOrLogout.setText("Logout"); | |
71 | - btnLoginOrLogout.setTag(1); | |
72 | - } else if (resultCode == RESULT_CANCELED) { | |
73 | - Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); | |
74 | - } | |
75 | - } | |
76 | - // @Deprecated | |
77 | - // else if (requestCode == GumpSDK.PAY_REQUEST_CODE) { | |
78 | - // if (resultCode == RESULT_OK) { | |
79 | - // int code = data.getIntExtra("code", -1); | |
80 | - // String msg = data.getStringExtra("msg"); | |
81 | - // String orderId = data.getStringExtra("orderId"); | |
82 | - // String extraInfo = data.getStringExtra("extraInfo"); | |
83 | - // Toast.makeText(this, "pay result: " + code + "," + msg + ",orderId:" + orderId + ",extraInfo:" + extraInfo, Toast.LENGTH_SHORT).show(); | |
84 | - // } else if (resultCode == RESULT_CANCELED) { | |
85 | - // Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); | |
86 | - // } | |
87 | - // } | |
88 | - super.onActivityResult(requestCode, resultCode, data); | |
89 | - } | |
90 | - | |
91 | - @Override | |
92 | - public void onLogout() { | |
93 | - btnLoginOrLogout.setText("Login"); | |
94 | - btnLoginOrLogout.setTag(0); | |
95 | - userInfo.append("\n User is logout"); | |
96 | - } | |
20 | +public class MainActivity extends Activity implements PurchaseCallback{ | |
97 | 21 | |
22 | + private static final String TAG = "MainActivity"; | |
23 | + | |
24 | + private TextView tvVersion; | |
25 | + private TextView userInfo; | |
26 | + | |
27 | + private Button btnLoginOrLogout; | |
28 | + | |
29 | + private String appId = "10022"; | |
30 | + private String appKey = "93a27b0bd99bac3e68a440b48aa421ab"; | |
31 | + | |
32 | + @Override | |
33 | + protected void onCreate(Bundle savedInstanceState) { | |
34 | + super.onCreate(savedInstanceState); | |
35 | + setContentView(R.layout.activity_main); | |
36 | + tvVersion = (TextView) findViewById(R.id.version); | |
37 | + userInfo = (TextView) findViewById(R.id.user_info); | |
38 | + btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); | |
39 | + btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { | |
40 | + | |
41 | + @Override | |
42 | + public void onClick(View v) { | |
43 | + if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) | |
44 | + GumpSDK.start(MainActivity.this); | |
45 | + else | |
46 | + GumpSDK.logout(MainActivity.this); | |
47 | + } | |
48 | + }); | |
49 | + findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { | |
50 | + | |
51 | + @Override | |
52 | + public void onClick(View v) { | |
53 | + Bundle payInfo = new Bundle(); | |
54 | + payInfo.putString("nick", "thi"); | |
55 | + payInfo.putString("product", "元宝"); | |
56 | + payInfo.putFloat("amount", 0.0f); | |
57 | + payInfo.putString("extraInfo", "This is demo!"); | |
58 | + payInfo.putString("serverId", "5001"); | |
59 | + GumpSDK.pay(MainActivity.this, payInfo, "3332768", MainActivity.this); | |
60 | + } | |
61 | + }); | |
62 | + GumpSDK.setDebugState(true); | |
63 | + GumpSDK.setLogoShow(true); | |
64 | + GumpSDK.setScreenLandscape(false); | |
65 | + GumpSDK.setUserStateListener(new LoginStateListener() { | |
66 | + @Override | |
67 | + public void onLoginSuccess(GumpUser user) { | |
68 | + userInfo.setText("Userid:" + user.getUid() + "\n accountType:" + user.getAccountType() + "\n sessionKey:" + user.getSessionKey()); | |
69 | + btnLoginOrLogout.setText("Logout"); | |
70 | + btnLoginOrLogout.setTag(1); | |
71 | + } | |
72 | + | |
73 | + @Override | |
74 | + public void onLoginFailed(int code, String msg) { | |
75 | + userInfo.setText(msg); | |
76 | + Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); | |
77 | + } | |
78 | + | |
79 | + @Override | |
80 | + public void onLoginCanceled() { | |
81 | + Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); | |
82 | + } | |
83 | + | |
84 | + @Override | |
85 | + public void onLogout() { | |
86 | + btnLoginOrLogout.setText("Login"); | |
87 | + btnLoginOrLogout.setTag(0); | |
88 | + userInfo.setText("User is logout"); | |
89 | + } | |
90 | + }); | |
91 | + GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { | |
92 | + @Override | |
93 | + public void initComplete(int result) { | |
94 | + if (result == GumpSDK.CODE.OK) { | |
95 | + btnLoginOrLogout.setEnabled(true); | |
96 | + } | |
97 | + } | |
98 | + }); | |
99 | + | |
100 | + | |
101 | + tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); | |
102 | + } | |
103 | + | |
104 | + @Override | |
105 | + public void onPurchaseCompleted(PurchaseResult result) { | |
106 | + Log.i(TAG,"purchase completed"); | |
107 | + } | |
108 | + | |
109 | + @Override | |
110 | + public void onPurchaseError(int code, String msg) { | |
111 | + Log.i(TAG,"purchase error"); | |
112 | + } | |
113 | + | |
114 | + @Override | |
115 | + public void onPurchaseCanceled() { | |
116 | + Log.i(TAG,"purchase canceled"); | |
117 | + } | |
98 | 118 | } |