Commit 83e53e405d2e05e59d72d2de14c124b1c1983c37

Authored by 赵康
Exists in master

Merge branch 'master' of http://git.letsgame.mobi/document/gumptech-document

Showing 10 changed files Inline Diff

android/GameSDKRelease/.classpath
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <classpath> 2 <classpath>
3 <classpathentry kind="src" path="src"/>
4 <classpathentry kind="src" path="gen"/> 3 <classpathentry kind="src" path="gen"/>
5 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> 4 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> 5 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> 6 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
8 <classpathentry kind="output" path="bin/classes"/> 7 <classpathentry kind="output" path="bin/classes"/>
9 </classpath> 8 </classpath>
10 9
android/GameSDKRelease/.gitignore
File was created 1 /bin/
2 /gen/
3
android/GameSDKRelease/libs/GameSDK2.4.0_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-19 14 target=android-18
15 android.library=true 15 android.library=true
16 16
android/GameSDKRelease/res/drawable-hdpi/logo.png

4.1 KB

android/GameSDKRelease/res/drawable-mdpi/logo.png

3.49 KB

android/GameSDKRelease/res/drawable-xhdpi/logo.png

6.46 KB

android/GameSDKRelease/res/layout/title.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <RelativeLayout 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="45dp" 4 android:layout_height="45dp"
5 android:background="@drawable/dialog_bg" > 5 android:background="@drawable/dialog_bg" >
6 6
7 <ImageView 7 <ImageView
8 android:id="@+id/btn_back" 8 android:id="@+id/btn_back"
9 android:layout_width="wrap_content" 9 android:layout_width="wrap_content"
10 android:layout_height="match_parent" 10 android:layout_height="match_parent"
11 android:layout_alignParentLeft="true" 11 android:layout_alignParentLeft="true"
12 android:layout_centerVertical="true" 12 android:layout_centerVertical="true"
13 android:paddingLeft="10dp" 13 android:paddingLeft="10dp"
14 android:paddingRight="10dp" 14 android:paddingRight="10dp"
15 android:src="@drawable/ic_back_dark" /> 15 android:src="@drawable/ic_back_dark" />
16 16
17 <TextView 17 <TextView
18 android:id="@+id/up_txt" 18 android:id="@+id/up_txt"
19 android:layout_width="wrap_content" 19 android:layout_width="wrap_content"
20 android:layout_height="wrap_content" 20 android:layout_height="wrap_content"
21 android:layout_centerVertical="true" 21 android:layout_centerVertical="true"
22 android:layout_toRightOf="@id/btn_back" 22 android:layout_toRightOf="@id/btn_back"
23 android:textColor="@color/black_text" 23 android:textColor="@color/black_text"
24 android:textSize="18sp" 24 android:textSize="18sp"
25 android:visibility="gone" /> 25 android:visibility="gone" />
26 26
27 <ImageView 27 <TextView
28 android:id="@+id/log" 28 android:id="@+id/title"
29 android:layout_width="wrap_content" 29 android:layout_width="wrap_content"
30 android:layout_height="30dp" 30 android:layout_height="wrap_content"
31 android:layout_centerInParent="true" 31 android:layout_centerInParent="true"
32 android:src="@drawable/logo" /> 32 android:textColor="@android:color/black"
33 33 android:textSize="18sp" />
34 <TextView 34
35 android:id="@+id/title" 35 <ImageView
36 android:layout_width="wrap_content" 36 android:id="@+id/btn_cancel"
37 android:layout_height="wrap_content" 37 android:layout_width="wrap_content"
38 android:layout_centerInParent="true" 38 android:layout_height="match_parent"
39 android:textColor="@android:color/black" 39 android:layout_alignParentRight="true"
40 android:textSize="18sp" /> 40 android:layout_centerVertical="true"
41 41 android:padding="10dp"
42 <ImageView 42 android:src="@drawable/ic_cancel_dark" />
43 android:id="@+id/btn_cancel" 43
44 android:layout_width="wrap_content" 44 <View
45 android:layout_height="match_parent" 45 android:layout_width="fill_parent"
46 android:layout_alignParentRight="true" 46 android:layout_height="1dp"
47 android:layout_centerVertical="true" 47 android:layout_alignParentBottom="true"
48 android:padding="10dp" 48 android:background="@color/line" />
49 android:src="@drawable/ic_cancel_dark" /> 49
50
51 <View
52 android:layout_width="fill_parent"
53 android:layout_height="1dp"
54 android:layout_alignParentBottom="true"
55 android:background="@color/line" />
56
57 </RelativeLayout> 50 </RelativeLayout>
android/GameSDKSample/.gitignore
File was created 1 /gen/
2 /bin/
3
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.Intent; 4 import android.content.Intent;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.util.Log; 6 import android.util.Log;
7 import android.view.View; 7 import android.view.View;
8 import android.widget.Button; 8 import android.widget.Button;
9 import android.widget.TextView; 9 import android.widget.TextView;
10 import android.widget.Toast; 10 import android.widget.Toast;
11 11
12 import com.gumptech.sdk.GumpSDK; 12 import com.gumptech.sdk.GumpSDK;
13 13
14 public class MainActivity extends Activity implements GumpSDK.Callback { 14 public class MainActivity extends Activity implements GumpSDK.Callback {
15 15
16 private TextView tvVersion; 16 private TextView tvVersion;
17 private TextView userInfo; 17 private TextView userInfo;
18 18
19 private Button btnLoginOrLogout; 19 private Button btnLoginOrLogout;
20 20
21 private String appId = "10009"; 21 private String appId = "10022";
22 22
23 @Override 23 @Override
24 protected void onCreate(Bundle savedInstanceState) { 24 protected void onCreate(Bundle savedInstanceState) {
25 super.onCreate(savedInstanceState); 25 super.onCreate(savedInstanceState);
26 setContentView(R.layout.activity_main); 26 setContentView(R.layout.activity_main);
27 tvVersion = (TextView) findViewById(R.id.version); 27 tvVersion = (TextView) findViewById(R.id.version);
28 userInfo = (TextView) findViewById(R.id.user_info); 28 userInfo = (TextView) findViewById(R.id.user_info);
29 btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); 29 btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout);
30 btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { 30 btnLoginOrLogout.setOnClickListener(new View.OnClickListener() {
31 31
32 @Override 32 @Override
33 public void onClick(View v) { 33 public void onClick(View v) {
34 if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) 34 if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0)
35 GumpSDK.start(MainActivity.this); 35 GumpSDK.start(MainActivity.this);
36 else 36 else
37 GumpSDK.logout(MainActivity.this, MainActivity.this); 37 GumpSDK.logout(MainActivity.this, MainActivity.this);
38 } 38 }
39 }); 39 });
40 findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { 40 findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() {
41 41
42 @Override 42 @Override
43 public void onClick(View v) { 43 public void onClick(View v) {
44 Bundle payInfo = new Bundle(); 44 Bundle payInfo = new Bundle();
45 payInfo.putString("nick", "thi"); 45 payInfo.putString("nick", "thi");
46 payInfo.putString("product", "元宝"); 46 payInfo.putString("product", "元宝");
47 payInfo.putFloat("amount", 0.0f); 47 payInfo.putFloat("amount", 0.0f);
48 payInfo.putString("extraInfo", "This is demo!"); 48 payInfo.putString("extraInfo", "This is demo!");
49 payInfo.putString("serverId", "B4003"); 49 payInfo.putString("serverId", "B4003");
50 payInfo.putString("roleId", "10010"); 50 payInfo.putString("roleId", "10010");
51 GumpSDK.pay(MainActivity.this, payInfo); 51 GumpSDK.pay(MainActivity.this, payInfo);
52 } 52 }
53 }); 53 });
54 GumpSDK.init(getApplicationContext(), appId, "483d8df877b31405c1e8fe4247f02d86", "301596413332339", "1000"); 54 GumpSDK.init(getApplicationContext(), appId, "93a27b0bd99bac3e68a440b48aa421ab", "1000");
55 tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); 55 tvVersion.setText("SDK Version:" + GumpSDK.getVersion());
56 GumpSDK.start(this); 56 GumpSDK.start(this);
57 } 57 }
58 58
59 @Override 59 @Override
60 protected void onActivityResult(int requestCode, int resultCode, Intent data) { 60 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
61 Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode); 61 Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode);
62 if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) { 62 if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) {
63 if (resultCode == RESULT_OK) { 63 if (resultCode == RESULT_OK) {
64 String uid = data.getStringExtra("userId"); 64 String uid = data.getStringExtra("userId");
65 int accountType = data.getIntExtra("accountType", -1); 65 int accountType = data.getIntExtra("accountType", -1);
66 String sessionkey = data.getStringExtra("sessionKey"); 66 String sessionkey = data.getStringExtra("sessionKey");
67 userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey); 67 userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey);
68 btnLoginOrLogout.setText("Logout"); 68 btnLoginOrLogout.setText("Logout");
69 btnLoginOrLogout.setTag(1); 69 btnLoginOrLogout.setTag(1);
70 } else if (resultCode == RESULT_CANCELED) { 70 } else if (resultCode == RESULT_CANCELED) {
71 Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); 71 Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show();
72 } 72 }
73 } else if (requestCode == GumpSDK.PAY_REQUEST_CODE) { 73 } else if (requestCode == GumpSDK.PAY_REQUEST_CODE) {
74 if (resultCode == RESULT_OK) { 74 if (resultCode == RESULT_OK) {
75 int code = data.getIntExtra("code", -1); 75 int code = data.getIntExtra("code", -1);
76 String msg = data.getStringExtra("msg"); 76 String msg = data.getStringExtra("msg");
77 String orderId = data.getStringExtra("orderId"); 77 String orderId = data.getStringExtra("orderId");
78 String extraInfo = data.getStringExtra("extraInfo"); 78 String extraInfo = data.getStringExtra("extraInfo");
79 Toast.makeText(this, "pay result: " + code + "," + msg + ",orderId:" + orderId + ",extraInfo:" + extraInfo, Toast.LENGTH_SHORT).show(); 79 Toast.makeText(this, "pay result: " + code + "," + msg + ",orderId:" + orderId + ",extraInfo:" + extraInfo, Toast.LENGTH_SHORT).show();
80 } else if (resultCode == RESULT_CANCELED) { 80 } else if (resultCode == RESULT_CANCELED) {
81 Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); 81 Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show();
82 } 82 }
83 } 83 }
84 super.onActivityResult(requestCode, resultCode, data); 84 super.onActivityResult(requestCode, resultCode, data);
85 } 85 }
86 86
87 @Override 87 @Override
88 public void onLogout() { 88 public void onLogout() {
89 btnLoginOrLogout.setText("Login"); 89 btnLoginOrLogout.setText("Login");
90 btnLoginOrLogout.setTag(0); 90 btnLoginOrLogout.setTag(0);
91 userInfo.append("\n User is logout"); 91 userInfo.append("\n User is logout");
92 } 92 }
93 93
94 } 94 }
95 95