Browse Source

Fixed file priorities and added appropriate action bar icons.

pull/11/head
Eric Kok 12 years ago
parent
commit
4056ddf497
  1. BIN
      core/res/drawable-hdpi/ic_action_priority_high_dark.png
  2. BIN
      core/res/drawable-hdpi/ic_action_priority_high_light.png
  3. BIN
      core/res/drawable-hdpi/ic_action_priority_low_dark.png
  4. BIN
      core/res/drawable-hdpi/ic_action_priority_low_light.png
  5. BIN
      core/res/drawable-hdpi/ic_action_priority_normal_dark.png
  6. BIN
      core/res/drawable-hdpi/ic_action_priority_normal_light.png
  7. BIN
      core/res/drawable-hdpi/ic_action_priority_off_dark.png
  8. BIN
      core/res/drawable-hdpi/ic_action_priority_off_light.png
  9. BIN
      core/res/drawable-hdpi/ic_action_trackers_dark.png
  10. BIN
      core/res/drawable-hdpi/ic_action_trackers_light.png
  11. BIN
      core/res/drawable-mdpi/ic_action_priority_high_dark.png
  12. BIN
      core/res/drawable-mdpi/ic_action_priority_high_light.png
  13. BIN
      core/res/drawable-mdpi/ic_action_priority_low_dark.png
  14. BIN
      core/res/drawable-mdpi/ic_action_priority_low_light.png
  15. BIN
      core/res/drawable-mdpi/ic_action_priority_normal_dark.png
  16. BIN
      core/res/drawable-mdpi/ic_action_priority_normal_light.png
  17. BIN
      core/res/drawable-mdpi/ic_action_priority_off_dark.png
  18. BIN
      core/res/drawable-mdpi/ic_action_priority_off_light.png
  19. BIN
      core/res/drawable-mdpi/ic_action_trackers_dark.png
  20. BIN
      core/res/drawable-mdpi/ic_action_trackers_light.png
  21. BIN
      core/res/drawable-xhdpi/ic_action_priority_high_dark.png
  22. BIN
      core/res/drawable-xhdpi/ic_action_priority_high_light.png
  23. BIN
      core/res/drawable-xhdpi/ic_action_priority_low_dark.png
  24. BIN
      core/res/drawable-xhdpi/ic_action_priority_low_light.png
  25. BIN
      core/res/drawable-xhdpi/ic_action_priority_normal_dark.png
  26. BIN
      core/res/drawable-xhdpi/ic_action_priority_normal_light.png
  27. BIN
      core/res/drawable-xhdpi/ic_action_priority_off_dark.png
  28. BIN
      core/res/drawable-xhdpi/ic_action_priority_off_light.png
  29. BIN
      core/res/drawable-xhdpi/ic_action_trackers_dark.png
  30. BIN
      core/res/drawable-xhdpi/ic_action_trackers_light.png
  31. 1
      core/res/menu/fragment_details.xml
  32. 4
      core/res/menu/fragment_details_file.xml
  33. 5
      core/res/values/attrs.xml
  34. 10
      core/res/values/styles.xml
  35. 6
      core/src/org/transdroid/core/gui/DetailsFragment.java
  36. 4
      core/src/org/transdroid/core/gui/TorrentsActivity.java
  37. 12
      core/src/org/transdroid/core/gui/TorrentsFragment.java
  38. 16
      core/src/org/transdroid/core/gui/lists/TorrentFilePriorityLayout.java
  39. 13
      core/src/org/transdroid/core/gui/lists/TorrentStatusLayout.java
  40. 2
      lib/src/org/transdroid/daemon/Daemon.java

BIN
core/res/drawable-hdpi/ic_action_priority_high_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
core/res/drawable-hdpi/ic_action_priority_high_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

BIN
core/res/drawable-hdpi/ic_action_priority_low_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

BIN
core/res/drawable-hdpi/ic_action_priority_low_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
core/res/drawable-hdpi/ic_action_priority_normal_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

BIN
core/res/drawable-hdpi/ic_action_priority_normal_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

BIN
core/res/drawable-hdpi/ic_action_priority_off_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

BIN
core/res/drawable-hdpi/ic_action_priority_off_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
core/res/drawable-hdpi/ic_action_trackers_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
core/res/drawable-hdpi/ic_action_trackers_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
core/res/drawable-mdpi/ic_action_priority_high_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

BIN
core/res/drawable-mdpi/ic_action_priority_high_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

BIN
core/res/drawable-mdpi/ic_action_priority_low_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

