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
This commit is contained in:
Jay 2020-01-21 19:48:26 -08:00
parent b7d538f7a6
commit 3f0aa0c037
4 changed files with 11 additions and 16 deletions

View File

@ -3,17 +3,15 @@ package eu.kanade.tachiyomi.ui.manga.info
import android.app.Activity import android.app.Activity
import android.app.Dialog import android.app.Dialog
import android.content.Intent import android.content.Intent
import android.graphics.drawable.Drawable
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView import com.afollestad.materialdialogs.customview.customView
import com.afollestad.materialdialogs.internal.main.DialogLayout
import com.bluelinelabs.conductor.Router import com.bluelinelabs.conductor.Router
import com.bumptech.glide.load.engine.DiskCacheStrategy 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 com.bumptech.glide.signature.ObjectKey
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.DatabaseHelper 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.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.ui.base.controller.DialogController 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.chop
import eu.kanade.tachiyomi.util.toast import eu.kanade.tachiyomi.util.toast
import kotlinx.android.synthetic.main.edit_manga_dialog.view.* 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 timber.log.Timber
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.io.IOException import java.io.IOException
import java.io.InputStream
class EditMangaDialog : DialogController { class EditMangaDialog : DialogController {
@ -59,20 +53,18 @@ class EditMangaDialog : DialogController {
.executeAsBlocking()!! .executeAsBlocking()!!
} }
override fun showDialog(router: Router) {
super.showDialog(router)
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
}
override fun onCreateDialog(savedViewState: Bundle?): Dialog { override fun onCreateDialog(savedViewState: Bundle?): Dialog {
val dialog = MaterialDialog(activity!!).apply { val dialog = MaterialDialog(activity!!).apply {
customView(viewRes = R.layout.edit_manga_dialog, scrollable = true) customView(viewRes = R.layout.edit_manga_dialog, scrollable = true)
negativeButton(android.R.string.cancel) negativeButton(android.R.string.cancel)
positiveButton(R.string.action_save) { onPositiveButtonClick() } positiveButton(R.string.action_save) { onPositiveButtonClick() }
} }
dialogView = dialog.view dialogView = dialog.view
onViewCreated(dialog.view, savedViewState) onViewCreated(dialog.view, savedViewState)
dialog.setOnShowListener {
val dView = (it as? MaterialDialog)?.view
dView?.contentLayout?.scrollView?.scrollTo(0, 0)
}
return dialog return dialog
} }
@ -122,6 +114,7 @@ class EditMangaDialog : DialogController {
view.manga_genres_tags.setTags(manga.currentGenres()?.split(", ")) view.manga_genres_tags.setTags(manga.currentGenres()?.split(", "))
} }
} }
view.manga_genres_tags.clearFocus()
view.cover_layout.setOnClickListener { view.cover_layout.setOnClickListener {
changeCover() changeCover()
} }

View File

@ -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.MangaCategory
import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.download.DownloadManager 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.LocalSource
import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
@ -275,6 +276,7 @@ class MangaInfoPresenter(
} }
if (manga.thumbnail_url != null && manga.favorite) { if (manga.thumbnail_url != null && manga.favorite) {
Injekt.get<PreferencesHelper>().refreshCoversToo().set(false)
coverCache.copyToCache(manga.thumbnail_url!!, inputStream) coverCache.copyToCache(manga.thumbnail_url!!, inputStream)
MangaImpl.setLastCoverFetch(manga.id!!, Date().time) MangaImpl.setLastCoverFetch(manga.id!!, Date().time)
return true return true

View File

@ -3,5 +3,5 @@
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFFFF" <path android:fillColor="#FFFFFFFF"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"
android:strokeColor="#000000" android:strokeWidth="0.5"/> android:strokeColor="#000000" android:strokeWidth="1"/>
</vector> </vector>

View File

@ -31,8 +31,8 @@
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:layout_marginBottom="4dp"> android:layout_marginBottom="4dp">
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="32dp"
android:layout_height="24dp" android:layout_height="32dp"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/ic_edit_outlined_white_24dp"/> android:src="@drawable/ic_edit_outlined_white_24dp"/>
</FrameLayout> </FrameLayout>