Commit 83e53e405d2e05e59d72d2de14c124b1c1983c37

Authored by 赵康
Exists in master

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

Showing 10 changed files Side-by-side Diff

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