Commit 43932caac25b48e18bbd9959df7a6f67b2d6396a

Authored by 赵康
1 parent 2ce00205d6
Exists in master

update for UI,add login way of Line and Wechat

Showing 8 changed files with 67 additions and 30 deletions Side-by-side Diff

GameSDK-release4.2.1.aar
No preview for this file type
GameSDK-release4.3.1.aar
No preview for this file type
GameSDKDemo/build.gradle
1 1 apply plugin: 'com.android.application'
2 2  
3   -repositories{
4   - flatDir{
  3 +repositories {
  4 + flatDir {
5 5 dirs 'libs'
6 6 }
7 7 }
8 8  
9 9 android {
10 10 compileSdkVersion 22
11   - buildToolsVersion "25.0.0"
  11 + buildToolsVersion "26.0.2"
12 12  
13 13 defaultConfig {
14 14 minSdkVersion 9
... ... @@ -24,7 +24,7 @@ android {
24 24 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 25 }
26 26 }
27   - lintOptions{
  27 + lintOptions {
28 28 abortOnError false
29 29 }
30 30 }
... ... @@ -33,7 +33,9 @@ dependencies {
33 33 compile fileTree(dir: 'libs', include: ['*.jar'])
34 34 testCompile 'junit:junit:4.12'
35 35 compile 'com.android.support:appcompat-v7:22.2.0'
  36 + //微信
  37 +// compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
36 38 // compile project(':GameSDK')
37   - compile(name:'GameSDK-release4.2.1',ext:'aar')
  39 + compile(name: 'GameSDK-release4.3.1', ext: 'aar')
38 40  
39 41 }
GameSDKDemo/libs/GameSDK-release4.2.1.aar
No preview for this file type
GameSDKDemo/libs/GameSDK-release4.3.1.aar
No preview for this file type
GameSDKDemo/src/main/AndroidManifest.xml
... ... @@ -30,6 +30,7 @@
30 30 android:name="com.gumptech.sdk.demo.MainActivity"
31 31 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout"
32 32 android:label="@string/app_name"
  33 + android:screenOrientation="landscape"
33 34 >
34 35 <intent-filter>
35 36 <action android:name="android.intent.action.MAIN"/>
GameSDKDemo/src/main/java/com/gumptech/sdk/demo/MainActivity.java
... ... @@ -13,6 +13,7 @@ import android.widget.Toast;
13 13 import com.gumptech.sdk.GumpPreference;
14 14 import com.gumptech.sdk.GumpSDK;
15 15 import com.gumptech.sdk.PaymentVersion;
  16 +import com.gumptech.sdk.SDKSettings;
16 17 import com.gumptech.sdk.bean.GumpUser;
17 18 import com.gumptech.sdk.bean.PurchaseResult;
18 19 import com.gumptech.sdk.callback.InitializeCallback;
... ... @@ -30,8 +31,8 @@ public class MainActivity extends Activity implements PurchaseCallback {
30 31  
31 32 private Button btnLoginOrLogout;
32 33  
33   - private String appId = "10022";
34   - private String appKey = "93a27b0bd99bac3e68a440b48aa421ab";
  34 + private String appId = "100";
  35 + private String appKey = "f899139df5e1059396431415e770c6dd";
35 36 private String sessionKey;
36 37  
37 38  
... ... @@ -62,7 +63,7 @@ public class MainActivity extends Activity implements PurchaseCallback {
62 63 payInfo.putFloat("amount", 0.1f);
63 64 payInfo.putString("extraInfo", "This is demo!");
64 65 payInfo.putString("serverId", "100");
65   - payInfo.putString("roleId","100123");
  66 + payInfo.putString("roleId", "100123");
66 67 payInfo.putString("sessionKey", sessionKey);
67 68 GumpSDK.pay(MainActivity.this, payInfo, MainActivity.this);
68 69 }
... ... @@ -75,7 +76,7 @@ public class MainActivity extends Activity implements PurchaseCallback {
75 76 payInfo.putFloat("amount", 0.1f);
76 77 payInfo.putString("extraInfo", "This is demo!");
77 78 payInfo.putString("serverId", "100");
78   - payInfo.putString("roleId","100123");
  79 + payInfo.putString("roleId", "100123");
79 80 GumpSDK.iap(MainActivity.this, payInfo, MainActivity.this);
80 81 }
81 82 });
... ... @@ -84,15 +85,30 @@ public class MainActivity extends Activity implements PurchaseCallback {
84 85 */
85 86 GumpSDK.getSettings().enableDebugLogging(true);
86 87 /**
87   - * 设置是否启用facebook登录
  88 + * 设置启用facebook登录
88 89 */
89   - GumpSDK.getSettings().setFBEnable(true);
  90 + GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_FB);
90 91 /**
91   - * 设置是否启用Vk登录
  92 + * 设置启用Vk登录
92 93 */
93   - GumpSDK.getSettings().setVKEnable(false);
  94 +// GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_VK);
94 95  
95 96 /**
  97 + * 设置启用Wechat登录
  98 + *
  99 + */
  100 +// GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_WECHAT);
  101 +
  102 + /**
  103 + * 设置启用google登录
  104 + */
  105 + GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_GOOGLE);
  106 +
  107 + /**
  108 + * 设置启用Line登录
  109 + */
  110 + GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_LINE);
  111 + /**
96 112 * 设置屏幕方向
97 113 */
98 114 GumpSDK.getSettings().setScreenLandscape(true);
... ... @@ -131,6 +147,12 @@ public class MainActivity extends Activity implements PurchaseCallback {
131 147 case GumpPreference.ACCOUNT_TYPE_GOOGLE:
132 148 userType = "google 登录";
133 149 break;
  150 + case GumpPreference.ACCOUNT_TYPE_WECHAT:
  151 + userType = "微信登录";
  152 + break;
  153 + case GumpPreference.ACCOUNT_TYPE_LINE:
  154 + userType = "Line登录";
  155 + break;
134 156 }
135 157 userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType() + ") " + userType + "\n sessionKey:" + user.getSessionKey());
136 158 btnLoginOrLogout.setText("Logout");
... ... @@ -173,11 +195,11 @@ public class MainActivity extends Activity implements PurchaseCallback {
173 195  
174 196 }
175 197  
176   - private void checkRisk(){
  198 + private void checkRisk() {
177 199 GumpSDK.checkRisk(this, new ResultCallback() {
178 200 @Override
179 201 public void onResult(boolean isRisk) {
180   - Log.i(TAG,isRisk?"There is some risks":"Nothing is risk");
  202 + Log.i(TAG, isRisk ? "There is some risks" : "Nothing is risk");
181 203 }
182 204 });
183 205 }
1 1 # Gump SDK 4 for Android接入文档
2 2  
3   -V4.2.0
4   -2017年4月26日
  3 +V4.3.1
  4 +2018年1月16日
5 5  
6 6 ## 版本概述
7 7  
8   -此版本为使用AndroidStudio开发的第一个版本,一改eclipse的工程依赖方式,使用aar的方式提供sdk接入包,除功能外,相对上一版本没有继承关系,请按此文档描述接入.
  8 +此版本为使用AndroidStudio开发的版本,一改eclipse的工程依赖方式,使用aar的方式提供sdk接入包,除功能外,相对上一版本没有继承关系,请按此文档描述接入.
9 9  
10 10 此SDK适用android2.3以上系统.
11 11  
... ... @@ -89,22 +89,13 @@ V4.2.0
89 89  
90 90 GumpSDK.getSettings().enableDebugLogging(true);
91 91  
92   -*Gump Logo隐藏
93   -
94   - GumpSDK.getSettings().setLogoShow(false);
95   -
96 92 *横竖屏控制,默认为横屏,参数为false即为竖屏
97 93  
98 94 GumpSDK.getSettings().setScreenLandscape(true);
99 95  
100   -*设置是否启用Facebook登录和VK登录
101   -
102   - GumpSDK.getSettings().setFBEnable(true);
103   - GumpSDK.getSettings().setVKEnable(true);
104   -
105   -*设置是否启用GoogleD登录
  96 +*设置需要启用的第三方登录,参数可选类型见第二章:<a href="#third_palt">第三方登录平台</a> 字段说明
106 97  
107   - GumpSDk.getSettings().setGoogleEnable(true);
  98 + GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_*);
