From 3f0aa0c03735305677a480953aaab34726539116 Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 21 Jan 2020 19:48:26 -0800 Subject: [PATCH] More updates to edit manga dialog Cleared focus from add tag edit pencil is more noticable now setting a local cover disables auto refresh covers --- .../ui/manga/info/EditMangaDialog.kt | 19 ++++++------------- .../ui/manga/info/MangaInfoPresenter.kt | 2 ++ .../drawable/ic_edit_outlined_white_24dp.xml | 2 +- app/src/main/res/layout/edit_manga_dialog.xml | 4 ++-- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/EditMangaDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/EditMangaDialog.kt index 20d5466699..34e81912ec 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/EditMangaDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/EditMangaDialog.kt @@ -3,17 +3,15 @@ package eu.kanade.tachiyomi.ui.manga.info import android.app.Activity import android.app.Dialog import android.content.Intent -import android.graphics.drawable.Drawable import android.net.Uri import android.os.Bundle import android.view.View import android.view.WindowManager import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.customview.customView +import com.afollestad.materialdialogs.internal.main.DialogLayout import com.bluelinelabs.conductor.Router import com.bumptech.glide.load.engine.DiskCacheStrategy -import com.bumptech.glide.request.target.CustomTarget -import com.bumptech.glide.request.transition.Transition import com.bumptech.glide.signature.ObjectKey import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.DatabaseHelper @@ -22,17 +20,13 @@ import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.ui.base.controller.DialogController -import eu.kanade.tachiyomi.ui.library.LibraryController import eu.kanade.tachiyomi.util.chop import eu.kanade.tachiyomi.util.toast import kotlinx.android.synthetic.main.edit_manga_dialog.view.* -import kotlinx.android.synthetic.main.edit_manga_dialog.view.manga_title -import me.gujun.android.taggroup.TagGroup import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.io.IOException -import java.io.InputStream class EditMangaDialog : DialogController { @@ -59,20 +53,18 @@ class EditMangaDialog : DialogController { .executeAsBlocking()!! } - override fun showDialog(router: Router) { - super.showDialog(router) - dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) - } - override fun onCreateDialog(savedViewState: Bundle?): Dialog { val dialog = MaterialDialog(activity!!).apply { customView(viewRes = R.layout.edit_manga_dialog, scrollable = true) negativeButton(android.R.string.cancel) positiveButton(R.string.action_save) { onPositiveButtonClick() } } - dialogView = dialog.view onViewCreated(dialog.view, savedViewState) + dialog.setOnShowListener { + val dView = (it as? MaterialDialog)?.view + dView?.contentLayout?.scrollView?.scrollTo(0, 0) + } return dialog } @@ -122,6 +114,7 @@ class EditMangaDialog : DialogController { view.manga_genres_tags.setTags(manga.currentGenres()?.split(", ")) } } + view.manga_genres_tags.clearFocus() view.cover_layout.setOnClickListener { changeCover() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt index 181f0c2bcf..c2523986d6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt @@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.MangaCategory import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.download.DownloadManager +import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.model.SManga @@ -275,6 +276,7 @@ class MangaInfoPresenter( } if (manga.thumbnail_url != null && manga.favorite) { + Injekt.get().refreshCoversToo().set(false) coverCache.copyToCache(manga.thumbnail_url!!, inputStream) MangaImpl.setLastCoverFetch(manga.id!!, Date().time) return true diff --git a/app/src/main/res/drawable/ic_edit_outlined_white_24dp.xml b/app/src/main/res/drawable/ic_edit_outlined_white_24dp.xml index 1090982e08..f2b354f78f 100644 --- a/app/src/main/res/drawable/ic_edit_outlined_white_24dp.xml +++ b/app/src/main/res/drawable/ic_edit_outlined_white_24dp.xml @@ -3,5 +3,5 @@ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + android:strokeColor="#000000" android:strokeWidth="1"/> \ No newline at end of file diff --git a/app/src/main/res/layout/edit_manga_dialog.xml b/app/src/main/res/layout/edit_manga_dialog.xml index 8ef622edcd..5543cea132 100644 --- a/app/src/main/res/layout/edit_manga_dialog.xml +++ b/app/src/main/res/layout/edit_manga_dialog.xml @@ -31,8 +31,8 @@ android:layout_marginEnd="4dp" android:layout_marginBottom="4dp">