DSteve595 / Put.io

Put.io for Android!
MIT License
142 stars 30 forks source link

New Feature: Select destination folder when adding new transfer + Move #25

Closed sregg closed 10 years ago

sregg commented 10 years ago

Hi,

First of all, I use your app every day. It allows me to add new torrents from magnet links. I love it. But one thing I've been missing is the ability to select the destination folder in which the transfer will be added. As I am an Android developer myself, I decided to develop this feature this morning and here it is. How it works: When adding a transfer from URL (from intent filter or through the + action bar item), you have a "Destination" button below the extract checkbox. The design is not final, maybe a label saying "Destination:" with a "Change" button would look nicer...

screen shot 2014-09-13 at 2 45 27 pm

When you click on this button it opens a dialog with the file structure so you can select the destination folder you want. (I reused your Files fragment and made it a DialogFragment + some tweaks).

screen shot 2014-09-13 at 2 45 37 pm

You can navigate through the file structure as you can do it in the main screen, and when you've chosen the folder you want, you can press the "Choose Folder" button.

screen shot 2014-09-13 at 2 46 37 pm

Once you clicked on that button, the dialog closes, and the selected folder is saved so it will be used in the API call (see the save_parent_id attribute in https://put.io/v2/docs/transfers.html#add).

screen shot 2014-09-13 at 2 46 46 pm

The only issue as you can see is that I couldn't find a way to get the name of the selected folder (there is a Files.getCurrentFolderId but no Files.getCurrentFolderName or Files.getCurrentFolder). Appart from that, it's working pretty well :)

Would you be able to help me on that?

Thank you in advance for your time. And thanks again for this awesome app!

sregg commented 10 years ago

I pushed a new commit (https://github.com/sregg/Put.io/commit/be4ab6b48491443d26630c49b599e0f245d0acd0) to move the button from AddTransferUrl.java to AddTransfers.java so the feature can be used when adding a transfer from File as well (and to avoid unnecessary communication between AddTransferUrl.java and AddTransfers.java)

When I testing the Upload from torrent file feature, I couldn't make it work (tested with your version as well). It says "Enter something to fetch first" even though I selected a .torrent file from my Downloads...

sregg commented 10 years ago

I pushed a third one to show the name of the selected folder instead of its id https://github.com/sregg/Put.io/commit/e66a2849f234710ae5ae54b5d2443fd5a7e28247

sregg commented 10 years ago

I was also thinking about re-using my DestinationFilesDialog to add a "Move" feature in addition to the existing "Rename" and "Delete".

DSteve595 commented 10 years ago

Thank you so much for helping out, I greatly appreciate it. I'm out for the weekend, will review when I get back.

I'm going to add a getCurrentFolder() method for the Files fragment. Should be cleaner than a bunch of getId, getName methods.

sregg commented 10 years ago

Sounds great! Have a good weekend.

DSteve595 commented 10 years ago

Move would also be a good feature I've been meaning to implement but never got around to.

I also want to redesign the Add Transfers dialog.

DSteve595 commented 10 years ago

Can't express how awesome this is, thanks a million.

sregg commented 10 years ago

"Move" done in 4th commit: https://github.com/sregg/Put.io/commit/106bc845368bc92307ec6dace1ce4afcf25df6c2

Let me know what you think.

sregg commented 10 years ago

By the way, your code is a delight to edit! This retrofit/job-queue/event-bus thing is awesome!

DSteve595 commented 10 years ago

Thanks, I love those libraries. Rewrote the network code with them a month or two ago and it's made everything easier. On Sep 13, 2014 8:35 PM, "sregg" notifications@github.com wrote:

By the way, your code is a delight to edit! This retrofit/job-queue/event-bus thing is awesome!

— Reply to this email directly or view it on GitHub https://github.com/DSteve595/Put.io/pull/25#issuecomment-55511595.

sregg commented 10 years ago

Hi there,

Did you have a chance to review this? I've been using it for 10 days now and it's working like a charm :)

DSteve595 commented 10 years ago

I'm really sorry, this and last week have been very hectic. Will look at this as soon as I can and release an update.

sregg commented 10 years ago

No worries. There's no rush :)

DSteve595 commented 10 years ago

I'm going to do some UI cleanup before merging. The Add Transfers dialog box, specifically.

DSteve595 commented 10 years ago

Have you been able to upload files (torrents) since the "parent_id" Field was added? I'm getting an error every time. Enabling logging gives this:

java.lang.IllegalArgumentException: PutioRestInterface.uploadFile: Only one encoding annotation is allowed.
        at retrofit.RestMethodInfo.methodError(RestMethodInfo.java:123)
        at retrofit.RestMethodInfo.parseMethodAnnotations(RestMethodInfo.java:176)
        at retrofit.RestMethodInfo.init(RestMethodInfo.java:133)
        at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:294)
        at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
        at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
        at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at retrofit.Platform$Android$2$1.run(Platform.java:142)
        at java.lang.Thread.run(Thread.java:841)

I merged your work and built off of it in the move-and-destination-folder branch. See if it was something I broke or if something else is wrong?

DSteve595 commented 10 years ago

Never mind, changing it to a Part worked.

oimctony commented 9 years ago

Hello ! It did work for me for a while but weirdly, it doesn't anymore. ( on both my devices, an Android 4.4.2 phone and a 4.4.2 tablet) .

When i click the "Destination" label, i can navigate trough my put.io folders, but when i click on "choose folder", the destination didn't change, and the transfer is done in the original folder.

I tried uninstall/reinstall, didn't help.

It's very weird :/

DSteve595 commented 9 years ago

Thanks for the report, will check it out.