108 99  
109 100 *若要使用V4版支付请设置
110 101  
... ... @@ -213,7 +204,28 @@ InitializeCallback为初始化回调接口,此接口只有一个回调方法init
213 204 }
214 205 });
215 206  
216   -## 第二章 常见问题
  207 +## 第二章 常量字段与代码
  208 +<a name="third_plat"> 1.第三方登录平台</a>
  209 +
  210 + | 常量字段 | 说明 |
  211 + | -------- | -------- |
  212 + |SDKSettings.THIRD_SUPPORT_FB|Facebook登录|
  213 + |SDKSettings.THIRD_SUPPORT_GOOGLE|Google登录|
  214 + |SDKSettings.THIRD_SUPPORT_LINE|Line登录|
  215 + |SDKSettings.THIRD_SUPPORT_VK|VK登录|
  216 +
  217 +### 2.登录账户类型
  218 +
  219 + | 常量字段 | 说明 |
  220 + | -------- | -------- |
  221 + |GumpPreference.ACCOUNT_TYPE_FB|Facebook用户|
  222 + |GumpPreference.ACCOUNT_TYPE_REG|Gump注册用户|
  223 + |GumpPreference.ACCOUNT_TYPE_QUICK_REG|快速注册用户|
  224 + |GumpPreference.ACCOUNT_TYPE_GOOGLE|Google用户|
  225 + |GumpPreference.ACCOUNT_TYPE_LINE|Line用户|
  226 + |GumpPreference.ACCOUNT_TYPE_VK|VK用户|
  227 +
  228 +## 第三章 常见问题
217 229 ### 问题1: 如何避免混淆对SDK的影响?
218 230 解答:有些开发者对接入了SDK的程序进行混淆时,有可能会覆盖某些java
219 231 类,导致SDK无法正常工作,解决方法如下: