Showing
5 changed files
with
31 additions
and
8 deletions
| ... | @@ -22,13 +22,14 @@ public final class R { | ... | @@ -22,13 +22,14 @@ public final class R { |
| 22 | public static final int public_sdk_self_ya_login_bt_selector=0x7f020008; | 22 | public static final int public_sdk_self_ya_login_bt_selector=0x7f020008; |
| 23 | } | 23 | } |
| 24 | public static final class id { | 24 | public static final class id { |
| 25 | - public static final int forum_bt=0x7f050004; | 25 | + public static final int forum_bt=0x7f050005; |
| 26 | - public static final int logout_bt=0x7f050003; | 26 | + public static final int logout_bt=0x7f050004; |
| 27 | public static final int ya_channel_center=0x7f050000; | 27 | public static final int ya_channel_center=0x7f050000; |
| 28 | - public static final int ya_enter_game_bt=0x7f050006; | 28 | + public static final int ya_enter_game_bt=0x7f050007; |
| 29 | - public static final int ya_login_bt=0x7f050005; | 29 | + public static final int ya_login_bt=0x7f050006; |
| 30 | public static final int ya_pay_bt=0x7f050001; | 30 | public static final int ya_pay_bt=0x7f050001; |
| 31 | - public static final int ya_submit_role_data_bt=0x7f050002; | 31 | + public static final int ya_submit_role_data_bt=0x7f050003; |
| 32 | + public static final int ya_switch_account_bt=0x7f050002; | ||
| 32 | } | 33 | } |
| 33 | public static final class layout { | 34 | public static final class layout { |
| 34 | public static final int public_sdk_self_game=0x7f030000; | 35 | public static final int public_sdk_self_game=0x7f030000; | ... | ... |
No preview for this file type
| ... | @@ -13,14 +13,14 @@ | ... | @@ -13,14 +13,14 @@ |
| 13 | android:background="@drawable/public_sdk_self_ya_bt_selector" | 13 | android:background="@drawable/public_sdk_self_ya_bt_selector" |
| 14 | android:onClick="yaOnClick"/> | 14 | android:onClick="yaOnClick"/> |
| 15 | 15 | ||
| 16 | - <!-- <Button | 16 | + <Button |
| 17 | android:id="@+id/ya_switch_account_bt" | 17 | android:id="@+id/ya_switch_account_bt" |
| 18 | android:layout_width="180dp" | 18 | android:layout_width="180dp" |
| 19 | android:layout_height="60dp" | 19 | android:layout_height="60dp" |
| 20 | android:layout_alignParentRight="true" | 20 | android:layout_alignParentRight="true" |
| 21 | android:layout_alignTop="@+id/ya_submit_role_data_bt" | 21 | android:layout_alignTop="@+id/ya_submit_role_data_bt" |
| 22 | android:background="@drawable/public_sdk_self_ya_bt_selector" | 22 | android:background="@drawable/public_sdk_self_ya_bt_selector" |
| 23 | - android:onClick="yaOnClick" /> --> | 23 | + android:onClick="yaOnClick" /> |
| 24 | 24 | ||
| 25 | <Button | 25 | <Button |
| 26 | android:id="@+id/ya_submit_role_data_bt" | 26 | android:id="@+id/ya_submit_role_data_bt" | ... | ... |
| ... | @@ -36,6 +36,7 @@ public class AppActivity extends Activity { | ... | @@ -36,6 +36,7 @@ public class AppActivity extends Activity { |
| 36 | private Button yaChannelCenter; | 36 | private Button yaChannelCenter; |
| 37 | private Button yaLogoutBt; | 37 | private Button yaLogoutBt; |
| 38 | private Button yaForumBt; | 38 | private Button yaForumBt; |
| 39 | + private Button yaSwitchAccountBt; | ||
| 39 | 40 | ||
| 40 | @Override | 41 | @Override |
| 41 | protected void onCreate(Bundle savedInstanceState) { | 42 | protected void onCreate(Bundle savedInstanceState) { |
| ... | @@ -241,6 +242,9 @@ public class AppActivity extends Activity { | ... | @@ -241,6 +242,9 @@ public class AppActivity extends Activity { |
| 241 | 242 | ||
| 242 | yaLogoutBt = (Button) findViewById(getRedIdByName("logout_bt", "id")); | 243 | yaLogoutBt = (Button) findViewById(getRedIdByName("logout_bt", "id")); |
| 243 | 244 | ||
| 245 | + yaSwitchAccountBt = (Button) findViewById(getRedIdByName("ya_switch_account_bt", "id")); | ||
| 246 | + yaSwitchAccountBt.setText("切换账号"); | ||
| 247 | + | ||
| 244 | yaForumBt = (Button) findViewById(getRedIdByName("forum_bt", "id")); | 248 | yaForumBt = (Button) findViewById(getRedIdByName("forum_bt", "id")); |
| 245 | } | 249 | } |
| 246 | 250 | ||
| ... | @@ -261,16 +265,34 @@ public class AppActivity extends Activity { | ... | @@ -261,16 +265,34 @@ public class AppActivity extends Activity { |
| 261 | logout(); | 265 | logout(); |
| 262 | } else if (view == yaForumBt){ | 266 | } else if (view == yaForumBt){ |
| 263 | openForum(); | 267 | openForum(); |
| 268 | + } else if(view == yaSwitchAccountBt){//切换账号 | ||
| 269 | + switchAccount(); | ||
| 264 | } | 270 | } |
| 265 | } | 271 | } |
| 266 | 272 | ||
| 273 | + /** | ||
| 274 | + * 切换帐号 | ||
| 275 | + */ | ||
| 276 | + private void switchAccount() { | ||
| 277 | + if(PoolSdkHelper.hasSwitchAccount()){ | ||
| 278 | + PoolSdkHelper.switchAccount(this); | ||
| 279 | + }else if(PoolSdkHelper.hasChannelCenter()){//打开渠道中心看是否有切换账号 | ||
| 280 | + PoolSdkHelper.openChannelCenter(); | ||
| 281 | + }else{//直接回到登录界面调用登录 | ||
| 282 | + int layoutId = getResources().getIdentifier( | ||
| 283 | + "public_sdk_self_game_login", "layout", getPackageName()); | ||
| 284 | + setContentView(layoutId); | ||
| 285 | + initLoginView(); | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + | ||
| 267 | private void openForum(){ | 289 | private void openForum(){ |
| 268 | PoolSdkHelper.openForum(); | 290 | PoolSdkHelper.openForum(); |
| 269 | } | 291 | } |
| 270 | 292 | ||
| 271 | private void logout(){ | 293 | private void logout(){ |
| 272 | - PoolSdkHelper.logout(this);//结果回调通知到PoolLogoutListener | ||
| 273 | if(PoolSdkHelper.hasLogout()){ | 294 | if(PoolSdkHelper.hasLogout()){ |
| 295 | + PoolSdkHelper.logout(this);//结果回调通知到PoolLogoutListener | ||
| 274 | } | 296 | } |
| 275 | } | 297 | } |
| 276 | 298 | ... | ... |
No preview for this file type
-
Please register or login to post a comment