Commit dd679641e9ed4b3dae2250db84cf3992954ea518

Authored by 赵康
1 parent 83e53e405d
Exists in master

增加gump logo,设置为logo显示可控

Showing 7 changed files with 151 additions and 143 deletions Inline Diff

android/GameSDKRelease/libs/GameSDK2.4.0_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/GameSDK_v2.4.0_proguard.jar
No preview for this file type
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 <TextView 27 <ImageView
28 android:id="@+id/title" 28 android:id="@+id/log"
29 android:layout_width="wrap_content" 29 android:layout_width="wrap_content"
30 android:layout_height="wrap_content" 30 android:layout_height="30dp"
31 android:layout_centerInParent="true" 31 android:layout_centerInParent="true"
32 android:textColor="@android:color/black" 32 android:visibility="gone" />
33 android:textSize="18sp" /> 33
34 34 <TextView
35 <ImageView 35 android:id="@+id/title"
36 android:id="@+id/btn_cancel" 36 android:layout_width="wrap_content"
37 android:layout_width="wrap_content" 37 android:layout_height="wrap_content"
38 android:layout_height="match_parent" 38 android:layout_centerInParent="true"
39 android:layout_alignParentRight="true" 39 android:textColor="@android:color/black"
40 android:layout_centerVertical="true" 40 android:textSize="18sp" />
41 android:padding="10dp" 41
42 android:src="@drawable/ic_cancel_dark" /> 42 <ImageView
43 43 android:id="@+id/btn_cancel"
44 <View 44 android:layout_width="wrap_content"
45 android:layout_width="fill_parent" 45 android:layout_height="match_parent"
46 android:layout_height="1dp" 46 android:layout_alignParentRight="true"
47 android:layout_alignParentBottom="true" 47 android:layout_centerVertical="true"
48 android:background="@color/line" /> 48 android:padding="10dp"
49 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
50 </RelativeLayout> 57 </RelativeLayout>
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 = "10022"; 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, "93a27b0bd99bac3e68a440b48aa421ab", "1000"); 54 GumpSDK.init(getApplicationContext(), appId, "93a27b0bd99bac3e68a440b48aa421ab", "1000");
55 tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); 55 GumpSDK.setLogoShow(true);
56 GumpSDK.start(this); 56 tvVersion.setText("SDK Version:" + GumpSDK.getVersion());
57 } 57 GumpSDK.start(this);
58 58 }
59 @Override 59
60 protected void onActivityResult(int requestCode, int resultCode, Intent data) { 60 @Override
61 Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode); 61 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
62 if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) { 62 Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode);
63 if (resultCode == RESULT_OK) { 63 if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) {
64 String uid = data.getStringExtra("userId"); 64 if (resultCode == RESULT_OK) {
65 int accountType = data.getIntExtra("accountType", -1); 65 String uid = data.getStringExtra("userId");
66 String sessionkey = data.getStringExtra("sessionKey"); 66 int accountType = data.getIntExtra("accountType", -1);
67 userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey); 67 String sessionkey = data.getStringExtra("sessionKey");
68 btnLoginOrLogout.setText("Logout"); 68 userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey);
69 btnLoginOrLogout.setTag(1); 69 btnLoginOrLogout.setText("Logout");
70 } else if (resultCode == RESULT_CANCELED) { 70 btnLoginOrLogout.setTag(1);
71 Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); 71 } else if (resultCode == RESULT_CANCELED) {
72 } 72 Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show();
73 } else if (requestCode == GumpSDK.PAY_REQUEST_CODE) { 73 }
74 if (resultCode == RESULT_OK) { 74 } else if (requestCode == GumpSDK.PAY_REQUEST_CODE) {
75 int code = data.getIntExtra("code", -1); 75 if (resultCode == RESULT_OK) {
76 String msg = data.getStringExtra("msg"); 76 int code = data.getIntExtra("code", -1);
77 String orderId = data.getStringExtra("orderId"); 77 String msg = data.getStringExtra("msg");
78 String extraInfo = data.getStringExtra("extraInfo"); 78 String orderId = data.getStringExtra("orderId");
79 Toast.makeText(this, "pay result: " + code + "," + msg + ",orderId:" + orderId + ",extraInfo:" + extraInfo, Toast.LENGTH_SHORT).show(); 79 String extraInfo = data.getStringExtra("extraInfo");
80 } else if (resultCode == RESULT_CANCELED) { 80 Toast.makeText(this, "pay result: " + code + "," + msg + ",orderId:" + orderId + ",extraInfo:" + extraInfo, Toast.LENGTH_SHORT).show();
81 Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); 81 } else if (resultCode == RESULT_CANCELED) {
82 } 82 Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show();
83 } 83 }
84 super.onActivityResult(requestCode, resultCode, data); 84 }
85 } 85 super.onActivityResult(requestCode, resultCode, data);
86 86 }
87 @Override 87
88 public void onLogout() { 88 @Override
89 btnLoginOrLogout.setText("Login"); 89 public void onLogout() {
90 btnLoginOrLogout.setTag(0); 90 btnLoginOrLogout.setText("Login");
91 userInfo.append("\n User is logout"); 91 btnLoginOrLogout.setTag(0);
92 } 92 userInfo.append("\n User is logout");
93 93 }
94 } 94
95 }
95 96