From 23a8ff95c04ab6db1d271de5b6b43967351b8853 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Tue, 26 Nov 2013 13:18:22 +0100 Subject: [PATCH] Show progress bar if a torrent is not complete, even when it is paused. Fixes #72. --- core/res/layout/list_item_torrent.xml | 10 +++++----- .../src/org/transdroid/core/gui/lists/TorrentView.java | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/res/layout/list_item_torrent.xml b/core/res/layout/list_item_torrent.xml index def4594a..d1e3a095 100644 --- a/core/res/layout/list_item_torrent.xml +++ b/core/res/layout/list_item_torrent.xml @@ -20,7 +20,8 @@ android:layout_height="wrap_content" android:background="?attr/activatable_background_transdroid" android:orientation="vertical" - android:paddingRight="@dimen/margin_default" > + android:paddingRight="@dimen/margin_default" + android:paddingBottom="@dimen/margin_half" > @@ -70,6 +70,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/ratio_text" + android:layout_marginTop="@dimen/margin_half" android:layout_marginLeft="@dimen/margin_torrentlistleft" /> @@ -92,7 +92,7 @@ android:layout_alignParentLeft="true" android:layout_marginLeft="@dimen/margin_torrentlistleft" android:layout_toLeftOf="@id/speed_text" - android:paddingBottom="@dimen/margin_half" + android:paddingTop="@dimen/margin_half" android:textIsSelectable="false" android:textSize="@dimen/text_small" /> diff --git a/core/src/org/transdroid/core/gui/lists/TorrentView.java b/core/src/org/transdroid/core/gui/lists/TorrentView.java index eed023c6..a29d4c33 100644 --- a/core/src/org/transdroid/core/gui/lists/TorrentView.java +++ b/core/src/org/transdroid/core/gui/lists/TorrentView.java @@ -64,6 +64,14 @@ public class TorrentView extends TorrentStatusLayout { peersText.setText(local.getProgressConnectionText(getResources())); speedText.setVisibility(View.VISIBLE); speedText.setText(local.getProgressSpeedText(getResources())); + } else if (torrent.getPartDone() < 1) { + // Not active, but also not complete, so show the status bar + torrentProgressbar.setVisibility(View.VISIBLE); + torrentProgressbar.setProgress((int) (torrent.getDownloadedPercentage() * 100)); + torrentProgressbar.setActive(torrent.canPause()); + torrentProgressbar.setError(torrent.getStatusCode() == TorrentStatus.Error); + peersText.setVisibility(View.GONE); + speedText.setVisibility(View.GONE); } else { torrentProgressbar.setVisibility(View.GONE); peersText.setVisibility(View.GONE);