From ac15c0c57e7088d0be34e1312b61c9c3006062d3 Mon Sep 17 00:00:00 2001 From: len Date: Thu, 31 Mar 2016 12:17:40 +0200 Subject: [PATCH] Fix an error when restoring backup --- .../tachiyomi/ui/backup/BackupFragment.kt | 5 ++-- .../kanade/tachiyomi/ui/main/MainActivity.kt | 30 ++++--------------- app/src/main/res/menu/menu_navigation.xml | 3 +- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/backup/BackupFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/backup/BackupFragment.kt index fd57965c26..15f4b0c04e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/backup/BackupFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/backup/BackupFragment.kt @@ -97,9 +97,8 @@ class BackupFragment : BaseRxFragment() { .progress(true, 0) .show() - context.contentResolver.openInputStream(data.data).use { - presenter.restoreBackup(it) - } + val stream = context.contentResolver.openInputStream(data.data) + presenter.restoreBackup(stream) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index be33e9a44e..3ad54c68e6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -61,30 +61,12 @@ class MainActivity : BaseActivity() { text_label.text = "" when (item.itemId) { - R.id.nav_drawer_library -> { - setFragment(LibraryFragment.newInstance()) - item.isChecked = true - } - R.id.nav_drawer_recent_updates -> { - setFragment(RecentChaptersFragment.newInstance()) - item.isChecked = true - } - R.id.nav_drawer_catalogues -> { - setFragment(CatalogueFragment.newInstance()) - item.isChecked = true - } - R.id.nav_drawer_downloads -> { - setFragment(DownloadFragment.newInstance()) - item.isChecked = true - } - R.id.nav_drawer_settings -> { - item.isChecked = false - startActivity(Intent(this, SettingsActivity::class.java)) - } - R.id.nav_drawer_backup -> { - setFragment(BackupFragment.newInstance()) - item.isChecked = true - } + R.id.nav_drawer_library -> setFragment(LibraryFragment.newInstance()) + R.id.nav_drawer_recent_updates -> setFragment(RecentChaptersFragment.newInstance()) + R.id.nav_drawer_catalogues -> setFragment(CatalogueFragment.newInstance()) + R.id.nav_drawer_downloads -> setFragment(DownloadFragment.newInstance()) + R.id.nav_drawer_settings -> startActivity(Intent(this, SettingsActivity::class.java)) + R.id.nav_drawer_backup -> setFragment(BackupFragment.newInstance()) } drawer.closeDrawer(GravityCompat.START) true diff --git a/app/src/main/res/menu/menu_navigation.xml b/app/src/main/res/menu/menu_navigation.xml index 09b653aab8..279f437726 100644 --- a/app/src/main/res/menu/menu_navigation.xml +++ b/app/src/main/res/menu/menu_navigation.xml @@ -25,7 +25,8 @@ + android:title="@string/label_settings" + android:checkable="false" />