diff --git a/core/res/drawable/loading_progress.xml b/core/res/drawable/loading_progress.xml index df2175ef..3ac28bc2 100644 --- a/core/res/drawable/loading_progress.xml +++ b/core/res/drawable/loading_progress.xml @@ -1,5 +1,13 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/core/res/layout/fragment_torrents.xml b/core/res/layout/fragment_torrents.xml index c2a223ca..a72b0fe4 100644 --- a/core/res/layout/fragment_torrents.xml +++ b/core/res/layout/fragment_torrents.xml @@ -16,31 +16,35 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" + android:indeterminate="true" + android:indeterminateOnly="true" android:indeterminateDrawable="@drawable/loading_progress" android:visibility="visible" /> - + - + - + \ No newline at end of file diff --git a/core/res/values-sw500dp/bools.xml b/core/res/values-sw500dp/bools.xml index 4a4c7757..f701a217 100644 --- a/core/res/values-sw500dp/bools.xml +++ b/core/res/values-sw500dp/bools.xml @@ -1,5 +1,5 @@ - false + false \ No newline at end of file diff --git a/core/res/values/bools.xml b/core/res/values/bools.xml index 2a472937..63d71d3e 100644 --- a/core/res/values/bools.xml +++ b/core/res/values/bools.xml @@ -1,5 +1,5 @@ - true + true \ No newline at end of file diff --git a/core/src/org/transdroid/core/gui/DetailsFragment.java b/core/src/org/transdroid/core/gui/DetailsFragment.java index 10eaf5f2..15250beb 100644 --- a/core/src/org/transdroid/core/gui/DetailsFragment.java +++ b/core/src/org/transdroid/core/gui/DetailsFragment.java @@ -127,6 +127,7 @@ public class DetailsFragment extends SherlockFragment { torrent = null; torrentDetails = null; torrentFiles = null; + getActivity().supportInvalidateOptionsMenu(); } /** @@ -143,12 +144,24 @@ public class DetailsFragment extends SherlockFragment { public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); + if (torrent == null) { + menu.findItem(R.id.action_resume).setVisible(false); + menu.findItem(R.id.action_pause).setVisible(false); + menu.findItem(R.id.action_start).setVisible(false); + menu.findItem(R.id.action_stop).setVisible(false); + menu.findItem(R.id.action_remove).setVisible(false); + menu.findItem(R.id.action_remove_withdata).setVisible(false); + menu.findItem(R.id.action_setlabel).setVisible(false); + menu.findItem(R.id.action_updatetrackers).setVisible(false); + return; + } // Update action availability boolean startStop = Daemon.supportsStoppingStarting(torrent.getDaemon()); menu.findItem(R.id.action_resume).setVisible(torrent.canResume()); menu.findItem(R.id.action_pause).setVisible(torrent.canPause()); menu.findItem(R.id.action_start).setVisible(startStop && torrent.canStart()); menu.findItem(R.id.action_stop).setVisible(startStop && torrent.canStop()); + menu.findItem(R.id.action_remove).setVisible(true); boolean removeWithData = Daemon.supportsRemoveWithData(torrent.getDaemon()); menu.findItem(R.id.action_remove_withdata).setVisible(removeWithData); boolean setLabel = Daemon.supportsSetLabel(torrent.getDaemon()); diff --git a/core/src/org/transdroid/core/gui/TorrentsActivity.java b/core/src/org/transdroid/core/gui/TorrentsActivity.java index dd45f2a1..2c29b439 100644 --- a/core/src/org/transdroid/core/gui/TorrentsActivity.java +++ b/core/src/org/transdroid/core/gui/TorrentsActivity.java @@ -142,8 +142,10 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi ServerSetting lastUsed = applicationSettings.getLastUsedServer(); if (lastUsed == null) { // Still no settings + updateFragmentVisibility(false); return; } + // TODO: See if this does not mean the refresh is called twice (first in onCreate) // There is a server now: select it to establish a connection filterSelected(lastUsed); } @@ -254,6 +256,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi currentConnection = server.createServerAdapter(); applicationSettings.setLastUsedServer(server); clearScreens(); + updateFragmentVisibility(true); refreshTorrents(); return; @@ -281,6 +284,17 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi return currentConnection.getSettings().getName(); } + /** + * Hides the filter list and details fragment's full view if there is no configured connection + * @param hasServerSettings Whether there are server settings available, so we can continue to connect + */ + private void updateFragmentVisibility(boolean hasServerSettings) { + if (filtersList != null) + filtersList.setVisibility(hasServerSettings? View.VISIBLE: View.GONE); + if (fragmentDetails != null) + getSupportFragmentManager().beginTransaction().hide(fragmentDetails).commit(); + } + /** * If required, add torrents, switch to a specific server, etc. */ diff --git a/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java b/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java index cb271715..96d26edd 100644 --- a/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java +++ b/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java @@ -38,7 +38,7 @@ public class NavigationHelper { * @return True if the app runs on a small device, false otherwise */ public boolean isSmallScreen() { - return context.getResources().getBoolean(R.bool.small_screen); + return context.getResources().getBoolean(R.bool.show_dialog_fullscreen); } /**