Added auto export feature

This commit is contained in:
tom5079
2019-06-06 00:57:10 +09:00
parent 6f8697791d
commit 9014ad6d77
5 changed files with 28 additions and 3 deletions

View File

@@ -59,8 +59,6 @@ class GalleryDownloader(
downloads.add(galleryBlock.id)
} else {
field = false
downloads.remove(galleryBlock.id)
}
onNotifyChangedHandler?.invoke(value)
@@ -232,7 +230,23 @@ class GalleryDownloader(
}
}
notificationManager.notify(galleryBlock.id, notificationBuilder.build())
val preference = PreferenceManager.getDefaultSharedPreferences(this@GalleryDownloader)
val autoExport = preference.getBoolean("auto_export", false)
if (autoExport) {
export({
notificationManager.notify(galleryBlock.id, notificationBuilder.build())
}, {
notificationBuilder
.setContentTitle(galleryBlock.title)
.setContentText(getString(R.string.main_export_error))
.setProgress(0, 0, false)
notificationManager.notify(galleryBlock.id, notificationBuilder.build())
})
} else {
notificationManager.notify(galleryBlock.id, notificationBuilder.build())
}
}
download = false

View File

@@ -63,4 +63,6 @@
<string name="main_export_error">エクスポートエラーが発生しました</string>
<string name="settings_export_zip_title">zipエクスポート</string>
<string name="settings_export_zip_summary">イメージフォルダの代わりzipファイルでエクスポート</string>
<string name="settings_auto_export_title">自動エクスポート</string>
<string name="settings_auto_export_summary">ダウンロード完了後自動的にエクスポート</string>
</resources>

View File

@@ -63,4 +63,6 @@
<string name="main_export_error">내보내기 오류가 발생했습니다</string>
<string name="settings_export_zip_title">zip 파일로 내보내기</string>
<string name="settings_export_zip_summary">이미지 폴더 대신 zip 파일로 내보내기</string>
<string name="settings_auto_export_title">자동 내보내기</string>
<string name="settings_auto_export_summary">다운로드가 끝난 후 자동 내보내기</string>
</resources>

View File

@@ -89,6 +89,8 @@
<string name="settings_use_hiyobi_summary">Load images from hiyobi.me to improve loading speed (if available)</string>
<string name="settings_export_zip_title">Export zip</string>
<string name="settings_export_zip_summary">Export to zip instead of image folder</string>
<string name="settings_auto_export_title">Auto Export</string>
<string name="settings_auto_export_summary">Automatically exports galleries when download is finished</string>
<string name="settings_security_mode_title">Enable security mode</string>
<string name="settings_security_mode_summary">Enable security mode to make the screen invisible on recent app window</string>

View File

@@ -47,6 +47,11 @@
app:title="@string/settings_export_zip_title"
app:summary="@string/settings_export_zip_summary"/>
<SwitchPreference
app:key="auto_export"
app:title="@string/settings_auto_export_title"
app:summary="@string/settings_auto_export_summary"/>
<SwitchPreference
app:key="security_mode"
app:title="@string/settings_security_mode_title"