Fix some issues
This commit is contained in:
parent
ddbd76bf15
commit
cbd74ffc8d
|
@ -1174,6 +1174,7 @@ public class Helper {
|
||||||
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
final String fileName = URLUtil.guessFileName(url, null, null);
|
final String fileName = URLUtil.guessFileName(url, null, null);
|
||||||
request.allowScanningByMediaScanner();
|
request.allowScanningByMediaScanner();
|
||||||
String myDir = sharedpreferences.getString(Helper.SET_FOLDER_RECORD, Environment.DIRECTORY_DOWNLOADS);
|
String myDir = sharedpreferences.getString(Helper.SET_FOLDER_RECORD, Environment.DIRECTORY_DOWNLOADS);
|
||||||
|
@ -1182,6 +1183,11 @@ public class Helper {
|
||||||
DownloadManager dm = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
|
DownloadManager dm = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
|
||||||
assert dm != null;
|
assert dm != null;
|
||||||
return dm.enqueue(request);
|
return dm.enqueue(request);
|
||||||
|
}catch (IllegalStateException e){
|
||||||
|
Toasty.error(context,context.getString(R.string.error_destination_path), Toast.LENGTH_LONG).show();
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMimeType(String url) {
|
public static String getMimeType(String url) {
|
||||||
|
|
|
@ -1221,4 +1221,5 @@
|
||||||
<string name="added_to_story">Media successfully added to your story!</string>
|
<string name="added_to_story">Media successfully added to your story!</string>
|
||||||
<string name="action_disabled">Action disabled</string>
|
<string name="action_disabled">Action disabled</string>
|
||||||
<string name="action_unfollow">Unfollow</string>
|
<string name="action_unfollow">Unfollow</string>
|
||||||
|
<string name="error_destination_path">Something went wrong, please check your download directory in settings.</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue