Update build tools to 26.0.2 and update Dropbox sample to v2 API #155
Conversation
…xample. I can't understand how the recycler view was ever found - is there some Android magic that has changed, or did the Dropbox example never work (which seems hard to believe)?
… any more and any requests that are made using it fail with an HTTP 400 Bad Request (v1_retired). I have removed the old Dropbox sdk jar from samples/libs and also deleted the supporting libraries that were required. The Dropbox sdk is now imported using a Gradle dependency. Unfortunately, the Dropbox v2 API is large and forced me to enable multiDex. I have seen people moaning about this to Dropbox on their forum, so hopefully they will do something to shrink the size of the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the PR @mitchyboy9
I've tested it and it seems to work great.
I also had a look at that recyclerview thing you noted. And indeed there was something weird. I've added two inline notes for lines to delete. The second one is the assignment you added but the first is an unecessay file-local recyclerview member. I've must have added this by mistake at some point and it kept working by accident.
The correct member is defined in the parent class here: https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerFragment.java#L88
and it is assigned during initialization here: https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerFragment.java#L172
I removed the two lines locally and no nullpointer exceptions.
@@ -57,6 +58,7 @@ protected View inflateRootView(LayoutInflater inflater, ViewGroup container) { | |||
View view = inflater.inflate(R.layout.fragment_loading_filepicker, container, false); | |||
// And bind the progress bar | |||
progressBar = (ProgressBar) view.findViewById(R.id.progressBar); | |||
recyclerView = (RecyclerView) view.findViewById(android.R.id.list); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this line.
private final DropboxAPI<AndroidAuthSession> dbApi; | ||
public class DropboxFilePickerFragment extends AbstractFilePickerFragment<Metadata> { | ||
private static final String TAG = "DbxFilePickerFragment"; | ||
private final DbxClientV2 dropboxClient; | ||
private ProgressBar progressBar; | ||
private RecyclerView recyclerView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this line.
And if it's not too much trouble, would you mind adding an entry for |
…odules and Travis config. * Altered Dropbox login logic so that the sample won't get stuck in a loop if the user doesn't authenticate with Dropbox. Previously, if they cancelled the login process, they would immediately be taken back to Dropbox to log in again...and again! * Removed the RecyclerView from DropboxFilePickerFragment.java, as it is already declared and instantiated in AbstractFilePickerFragment.java
Thanks very much for your help with the RecyclerView issue. It's working fine for me now as well. I've updated the Travis build tools (and the Example and Sample modules, so everything is at the same level). Finally, I made a tweak to the Dropbox login code because, if you didn't authenticate with Dropbox when taken to the app/website to authorise the sample, you would get stuck in a loop where the sample would try to authenticate again...and again until you either killed the app, or did, actually, log in to Dropbox. |
Excellent. Thanks so much. |
Hello,
I wanted to use NoNonesense FilePicker in my project to select directories from Dropbox, but it wouldn't work because Dropbox has discontinued the v1 API used by the samples.
I have re-written the Dropbox sample to use the v2 API and thought I would share it for others to benefit.
The only thing that I'm not sure about, and would appreciate your help with, is the change I made in commit a0349ef, which I did to remove a NullPointerException when I first tried to run the Dropbox sample. I feel like I have missed something and that recyclerView in DropboxFilePickerFragment.java should somehow get automatically assigned. Is there a better way that I could have used to do this?