Commit c0425350121eb598035c5fc1293ca3229eb26e1a
1 parent
b0ad9130e1
Exists in
master
tag:release3.3.3_final
修改生成订单号时运营商含空格的崩溃问题
Showing 5 changed files with 163 additions and 141 deletions Inline Diff
android/GameSDKRelease/libs/GameSDK_v3.3.2_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/GameSDK_v3.3.3_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.gumpsdk.wuruid" | 3 | package="com.gumpsdk.wuruid" |
| 4 | android:versionCode="6" | 4 | android:versionCode="6" |
| 5 | android:versionName="1.6" > | 5 | android:versionName="1.6" > |
| 6 | 6 | ||
| 7 | <uses-sdk | 7 | <uses-sdk |
| 8 | android:minSdkVersion="9" | 8 | android:minSdkVersion="9" |
| 9 | android:targetSdkVersion="22" /> | 9 | android:targetSdkVersion="22" /> |
| 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 | <uses-permission android:name="android.permission.SEND_SMS"/> | 20 | <uses-permission android:name="android.permission.SEND_SMS"/> |
| 21 | 21 | ||
| 22 | <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> | 22 | <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> |
| 23 | <uses-permission android:name="com.android.vending.BILLING" /> | 23 | <uses-permission android:name="com.android.vending.BILLING" /> |
| 24 | 24 | ||
| 25 | <application | 25 | <application |
| 26 | android:allowBackup="true" | 26 | android:allowBackup="true" |
| 27 | android:icon="@drawable/ic_launcher" | 27 | android:icon="@drawable/ic_launcher" |
| 28 | android:label="@string/app_name" > | 28 | android:label="@string/app_name" > |
| 29 | <activity | 29 | <activity |
| 30 | android:name="com.gumptech.loginsdk.sample.MainActivity" | 30 | android:name="com.gumptech.loginsdk.sample.MainActivity" |
| 31 | android:configChanges="navigation|orientation|keyboard" | 31 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
| 32 | android:label="@string/app_name" | 32 | android:label="@string/app_name" |
| 33 | android:screenOrientation="portrait" > | 33 | android:screenOrientation="portrait" > |
| 34 | <intent-filter> | 34 | <intent-filter> |
| 35 | <action android:name="android.intent.action.MAIN" /> | 35 | <action android:name="android.intent.action.MAIN" /> |
| 36 | 36 | ||
| 37 | <category android:name="android.intent.category.LAUNCHER" /> | 37 | <category android:name="android.intent.category.LAUNCHER" /> |
| 38 | </intent-filter> | 38 | </intent-filter> |
| 39 | </activity> | 39 | </activity> |
| 40 | <activity | 40 | <activity |
| 41 | android:name="com.gumptech.sdk.ContainerActivity" | 41 | android:name="com.gumptech.sdk.ContainerActivity" |
| 42 | android:configChanges="orientation|screenLayout" | 42 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
| 43 | android:windowSoftInputMode="stateAlwaysHidden|adjustPan" | 43 | android:windowSoftInputMode="stateAlwaysHidden|adjustPan" |
| 44 | android:theme="@style/Theme.TransparentWin" > | 44 | android:theme="@style/Theme.TransparentWin" > |
| 45 | </activity> | 45 | </activity> |
| 46 | <activity | 46 | <activity |
| 47 | android:name="com.gumptech.sdk.PaymentActivity" | 47 | android:name="com.gumptech.sdk.PaymentActivity" |
| 48 | android:configChanges="orientation|screenLayout" | 48 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
| 49 | android:theme="@android:style/Theme.Translucent.NoTitleBar" > | 49 | android:theme="@android:style/Theme.Translucent.NoTitleBar" > |
| 50 | </activity> | 50 | </activity> |
| 51 | <activity | 51 | <activity |
| 52 | android:name="com.gumptech.sdk.ExchangeWindow" | 52 | android:name="com.gumptech.sdk.ExchangeWindow" |
| 53 | android:configChanges="orientation|screenLayout" | 53 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
| 54 | android:theme="@style/Theme.WinForExchange" > | 54 | android:theme="@style/Theme.WinForExchange" > |
| 55 | </activity> | 55 | </activity> |
| 56 | 56 | ||
| 57 | <service android:name="com.gumptech.sdk.PushService" > | 57 | <service android:name="com.gumptech.sdk.PushService" > |
| 58 | </service> | 58 | </service> |
| 59 | 59 | ||
| 60 | <!-- facebook --> | 60 | <!-- facebook --> |
| 61 | <activity | 61 | <activity |
| 62 | android:name="com.facebook.FacebookActivity" | 62 | android:name="com.facebook.FacebookActivity" |
| 63 | android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" | 63 | android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" |
| 64 | android:label="@string/app_name" | 64 | android:label="@string/app_name" |
| 65 | android:theme="@android:style/Theme.Translucent.NoTitleBar" /> | 65 | android:theme="@android:style/Theme.Translucent.NoTitleBar" /> |
| 66 | <!-- vk --> | 66 | <!-- vk --> |
| 67 | <activity android:name="com.vk.sdk.VKOpenAuthActivity" /> | 67 | <activity android:name="com.vk.sdk.VKOpenAuthActivity" /> |
| 68 | <activity | 68 | <activity |
| 69 | android:name="com.vk.sdk.VKServiceActivity" | 69 | android:name="com.vk.sdk.VKServiceActivity" |
| 70 | android:label="ServiceActivity" | 70 | android:label="ServiceActivity" |
| 71 | android:theme="@style/VK.Transparent" /> | 71 | android:theme="@style/VK.Transparent" /> |
| 72 | </application> | 72 | </application> |
| 73 | 73 | ||
| 74 | </manifest> | 74 | </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" | 8 | android:id="@+id/version" |
| 9 | android:layout_width="wrap_content" | 9 | android:layout_width="wrap_content" |
| 10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
| 11 | android:layout_gravity="center_horizontal" /> | 11 | android:layout_gravity="center_horizontal" |
| 12 | android:textColor="@color/black_text" /> | ||
| 12 | 13 | ||
| 13 | <TextView | 14 | <TextView |
| 14 | android:id="@+id/user_info" | 15 | android:id="@+id/user_info" |
| 15 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
| 16 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
| 17 | android:textColor="@android:color/black" /> | 18 | android:textColor="@android:color/black" /> |
| 18 | 19 | ||
| 19 | <Button | 20 | <Button |
| 20 | android:id="@+id/login_or_logout" | 21 | android:id="@+id/login_or_logout" |
| 21 | android:layout_width="wrap_content" | 22 | android:layout_width="wrap_content" |
| 22 | android:layout_height="wrap_content" | 23 | android:layout_height="wrap_content" |
| 23 | android:enabled="false" | 24 | android:enabled="false" |
| 24 | android:text="Login" /> | 25 | android:text="Login" /> |
| 25 | 26 | ||
| 26 | <Button | 27 | <Button |
| 27 | android:id="@+id/pay" | 28 | android:id="@+id/pay" |
| 28 | android:layout_width="wrap_content" | 29 | android:layout_width="wrap_content" |
| 29 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
| 30 | android:text="pay" /> | 31 | android:text="pay" /> |
| 31 | 32 | ||
| 32 | </LinearLayout> | 33 | </LinearLayout> |
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.os.Bundle; | 4 | import android.content.Context; |
| 5 | import android.util.Log; | 5 | import android.os.Bundle; |
| 6 | import android.view.View; | 6 | import android.text.ClipboardManager; |
| 7 | import android.widget.Button; | 7 | import android.util.Log; |
| 8 | import android.widget.TextView; | 8 | import android.view.View; |
| 9 | import android.widget.Toast; | 9 | import android.widget.Button; |
| 10 | 10 | import android.widget.TextView; | |
| 11 | import com.gumptech.sdk.GumpSDK; | 11 | import android.widget.Toast; |
| 12 | import com.gumptech.sdk.bean.GumpUser; | 12 | |
| 13 | import com.gumptech.sdk.bean.PurchaseResult; | 13 | import com.gumptech.sdk.GumpPreference; |
| 14 | import com.gumptech.sdk.callback.InitializeCallback; | 14 | import com.gumptech.sdk.GumpSDK; |
| 15 | import com.gumptech.sdk.callback.LoginStateListener; | 15 | import com.gumptech.sdk.bean.GumpUser; |
| 16 | import com.gumptech.sdk.callback.PurchaseCallback; | 16 | import com.gumptech.sdk.bean.PurchaseResult; |
| 17 | import com.gumpsdk.wuruid.R; | 17 | import com.gumptech.sdk.callback.InitializeCallback; |
| 18 | 18 | import com.gumptech.sdk.callback.LoginStateListener; | |
| 19 | public class MainActivity extends Activity implements PurchaseCallback{ | 19 | import com.gumptech.sdk.callback.PurchaseCallback; |
| 20 | 20 | import com.gumpsdk.wuruid.R; | |
| 21 | private static final String TAG = "MainActivity"; | 21 | |
| 22 | 22 | public class MainActivity extends Activity implements PurchaseCallback{ | |
| 23 | private TextView tvVersion; | 23 | |
| 24 | private TextView userInfo; | 24 | private static final String TAG = "MainActivity"; |
| 25 | 25 | ||
| 26 | private Button btnLoginOrLogout; | 26 | private TextView tvVersion; |
| 27 | 27 | private TextView userInfo; | |
| 28 | private String appId = "10022"; | 28 | |
| 29 | private String appKey = "93a27b0bd99bac3e68a440b48aa421ab"; | 29 | private Button btnLoginOrLogout; |
| 30 | 30 | ||
| 31 | @Override | 31 | private String appId = "10022"; |
| 32 | protected void onCreate(Bundle savedInstanceState) { | 32 | private String appKey = "93a27b0bd99bac3e68a440b48aa421ab"; |
| 33 | super.onCreate(savedInstanceState); | 33 | |
| 34 | setContentView(R.layout.activity_main); | 34 | @Override |
| 35 | tvVersion = (TextView) findViewById(R.id.version); | 35 | protected void onCreate(Bundle savedInstanceState) { |
| 36 | userInfo = (TextView) findViewById(R.id.user_info); | 36 | super.onCreate(savedInstanceState); |
| 37 | btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); | 37 | setContentView(R.layout.activity_main); |
| 38 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { | 38 | tvVersion = (TextView) findViewById(R.id.version); |
| 39 | 39 | userInfo = (TextView) findViewById(R.id.user_info); | |
| 40 | @Override | 40 | btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); |
| 41 | public void onClick(View v) { | 41 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { |
| 42 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) | 42 | |
| 43 | GumpSDK.start(MainActivity.this); | 43 | @Override |
| 44 | else | 44 | public void onClick(View v) { |
| 45 | GumpSDK.logout(MainActivity.this); | 45 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) |
| 46 | } | 46 | GumpSDK.start(MainActivity.this); |
| 47 | }); | 47 | else |
| 48 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { | 48 | GumpSDK.logout(MainActivity.this); |
| 49 | 49 | } | |
| 50 | @Override | 50 | }); |
| 51 | public void onClick(View v) { | 51 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { |
| 52 | Bundle payInfo = new Bundle(); | 52 | |
| 53 | payInfo.putString("nick", "thi"); | 53 | @Override |
| 54 | payInfo.putString("product", "元宝"); | 54 | public void onClick(View v) { |
| 55 | payInfo.putFloat("amount", 0.0f); | 55 | Bundle payInfo = new Bundle(); |
| 56 | payInfo.putString("extraInfo", "This is demo!"); | 56 | payInfo.putString("nick", "thi"); |
| 57 | payInfo.putString("serverId", "103"); | 57 | payInfo.putString("product", "元宝"); |
| 58 | GumpSDK.pay(MainActivity.this, payInfo, "6151046", MainActivity.this); | 58 | payInfo.putFloat("amount", 0.0f); |
| 59 | } | 59 | payInfo.putString("extraInfo", "This is demo!"); |
| 60 | }); | 60 | payInfo.putString("serverId", "5001"); |
| 61 | /** | 61 | GumpSDK.pay(MainActivity.this, payInfo, "3332768", MainActivity.this); |
| 62 | * 设置否是开启debug模式 | 62 | } |
| 63 | */ | 63 | }); |
| 64 | GumpSDK.setDebugState(true); | 64 | /** |
| 65 | /** | 65 | * 设置否是开启debug模式 |
| 66 | * 设置是否启用facebook登录 | 66 | */ |
| 67 | */ | 67 | GumpSDK.setDebugState(true); |
| 68 | GumpSDK.setFBEnable(true); | 68 | /** |
| 69 | /** | 69 | * 设置是否启用facebook登录 |
| 70 | * 设置是否启用Vk登录 | 70 | */ |
| 71 | */ | 71 | GumpSDK.setFBEnable(true); |
| 72 | GumpSDK.setVKEnable(true); | 72 | /** |
| 73 | /** | 73 | * 设置是否启用Vk登录 |
| 74 | * 设置屏幕方向 | 74 | */ |
| 75 | */ | 75 | GumpSDK.setVKEnable(false); |
| 76 | GumpSDK.setScreenLandscape(false); | 76 | /** |
| 77 | /** | 77 | * 设置屏幕方向 |
| 78 | * 设置用户登录状态监听器 | 78 | */ |
| 79 | */ | 79 | GumpSDK.setScreenLandscape(false); |
| 80 | GumpSDK.setUserStateListener(new LoginStateListener() { | 80 | /** |
| 81 | @Override | 81 | * 设置用户登录状态监听器 |
| 82 | public void onLoginSuccess(GumpUser user) { | 82 | */ |
| 83 | userInfo.setText("Userid:" + user.getUid() + "\n accountType:" + user.getAccountType() + "\n sessionKey:" + user.getSessionKey()); | 83 | GumpSDK.setUserStateListener(new LoginStateListener() { |
| 84 | btnLoginOrLogout.setText("Logout"); | 84 | @Override |
| 85 | btnLoginOrLogout.setTag(1); | 85 | public void onLoginSuccess(GumpUser user) { |
| 86 | } | 86 | ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); |
| 87 | 87 | cm.setText(user.getSessionKey()); | |
| 88 | @Override | 88 | |
| 89 | public void onLoginFailed(int code, String msg) { | 89 | String userType=null; |
| 90 | userInfo.setText(msg); | 90 | switch(user.getAccountType()){ |
| 91 | Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); | 91 | case GumpPreference.ACCOUNT_TYPE_FB: |
| 92 | } | 92 | userType = "Facebook登录"; |
| 93 | 93 | break; | |
| 94 | @Override | 94 | case GumpPreference.ACCOUNT_TYPE_QUICK_REG: |
| 95 | public void onLoginCanceled() { | 95 | userType = "快速登录"; |
| 96 | Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); | 96 | break; |
| 97 | } | 97 | case GumpPreference.ACCOUNT_TYPE_REG: |
| 98 | 98 | userType = "gump注册用户"; | |
| 99 | @Override | 99 | break; |
| 100 | public void onLogout() { | 100 | case GumpPreference.ACCOUNT_TYPE_VK: |
| 101 | btnLoginOrLogout.setText("Login"); | 101 | userType = "vk登录"; |
| 102 | btnLoginOrLogout.setTag(0); | 102 | break; |
| 103 | userInfo.setText("User is logout"); | 103 | } |
| 104 | } | 104 | userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType()+") "+userType + "\n sessionKey:" + user.getSessionKey()); |
| 105 | }); | 105 | btnLoginOrLogout.setText("Logout"); |
| 106 | /** | 106 | btnLoginOrLogout.setTag(1); |
| 107 | * 初始化sdk | 107 | } |
| 108 | */ | 108 | |
| 109 | GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { | 109 | @Override |
| 110 | @Override | 110 | public void onLoginFailed(int code, String msg) { |
| 111 | public void initComplete(int result) { | 111 | userInfo.setText(msg); |
| 112 | if (result == GumpSDK.CODE.OK) { | 112 | Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); |
| 113 | btnLoginOrLogout.setEnabled(true); | 113 | } |
| 114 | } | 114 | |
| 115 | } | 115 | @Override |
| 116 | }); | 116 | public void onLoginCanceled() { |
| 117 | 117 | Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); | |
| 118 | 118 | } | |
| 119 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); | 119 | |
| 120 | } | 120 | @Override |
| 121 | 121 | public void onLogout() { | |
| 122 | @Override | 122 | btnLoginOrLogout.setText("Login"); |
| 123 | public void onPurchaseCompleted(PurchaseResult result) { | 123 | btnLoginOrLogout.setTag(0); |
| 124 | Log.i(TAG,"purchase completed"); | 124 | userInfo.setText("User is logout"); |
| 125 | } | 125 | } |
| 126 | 126 | }); | |
| 127 | @Override | 127 | /** |
| 128 | public void onPurchaseError(int code, String msg) { | 128 | * 初始化sdk |
| 129 | Log.i(TAG,"purchase error"); | 129 | */ |
| 130 | } | 130 | GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { |
| 131 | 131 | @Override | |
| 132 | @Override | 132 | public void initComplete(int result) { |
| 133 | public void onPurchaseCanceled() { | 133 | if (result == GumpSDK.CODE.OK) { |
| 134 | Log.i(TAG,"purchase canceled"); | 134 | btnLoginOrLogout.setEnabled(true); |
| 135 | } | 135 | } |
| 136 | } | 136 | } |
| 137 | }); | ||
| 138 | |||
| 139 | |||
| 140 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); | ||
| 141 | } | ||
| 142 | |||
| 143 | @Override | ||
| 144 | public void onPurchaseCompleted(PurchaseResult result) { | ||
| 145 | Log.i(TAG,"purchase completed"); | ||
| 146 | } | ||
| 147 | |||
| 148 | @Override | ||
| 149 | public void onPurchaseError(int code, String msg) { | ||
| 150 | Log.i(TAG,"purchase error"); | ||
| 151 | } | ||
| 152 | |||
| 153 | @Override | ||
| 154 | public void onPurchaseCanceled() { | ||
| 155 | Log.i(TAG,"purchase canceled"); | ||
| 156 | } | ||
| 157 | } | ||
| 137 | 158 |