Commit dd679641e9ed4b3dae2250db84cf3992954ea518

Authored by 赵康
1 parent 83e53e405d
Exists in master

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

Showing 7 changed files with 151 additions and 143 deletions Side-by-side 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"?>
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   -
  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:visibility="gone" />
  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 +
50 57 </RelativeLayout>
51 58 \ No newline at end of file
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 = "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   -}
  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 + GumpSDK.setLogoShow(true);
  56 + tvVersion.setText("SDK Version:" + GumpSDK.getVersion());
  57 + GumpSDK.start(this);
  58 + }
  59 +
  60 + @Override
  61 + protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  62 + Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode);
  63 + if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) {
  64 + if (resultCode == RESULT_OK) {
  65 + String uid = data.getStringExtra("userId");
  66 + int accountType = data.getIntExtra("accountType", -1);
  67 + String sessionkey = data.getStringExtra("sessionKey");
  68 + userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey);
  69 + btnLoginOrLogout.setText("Logout");
  70 + btnLoginOrLogout.setTag(1);
  71 + } else if (resultCode == RESULT_CANCELED) {
  72 + Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show();
  73 + }
  74 + } else if (requestCode == GumpSDK.PAY_REQUEST_CODE) {
  75 + if (resultCode == RESULT_OK) {
  76 + int code = data.getIntExtra("code", -1);
  77 + String msg = data.getStringExtra("msg");
  78 + String orderId = data.getStringExtra("orderId");
  79 + String extraInfo = data.getStringExtra("extraInfo");
  80 + Toast.makeText(this, "pay result: " + code + "," + msg + ",orderId:" + orderId + ",extraInfo:" + extraInfo, Toast.LENGTH_SHORT).show();
  81 + } else if (resultCode == RESULT_CANCELED) {
  82 + Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show();
  83 + }
  84 + }
  85 + super.onActivityResult(requestCode, resultCode, data);
  86 + }
  87 +
  88 + @Override
  89 + public void onLogout() {
  90 + btnLoginOrLogout.setText("Login");
  91 + btnLoginOrLogout.setTag(0);
  92 + userInfo.append("\n User is logout");
  93 + }
  94 +
  95 +}