From 1d9fe52b35235153fcb91f156f8505528fcb8981 Mon Sep 17 00:00:00 2001 From: Phillip Dykman Date: Tue, 9 Feb 2016 03:02:10 -0800 Subject: [PATCH 1/2] Add force recheck command for qBitTorrent --- app/src/main/java/org/transdroid/daemon/Daemon.java | 2 +- .../transdroid/daemon/Qbittorrent/QbittorrentAdapter.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/transdroid/daemon/Daemon.java b/app/src/main/java/org/transdroid/daemon/Daemon.java index 38eea048..dcc27416 100644 --- a/app/src/main/java/org/transdroid/daemon/Daemon.java +++ b/app/src/main/java/org/transdroid/daemon/Daemon.java @@ -364,7 +364,7 @@ public enum Daemon { } public static boolean supportsForceRecheck(Daemon type) { - return type == uTorrent || type == BitTorrent || type == Deluge || type == rTorrent || type == Transmission || type == Dummy; + return type == uTorrent || type == BitTorrent || type == Deluge || type == rTorrent || type == Transmission || type == Dummy || type == qBittorrent; } public static boolean supportsExtraPassword(Daemon type) { diff --git a/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java b/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java index 20541955..d9670752 100644 --- a/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java +++ b/app/src/main/java/org/transdroid/daemon/Qbittorrent/QbittorrentAdapter.java @@ -298,6 +298,11 @@ public class QbittorrentAdapter implements IDaemonAdapter { } return new DaemonTaskSuccessResult(task); + case ForceRecheck: + // Force recheck a torrent + makeRequest(log, "/command/recheck", new BasicNameValuePair("hash", task.getTargetTorrent().getUniqueID())); + return new DaemonTaskSuccessResult(task); + case SetTransferRates: // TODO: This doesn't seem to work yet From 3bc3fbcf78007504f645e001b6ceac03fe66178f Mon Sep 17 00:00:00 2001 From: Zach Strudler Date: Mon, 22 Feb 2016 01:53:21 -0500 Subject: [PATCH 2/2] Show popup in UI thread --- .../core/gui/navigation/NavigationHelper.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java b/app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java index f70c16fc..e99c5d11 100644 --- a/app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java +++ b/app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java @@ -92,13 +92,17 @@ public class NavigationHelper { return true; if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // Never asked again: show a dialog with an explanation - new MaterialDialog.Builder(context).content(R.string.permission_readtorrent).positiveText(android.R.string.ok) - .onPositive(new MaterialDialog.SingleButtonCallback() { - @Override - public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { - ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); - } - }).show(); + activity.runOnUiThread(new Runnable() { + public void run() { + new MaterialDialog.Builder(context).content(R.string.permission_readtorrent).positiveText(android.R.string.ok) + .onPositive(new MaterialDialog.SingleButtonCallback() { + @Override + public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { + ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); + } + }).show(); + } + }); return false; } // Permission not granted (and we asked for it already before)