route video downloads to "Movies" and audio to "Music"
use the standard Android folders when downloading files.
This commit is contained in:
parent
ccdd13d136
commit
d715eae0d1
|
@ -61,21 +61,24 @@ public class DownloadDialog extends DialogFragment {
|
||||||
String suffix = "";
|
String suffix = "";
|
||||||
String title = arguments.getString(TITLE);
|
String title = arguments.getString(TITLE);
|
||||||
String url = "";
|
String url = "";
|
||||||
|
String downloadFolder = "Download";
|
||||||
switch(which) {
|
switch(which) {
|
||||||
case 0: // Video
|
case 0: // Video
|
||||||
suffix = arguments.getString(FILE_SUFFIX_VIDEO);
|
suffix = arguments.getString(FILE_SUFFIX_VIDEO);
|
||||||
url = arguments.getString(VIDEO_URL);
|
url = arguments.getString(VIDEO_URL);
|
||||||
|
downloadFolder = "Movies";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
suffix = arguments.getString(FILE_SUFFIX_AUDIO);
|
suffix = arguments.getString(FILE_SUFFIX_AUDIO);
|
||||||
url = arguments.getString(AUDIO_URL);
|
url = arguments.getString(AUDIO_URL);
|
||||||
|
downloadFolder = "Music";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.d(TAG, "lolz");
|
Log.d(TAG, "lolz");
|
||||||
}
|
}
|
||||||
//to avoid hard-coded string like "/storage/emulated/0/Movies"
|
//to avoid hard-coded string like "/storage/emulated/0/Movies"
|
||||||
String downloadPath = prefs.getString(getString(R.string.downloadPathPreference),
|
String downloadPath = prefs.getString(getString(R.string.downloadPathPreference),
|
||||||
Environment.getExternalStorageDirectory().getAbsolutePath() + "/Movies");
|
Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + downloadFolder);
|
||||||
final File dir = new File(downloadPath);
|
final File dir = new File(downloadPath);
|
||||||
if(!dir.exists()) {
|
if(!dir.exists()) {
|
||||||
boolean mkdir = dir.mkdir(); //attempt to create directory
|
boolean mkdir = dir.mkdir(); //attempt to create directory
|
||||||
|
|
Loading…
Reference in New Issue