don't expand description on the manga found by smart search being used for merging, so user can see the button 'Merge with another' (#310)
This commit is contained in:
parent
eb311ee27a
commit
37a817e8f8
4 changed files with 29 additions and 3 deletions
|
|
@ -303,7 +303,17 @@ data class BrowseSourceScreen(
|
|||
bulkFavoriteScreenModel.toggleSelection(it)
|
||||
} else {
|
||||
// KMK <--
|
||||
navigator.push(MangaScreen(it.id, true, smartSearchConfig))
|
||||
navigator.push(
|
||||
MangaScreen(
|
||||
it.id,
|
||||
// KMK -->
|
||||
// Finding the entry to be merged to, so we don't want to expand description
|
||||
// so that user can see the `Merge to another` button
|
||||
smartSearchConfig != null,
|
||||
// KMK <--
|
||||
smartSearchConfig,
|
||||
),
|
||||
)
|
||||
}
|
||||
},
|
||||
onMangaLongClick = { manga ->
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ import uy.kohesive.injekt.api.get
|
|||
|
||||
class MangaScreen(
|
||||
private val mangaId: Long,
|
||||
/** If it is opened from Source then it will auto expand the manga description */
|
||||
val fromSource: Boolean = false,
|
||||
private val smartSearchConfig: SourcesScreen.SmartSearchConfig? = null,
|
||||
) : Screen(), AssistContentScreen {
|
||||
|
|
@ -560,6 +561,7 @@ class MangaScreen(
|
|||
context.startActivity(ReaderActivity.newIntent(context, chapter.mangaId, chapter.id))
|
||||
}
|
||||
|
||||
@Suppress("LocalVariableName")
|
||||
private fun getMangaUrl(manga_: Manga?, source_: Source?): String? {
|
||||
val manga = manga_ ?: return null
|
||||
val source = source_ as? HttpSource ?: return null
|
||||
|
|
@ -571,6 +573,7 @@ class MangaScreen(
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("LocalVariableName")
|
||||
private fun openMangaInWebView(navigator: Navigator, manga_: Manga?, source_: Source?) {
|
||||
getMangaUrl(manga_, source_)?.let { url ->
|
||||
navigator.push(
|
||||
|
|
@ -583,6 +586,7 @@ class MangaScreen(
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("LocalVariableName")
|
||||
private fun shareManga(context: Context, manga_: Manga?, source_: Source?) {
|
||||
try {
|
||||
getMangaUrl(manga_, source_)?.let { url ->
|
||||
|
|
@ -692,6 +696,7 @@ class MangaScreen(
|
|||
/**
|
||||
* Copy Manga URL to Clipboard
|
||||
*/
|
||||
@Suppress("LocalVariableName")
|
||||
private fun copyMangaUrl(context: Context, manga_: Manga?, source_: Source?) {
|
||||
val manga = manga_ ?: return
|
||||
val source = source_ as? HttpSource ?: return
|
||||
|
|
|
|||
|
|
@ -161,8 +161,9 @@ class MangaScreenModel(
|
|||
val context: Context,
|
||||
val mangaId: Long,
|
||||
// SY -->
|
||||
/** If it is opened from Source then it will auto expand the manga description */
|
||||
private val isFromSource: Boolean,
|
||||
val smartSearched: Boolean,
|
||||
private val smartSearched: Boolean,
|
||||
// SY <--
|
||||
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||
readerPreferences: ReaderPreferences = Injekt.get(),
|
||||
|
|
|
|||
|
|
@ -48,7 +48,17 @@ class SmartSearchScreen(
|
|||
val results = state
|
||||
if (results != null) {
|
||||
if (results is SmartSearchScreenModel.SearchResults.Found) {
|
||||
navigator.replace(MangaScreen(results.manga.id, true, smartSearchConfig))
|
||||
navigator.replace(
|
||||
MangaScreen(
|
||||
results.manga.id,
|
||||
// KMK -->
|
||||
// Finding the entry to be merged to, so we don't want to expand description
|
||||
// so that user can see the `Merge to another` button
|
||||
false,
|
||||
// KMK <--
|
||||
smartSearchConfig,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
if (results is SmartSearchScreenModel.SearchResults.NotFound) {
|
||||
context.toast(SYMR.strings.could_not_find_entry)
|
||||
|
|
|
|||
Loading…
Reference in a new issue