Browse Source

Show progress bar if a torrent is not complete, even when it is paused. Fixes #72.

pull/82/head
Eric Kok 11 years ago
parent
commit
23a8ff95c0
  1. 10
      core/res/layout/list_item_torrent.xml
  2. 8
      core/src/org/transdroid/core/gui/lists/TorrentView.java

10
core/res/layout/list_item_torrent.xml

@ -20,7 +20,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/activatable_background_transdroid" android:background="?attr/activatable_background_transdroid"
android:orientation="vertical" android:orientation="vertical"
android:paddingRight="@dimen/margin_default" > android:paddingRight="@dimen/margin_default"
android:paddingBottom="@dimen/margin_half" >
<TextView <TextView
android:id="@+id/name_text" android:id="@+id/name_text"
@ -41,7 +42,6 @@
android:layout_below="@id/name_text" android:layout_below="@id/name_text"
android:layout_marginLeft="@dimen/margin_half" android:layout_marginLeft="@dimen/margin_half"
android:layout_marginTop="4.0dip" android:layout_marginTop="4.0dip"
android:paddingBottom="@dimen/margin_half"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small" />
@ -70,6 +70,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/ratio_text" android:layout_below="@id/ratio_text"
android:layout_marginTop="@dimen/margin_half"
android:layout_marginLeft="@dimen/margin_torrentlistleft" /> android:layout_marginLeft="@dimen/margin_torrentlistleft" />
<TextView <TextView
@ -79,8 +80,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_below="@id/torrent_progressbar" android:layout_below="@id/torrent_progressbar"
android:layout_marginLeft="@dimen/margin_half" android:layout_marginLeft="@dimen/margin_half"
android:layout_marginTop="@dimen/margin_half" android:paddingTop="@dimen/margin_half"
android:paddingBottom="@dimen/margin_half"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small" />
@ -92,7 +92,7 @@
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/margin_torrentlistleft" android:layout_marginLeft="@dimen/margin_torrentlistleft"
android:layout_toLeftOf="@id/speed_text" android:layout_toLeftOf="@id/speed_text"
android:paddingBottom="@dimen/margin_half" android:paddingTop="@dimen/margin_half"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small" />

8
core/src/org/transdroid/core/gui/lists/TorrentView.java

@ -64,6 +64,14 @@ public class TorrentView extends TorrentStatusLayout {
peersText.setText(local.getProgressConnectionText(getResources())); peersText.setText(local.getProgressConnectionText(getResources()));
speedText.setVisibility(View.VISIBLE); speedText.setVisibility(View.VISIBLE);
speedText.setText(local.getProgressSpeedText(getResources())); 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 { } else {
torrentProgressbar.setVisibility(View.GONE); torrentProgressbar.setVisibility(View.GONE);
peersText.setVisibility(View.GONE); peersText.setVisibility(View.GONE);

Loading…
Cancel
Save