Tune transitions
This commit is contained in:
@@ -92,7 +92,7 @@
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:name="org.koitharu.kotatsu.favourites.ui.categories.FavouriteCategoriesActivity"
|
||||
android:label="@string/favourites_categories"
|
||||
android:label="@string/favourites"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="org.koitharu.kotatsu.widget.shelf.ShelfConfigActivity"
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.koitharu.kotatsu.parsers.model.Manga
|
||||
import org.koitharu.kotatsu.reader.ui.ReaderActivity
|
||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||
import org.koitharu.kotatsu.utils.ext.invalidateNestedItemDecorations
|
||||
import org.koitharu.kotatsu.utils.ext.scaleUpActivityOptionsOf
|
||||
|
||||
class BookmarksFragment : BaseFragment<FragmentListSimpleBinding>(), ListStateHolderListener,
|
||||
OnListItemClickListener<Bookmark>, SectionedSelectionController.Callback<Manga> {
|
||||
@@ -74,7 +75,7 @@ class BookmarksFragment : BaseFragment<FragmentListSimpleBinding>(), ListStateHo
|
||||
override fun onItemClick(item: Bookmark, view: View) {
|
||||
if (selectionController?.onItemClick(item.manga, item.pageId) != true) {
|
||||
val intent = ReaderActivity.newIntent(view.context, item)
|
||||
startActivity(intent)
|
||||
startActivity(intent, scaleUpActivityOptionsOf(view).toBundle())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.koitharu.kotatsu.details.ui
|
||||
|
||||
import android.app.ActivityOptions
|
||||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import android.widget.AdapterView
|
||||
@@ -30,7 +29,7 @@ import org.koitharu.kotatsu.reader.ui.ReaderActivity
|
||||
import org.koitharu.kotatsu.reader.ui.ReaderState
|
||||
import org.koitharu.kotatsu.utils.RecyclerViewScrollCallback
|
||||
import org.koitharu.kotatsu.utils.ext.addMenuProvider
|
||||
import org.koitharu.kotatsu.utils.ext.end
|
||||
import org.koitharu.kotatsu.utils.ext.scaleUpActivityOptionsOf
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class ChaptersFragment :
|
||||
@@ -93,14 +92,13 @@ class ChaptersFragment :
|
||||
(activity as? DetailsActivity)?.showChapterMissingDialog(item.chapter.id)
|
||||
return
|
||||
}
|
||||
val options = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.width, view.height)
|
||||
startActivity(
|
||||
ReaderActivity.newIntent(
|
||||
context = view.context,
|
||||
manga = viewModel.manga.value ?: return,
|
||||
state = ReaderState(item.chapter.id, 0, 0),
|
||||
),
|
||||
options.toBundle()
|
||||
scaleUpActivityOptionsOf(view).toBundle()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.koitharu.kotatsu.details.ui
|
||||
|
||||
import android.app.ActivityOptions
|
||||
import android.os.Bundle
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.*
|
||||
@@ -83,8 +82,10 @@ class DetailsFragment :
|
||||
}
|
||||
|
||||
override fun onItemClick(item: Bookmark, view: View) {
|
||||
val options = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.width, view.height)
|
||||
startActivity(ReaderActivity.newIntent(view.context, item), options.toBundle())
|
||||
startActivity(
|
||||
ReaderActivity.newIntent(view.context, item),
|
||||
scaleUpActivityOptionsOf(view).toBundle(),
|
||||
)
|
||||
}
|
||||
|
||||
override fun onItemLongClick(item: Bookmark, view: View): Boolean {
|
||||
@@ -277,10 +278,9 @@ class DetailsFragment :
|
||||
)
|
||||
}
|
||||
R.id.imageView_cover -> {
|
||||
val options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.width, v.height)
|
||||
startActivity(
|
||||
ImageActivity.newIntent(v.context, manga.largeCoverUrl.ifNullOrEmpty { manga.coverUrl }),
|
||||
options.toBundle()
|
||||
scaleUpActivityOptionsOf(v).toBundle()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.koitharu.kotatsu.details.ui.scrobbling
|
||||
|
||||
import android.app.ActivityOptions
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.method.LinkMovementMethod
|
||||
@@ -30,6 +29,7 @@ import org.koitharu.kotatsu.scrobbling.ui.selector.ScrobblingSelectorBottomSheet
|
||||
import org.koitharu.kotatsu.utils.ext.crossfade
|
||||
import org.koitharu.kotatsu.utils.ext.enqueueWith
|
||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||
import org.koitharu.kotatsu.utils.ext.scaleUpActivityOptionsOf
|
||||
|
||||
class ScrobblingInfoBottomSheet :
|
||||
BaseBottomSheet<SheetScrobblingBinding>(),
|
||||
@@ -93,7 +93,7 @@ class ScrobblingInfoBottomSheet :
|
||||
R.id.button_menu -> menu?.show()
|
||||
R.id.imageView_cover -> {
|
||||
val coverUrl = viewModel.scrobblingInfo.value?.coverUrl ?: return
|
||||
val options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.width, v.height)
|
||||
val options = scaleUpActivityOptionsOf(v)
|
||||
startActivity(ImageActivity.newIntent(v.context, coverUrl), options.toBundle())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.koitharu.kotatsu.favourites.ui.categories
|
||||
|
||||
import android.app.ActivityOptions
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
@@ -29,6 +28,7 @@ import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||
import org.koitharu.kotatsu.utils.ext.measureHeight
|
||||
import org.koitharu.kotatsu.utils.ext.scaleUpActivityOptionsOf
|
||||
|
||||
class FavouriteCategoriesActivity :
|
||||
BaseActivity<ActivityCategoriesBinding>(),
|
||||
@@ -105,8 +105,7 @@ class FavouriteCategoriesActivity :
|
||||
return
|
||||
}
|
||||
val intent = FavouritesActivity.newIntent(this, item)
|
||||
val options =
|
||||
ActivityOptions.makeScaleUpAnimation(view, view.width / 2, view.height / 2, view.width, view.height)
|
||||
val options = scaleUpActivityOptionsOf(view)
|
||||
startActivity(intent, options.toBundle())
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ fun categoryAD(
|
||||
) {
|
||||
|
||||
val eventListener = object : OnClickListener, OnLongClickListener, OnTouchListener {
|
||||
override fun onClick(v: View) = clickListener.onItemClick(item.category, v)
|
||||
override fun onLongClick(v: View) = clickListener.onItemLongClick(item.category, v)
|
||||
override fun onClick(v: View) = clickListener.onItemClick(item.category, binding.imageViewCover1)
|
||||
override fun onLongClick(v: View) = clickListener.onItemLongClick(item.category, binding.imageViewCover1)
|
||||
override fun onTouch(v: View?, event: MotionEvent): Boolean = item.isReorderMode &&
|
||||
event.actionMasked == MotionEvent.ACTION_DOWN &&
|
||||
clickListener.onDragHandleTouch(this@adapterDelegateViewBinding)
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.koitharu.kotatsu.list.ui.model
|
||||
import androidx.annotation.StringRes
|
||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||
|
||||
@Deprecated("")
|
||||
data class ListHeader(
|
||||
val text: CharSequence?,
|
||||
@StringRes val textRes: Int,
|
||||
|
||||
@@ -16,7 +16,10 @@ import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.download.ui.service.DownloadService
|
||||
import org.koitharu.kotatsu.history.domain.HistoryRepository
|
||||
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
||||
import org.koitharu.kotatsu.list.ui.model.*
|
||||
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
||||
import org.koitharu.kotatsu.list.ui.model.LoadingState
|
||||
import org.koitharu.kotatsu.list.ui.model.toErrorState
|
||||
import org.koitharu.kotatsu.list.ui.model.toUi
|
||||
import org.koitharu.kotatsu.local.domain.LocalMangaRepository
|
||||
import org.koitharu.kotatsu.parsers.model.Manga
|
||||
import org.koitharu.kotatsu.utils.SingleLiveEvent
|
||||
@@ -36,7 +39,6 @@ class LocalListViewModel(
|
||||
val importProgress = MutableLiveData<Progress?>(null)
|
||||
private val listError = MutableStateFlow<Throwable?>(null)
|
||||
private val mangaList = MutableStateFlow<List<Manga>?>(null)
|
||||
private val headerModel = ListHeader(null, R.string.local_storage, null)
|
||||
private var importJob: Job? = null
|
||||
|
||||
override val content = combine(
|
||||
@@ -55,15 +57,9 @@ class LocalListViewModel(
|
||||
actionStringRes = R.string._import,
|
||||
)
|
||||
)
|
||||
else -> ArrayList<ListModel>(list.size + 1).apply {
|
||||
add(headerModel)
|
||||
list.toUi(this, mode)
|
||||
}
|
||||
else -> list.toUi(mode)
|
||||
}
|
||||
}.asLiveDataDistinct(
|
||||
viewModelScope.coroutineContext + Dispatchers.Default,
|
||||
listOf(LoadingState)
|
||||
)
|
||||
}.asLiveDataDistinct(viewModelScope.coroutineContext + Dispatchers.Default, listOf(LoadingState))
|
||||
|
||||
init {
|
||||
onRefresh()
|
||||
|
||||
@@ -260,8 +260,10 @@ class MainActivity :
|
||||
}
|
||||
|
||||
private fun onOpenReader(manga: Manga) {
|
||||
// val options = ActivityOptions.makeScaleUpAnimation(binding.fab, 0, 0, binding.fab.width, binding.fab.height)
|
||||
startActivity(ReaderActivity.newIntent(this, manga))
|
||||
val options = binding.fab?.let {
|
||||
scaleUpActivityOptionsOf(it).toBundle()
|
||||
}
|
||||
startActivity(ReaderActivity.newIntent(this, manga), options)
|
||||
}
|
||||
|
||||
private fun onError(e: Throwable) {
|
||||
|
||||
@@ -31,7 +31,7 @@ class MangaListActivity : BaseActivity<ActivityContainerBinding>() {
|
||||
finishAfterTransition()
|
||||
return
|
||||
}
|
||||
title = source.title
|
||||
title = if (source == MangaSource.LOCAL) getString(R.string.local_storage) else source.title
|
||||
val fm = supportFragmentManager
|
||||
if (fm.findFragmentById(R.id.container) == null) {
|
||||
fm.commit {
|
||||
|
||||
@@ -8,7 +8,10 @@ import kotlinx.coroutines.flow.onStart
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
||||
import org.koitharu.kotatsu.list.ui.model.*
|
||||
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
||||
import org.koitharu.kotatsu.list.ui.model.LoadingState
|
||||
import org.koitharu.kotatsu.list.ui.model.toErrorState
|
||||
import org.koitharu.kotatsu.list.ui.model.toUi
|
||||
import org.koitharu.kotatsu.suggestions.domain.SuggestionRepository
|
||||
import org.koitharu.kotatsu.utils.ext.asLiveDataDistinct
|
||||
import org.koitharu.kotatsu.utils.ext.onFirst
|
||||
@@ -18,8 +21,6 @@ class SuggestionsViewModel(
|
||||
settings: AppSettings,
|
||||
) : MangaListViewModel(settings) {
|
||||
|
||||
private val headerModel = ListHeader(null, R.string.suggestions, null)
|
||||
|
||||
override val content = combine(
|
||||
repository.observeAll(),
|
||||
createListModeFlow()
|
||||
@@ -33,10 +34,7 @@ class SuggestionsViewModel(
|
||||
actionStringRes = 0,
|
||||
)
|
||||
)
|
||||
else -> buildList<ListModel>(list.size + 1) {
|
||||
add(headerModel)
|
||||
list.toUi(this, mode)
|
||||
}
|
||||
else -> list.toUi(mode)
|
||||
}
|
||||
}.onStart {
|
||||
loadingCounter.increment()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.koitharu.kotatsu.utils.ext
|
||||
|
||||
import android.app.ActivityOptions
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.ResolveInfo
|
||||
@@ -10,6 +11,7 @@ import android.net.NetworkRequest
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewPropertyAnimator
|
||||
import android.view.Window
|
||||
@@ -130,4 +132,12 @@ inline fun <reified T> ViewGroup.findChild(): T? {
|
||||
|
||||
inline fun <reified T> ViewGroup.findDescendant(): T? {
|
||||
return descendants.find { it is T } as? T
|
||||
}
|
||||
}
|
||||
|
||||
fun scaleUpActivityOptionsOf(view: View): ActivityOptions = ActivityOptions.makeScaleUpAnimation(
|
||||
view,
|
||||
0,
|
||||
0,
|
||||
view.width,
|
||||
view.height,
|
||||
)
|
||||
Reference in New Issue
Block a user