BIN
core/res/drawable-mdpi/ic_action_priority_low_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

BIN
core/res/drawable-mdpi/ic_action_priority_normal_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

BIN
core/res/drawable-mdpi/ic_action_priority_normal_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

BIN
core/res/drawable-mdpi/ic_action_priority_off_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

BIN
core/res/drawable-mdpi/ic_action_priority_off_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

BIN
core/res/drawable-mdpi/ic_action_trackers_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
core/res/drawable-mdpi/ic_action_trackers_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
core/res/drawable-xhdpi/ic_action_priority_high_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
core/res/drawable-xhdpi/ic_action_priority_high_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
core/res/drawable-xhdpi/ic_action_priority_low_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
core/res/drawable-xhdpi/ic_action_priority_low_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
core/res/drawable-xhdpi/ic_action_priority_normal_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
core/res/drawable-xhdpi/ic_action_priority_normal_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
core/res/drawable-xhdpi/ic_action_priority_off_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
core/res/drawable-xhdpi/ic_action_priority_off_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
core/res/drawable-xhdpi/ic_action_trackers_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
core/res/drawable-xhdpi/ic_action_trackers_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

1
core/res/menu/fragment_details.xml

@ -42,6 +42,7 @@ @@ -42,6 +42,7 @@
android:title="@string/action_setlabel" />
<item
android:id="@+id/action_updatetrackers"
android:icon="?attr/ic_action_trackers"
android:showAsAction="ifRoom"
android:title="@string/action_updatetrackers" />

4
core/res/menu/fragment_details_file.xml

@ -2,18 +2,22 @@ @@ -2,18 +2,22 @@
<item
android:id="@+id/action_priority_off"
android:icon="?attr/ic_action_priority_off"
android:showAsAction="ifRoom"
android:title="@string/action_priority_off" />
<item
android:id="@+id/action_priority_low"
android:icon="?attr/ic_action_priority_low"
android:showAsAction="ifRoom"
android:title="@string/action_priority_low" />
<item
android:id="@+id/action_priority_normal"
android:icon="?attr/ic_action_priority_normal"
android:showAsAction="ifRoom"
android:title="@string/action_priority_normal" />
<item
android:id="@+id/action_priority_high"
android:icon="?attr/ic_action_priority_high"
android:showAsAction="ifRoom"
android:title="@string/action_priority_high" />
<item

5
core/res/values/attrs.xml

@ -10,6 +10,10 @@ @@ -10,6 +10,10 @@
<attr name="ic_action_labels" format="reference"/>
<attr name="ic_action_new" format="reference"/>
<attr name="ic_action_pause" format="reference"/>
<attr name="ic_action_priority_off" format="reference"/>
<attr name="ic_action_priority_low" format="reference"/>
<attr name="ic_action_priority_normal" format="reference"/>
<attr name="ic_action_priority_high" format="reference"/>
<attr name="ic_action_refresh" format="reference"/>
<attr name="ic_action_remove" format="reference"/>
<attr name="ic_action_resume" format="reference"/>
@ -18,6 +22,7 @@ @@ -18,6 +22,7 @@
<attr name="ic_action_sort_by_size" format="reference"/>
<attr name="ic_action_start" format="reference"/>
<attr name="ic_action_stop" format="reference"/>
<attr name="ic_action_trackers" format="reference"/>
<attr name="ic_action_website" format="reference"/>
<attr name="loading_progress" format="reference"/>
<attr name="selectable_background_transdroid" format="reference"/>

10
core/res/values/styles.xml

@ -9,6 +9,10 @@ @@ -9,6 +9,10 @@
<item name="ic_action_labels">@drawable/ic_action_labels_light</item>
<item name="ic_action_new">@drawable/ic_action_new_light</item>
<item name="ic_action_pause">@drawable/ic_action_pause_light</item>
<item name="ic_action_priority_off">@drawable/ic_action_priority_off_light</item>
<item name="ic_action_priority_low">@drawable/ic_action_priority_low_light</item>
<item name="ic_action_priority_normal">@drawable/ic_action_priority_normal_light</item>
<item name="ic_action_priority_high">@drawable/ic_action_priority_high_light</item>
<item name="ic_action_refresh">@drawable/ic_action_refresh_light</item>
<item name="ic_action_remove">@drawable/ic_action_remove_light</item>
<item name="ic_action_resume">@drawable/ic_action_resume_light</item>
@ -17,6 +21,7 @@ @@ -17,6 +21,7 @@
<item name="ic_action_sort_by_size">@drawable/ic_action_sort_by_size_light</item>
<item name="ic_action_start">@drawable/ic_action_start_light</item>
<item name="ic_action_stop">@drawable/ic_action_stop_light</item>
<item name="ic_action_trackers">@drawable/ic_action_trackers_light</item>
<item name="ic_action_website">@drawable/ic_action_website_light</item>
<item name="loading_progress">@drawable/loading_progress_light</item>
<item name="selectable_background_transdroid">@drawable/selectable_background_transdroid2</item>
@ -33,6 +38,10 @@ @@ -33,6 +38,10 @@
<item name="ic_action_labels">@drawable/ic_action_labels_dark</item>
<item name="ic_action_new">@drawable/ic_action_new_dark</item>
<item name="ic_action_pause">@drawable/ic_action_pause_dark</item>
<item name="ic_action_priority_off">@drawable/ic_action_priority_off_dark</item>
<item name="ic_action_priority_low">@drawable/ic_action_priority_low_dark</item>
<item name="ic_action_priority_normal">@drawable/ic_action_priority_normal_dark</item>
<item name="ic_action_priority_high">@drawable/ic_action_priority_high_dark</item>
<item name="ic_action_refresh">@drawable/ic_action_refresh_dark</item>
<item name="ic_action_remove">@drawable/ic_action_remove_dark</item>
<item name="ic_action_resume">@drawable/ic_action_resume_dark</item>
@ -41,6 +50,7 @@ @@ -41,6 +50,7 @@
<item name="ic_action_sort_by_size">@drawable/ic_action_sort_by_size_dark</item>
<item name="ic_action_start">@drawable/ic_action_start_dark</item>
<item name="ic_action_stop">@drawable/ic_action_stop_dark</item>
<item name="ic_action_trackers">@drawable/ic_action_trackers_dark</item>
<item name="ic_action_website">@drawable/ic_action_website_dark</item>
<item name="loading_progress">@drawable/loading_progress_light</item>
<item name="selectable_background_transdroid">@drawable/selectable_background_transdroid</item>

6
core/src/org/transdroid/core/gui/DetailsFragment.java

@ -274,9 +274,13 @@ public class DetailsFragment extends SherlockFragment { @@ -274,9 +274,13 @@ public class DetailsFragment extends SherlockFragment {
mode.finish();
return true;
} else {
Priority priority = Priority.Normal;
Priority priority = Priority.Off;
if (itemId == R.id.action_priority_low)
priority = Priority.Low;
if (itemId == R.id.action_priority_normal)
priority = Priority.Normal;
if (itemId == R.id.action_priority_high)
priority = Priority.High;
getTasksExecutor().updatePriority(torrent, checked, priority);
mode.finish();
return true;

4
core/src/org/transdroid/core/gui/TorrentsActivity.java

@ -305,7 +305,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi @@ -305,7 +305,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
navigationSpinnerAdapter.updateCurrentFilter(currentFilter);
// Clear the currently shown list of torrents and perhaps the details
fragmentTorrents.clear();
fragmentTorrents.clear(true);
if (fragmentDetails != null && fragmentDetails.getActivity() != null) {
fragmentDetails.clear();
}
@ -701,7 +701,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi @@ -701,7 +701,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
DaemonTaskResult result = RemoveTask.create(currentConnection, torrent, withData).execute();
if (result instanceof DaemonTaskResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, getString(withData ? R.string.result_removed_with_data
: R.string.result_removed));
: R.string.result_removed, torrent.getName()));
} else {
onCommunicationError((DaemonTaskFailureResult) result, false);
}

12
core/src/org/transdroid/core/gui/TorrentsFragment.java

