android-storage icon indicating copy to clipboard operation
android-storage copied to clipboard

Context is not necessary when only using ExternalStorage

Open drakeet opened this issue 6 years ago • 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!

drakeet avatar Oct 03 '17 11:10 drakeet

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 avatar Nov 26 '17 18:11 krokofant

@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 avatar Nov 26 '17 23:11 drakeet

@drakeet I see what you mean now.

krokofant avatar Nov 27 '17 11:11 krokofant