From f514d466a6bbce4e57d10fac719b43f6d1090f86 Mon Sep 17 00:00:00 2001 From: len Date: Sat, 3 Dec 2016 13:08:26 +0100 Subject: [PATCH] Minor changes and fixes --- app/src/main/AndroidManifest.xml | 2 +- .../kanade/tachiyomi/data/library/LibraryUpdateService.kt | 7 +++---- .../eu/kanade/tachiyomi/ui/main/ChangelogDialogFragment.kt | 2 ++ .../ui/reader/notification/ImageNotificationReceiver.kt | 3 ++- .../tachiyomi/ui/setting/SettingsDownloadsFragment.kt | 5 +++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6f402b8b06..3481942e49 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -56,7 +56,7 @@ , failedUpdates: List): 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() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/ChangelogDialogFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/ChangelogDialogFragment.kt index 0eeb10bc22..db7eee11b0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/ChangelogDialogFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/ChangelogDialogFragment.kt @@ -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()) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/notification/ImageNotificationReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/notification/ImageNotificationReceiver.kt index d3a4d1365d..09377f77c0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/notification/ImageNotificationReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/notification/ImageNotificationReceiver.kt @@ -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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadsFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadsFragment.kt index d3d5b06928..64c217d906 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadsFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadsFragment.kt @@ -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") }