Kaydet (Commit) 2e605fcb authored tarafından Artur Dryomov's avatar Artur Dryomov

Fix some comments and tabs positions.

Change-Id: I6678d8142f7cbe2446b178174ffb36d446aeda11
üst afabf78f
...@@ -29,14 +29,6 @@ import org.libreoffice.impressremote.util.Preferences; ...@@ -29,14 +29,6 @@ import org.libreoffice.impressremote.util.Preferences;
import org.libreoffice.impressremote.util.SavedStates; import org.libreoffice.impressremote.util.SavedStates;
public class ComputersActivity extends SherlockFragmentActivity implements ActionBar.TabListener, ViewPager.OnPageChangeListener { public class ComputersActivity extends SherlockFragmentActivity implements ActionBar.TabListener, ViewPager.OnPageChangeListener {
private static final class TabsIndices {
private TabsIndices() {
}
public static final int BLUETOOTH = 0;
public static final int WIFI = 1;
}
private boolean mBluetoothWasEnabled; private boolean mBluetoothWasEnabled;
@Override @Override
...@@ -52,9 +44,9 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio ...@@ -52,9 +44,9 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio
private void saveBluetoothState(Bundle aSavedInstanceState) { private void saveBluetoothState(Bundle aSavedInstanceState) {
// In more ideal world this work should be done at the service. // In more ideal world this work should be done at the service.
// Unfortunately service cannot save or restore its state // Unfortunately service cannot save or restore its state.
// but enabling or disabling Bluetooth is quite a long operation, // On other hand we should remember Bluetooth state exactly
// so we have more chances to manage state right at the activity. // after the app’s start and pass it during recreation cycle.
if (!BluetoothOperator.isAvailable()) { if (!BluetoothOperator.isAvailable()) {
return; return;
...@@ -78,7 +70,7 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio ...@@ -78,7 +70,7 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio
private void setUpTitle() { private void setUpTitle() {
// Looks hacky but it seems to be the best way to set activity’s title // Looks hacky but it seems to be the best way to set activity’s title
// different to application’s label. The other way is setting title // different to application’s label. The other way is setting title
// to intents filter but it shows wrong label for recent apps screen. // to intents filter but it shows wrong label for recent apps screen then.
ActionBar aActionBar = getSupportActionBar(); ActionBar aActionBar = getSupportActionBar();
...@@ -111,8 +103,10 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio ...@@ -111,8 +103,10 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio
private void setUpTabs() { private void setUpTabs() {
ActionBar aActionBar = getSupportActionBar(); ActionBar aActionBar = getSupportActionBar();
aActionBar.addTab(buildActionBarTab(R.string.title_bluetooth), TabsIndices.BLUETOOTH); aActionBar.addTab(buildActionBarTab(
aActionBar.addTab(buildActionBarTab(R.string.title_wifi), TabsIndices.WIFI); R.string.title_bluetooth), ComputersPagerAdapter.PagesIndices.BLUETOOTH);
aActionBar.addTab(buildActionBarTab(
R.string.title_wifi), ComputersPagerAdapter.PagesIndices.WIFI);
} }
private ActionBar.Tab buildActionBarTab(int aTitleResourceId) { private ActionBar.Tab buildActionBarTab(int aTitleResourceId) {
...@@ -203,11 +197,11 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio ...@@ -203,11 +197,11 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio
MenuItem aComputerAddingMenuItem = aMenu.findItem(R.id.menu_add_computer); MenuItem aComputerAddingMenuItem = aMenu.findItem(R.id.menu_add_computer);
switch (getSupportActionBar().getSelectedNavigationIndex()) { switch (getSupportActionBar().getSelectedNavigationIndex()) {
case TabsIndices.BLUETOOTH: case ComputersPagerAdapter.PagesIndices.BLUETOOTH:
aComputerAddingMenuItem.setVisible(false); aComputerAddingMenuItem.setVisible(false);
break; break;
case TabsIndices.WIFI: case ComputersPagerAdapter.PagesIndices.WIFI:
aComputerAddingMenuItem.setVisible(true); aComputerAddingMenuItem.setVisible(true);
default: default:
......
...@@ -17,8 +17,8 @@ import org.libreoffice.impressremote.fragment.ComputersFragment; ...@@ -17,8 +17,8 @@ import org.libreoffice.impressremote.fragment.ComputersFragment;
public class ComputersPagerAdapter extends FragmentPagerAdapter { public class ComputersPagerAdapter extends FragmentPagerAdapter {
private static final int PAGER_SIZE = 2; private static final int PAGER_SIZE = 2;
private static final class PagerPositions { public static final class PagesIndices {
private PagerPositions() { private PagesIndices() {
} }
public static final int BLUETOOTH = 0; public static final int BLUETOOTH = 0;
...@@ -32,10 +32,10 @@ public class ComputersPagerAdapter extends FragmentPagerAdapter { ...@@ -32,10 +32,10 @@ public class ComputersPagerAdapter extends FragmentPagerAdapter {
@Override @Override
public Fragment getItem(int aPosition) { public Fragment getItem(int aPosition) {
switch (aPosition) { switch (aPosition) {
case PagerPositions.BLUETOOTH: case PagesIndices.BLUETOOTH:
return ComputersFragment.newInstance(ComputersFragment.Type.BLUETOOTH); return ComputersFragment.newInstance(ComputersFragment.Type.BLUETOOTH);
case PagerPositions.WIFI: case PagesIndices.WIFI:
return ComputersFragment.newInstance(ComputersFragment.Type.WIFI); return ComputersFragment.newInstance(ComputersFragment.Type.WIFI);
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment