sromku/android-storage

Context is not necessary when only using ExternalStorage

Opened this issue · 3 comments

I used this library v1.2.1 in my App Pure Writer. It is great!

I turn to v2.1.0 today, and I found Context is not necessary when only using Storage.getExternalStorageDirectory(). It may be better and convenient that move the Context parameter to getInternalFilesDirectory() and getInternalCacheDirectory() which truly need the Context, and supply a Storage() constructor. How about it?

Thanks!

How would it be better and convenient? I think keeping all the methods on an Storage instance is much cleaner. The only method I see being static now in Storage is the isExternalWritable.

If you're going to need Storage you'd need to create an instance of Storage. If you're not going to create an instance of it and only need the getExternalStorageDirectory method you could just call getExternalStorageDirectory on android.os.Environment yourself.

@krokofant I need Storage to read and modify files not only get external storage dir, but for external storage we not need Context at all.

@drakeet I see what you mean now.