@ -95,10 +95,12 @@ public class TorrentsFragment extends SherlockFragment { @@ -95,10 +95,12 @@ public class TorrentsFragment extends SherlockFragment {
/**
* Clears the currently visible list of torrents.
* @param b
*/
public void clear() {
public void clear(boolean clearError) {
this.torrents = null;
this.connectionErrorMessage = null;
if (clearError)
this.connectionErrorMessage = null;
this.currentTextFilter = null;
this.currentNavigationFilter = null;
applyAllFilters();
@ -264,7 +266,7 @@ public class TorrentsFragment extends SherlockFragment { @@ -264,7 +266,7 @@ public class TorrentsFragment extends SherlockFragment {
public void updateConnectionStatus(boolean hasAConnection) {
this.hasAConnection = hasAConnection;
if (!hasAConnection) {
clear(); // Indirectly also calls updateViewVisibility()
clear(true); // Indirectly also calls updateViewVisibility()
} else {
updateViewVisibility();
}
@ -278,7 +280,7 @@ public class TorrentsFragment extends SherlockFragment { @@ -278,7 +280,7 @@ public class TorrentsFragment extends SherlockFragment {
public void updateIsLoading(boolean isLoading) {
this.isLoading = isLoading;
if (isLoading) {
clear(); // Indirectly also calls updateViewVisibility()
clear(true); // Indirectly also calls updateViewVisibility()
} else {
updateViewVisibility();
}
@ -294,7 +296,7 @@ public class TorrentsFragment extends SherlockFragment { @@ -294,7 +296,7 @@ public class TorrentsFragment extends SherlockFragment {
this.connectionErrorMessage = connectionErrorMessage;
errorText.setText(connectionErrorMessage);
if (connectionErrorMessage != null) {
clear(); // Indirectly also calls updateViewVisibility()
clear(false); // Indirectly also calls updateViewVisibility()
} else {
updateViewVisibility();
}

16
core/src/org/transdroid/core/gui/lists/TorrentFilePriorityLayout.java

@ -9,10 +9,16 @@ import android.graphics.RectF; @@ -9,10 +9,16 @@ import android.graphics.RectF;
import android.util.AttributeSet;
import fr.marvinlabs.widget.CheckableRelativeLayout;
/**
* A relative layout that that is checkable (to be used in a contextual action bar) and shows a coloured bar in the far
* left indicating the priority of the represented file. The darker the green, the higher the priority, while grey means
* the file isn't downloaded at all.
* @author Eric Kok
*/
public class TorrentFilePriorityLayout extends CheckableRelativeLayout {
private final float scale = getContext().getResources().getDisplayMetrics().density;
private final int WIDTH = (int) (5 * scale + 0.5f);
private final int WIDTH = (int) (6 * scale + 0.5f);
private Priority priority = null;
private final Paint offPaint = new Paint();
@ -34,10 +40,10 @@ public class TorrentFilePriorityLayout extends CheckableRelativeLayout { @@ -34,10 +40,10 @@ public class TorrentFilePriorityLayout extends CheckableRelativeLayout {
}
private void initPaints() {
offPaint.setColor(0xFF9E9E9E); // Grey
lowPaint.setColor(0x778ACC12); // Very Light green
normalPaint.setColor(0xBB8ACC12); // Light green
highPaint.setColor(0xFF8ACC12); // Green
offPaint.setColor(0xFF9E9E9E); // Grey
lowPaint.setColor(0xFFC8E88E); // Light green
normalPaint.setColor(0xFF8ACC12); // Normal green
highPaint.setColor(0xFF4B6617); // Dark green
}
public void setPriority(Priority priority) {

13
core/src/org/transdroid/core/gui/lists/TorrentStatusLayout.java

@ -9,10 +9,16 @@ import android.graphics.RectF; @@ -9,10 +9,16 @@ import android.graphics.RectF;
import android.util.AttributeSet;
import fr.marvinlabs.widget.CheckableRelativeLayout;
/**
* A relative layout that is checkable (to be used in a contextual action bar) and shows a coloured bar in the far left
* indicating the status of the represented torrent. Active downloads are blue, seeding torrents are green, errors are
* red, etc.
* @author Eric Kok
*/
public class TorrentStatusLayout extends CheckableRelativeLayout {
private final float scale = getContext().getResources().getDisplayMetrics().density;
private final int WIDTH = (int) (5 * scale + 0.5f);
private final int WIDTH = (int) (6 * scale + 0.5f);
private TorrentStatus status = null;
private final Paint inactiveDonePaint = new Paint();
@ -42,6 +48,11 @@ public class TorrentStatusLayout extends CheckableRelativeLayout { @@ -42,6 +48,11 @@ public class TorrentStatusLayout extends CheckableRelativeLayout {
errorPaint.setColor(0xFFDE3939); // Red
}
/**
* Registers the status of the represented torrent and invalidates the view so the status colour will be updated
* accordingly.
* @param status
*/
public void setStatus(TorrentStatus status) {
this.status = status;
this.invalidate();

2
lib/src/org/transdroid/daemon/Daemon.java

@ -217,7 +217,7 @@ public enum Daemon { @@ -217,7 +217,7 @@ public enum Daemon {
return 80;
}
case Deluge:
return 8112;
return 8112;
case Transmission:
return 9091;
case Bitflu:

Loading…
Cancel
Save