Skip to content

Commit

Permalink
ArenaControl
Browse files Browse the repository at this point in the history
  • Loading branch information
sashaqwert committed Mar 24, 2018
1 parent 22d7043 commit bc9b2fb
Showing 1 changed file with 41 additions and 19 deletions.
60 changes: 41 additions & 19 deletions app/src/main/java/ru/sccraft/arenacontrol/ServerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,36 +523,58 @@ public SectionsPagerAdapter(FragmentManager fm) {
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a ServerInfoFragment (defined as a static inner class below).
switch(position) {
case 0:
return ServerInfoFragment.newInstance(position + 1);
case 1:
return ServerPlayersFragment.newInstance(position + 1);
case 2:
return ServerResFragment.newInstance(position + 1);
case 3:
return ServerWorldFragment.newInstance(position + 1);
if (сервер.статус == 1) {
switch(position) {
case 0:
return ServerInfoFragment.newInstance(position + 1);
case 1:
return ServerPlayersFragment.newInstance(position + 1);
case 2:
return ServerResFragment.newInstance(position + 1);
case 3:
return ServerWorldFragment.newInstance(position + 1);
}
} else {
switch (position) {
case 0:
return ServerInfoFragment.newInstance(position + 1);
case 1:
return ServerResFragment.newInstance(position + 1);
}
}
return ServerInfoFragment.newInstance(position + 1);
}

@Override
public int getCount() {
// Show 3 total pages.
return 4;
if (сервер.статус == 1) {
return 4;
} else {
return 2;
}
}

@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return getString(R.string.serverActivity_info);
case 1:
return getString(R.string.serverActivity_players);
case 2:
return getString(R.string.serverActivity_resources);
case 3:
return getString(R.string.serverActivity_world);
if (сервер.статус == 1) {
switch (position) {
case 0:
return getString(R.string.serverActivity_info);
case 1:
return getString(R.string.serverActivity_players);
case 2:
return getString(R.string.serverActivity_resources);
case 3:
return getString(R.string.serverActivity_world);
}
} else {
switch (position) {
case 0:
return getString(R.string.serverActivity_info);
case 1:
return getString(R.string.serverActivity_resources);
}
}
return null;
}
Expand Down

0 comments on commit bc9b2fb

Please sign in to comment.