Minor changes and fixes

This commit is contained in:
len 2016-12-03 13:08:26 +01:00
parent d10bf45283
commit f514d466a6
5 changed files with 11 additions and 8 deletions

View File

@ -56,7 +56,7 @@
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="eu.kanade.tachiyomi.provider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data

View File

@ -319,7 +319,7 @@ class LibraryUpdateService : Service() {
* @return the body of the notification to display.
*/
private fun getUpdatedMangasBody(updates: List<Manga>, failedUpdates: List<Manga>): String {
return with(StringBuilder()) {
return buildString {
if (updates.isEmpty()) {
append(getString(R.string.notification_no_new_chapters))
append("\n")
@ -327,7 +327,7 @@ class LibraryUpdateService : Service() {
append(getString(R.string.notification_new_chapters))
for (manga in updates) {
append("\n")
append(manga.title.chop(30))
append(manga.title.chop(45))
}
}
if (!failedUpdates.isEmpty()) {
@ -335,10 +335,9 @@ class LibraryUpdateService : Service() {
append(getString(R.string.notification_manga_update_failed))
for (manga in failedUpdates) {
append("\n")
append(manga.title.chop(30))
append(manga.title.chop(45))
}
}
toString()
}
}

View File

@ -26,6 +26,8 @@ class ChangelogDialogFragment : DialogFragment() {
ChangelogDialogFragment().show(fm, "changelog")
// TODO better upgrades management
if (oldVersion == 0) return
if (oldVersion < 14) {
// Restore jobs after upgrading to evernote's job scheduler.
if (BuildConfig.INCLUDE_UPDATER && preferences.automaticUpdates()) {

View File

@ -6,6 +6,7 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import android.support.v4.content.FileProvider
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.notificationManager
import java.io.File
@ -61,7 +62,7 @@ class ImageNotificationReceiver : BroadcastReceiver() {
private fun showImage(context: Context, path: String) {
val intent = Intent(Intent.ACTION_VIEW).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION
val uri = FileProvider.getUriForFile(context, "eu.kanade.tachiyomi.provider", File(path))
val uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", File(path))
setDataAndType(uri, "image/*")
}
context.startActivity(intent)

View File

@ -83,10 +83,11 @@ class SettingsDownloadsFragment : SettingsFragment() {
subscriptions += preferences.downloadsDirectory().asObservable()
.subscribe { path ->
downloadDirPref.summary = path
val dir = UniFile.fromUri(context, Uri.parse(path))
downloadDirPref.summary = dir.filePath ?: path
// Don't display downloaded chapters in gallery apps creating a ".nomedia" file.
val dir = UniFile.fromUri(context, Uri.parse(path))
if (dir != null && dir.exists()) {
dir.createFile(".nomedia")
}