author | Medo <smaxein@googlemail.com> |
Mon, 16 Jul 2012 20:16:03 +0200 | |
changeset 7330 | 867e4fda496e |
child 7332 | 3f2e130f9715 |
permissions | -rw-r--r-- |
7330
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
1 |
package org.hedgewars.hedgeroid.netplay; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
2 |
|
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
3 |
import org.hedgewars.hedgeroid.R; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
4 |
|
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
5 |
import android.os.Bundle; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
6 |
import android.support.v4.app.Fragment; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
7 |
import android.support.v4.app.FragmentActivity; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
8 |
import android.support.v4.app.FragmentManager; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
9 |
import android.support.v4.app.FragmentPagerAdapter; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
10 |
import android.support.v4.view.ViewPager; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
11 |
|
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
12 |
public class TestActivity extends FragmentActivity { |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
13 |
@Override |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
14 |
protected void onCreate(Bundle arg0) { |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
15 |
super.onCreate(arg0); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
16 |
setContentView(R.layout.activity_lobby_paged); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
17 |
ViewPager pager = (ViewPager)findViewById(R.id.pager); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
18 |
pager.setAdapter(new Adapter(getSupportFragmentManager())); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
19 |
} |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
20 |
|
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
21 |
private static class Adapter extends FragmentPagerAdapter { |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
22 |
public Adapter(FragmentManager mgr) { |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
23 |
super(mgr); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
24 |
} |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
25 |
|
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
26 |
@Override |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
27 |
public int getCount() { |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
28 |
return 3; |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
29 |
} |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
30 |
|
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
31 |
@Override |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
32 |
public Fragment getItem(int arg0) { |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
33 |
switch(arg0) { |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
34 |
case 0: return new RoomlistFragment(); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
35 |
case 1: return new LobbyChatFragment(); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
36 |
case 2: return new PlayerlistFragment(); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
37 |
default: throw new IndexOutOfBoundsException(); |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
38 |
} |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
39 |
} |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
40 |
} |
867e4fda496e
Hedgeroid: Layout experiments for the lobby page
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
41 |
} |