Commit 3b0b01ef6f0430a27f104703fa8616c6858fbfbd
1 parent
45cb1782b3
Exists in
master
modify entrance webview function for FB login\nmodify demo UI
Showing 4 changed files with 29 additions and 15 deletions Inline Diff
android/GameSDKRelease/libs/GameSDK2.4.0_proguard.jar
No preview for this file type
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.gumptech.loginsdk.sample" | 3 | package="com.gumptech.loginsdk.sample" |
4 | android:versionCode="4" | 4 | android:versionCode="4" |
5 | android:versionName="1.4" > | 5 | android:versionName="1.4" > |
6 | 6 | ||
7 | <uses-sdk | 7 | <uses-sdk |
8 | android:minSdkVersion="8" | 8 | android:minSdkVersion="8" |
9 | android:targetSdkVersion="8" /> | 9 | android:targetSdkVersion="8" /> |
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 | <!-- for card.io card scanning --> | 20 | <!-- for card.io card scanning --> |
21 | <uses-permission android:name="android.permission.CAMERA" /> | 21 | <uses-permission android:name="android.permission.CAMERA" /> |
22 | <uses-permission android:name="android.permission.VIBRATE" /> | 22 | <uses-permission android:name="android.permission.VIBRATE" /> |
23 | <uses-permission android:name="android.permission.SEND_SMS"/> | 23 | <uses-permission android:name="android.permission.SEND_SMS" /> |
24 | <!-- coda --> | 24 | <!-- coda --> |
25 | <uses-permission android:name="android.permission.RECEIVE_SMS" /> | 25 | <uses-permission android:name="android.permission.RECEIVE_SMS" /> |
26 | <uses-permission android:name="android.permission.READ_SMS" /> | 26 | <uses-permission android:name="android.permission.READ_SMS" /> |
27 | <uses-permission android:name="android.permission.WRITE_SMS" /> | 27 | <uses-permission android:name="android.permission.WRITE_SMS" /> |
28 | <uses-permission android:name="android.permission.GET_TASKS" /> | 28 | <uses-permission android:name="android.permission.GET_TASKS" /> |
29 | 29 | ||
30 | <uses-feature | 30 | <uses-feature |
31 | android:name="android.hardware.camera" | 31 | android:name="android.hardware.camera" |
32 | android:required="false" /> | 32 | android:required="false" /> |
33 | <uses-feature | 33 | <uses-feature |
34 | android:name="android.hardware.camera.autofocus" | 34 | android:name="android.hardware.camera.autofocus" |
35 | android:required="false" /> | 35 | android:required="false" /> |
36 | <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> | 36 | <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> |
37 | <uses-permission android:name="com.android.vending.BILLING" /> | 37 | <uses-permission android:name="com.android.vending.BILLING" /> |
38 | 38 | ||
39 | <application | 39 | <application |
40 | android:allowBackup="true" | 40 | android:allowBackup="true" |
41 | android:icon="@drawable/ic_launcher" | 41 | android:icon="@drawable/ic_launcher" |
42 | android:label="@string/app_name" > | 42 | android:label="@string/app_name" > |
43 | <activity | 43 | <activity |
44 | android:name="com.gumptech.loginsdk.sample.MainActivity" | 44 | android:name="com.gumptech.loginsdk.sample.MainActivity" |
45 | android:configChanges="navigation|orientation|keyboard" | 45 | android:configChanges="navigation|orientation|keyboard" |
46 | android:label="@string/app_name" | 46 | android:label="@string/app_name" |
47 | android:screenOrientation="portrait" > | 47 | android:screenOrientation="portrait" > |
48 | <intent-filter> | 48 | <intent-filter> |
49 | <action android:name="android.intent.action.MAIN" /> | 49 | <action android:name="android.intent.action.MAIN" /> |
50 | 50 | ||
51 | <category android:name="android.intent.category.LAUNCHER" /> | 51 | <category android:name="android.intent.category.LAUNCHER" /> |
52 | </intent-filter> | 52 | </intent-filter> |
53 | </activity> | 53 | </activity> |
54 | <activity | 54 | <activity |
55 | android:name="com.gumptech.sdk.ContainerActivity" | 55 | android:name="com.gumptech.sdk.ContainerActivity" |
56 | android:configChanges="orientation|screenLayout" | 56 | android:configChanges="orientation|screenLayout" |
57 | android:screenOrientation="portrait" | 57 | android:screenOrientation="portrait" |
58 | android:theme="@style/container_dialog" > | 58 | android:theme="@style/container_dialog" > |
59 | </activity> | 59 | </activity> |
60 | <activity | 60 | <activity |
61 | android:name="com.facebook.LoginActivity" | 61 | android:name="com.facebook.LoginActivity" |
62 | android:theme="@android:style/Theme.Translucent.NoTitleBar" > | 62 | android:theme="@android:style/Theme.Translucent.NoTitleBar" > |
63 | </activity> | 63 | </activity> |
64 | <activity | 64 | <activity |
65 | android:name="com.gumptech.sdk.PaymentActivity" | 65 | android:name="com.gumptech.sdk.PaymentActivity" |
66 | android:configChanges="orientation|screenLayout" | 66 | android:configChanges="orientation|screenLayout" |
67 | android:theme="@android:style/Theme.Translucent.NoTitleBar" > | 67 | android:theme="@android:style/Theme.Translucent.NoTitleBar" > |
68 | </activity> | 68 | </activity> |
69 | <activity | 69 | <activity |
70 | android:name="com.gumptech.sdk.ExchangeWindow" | 70 | android:name="com.gumptech.sdk.ExchangeWindow" |
71 | android:configChanges="orientation|screenLayout" | 71 | android:configChanges="orientation|screenLayout" |
72 | android:theme="@style/ex_win" > | 72 | android:theme="@style/ex_win" > |
73 | </activity> | 73 | </activity> |
74 | <!-- paypal --> | 74 | <!-- paypal --> |
75 | <service | 75 | <service |
76 | android:name="com.paypal.android.sdk.payments.PayPalService" | 76 | android:name="com.paypal.android.sdk.payments.PayPalService" |
77 | android:exported="false" /> | 77 | android:exported="false" /> |
78 | 78 | ||
79 | <activity android:name="com.paypal.android.sdk.payments.PaymentActivity" /> | 79 | <activity android:name="com.paypal.android.sdk.payments.PaymentActivity" /> |
80 | <activity android:name="com.paypal.android.sdk.payments.LoginActivity" /> | 80 | <activity android:name="com.paypal.android.sdk.payments.LoginActivity" /> |
81 | <activity android:name="com.paypal.android.sdk.payments.PaymentMethodActivity" /> | 81 | <activity android:name="com.paypal.android.sdk.payments.PaymentMethodActivity" /> |
82 | <activity android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity" /> | 82 | <activity android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity" /> |
83 | <activity android:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity" /> | 83 | <activity android:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity" /> |
84 | <activity android:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity" /> | 84 | <activity android:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity" /> |
85 | <activity android:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity" /> | 85 | <activity android:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity" /> |
86 | <activity | 86 | <activity |
87 | android:name="io.card.payment.CardIOActivity" | 87 | android:name="io.card.payment.CardIOActivity" |
88 | android:configChanges="keyboardHidden|orientation" /> | 88 | android:configChanges="keyboardHidden|orientation" /> |
89 | <activity android:name="io.card.payment.DataEntryActivity" /> | 89 | <activity android:name="io.card.payment.DataEntryActivity" /> |
90 | <activity | 90 | <activity |
91 | android:name="com.android.easy2pay.Easy2PayScreen" | 91 | android:name="com.android.easy2pay.Easy2PayScreen" |
92 | android:theme="@android:style/Theme.Translucent.NoTitleBar" /> | 92 | android:theme="@android:style/Theme.Translucent.NoTitleBar" /> |
93 | <activity | 93 | <activity |
94 | android:name="com.codapayments.sdk.pay.CodaWeb" | 94 | android:name="com.codapayments.sdk.pay.CodaWeb" |
95 | android:alwaysRetainTaskState="true" | 95 | android:alwaysRetainTaskState="true" |
96 | android:configChanges="orientation|screenSize" | 96 | android:configChanges="orientation|screenSize" |
97 | android:screenOrientation="unspecified" > | 97 | android:screenOrientation="unspecified" > |
98 | </activity> | 98 | </activity> |
99 | 99 | ||
100 | <receiver | 100 | <receiver |
101 | android:name="com.codapayments.sdk.message.PendingTxnReceiver" | 101 | android:name="com.codapayments.sdk.message.PendingTxnReceiver" |
102 | android:enabled="true" > | 102 | android:enabled="true" > |
103 | </receiver> | 103 | </receiver> |
104 | </application> | 104 | </application> |
105 | 105 | ||
106 | </manifest> | 106 | </manifest> |
android/GameSDKSample/res/layout/activity_main.xml
1 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 1 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
2 | android:layout_width="match_parent" | 2 | android:layout_width="match_parent" |
3 | android:layout_height="match_parent" | 3 | android:layout_height="match_parent" |
4 | android:background="@android:color/white" | 4 | android:background="@android:color/white" |
5 | android:orientation="vertical" > | 5 | android:orientation="vertical" > |
6 | 6 | ||
7 | <TextView | 7 | <TextView |
8 | android:id="@+id/version" | ||
9 | android:layout_width="wrap_content" | ||
10 | android:layout_height="wrap_content" | ||
11 | android:layout_gravity="center_horizontal" /> | ||
12 | |||
13 | <TextView | ||
8 | android:id="@+id/user_info" | 14 | android:id="@+id/user_info" |
9 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
10 | android:layout_height="wrap_content" /> | 16 | android:layout_height="wrap_content" |
17 | android:textColor="@android:color/black" /> | ||
11 | 18 | ||
12 | <Button | 19 | <Button |
13 | android:id="@+id/logout" | 20 | android:id="@+id/login_or_logout" |
14 | android:layout_width="wrap_content" | 21 | android:layout_width="wrap_content" |
15 | android:layout_height="wrap_content" | 22 | android:layout_height="wrap_content" |
16 | android:text="logout" | 23 | android:text="Login" /> |
17 | android:visibility="gone" /> | ||
18 | 24 | ||
19 | <Button | 25 | <Button |
20 | android:id="@+id/pay" | 26 | android:id="@+id/pay" |
21 | android:layout_width="wrap_content" | 27 | android:layout_width="wrap_content" |
22 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
23 | android:text="pay" /> | 29 | android:text="pay" /> |
24 | 30 |
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 userInfo; | 17 | private TextView userInfo; |
17 | 18 | ||
18 | private Button btnLogout; | 19 | private Button btnLoginOrLogout; |
19 | 20 | ||
20 | private String appId = "10009"; | 21 | private String appId = "10009"; |
21 | 22 | ||
22 | @Override | 23 | @Override |
23 | protected void onCreate(Bundle savedInstanceState) { | 24 | protected void onCreate(Bundle savedInstanceState) { |
24 | super.onCreate(savedInstanceState); | 25 | super.onCreate(savedInstanceState); |
25 | setContentView(R.layout.activity_main); | 26 | setContentView(R.layout.activity_main); |
27 | tvVersion = (TextView) findViewById(R.id.version); | ||
26 | userInfo = (TextView) findViewById(R.id.user_info); | 28 | userInfo = (TextView) findViewById(R.id.user_info); |
27 | btnLogout = (Button) findViewById(R.id.logout); | 29 | btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); |
28 | btnLogout.setOnClickListener(new View.OnClickListener() { | 30 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { |
29 | 31 | ||
30 | @Override | 32 | @Override |
31 | public void onClick(View v) { | 33 | public void onClick(View v) { |
34 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) | ||
35 | GumpSDK.start(MainActivity.this); | ||
36 | else | ||
32 | GumpSDK.logout(MainActivity.this, MainActivity.this); | 37 | GumpSDK.logout(MainActivity.this, MainActivity.this); |
33 | } | 38 | } |
34 | }); | 39 | }); |
35 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { | 40 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { |
36 | 41 | ||
37 | @Override | 42 | @Override |
38 | public void onClick(View v) { | 43 | public void onClick(View v) { |
39 | Bundle payInfo = new Bundle(); | 44 | Bundle payInfo = new Bundle(); |
40 | payInfo.putString("nick", "thi"); | 45 | payInfo.putString("nick", "thi"); |
41 | payInfo.putString("product", "元宝"); | 46 | payInfo.putString("product", "元宝"); |
42 | payInfo.putFloat("amount", 0.0f); | 47 | payInfo.putFloat("amount", 0.0f); |
43 | payInfo.putString("extraInfo", "This is demo!"); | 48 | payInfo.putString("extraInfo", "This is demo!"); |
44 | payInfo.putString("serverId", "B4003"); | 49 | payInfo.putString("serverId", "B4003"); |
45 | payInfo.putString("roleId", "10010"); | 50 | payInfo.putString("roleId", "10010"); |
46 | GumpSDK.pay(MainActivity.this, payInfo); | 51 | GumpSDK.pay(MainActivity.this, payInfo); |
47 | } | 52 | } |
48 | }); | 53 | }); |
49 | GumpSDK.init(getApplicationContext(), appId, "483d8df877b31405c1e8fe4247f02d86", "301596413332339", "1000"); | 54 | GumpSDK.init(getApplicationContext(), appId, "483d8df877b31405c1e8fe4247f02d86", "301596413332339", "1000"); |
55 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); | ||
50 | GumpSDK.start(this); | 56 | GumpSDK.start(this); |
51 | } | 57 | } |
52 | 58 | ||
53 | @Override | 59 | @Override |
54 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 60 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
55 | Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode); | 61 | Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode); |
56 | if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) { | 62 | if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) { |
57 | if (resultCode == RESULT_OK) { | 63 | if (resultCode == RESULT_OK) { |
58 | String uid = data.getStringExtra("userId"); | 64 | String uid = data.getStringExtra("userId"); |
59 | int accountType = data.getIntExtra("accountType", -1); | 65 | int accountType = data.getIntExtra("accountType", -1); |
60 | String sessionkey = data.getStringExtra("sessionKey"); | 66 | String sessionkey = data.getStringExtra("sessionKey"); |
61 | userInfo.setText("userid:" + uid + ",accountType:" + accountType + ",sessionKey:" + sessionkey); | 67 | userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey); |
62 | btnLogout.setVisibility(View.VISIBLE); | 68 | btnLoginOrLogout.setText("Logout"); |
69 | btnLoginOrLogout.setTag(1); | ||
63 | } else if (resultCode == RESULT_CANCELED) { | 70 | } else if (resultCode == RESULT_CANCELED) { |
64 | Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); | 71 | Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); |
65 | } | 72 | } |
66 | } else if (requestCode == GumpSDK.PAY_REQUEST_CODE) { | 73 | } else if (requestCode == GumpSDK.PAY_REQUEST_CODE) { |
67 | if (resultCode == RESULT_OK) { | 74 | if (resultCode == RESULT_OK) { |
68 | int code = data.getIntExtra("code", -1); | 75 | int code = data.getIntExtra("code", -1); |
69 | String msg = data.getStringExtra("msg"); | 76 | String msg = data.getStringExtra("msg"); |
70 | String orderId = data.getStringExtra("orderId"); | 77 | String orderId = data.getStringExtra("orderId"); |
71 | String extraInfo = data.getStringExtra("extraInfo"); | 78 | String extraInfo = data.getStringExtra("extraInfo"); |
72 | 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(); |
73 | } else if (resultCode == RESULT_CANCELED) { | 80 | } else if (resultCode == RESULT_CANCELED) { |
74 | Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); | 81 | Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); |
75 | } | 82 | } |
76 | } | 83 | } |
77 | super.onActivityResult(requestCode, resultCode, data); | 84 | super.onActivityResult(requestCode, resultCode, data); |
78 | } | 85 | } |
79 | 86 | ||
80 | @Override | 87 | @Override |
81 | public void onLogout() { | 88 | public void onLogout() { |
82 | btnLogout.setVisibility(View.GONE); | 89 | btnLoginOrLogout.setText("Login"); |
83 | userInfo.append(" is logout"); | 90 | btnLoginOrLogout.setTag(0); |
91 | userInfo.append("\n User is logout"); | ||
84 | } | 92 | } |
85 | 93 | ||
86 | } | 94 | } |
87 | 95 |