Move isValidZipFile to ZipHelper

This commit is contained in:
XiangRongLin 2020-12-19 14:14:48 +01:00
parent ea91a62c89
commit 19cd3a17df
3 changed files with 11 additions and 11 deletions

View file

@ -224,7 +224,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
private void importDatabase(final String filePath) {
// check if file is supported
if (!manager.isValidZipFile(filePath)) {
if (!ZipHelper.isValidZipFile(filePath)) {
Toast.makeText(getContext(), R.string.no_valid_zip_file, Toast.LENGTH_SHORT)
.show();
return;

View file

@ -36,16 +36,6 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) {
}
}
fun isValidZipFile(filePath: String): Boolean {
try {
ZipFile(filePath).use {
return@isValidZipFile true
}
} catch (ioe: IOException) {
return false
}
}
/**
* Tries to create database directory if it does not exist.
*