Amazefilemanager: Loading images from cloud is broken

Created on 29 Dec 2017  路  11Comments  路  Source: TeamAmaze/AmazeFileManager

Images from dropbox won't load, a model must be added to support DROPBOX:// and other similar paths.

Issue-Bug

All 11 comments

@VishalNehra I believe you were working on this?

Test with current master on my Oneplus One running Slim7 (7.1.2).

Onedrive and Dropbox are both working. Possibly due to the way I setup my phone, I couldn't link my Google Drive account with Amaze, so can't tell... but I think it should also work.

Outside the cloud plugin, images can also be opened over SFTP connections, but not over SMB connections... but it didn't happen with Galaxy S2 running SlimLP (5.1.1).

On 7.1.2 app would crash of android.os.NetworkOnMainThreadException.

@TranceLove this issue was for loading of icons not the images themselves. I'm already working on this in another branch.

Any progress, can I help?

I might need some help over here. Will let you know after a few more tries. Basically, we're loading icons on main thread now, it throws NetworkOnMainThread exception when loading cloud icons. I've written models and helper classes to pool the requests and load them in background. But now icons are not being loaded at all.
Like I said, will let you know if I fail this weekend.

News? At least upload a fix branch to the repo...

Will update the branch once I finalize. I've managed to pinpoint the problem and fix is almost been worked up.

I now see there's branch fix-glide-iconloading for this. I still don't understand why you implemented your own threaded solution to download (in IconLoaderUtil) I would imagine Glide already has one...

Please point me to it then.

You don't tell me where you got stuck... So I've read your code, side by side with the official guide.
I will write what I think are mistakes:

  1. The ModelLoader (A) has a redundant name (see point 3) (B) takes an InputStream and not a String (URLs are now InputStreams?) and (C) returns true...
    InputStreamModelLoader:
    @Override
    public boolean handles(InputStream inputStream) {
        return true;
    }
  1. Why is the KEY for caching the current time in milliseconds?!
    @Nullable
    @Override
    public LoadData<InputStream> buildLoadData(InputStream inputStream, int width, int height, Options options) {
        return new LoadData<>(new ObjectKey(System.currentTimeMillis()), new InputStreamDataFetcher(inputStream));
    }
  1. InputStreamDataFetcher should have a more specific name (like CloudServiceDataFetcher). Also, loadData is not doing the loading?
    >[...] loadData() is the method where Glide expects you to do your heavy lifting. You can queue an asynchronous task, start a network request, load some data from disk or whatever you鈥檇 like. loadData() is always called on one of Glide鈥檚 background threads. A given DataFetcher will only be used on a single background thread at a time, so it doesn鈥檛 need to be thread safe. However, multiple DataFetchers may be run in parallel, so any shared resources accessed by DataFetchers should be thread safe.

-- source

   @Override
    public void loadData(Priority priority, DataCallback<? super InputStream> callback) {
        callback.onDataReady(inputStream);
    }

Maybe Advanced Usecases will help you, anyways, the code is very long and I'm trying to not have to understand it all, because multi-threading can be very tiering for me, please do tell me WHERE you are stuck/don't know how to not reinvent the wheel.

Thank you, your last advice about loadData handling all the heavy work for icon loading really helped as I seem to have skipped it while reading documentation.
I've made a PR which should fix this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

organik1 picture organik1  路  4Comments

kr-nahid picture kr-nahid  路  5Comments

mueller-ma picture mueller-ma  路  5Comments

Wilker-a picture Wilker-a  路  5Comments

EmmanuelMess picture EmmanuelMess  路  3Comments