Commit af9c440cf4886a19c648d531d84af120b2dae2ba

Authored by 赵康
1 parent f175cbeae7
Exists in master

v3.3.6

分离fb登录模块,设置禁用时,可不用导入fb sdk

Showing 6 changed files with 8 additions and 9 deletions Inline Diff

android/GameSDKRelease/libs/GameSDK_v3.3.5_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/GameSDK_v3.3.6_proguard.jar
No preview for this file type
android/GameSDKRelease/project.properties
1 # This file is automatically generated by Android Tools. 1 # This file is automatically generated by Android Tools.
2 # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 2 # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 # 3 #
4 # This file must be checked in Version Control Systems. 4 # This file must be checked in Version Control Systems.
5 # 5 #
6 # To customize properties used by the Ant build system edit 6 # To customize properties used by the Ant build system edit
7 # "ant.properties", and override values to adapt the script to your 7 # "ant.properties", and override values to adapt the script to your
8 # project structure. 8 # project structure.
9 # 9 #
10 # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 10 # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 11 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 12
13 # Project target. 13 # Project target.
14 target=android-21 14 target=android-21
15 android.library=true 15 android.library=true
16 android.library.reference.1=..\\..\\..\\..\\..\\facebook
17 android.library.reference.2=../../../../../Project/vksdk_library
18 16
android/GameSDKRelease/res/layout/fragment_sign_choice.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="wrap_content" 4 android:layout_height="wrap_content"
5 android:gravity="center" 5 android:gravity="center"
6 android:orientation="vertical" > 6 android:orientation="vertical" >
7 7
8 <LinearLayout 8 <LinearLayout
9 android:layout_width="match_parent" 9 android:layout_width="match_parent"
10 android:layout_height="wrap_content" 10 android:layout_height="wrap_content"
11 android:background="@color/white_translucent" 11 android:background="@color/white_translucent"
12 android:orientation="vertical" > 12 android:orientation="vertical" >
13 13
14 <LinearLayout 14 <LinearLayout
15 android:layout_width="match_parent" 15 android:layout_width="match_parent"
16 android:layout_height="31dp" 16 android:layout_height="31dp"
17 android:layout_marginLeft="35dp" 17 android:layout_marginLeft="35dp"
18 android:layout_marginRight="35dp" 18 android:layout_marginRight="35dp"
19 android:layout_marginTop="13dp" 19 android:layout_marginTop="13dp"
20 android:background="@color/white" > 20 android:background="@color/white" >
21 21
22 <ImageView 22 <ImageView
23 android:layout_width="wrap_content" 23 android:layout_width="wrap_content"
24 android:layout_height="wrap_content" 24 android:layout_height="wrap_content"
25 android:layout_gravity="center_vertical" 25 android:layout_gravity="center_vertical"
26 android:layout_marginLeft="9.5dp" 26 android:layout_marginLeft="9.5dp"
27 android:layout_marginRight="9.5dp" 27 android:layout_marginRight="9.5dp"
28 android:src="@drawable/ic_user" /> 28 android:src="@drawable/ic_user" />
29 29
30 <View 30 <View
31 android:layout_width="1dp" 31 android:layout_width="1dp"
32 android:layout_height="20dp" 32 android:layout_height="20dp"
33 android:layout_gravity="center_vertical" 33 android:layout_gravity="center_vertical"
34 android:background="@color/light_gray" /> 34 android:background="@color/light_gray" />
35 35
36 <EditText 36 <EditText
37 android:id="@+id/username" 37 android:id="@+id/username"
38 android:layout_width="match_parent" 38 android:layout_width="match_parent"
39 android:layout_height="match_parent" 39 android:layout_height="match_parent"
40 android:background="@color/transparent" 40 android:background="@color/transparent"
41 android:hint="@string/user_name_hint" 41 android:hint="@string/user_name_hint"
42 android:paddingLeft="6dp" /> 42 android:paddingLeft="6dp" />
43 </LinearLayout> 43 </LinearLayout>
44 44
45 <LinearLayout 45 <LinearLayout
46 android:layout_width="match_parent" 46 android:layout_width="match_parent"
47 android:layout_height="31dp" 47 android:layout_height="31dp"
48 android:layout_marginLeft="35dp" 48 android:layout_marginLeft="35dp"
49 android:layout_marginRight="35dp" 49 android:layout_marginRight="35dp"
50 android:layout_marginTop="16dp" 50 android:layout_marginTop="16dp"
51 android:background="@color/white" 51 android:background="@color/white"
52 android:orientation="horizontal" > 52 android:orientation="horizontal" >
53 53
54 <ImageView 54 <ImageView
55 android:layout_width="wrap_content" 55 android:layout_width="wrap_content"
56 android:layout_height="wrap_content" 56 android:layout_height="wrap_content"
57 android:layout_gravity="center_vertical" 57 android:layout_gravity="center_vertical"
58 android:layout_marginLeft="12.5dp" 58 android:layout_marginLeft="12.5dp"
59 android:layout_marginRight="12.5dp" 59 android:layout_marginRight="12.5dp"
60 android:src="@drawable/ic_pwd" /> 60 android:src="@drawable/ic_pwd" />
61 61
62 <View 62 <View
63 android:layout_width="1dp" 63 android:layout_width="1dp"
64 android:layout_height="20dp" 64 android:layout_height="20dp"
65 android:layout_gravity="center_vertical" 65 android:layout_gravity="center_vertical"
66 android:background="@color/light_gray" /> 66 android:background="@color/light_gray" />
67 67
68 <EditText 68 <EditText
69 android:id="@+id/pwd" 69 android:id="@+id/pwd"
70 android:layout_width="match_parent" 70 android:layout_width="match_parent"
71 android:layout_height="match_parent" 71 android:layout_height="match_parent"
72 android:background="@color/white" 72 android:background="@color/white"
73 android:hint="@string/password_hint" 73 android:hint="@string/password_hint"
74 android:inputType="textPassword" 74 android:inputType="textPassword"
75 android:paddingLeft="6dp" /> 75 android:paddingLeft="6dp" />
76 </LinearLayout> 76 </LinearLayout>
77 77
78 <LinearLayout 78 <LinearLayout
79 android:layout_width="fill_parent" 79 android:layout_width="fill_parent"
80 android:layout_height="wrap_content" 80 android:layout_height="wrap_content"
81 android:layout_marginLeft="35dp" 81 android:layout_marginLeft="35dp"
82 android:layout_marginRight="35dp" 82 android:layout_marginRight="35dp"
83 android:layout_marginTop="16dp" 83 android:layout_marginTop="16dp"
84 android:orientation="horizontal" > 84 android:orientation="horizontal" >
85 85
86 <Button 86 <Button
87 android:id="@+id/gump_reg" 87 android:id="@+id/gump_reg"
88 android:layout_width="fill_parent" 88 android:layout_width="fill_parent"
89 android:layout_height="wrap_content" 89 android:layout_height="wrap_content"
90 android:layout_marginRight="10dp" 90 android:layout_marginRight="10dp"
91 android:layout_weight="1" 91 android:layout_weight="1"
92 android:background="@drawable/btn_green_bg" 92 android:background="@drawable/btn_green_bg"
93 android:text="@string/signup" 93 android:text="@string/signup"
94 android:textColor="@color/white" /> 94 android:textColor="@color/white" />
95 95
96 <Button 96 <Button
97 android:id="@+id/gump_login" 97 android:id="@+id/gump_login"
98 android:layout_width="fill_parent" 98 android:layout_width="fill_parent"
99 android:layout_height="wrap_content" 99 android:layout_height="wrap_content"
100 android:layout_marginLeft="11dp" 100 android:layout_marginLeft="11dp"
101 android:layout_weight="1" 101 android:layout_weight="1"
102 android:background="@drawable/btn_orange_bg" 102 android:background="@drawable/btn_orange_bg"
103 android:gravity="center" 103 android:gravity="center"
104 android:text="@string/login" 104 android:text="@string/login"
105 android:textColor="@android:color/white" 105 android:textColor="@android:color/white"
106 android:textSize="15sp" 106 android:textSize="15sp"
107 android:textStyle="bold" /> 107 android:textStyle="bold" />
108 </LinearLayout> 108 </LinearLayout>
109 109
110 <Button 110 <Button
111 android:id="@+id/play" 111 android:id="@+id/play"
112 android:layout_width="fill_parent" 112 android:layout_width="fill_parent"
113 android:layout_height="wrap_content" 113 android:layout_height="wrap_content"
114 android:layout_marginBottom="16dp" 114 android:layout_marginBottom="16dp"
115 android:layout_marginLeft="35dp" 115 android:layout_marginLeft="35dp"
116 android:layout_marginRight="35dp" 116 android:layout_marginRight="35dp"
117 android:layout_marginTop="16dp" 117 android:layout_marginTop="16dp"
118 android:background="@drawable/btn_orange_bg" 118 android:background="@drawable/btn_orange_bg"
119 android:padding="5dp" 119 android:padding="5dp"
120 android:text="@string/quick_play" 120 android:text="@string/quick_play"
121 android:textColor="@android:color/white" 121 android:textColor="@android:color/white"
122 android:textSize="16sp" 122 android:textSize="16sp"
123 android:textStyle="bold" /> 123 android:textStyle="bold" />
124 124
125 <ImageView 125 <ImageView
126 android:id="@+id/or_line"
126 android:layout_width="fill_parent" 127 android:layout_width="fill_parent"
127 android:layout_height="wrap_content" 128 android:layout_height="wrap_content"
128 android:layout_marginLeft="35dp" 129 android:layout_marginLeft="35dp"
129 android:layout_marginRight="35dp" 130 android:layout_marginRight="35dp"
130 android:background="@drawable/horizontal_line" /> 131 android:background="@drawable/horizontal_line" />
131 </LinearLayout> 132 </LinearLayout>
132 133
133 <LinearLayout 134 <LinearLayout
134 android:layout_width="match_parent" 135 android:layout_width="match_parent"
135 android:layout_height="wrap_content" 136 android:layout_height="wrap_content"
136 android:background="@drawable/bottom_light_bg" 137 android:background="@drawable/bottom_light_bg"
137 android:gravity="center_horizontal" > 138 android:gravity="center_horizontal" >
138 139
139 <ImageView 140 <ImageView
140 android:id="@+id/fb_login" 141 android:id="@+id/fb_login"
141 android:layout_width="wrap_content" 142 android:layout_width="wrap_content"
142 android:layout_height="wrap_content" 143 android:layout_height="wrap_content"
143 android:layout_marginTop="10dp" 144 android:layout_marginTop="10dp"
144 android:layout_marginRight="5dp" 145 android:layout_marginRight="5dp"
145 android:src="@drawable/ic_fb" /> 146 android:src="@drawable/ic_fb" />
146 147
147 <ImageView 148 <ImageView
148 android:id="@+id/vk_login" 149 android:id="@+id/vk_login"
149 android:layout_width="wrap_content" 150 android:layout_width="wrap_content"
150 android:layout_height="wrap_content" 151 android:layout_height="wrap_content"
151 android:layout_marginTop="10dp" 152 android:layout_marginTop="10dp"
152 android:layout_marginLeft="5dp" 153 android:layout_marginLeft="5dp"
153 android:src="@drawable/ic_vk" /> 154 android:src="@drawable/ic_vk" />
154 </LinearLayout> 155 </LinearLayout>
155 156
156 </LinearLayout> 157 </LinearLayout>
android/GameSDKSample/AndroidManifest.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.gumpsdk.wuruid" 3 package="com.gumpsdk.wuruid"
4 android:versionCode="6" 4 android:versionCode="6"
5 android:versionName="1.6" > 5 android:versionName="1.6" >
6 6
7 <uses-sdk 7 <uses-sdk
8 android:minSdkVersion="9" 8 android:minSdkVersion="9"
9 android:targetSdkVersion="22" /> 9 android:targetSdkVersion="22" />
10 10
11 <uses-permission android:name="android.permission.INTERNET" /> 11 <uses-permission android:name="android.permission.INTERNET" />
12 <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 12 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
13 <uses-permission android:name="android.permission.BLUETOOTH" /> 13 <uses-permission android:name="android.permission.BLUETOOTH" />
14 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 14 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
15 <uses-permission android:name="android.permission.WRITE_SETTINGS" /> 15 <uses-permission android:name="android.permission.WRITE_SETTINGS" />
16 <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 16 <uses-permission android:name="android.permission.GET_ACCOUNTS" />
17 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 17 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
18 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 18 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
19 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> 19 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
20 <uses-permission android:name="android.permission.SEND_SMS"/> 20 <uses-permission android:name="android.permission.SEND_SMS"/>
21 21
22 <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> 22 <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. -->
23 <uses-permission android:name="com.android.vending.BILLING" /> 23 <uses-permission android:name="com.android.vending.BILLING" />
24 24
25 <application 25 <application
26 android:allowBackup="true" 26 android:allowBackup="true"
27 android:icon="@drawable/ic_launcher" 27 android:icon="@drawable/ic_launcher"
28 android:label="@string/app_name" > 28 android:label="@string/app_name" >
29 <activity 29 <activity
30 android:name="com.gumptech.loginsdk.sample.MainActivity" 30 android:name="com.gumptech.loginsdk.sample.MainActivity"
31 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" 31 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout"
32 android:label="@string/app_name" 32 android:label="@string/app_name"
33 android:screenOrientation="portrait" > 33 android:screenOrientation="portrait" >
34 <intent-filter> 34 <intent-filter>
35 <action android:name="android.intent.action.MAIN" /> 35 <action android:name="android.intent.action.MAIN" />
36 36
37 <category android:name="android.intent.category.LAUNCHER" /> 37 <category android:name="android.intent.category.LAUNCHER" />
38 </intent-filter> 38 </intent-filter>
39 </activity> 39 </activity>
40 <activity 40 <activity
41 android:name="com.gumptech.sdk.ContainerActivity" 41 android:name="com.gumptech.sdk.ContainerActivity"
42 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" 42 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout"
43 android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 43 android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
44 android:theme="@style/Theme.TransparentWin" > 44 android:theme="@style/Theme.TransparentWin" >
45 </activity> 45 </activity>
46 <activity 46 <activity
47 android:name="com.gumptech.sdk.PaymentActivity" 47 android:name="com.gumptech.sdk.PaymentActivity"
48 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" 48 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout"
49 android:theme="@android:style/Theme.Translucent.NoTitleBar" > 49 android:theme="@android:style/Theme.Translucent.NoTitleBar" >
50 </activity> 50 </activity>
51 <activity 51 <activity
52 android:name="com.gumptech.sdk.ExchangeWindow" 52 android:name="com.gumptech.sdk.ExchangeWindow"
53 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" 53 android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout"
54 android:theme="@style/Theme.WinForExchange" > 54 android:theme="@style/Theme.WinForExchange" >
55 </activity> 55 </activity>
56 56
57 <service android:name="com.gumptech.sdk.PushService" > 57 <service android:name="com.gumptech.sdk.PushService" >
58 </service> 58 </service>
59 59
60 <!-- facebook --> 60 <!-- facebook -->
61 <activity 61 <activity
62 android:name="com.facebook.FacebookActivity" 62 android:name="com.facebook.FacebookActivity"
63 android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" 63 android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
64 android:label="@string/app_name" 64 android:label="@string/app_name"
65 android:theme="@android:style/Theme.Translucent.NoTitleBar" /> 65 android:theme="@android:style/Theme.Translucent.NoTitleBar" />
66 <!-- vk --> 66 <!-- vk -->
67 <activity android:name="com.vk.sdk.VKOpenAuthActivity" /> 67 <!-- <activity android:name="com.vk.sdk.VKOpenAuthActivity" /> -->
68 <activity 68 <!-- <activity -->
69 android:name="com.vk.sdk.VKServiceActivity" 69 <!-- android:name="com.vk.sdk.VKServiceActivity" -->
70 android:label="ServiceActivity" 70 <!-- android:label="ServiceActivity" -->
71 android:theme="@style/VK.Transparent" /> 71 <!-- android:theme="@style/VK.Transparent" /> -->
72 </application> 72 </application>
73 73
74 </manifest> 74 </manifest>
android/GameSDKSample/src/com/gumptech/loginsdk/sample/MainActivity.java
1 package com.gumptech.loginsdk.sample; 1 package com.gumptech.loginsdk.sample;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Context; 4 import android.content.Context;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.text.ClipboardManager; 6 import android.text.ClipboardManager;
7 import android.util.Log; 7 import android.util.Log;
8 import android.view.View; 8 import android.view.View;
9 import android.widget.Button; 9 import android.widget.Button;
10 import android.widget.TextView; 10 import android.widget.TextView;
11 import android.widget.Toast; 11 import android.widget.Toast;
12 12
13 import com.gumptech.sdk.GumpPreference; 13 import com.gumptech.sdk.GumpPreference;
14 import com.gumptech.sdk.GumpSDK; 14 import com.gumptech.sdk.GumpSDK;
15 import com.gumptech.sdk.bean.GumpUser; 15 import com.gumptech.sdk.bean.GumpUser;
16 import com.gumptech.sdk.bean.PurchaseResult; 16 import com.gumptech.sdk.bean.PurchaseResult;
17 import com.gumptech.sdk.callback.InitializeCallback; 17 import com.gumptech.sdk.callback.InitializeCallback;
18 import com.gumptech.sdk.callback.LoginStateListener; 18 import com.gumptech.sdk.callback.LoginStateListener;
19 import com.gumptech.sdk.callback.PurchaseCallback; 19 import com.gumptech.sdk.callback.PurchaseCallback;
20 import com.gumpsdk.wuruid.R; 20 import com.gumpsdk.wuruid.R;
21 21
22 public class MainActivity extends Activity implements PurchaseCallback{ 22 public class MainActivity extends Activity implements PurchaseCallback{
23 23
24 private static final String TAG = "MainActivity"; 24 private static final String TAG = "MainActivity";
25 25
26 private TextView tvVersion; 26 private TextView tvVersion;
27 private TextView userInfo; 27 private TextView userInfo;
28 28
29 private Button btnLoginOrLogout; 29 private Button btnLoginOrLogout;
30 30
31 private String appId = "10022"; 31 private String appId = "10022";
32 private String appKey = "93a27b0bd99bac3e68a440b48aa421ab"; 32 private String appKey = "93a27b0bd99bac3e68a440b48aa421ab";
33 private String sessionKey; 33 private String sessionKey;
34 34
35 @Override 35 @Override
36 protected void onCreate(Bundle savedInstanceState) { 36 protected void onCreate(Bundle savedInstanceState) {
37 super.onCreate(savedInstanceState); 37 super.onCreate(savedInstanceState);
38 setContentView(R.layout.activity_main); 38 setContentView(R.layout.activity_main);
39 tvVersion = (TextView) findViewById(R.id.version); 39 tvVersion = (TextView) findViewById(R.id.version);
40 userInfo = (TextView) findViewById(R.id.user_info); 40 userInfo = (TextView) findViewById(R.id.user_info);
41 btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); 41 btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout);
42 btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { 42 btnLoginOrLogout.setOnClickListener(new View.OnClickListener() {
43 43
44 @Override 44 @Override
45 public void onClick(View v) { 45 public void onClick(View v) {
46 if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) 46 if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0)
47 GumpSDK.start(MainActivity.this); 47 GumpSDK.start(MainActivity.this);
48 else 48 else
49 GumpSDK.logout(MainActivity.this); 49 GumpSDK.logout(MainActivity.this);
50 } 50 }
51 }); 51 });
52 findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { 52 findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() {
53 53
54 @Override 54 @Override
55 public void onClick(View v) { 55 public void onClick(View v) {
56 Bundle payInfo = new Bundle(); 56 Bundle payInfo = new Bundle();
57 payInfo.putString("nick", "thi"); 57 payInfo.putString("nick", "thi");
58 payInfo.putString("product", "元宝"); 58 payInfo.putString("product", "元宝");
59 payInfo.putFloat("amount", 0.0f); 59 payInfo.putFloat("amount", 0.0f);
60 payInfo.putString("extraInfo", "This is demo!"); 60 payInfo.putString("extraInfo", "This is demo!");
61 payInfo.putString("serverId", "100"); 61 payInfo.putString("serverId", "100");
62 payInfo.putString("sessionKey", sessionKey); 62 payInfo.putString("sessionKey", sessionKey);
63 GumpSDK.pay(MainActivity.this, payInfo, MainActivity.this); 63 GumpSDK.pay(MainActivity.this, payInfo, MainActivity.this);
64 } 64 }
65 }); 65 });
66 /** 66 /**
67 * 设置否是开启debug模式 67 * 设置否是开启debug模式
68 */ 68 */
69 GumpSDK.setDebugState(false); 69 GumpSDK.setDebugState(false);
70 /** 70 /**
71 * 设置是否启用facebook登录 71 * 设置是否启用facebook登录
72 */ 72 */
73 GumpSDK.setFBEnable(true); 73 GumpSDK.setFBEnable(false);
74 /** 74 /**
75 * 设置是否启用Vk登录 75 * 设置是否启用Vk登录
76 */ 76 */
77 GumpSDK.setVKEnable(true); 77 GumpSDK.setVKEnable(false);
78 /** 78 /**
79 * 设置屏幕方向 79 * 设置屏幕方向
80 */ 80 */
81 GumpSDK.setScreenLandscape(true); 81 GumpSDK.setScreenLandscape(true);
82 /** 82 /**
83 * 设置用户登录状态监听器 83 * 设置用户登录状态监听器
84 */ 84 */
85 GumpSDK.setUserStateListener(new LoginStateListener() { 85 GumpSDK.setUserStateListener(new LoginStateListener() {
86 @Override 86 @Override
87 public void onLoginSuccess(GumpUser user) { 87 public void onLoginSuccess(GumpUser user) {
88 ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); 88 ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
89 cm.setText(user.getSessionKey()); 89 cm.setText(user.getSessionKey());
90 sessionKey = user.getSessionKey(); 90 sessionKey = user.getSessionKey();
91 String userType=null; 91 String userType=null;
92 switch(user.getAccountType()){ 92 switch(user.getAccountType()){
93 case GumpPreference.ACCOUNT_TYPE_FB: 93 case GumpPreference.ACCOUNT_TYPE_FB:
94 userType = "Facebook登录"; 94 userType = "Facebook登录";
95 break; 95 break;
96 case GumpPreference.ACCOUNT_TYPE_QUICK_REG: 96 case GumpPreference.ACCOUNT_TYPE_QUICK_REG:
97 userType = "快速登录"; 97 userType = "快速登录";
98 break; 98 break;
99 case GumpPreference.ACCOUNT_TYPE_REG: 99 case GumpPreference.ACCOUNT_TYPE_REG:
100 userType = "gump注册用户"; 100 userType = "gump注册用户";
101 break; 101 break;
102 case GumpPreference.ACCOUNT_TYPE_VK: 102 case GumpPreference.ACCOUNT_TYPE_VK:
103 userType = "vk登录"; 103 userType = "vk登录";
104 break; 104 break;
105 } 105 }
106 userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType()+") "+userType + "\n sessionKey:" + user.getSessionKey()); 106 userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType()+") "+userType + "\n sessionKey:" + user.getSessionKey());
107 btnLoginOrLogout.setText("Logout"); 107 btnLoginOrLogout.setText("Logout");
108 btnLoginOrLogout.setTag(1); 108 btnLoginOrLogout.setTag(1);
109 } 109 }
110 110
111 @Override 111 @Override
112 public void onLoginFailed(int code, String msg) { 112 public void onLoginFailed(int code, String msg) {
113 userInfo.setText(msg); 113 userInfo.setText(msg);
114 Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); 114 Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show();
115 } 115 }
116 116
117 @Override 117 @Override
118 public void onLoginCanceled() { 118 public void onLoginCanceled() {
119 Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); 119 Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show();
120 } 120 }
121 121
122 @Override 122 @Override
123 public void onLogout() { 123 public void onLogout() {
124 btnLoginOrLogout.setText("Login"); 124 btnLoginOrLogout.setText("Login");
125 btnLoginOrLogout.setTag(0); 125 btnLoginOrLogout.setTag(0);
126 userInfo.setText("User is logout"); 126 userInfo.setText("User is logout");
127 } 127 }
128 }); 128 });
129 /** 129 /**
130 * 初始化sdk 130 * 初始化sdk
131 */ 131 */
132 GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { 132 GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() {
133 @Override 133 @Override
134 public void initComplete(int result) { 134 public void initComplete(int result) {
135 if (result == GumpSDK.CODE.OK) { 135 if (result == GumpSDK.CODE.OK) {
136 btnLoginOrLogout.setEnabled(true); 136 btnLoginOrLogout.setEnabled(true);
137 } 137 }
138 } 138 }
139 }); 139 });
140 140
141 141
142 tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); 142 tvVersion.setText("SDK Version:" + GumpSDK.getVersion());
143 } 143 }
144 144
145 @Override 145 @Override
146 public void onPurchaseCompleted(PurchaseResult result) { 146 public void onPurchaseCompleted(PurchaseResult result) {
147 Log.i(TAG,"purchase completed"); 147 Log.i(TAG,"purchase completed");
148 } 148 }
149 149
150 @Override 150 @Override
151 public void onPurchaseError(int code, String msg) { 151 public void onPurchaseError(int code, String msg) {
152 Log.i(TAG,"purchase error"); 152 Log.i(TAG,"purchase error");
153 } 153 }
154 154
155 @Override 155 @Override
156 public void onPurchaseCanceled() { 156 public void onPurchaseCanceled() {
157 Log.i(TAG,"purchase canceled"); 157 Log.i(TAG,"purchase canceled");
158 } 158 }
159 } 159 }
160 160