|
|
@ -100,6 +100,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi |
|
|
|
protected ApplicationSettings applicationSettings; |
|
|
|
protected ApplicationSettings applicationSettings; |
|
|
|
@InstanceState |
|
|
|
@InstanceState |
|
|
|
boolean firstStart = true; |
|
|
|
boolean firstStart = true; |
|
|
|
|
|
|
|
boolean skipNextOnNavigationItemSelectedCall = false; |
|
|
|
private IDaemonAdapter currentConnection = null; |
|
|
|
private IDaemonAdapter currentConnection = null; |
|
|
|
@InstanceState |
|
|
|
@InstanceState |
|
|
|
protected NavigationFilter currentFilter = null; |
|
|
|
protected NavigationFilter currentFilter = null; |
|
|
@ -154,7 +155,8 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// Set this as selection in the action bar spinner; we can use the server setting key since we have stable ids
|
|
|
|
// Set this as selection in the action bar spinner; we can use the server setting key since we have stable ids
|
|
|
|
getSupportActionBar().setSelectedNavigationItem(lastUsed.getOrder()); |
|
|
|
getSupportActionBar().setSelectedNavigationItem(lastUsed.getOrder() + 1); |
|
|
|
|
|
|
|
skipNextOnNavigationItemSelectedCall = true; |
|
|
|
|
|
|
|
|
|
|
|
// Handle any start up intents
|
|
|
|
// Handle any start up intents
|
|
|
|
if (firstStart && getIntent() != null) { |
|
|
|
if (firstStart && getIntent() != null) { |
|
|
@ -242,6 +244,10 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean onNavigationItemSelected(int itemPosition, long itemId) { |
|
|
|
public boolean onNavigationItemSelected(int itemPosition, long itemId) { |
|
|
|
|
|
|
|
if (skipNextOnNavigationItemSelectedCall) { |
|
|
|
|
|
|
|
skipNextOnNavigationItemSelectedCall = false; |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
Object item = navigationSpinnerAdapter.getItem(itemPosition); |
|
|
|
Object item = navigationSpinnerAdapter.getItem(itemPosition); |
|
|
|
if (item instanceof SimpleListItem) { |
|
|
|
if (item instanceof SimpleListItem) { |
|
|
|
// A filter item was selected form the navigation spinner
|
|
|
|
// A filter item was selected form the navigation spinner
|
|
|
@ -297,9 +303,8 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi |
|
|
|
if (fragmentDetails != null && fragmentDetails.getActivity() != null) { |
|
|
|
if (fragmentDetails != null && fragmentDetails.getActivity() != null) { |
|
|
|
fragmentDetails.clear(); |
|
|
|
fragmentDetails.clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
fragmentTorrents.updateIsLoading(true); |
|
|
|
|
|
|
|
updateFragmentVisibility(true); |
|
|
|
updateFragmentVisibility(true); |
|
|
|
refreshTorrents(); |
|
|
|
refreshScreen(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -558,7 +563,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi |
|
|
|
@Background |
|
|
|
@Background |
|
|
|
protected void updateTurtleMode(boolean enable) { |
|
|
|
protected void updateTurtleMode(boolean enable) { |
|
|
|
DaemonTaskResult result = SetAlternativeModeTask.create(currentConnection, enable).execute(); |
|
|
|
DaemonTaskResult result = SetAlternativeModeTask.create(currentConnection, enable).execute(); |
|
|
|
if (result instanceof GetStatsTaskSuccessResult) { |
|
|
|
if (result instanceof DaemonTaskSuccessResult) { |
|
|
|
// Success; no need to retrieve it again - just update the visual indicator
|
|
|
|
// Success; no need to retrieve it again - just update the visual indicator
|
|
|
|
onTurtleModeRetrieved(enable); |
|
|
|
onTurtleModeRetrieved(enable); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|