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