|
1 package org.hedgewars.hedgeroid.netplay; |
|
2 |
|
3 import org.hedgewars.hedgeroid.R; |
|
4 import org.hedgewars.hedgeroid.netplay.JnaFrontlib.NetconnPtr; |
|
5 |
|
6 import android.content.IntentFilter; |
|
7 import android.os.Bundle; |
|
8 import android.support.v4.app.Fragment; |
|
9 import android.support.v4.app.FragmentActivity; |
|
10 import android.support.v4.content.LocalBroadcastManager; |
|
11 import android.widget.LinearLayout; |
|
12 import android.widget.TabHost; |
|
13 |
|
14 public class RoomActivity extends FragmentActivity { |
|
15 private TabHost tabHost; |
|
16 private Netplay netconn; |
|
17 |
|
18 @Override |
|
19 protected void onCreate(Bundle icicle) { |
|
20 super.onCreate(icicle); |
|
21 netconn = Netplay.getAppInstance(getApplicationContext()); |
|
22 |
|
23 setContentView(R.layout.activity_lobby); |
|
24 Fragment chatFragment = getSupportFragmentManager().findFragmentById(R.id.chatFragment); |
|
25 chatFragment.getArguments().putBoolean(ChatFragment.ARGUMENT_INROOM, true); |
|
26 |
|
27 tabHost = (TabHost)findViewById(android.R.id.tabhost); |
|
28 if(tabHost != null) { |
|
29 tabHost.setup(); |
|
30 tabHost.getTabWidget().setOrientation(LinearLayout.VERTICAL); |
|
31 |
|
32 //tabHost.addTab(tabHost.newTabSpec("chat").setIndicator(createIndicatorView(tabHost, R.string.lobby_tab_chat, getResources().getDrawable(R.drawable.edit))).setContent(R.id.chatFragment)); |
|
33 //tabHost.addTab(tabHost.newTabSpec("players").setIndicator(createIndicatorView(tabHost, R.string.lobby_tab_players, getResources().getDrawable(R.drawable.human))).setContent(R.id.playerListFragment)); |
|
34 |
|
35 if (icicle != null) { |
|
36 tabHost.setCurrentTabByTag(icicle.getString("currentTab")); |
|
37 } |
|
38 } |
|
39 } |
|
40 |
|
41 @Override |
|
42 protected void onSaveInstanceState(Bundle icicle) { |
|
43 super.onSaveInstanceState(icicle); |
|
44 if(tabHost != null) { |
|
45 icicle.putString("currentTab", tabHost.getCurrentTabTag()); |
|
46 } |
|
47 } |
|
48 } |