mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Merge branch 'compile-33'
This commit is contained in:
commit
f423ad7192
10 changed files with 31 additions and 30 deletions
|
@ -29,6 +29,7 @@
|
||||||
android:preserveLegacyExternalStorage="true"
|
android:preserveLegacyExternalStorage="true"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
|
|
|
@ -18,8 +18,8 @@ class LibraryGestureDetector(private val controller: LibraryController) : Gestur
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onScroll(
|
override fun onScroll(
|
||||||
e1: MotionEvent?,
|
e1: MotionEvent,
|
||||||
e2: MotionEvent?,
|
e2: MotionEvent,
|
||||||
distanceX: Float,
|
distanceX: Float,
|
||||||
distanceY: Float,
|
distanceY: Float,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
@ -29,7 +29,7 @@ class LibraryGestureDetector(private val controller: LibraryController) : Gestur
|
||||||
return super.onScroll(e1, e2, distanceX, distanceY)
|
return super.onScroll(e1, e2, distanceX, distanceY)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSingleTapUp(e: MotionEvent?): Boolean {
|
override fun onSingleTapUp(e: MotionEvent): Boolean {
|
||||||
return super.onSingleTapUp(e)
|
return super.onSingleTapUp(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,19 +18,19 @@ class LibraryHeaderGestureDetector(
|
||||||
) : GestureDetector.SimpleOnGestureListener() {
|
) : GestureDetector.SimpleOnGestureListener() {
|
||||||
|
|
||||||
var vibrated = false
|
var vibrated = false
|
||||||
override fun onDown(e: MotionEvent?): Boolean {
|
override fun onDown(e: MotionEvent): Boolean {
|
||||||
vibrated = false
|
vibrated = false
|
||||||
return super.onDown(e)
|
return super.onDown(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onScroll(
|
override fun onScroll(
|
||||||
e1: MotionEvent?,
|
e1: MotionEvent,
|
||||||
e2: MotionEvent?,
|
e2: MotionEvent,
|
||||||
distanceX: Float,
|
distanceX: Float,
|
||||||
distanceY: Float,
|
distanceY: Float,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (binding == null || header == null) return false
|
if (binding == null || header == null) return false
|
||||||
val distance = ((e1?.rawX ?: 0f) - (e2?.rawX ?: 0f))
|
val distance = (e1.rawX - e2.rawX)
|
||||||
val poa = 0.75f
|
val poa = 0.75f
|
||||||
binding.categoryHeaderLayout.translationX = abs(distance).pow(poa) * -sign(distance)
|
binding.categoryHeaderLayout.translationX = abs(distance).pow(poa) * -sign(distance)
|
||||||
binding.rearView.isVisible = distance != 0f
|
binding.rearView.isVisible = distance != 0f
|
||||||
|
|
|
@ -385,7 +385,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||||
|
|
||||||
binding.searchToolbar.searchItem?.setOnActionExpandListener(
|
binding.searchToolbar.searchItem?.setOnActionExpandListener(
|
||||||
object : MenuItem.OnActionExpandListener {
|
object : MenuItem.OnActionExpandListener {
|
||||||
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
|
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
|
||||||
val controller = router.backstack.lastOrNull()?.controller
|
val controller = router.backstack.lastOrNull()?.controller
|
||||||
binding.appBar.compactSearchMode =
|
binding.appBar.compactSearchMode =
|
||||||
binding.appBar.useLargeToolbar && resources.configuration.screenHeightDp < 600
|
binding.appBar.useLargeToolbar && resources.configuration.screenHeightDp < 600
|
||||||
|
@ -404,7 +404,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
|
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
|
||||||
val controller = router.backstack.lastOrNull()?.controller
|
val controller = router.backstack.lastOrNull()?.controller
|
||||||
binding.appBar.compactSearchMode = false
|
binding.appBar.compactSearchMode = false
|
||||||
controller?.mainRecyclerView?.requestApplyInsets()
|
controller?.mainRecyclerView?.requestApplyInsets()
|
||||||
|
@ -1059,14 +1059,14 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||||
@SuppressLint("RestrictedApi")
|
@SuppressLint("RestrictedApi")
|
||||||
private fun updateSubMenu(oldMenuItem: MenuItem, menuItem: MenuItem) {
|
private fun updateSubMenu(oldMenuItem: MenuItem, menuItem: MenuItem) {
|
||||||
if (oldMenuItem.hasSubMenu()) {
|
if (oldMenuItem.hasSubMenu()) {
|
||||||
val oldSubMenu = oldMenuItem.subMenu
|
val oldSubMenu = oldMenuItem.subMenu ?: return
|
||||||
val newMenuIds = oldSubMenu.children.toList().map { it.itemId }
|
val newMenuIds = oldSubMenu.children.toList().map { it.itemId }
|
||||||
val currentItemsId = menuItem.subMenu.children.toList().map { it.itemId }
|
val currentItemsId = menuItem.subMenu?.children?.toList()?.map { it.itemId } ?: return
|
||||||
var isExclusiveCheckable = false
|
var isExclusiveCheckable = false
|
||||||
var isCheckable = false
|
var isCheckable = false
|
||||||
oldSubMenu.children.toList().forEachIndexed { index, oldSubMenuItem ->
|
oldSubMenu.children.toList().forEachIndexed { index, oldSubMenuItem ->
|
||||||
val isSubVisible = oldSubMenuItem.isVisible
|
val isSubVisible = oldSubMenuItem.isVisible
|
||||||
addOrUpdateMenuItem(oldSubMenuItem, menuItem.subMenu, isSubVisible, currentItemsId, index)
|
addOrUpdateMenuItem(oldSubMenuItem, menuItem.subMenu!!, isSubVisible, currentItemsId, index)
|
||||||
if (!isExclusiveCheckable) {
|
if (!isExclusiveCheckable) {
|
||||||
isExclusiveCheckable = (oldSubMenuItem as? MenuItemImpl)?.isExclusiveCheckable ?: false
|
isExclusiveCheckable = (oldSubMenuItem as? MenuItemImpl)?.isExclusiveCheckable ?: false
|
||||||
}
|
}
|
||||||
|
@ -1074,10 +1074,10 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||||
isCheckable = oldSubMenuItem.isCheckable
|
isCheckable = oldSubMenuItem.isCheckable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menuItem.subMenu.setGroupCheckable(oldSubMenu.children.first().groupId, isCheckable, isExclusiveCheckable)
|
menuItem.subMenu?.setGroupCheckable(oldSubMenu.children.first().groupId, isCheckable, isExclusiveCheckable)
|
||||||
menuItem.subMenu.children.toList().forEach {
|
menuItem.subMenu?.children?.toList()?.forEach {
|
||||||
if (!newMenuIds.contains(it.itemId)) {
|
if (!newMenuIds.contains(it.itemId)) {
|
||||||
menuItem.subMenu.removeItem(it.itemId)
|
menuItem.subMenu?.removeItem(it.itemId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -462,8 +462,8 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
menuCopy.icon.mutate()
|
menuCopy.icon?.mutate()
|
||||||
menuMigrate.icon.mutate()
|
menuMigrate.icon?.mutate()
|
||||||
val tintColor = activity?.getResourceColor(R.attr.actionBarTintColor) ?: Color.WHITE
|
val tintColor = activity?.getResourceColor(R.attr.actionBarTintColor) ?: Color.WHITE
|
||||||
val translucentWhite = ColorUtils.setAlphaComponent(tintColor, 127)
|
val translucentWhite = ColorUtils.setAlphaComponent(tintColor, 127)
|
||||||
menuCopy.icon?.setTint(if (allMangasDone) tintColor else translucentWhite)
|
menuCopy.icon?.setTint(if (allMangasDone) tintColor else translucentWhite)
|
||||||
|
|
|
@ -19,14 +19,14 @@ class ReaderNavGestureDetector(private val activity: ReaderActivity) : GestureDe
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onScroll(
|
override fun onScroll(
|
||||||
e1: MotionEvent?,
|
e1: MotionEvent,
|
||||||
e2: MotionEvent?,
|
e2: MotionEvent,
|
||||||
distanceX: Float,
|
distanceX: Float,
|
||||||
distanceY: Float,
|
distanceY: Float,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val newDistanceX = (e1?.rawX ?: 0f) - (e2?.rawX ?: 0f)
|
val newDistanceX = e1.rawX - e2.rawX
|
||||||
val newDistanceY = (e1?.rawY ?: 0f) - (e2?.rawY ?: 0f)
|
val newDistanceY = e1.rawY - e2.rawY
|
||||||
if ((!hasScrollHorizontal || lockVertical) && e2 != null) {
|
if ((!hasScrollHorizontal || lockVertical)) {
|
||||||
hasScrollHorizontal = abs(newDistanceX) > abs(newDistanceY) && abs(newDistanceX) > 40
|
hasScrollHorizontal = abs(newDistanceX) > abs(newDistanceY) && abs(newDistanceX) > 40
|
||||||
if (!lockVertical) {
|
if (!lockVertical) {
|
||||||
lockVertical = abs(newDistanceX) < abs(newDistanceY) && abs(newDistanceY) > 150
|
lockVertical = abs(newDistanceX) < abs(newDistanceY) && abs(newDistanceY) > 150
|
||||||
|
|
|
@ -251,7 +251,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
|
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
||||||
this@ReaderPageImageView.onViewClicked()
|
this@ReaderPageImageView.onViewClicked()
|
||||||
return super.onSingleTapConfirmed(e)
|
return super.onSingleTapConfirmed(e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,12 +176,12 @@ class ReaderProgressBar @JvmOverloads constructor(
|
||||||
duration = 1000
|
duration = 1000
|
||||||
addListener(
|
addListener(
|
||||||
object : AnimatorListenerAdapter() {
|
object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationEnd(animation: Animator?) {
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
visibility = View.GONE
|
visibility = View.GONE
|
||||||
alpha = 1f
|
alpha = 1f
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAnimationCancel(animation: Animator?) {
|
override fun onAnimationCancel(animation: Animator) {
|
||||||
alpha = 1f
|
alpha = 1f
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -50,7 +50,7 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
|
||||||
* Scale listener used to delegate events to the recycler view.
|
* Scale listener used to delegate events to the recycler view.
|
||||||
*/
|
*/
|
||||||
inner class ScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener() {
|
inner class ScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener() {
|
||||||
override fun onScaleBegin(detector: ScaleGestureDetector?): Boolean {
|
override fun onScaleBegin(detector: ScaleGestureDetector): Boolean {
|
||||||
recycler?.onScaleBegin()
|
recycler?.onScaleBegin()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -69,13 +69,13 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
|
||||||
* Fling listener used to delegate events to the recycler view.
|
* Fling listener used to delegate events to the recycler view.
|
||||||
*/
|
*/
|
||||||
inner class FlingListener : GestureDetector.SimpleOnGestureListener() {
|
inner class FlingListener : GestureDetector.SimpleOnGestureListener() {
|
||||||
override fun onDown(e: MotionEvent?): Boolean {
|
override fun onDown(e: MotionEvent): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFling(
|
override fun onFling(
|
||||||
e1: MotionEvent?,
|
e1: MotionEvent,
|
||||||
e2: MotionEvent?,
|
e2: MotionEvent,
|
||||||
velocityX: Float,
|
velocityX: Float,
|
||||||
velocityY: Float,
|
velocityY: Float,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
object AndroidVersions {
|
object AndroidVersions {
|
||||||
const val compileSdk = 32
|
const val compileSdk = 33
|
||||||
const val minSdk = 23
|
const val minSdk = 23
|
||||||
const val targetSdk = 30
|
const val targetSdk = 30
|
||||||
const val versionCode = 93
|
const val versionCode = 93
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue